Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/apps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarkascha <github@christian-reiner.info>2013-06-13 17:36:36 +0400
committerarkascha <github@christian-reiner.info>2013-06-13 17:36:36 +0400
commitf582266811391e76d5d60bc44e83bdfa24cfdf60 (patch)
treeabfb0d8d558eb3a3a921e06469bc3e7ccb2a63c3 /fluxx_compensator
parent755eebf39790fa3c95e110336d102388f5d45de4 (diff)
fluxx-compensator: Fix triggering the swapping action for safari who does not fire a load event when styles have loaded (safety catch).
Diffstat (limited to 'fluxx_compensator')
-rw-r--r--fluxx_compensator/js/fluxx.js37
1 files changed, 23 insertions, 14 deletions
diff --git a/fluxx_compensator/js/fluxx.js b/fluxx_compensator/js/fluxx.js
index bf89ef40e..5fb7ae151 100644
--- a/fluxx_compensator/js/fluxx.js
+++ b/fluxx_compensator/js/fluxx.js
@@ -466,25 +466,34 @@ OC.FluXX={
return dfd.promise();
}, // OC.FluXX.swap
/**
+ * @method OC.FluXX.time
+ * @brief waits for the transition style to load before starting the actual swapping of a handle
+ * @author Christian Reiner
+ */
+ time: function(handle){
+ var dfd = new $.Deferred();
+ // swap handle (animation)
+ $.when(
+ OC.FluXX.swap(handle)
+ ).done(function(){
+ OC.FluXX.maximize(handle);
+ // remove temporarily included transition rules
+ $('head #fluxx-transitions').remove();
+ dfd.resolve();
+ }).fail(dfd.reject);
+ return dfd.promise();
+ }, // OC.FluXX.time
+ /**
* @method OC.FluXX.toggle
* @brief Toggles the visibility of the navigation area
* @author Christian Reiner
*/
toggle: function(handle){
- var dfd = new $.Deferred();
// temporarily include transition style rules if not yet present (should not be!)
var transitions=OC.FluXX.transitions.clone().attr('rel','stylesheet').attr('id','fluxx-transitions').appendTo('head');
- $('head #fluxx-transitions').one('load',function(){
- // swap handle (animation)
- $.when(
- OC.FluXX.swap(handle)
- ).done(function(){
- OC.FluXX.maximize(handle);
- // remove temporarily included transition rules
- $('head #fluxx-transitions').remove();
- dfd.resolve();
- }).fail(dfd.reject);
- });
- return dfd.promise();
- }, // OC.FluXX.toggle
+ // some safety catch for browsers that do not fire the load event when stuff is loaded (safari)
+ var timer = setTimeout(function(){OC.FluXX.time(handle);},100); // should be preloaded...
+ // the more elegant approach however is to react on the load event (_if_ fired)
+ $('head #fluxx-transitions').one('load',function(){clearTimeout(timer);OC.FluXX.time(handle);});
+ } // OC.FluXX.toggle
} // OC.FluXX