myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1763435 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Date Wed, 05 Oct 2016 11:54:22 GMT
Author: lofwyr
Date: Wed Oct  5 11:54:22 2016
New Revision: 1763435

URL: http://svn.apache.org/viewvc?rev=1763435&view=rev
Log:
simplify code

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1763435&r1=1763434&r2=1763435&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Wed Oct  5 11:54:22 2016
@@ -51,13 +51,6 @@ var Tobago = {
 
   lastFocusId: undefined,
 
-  /**
-   * The resize action is a function which should be executed when the window was resized.
-   * Can be defined as facet in the page.
-   */
-  resizeAction: undefined,
-  resizeEventCount: 0,
-
   htmlIdIndex: 0,
 
   createHtmlId: function() {
@@ -183,11 +176,6 @@ var Tobago = {
     }
     console.timeEnd("[tobago] applicationOnload"); // @DEV_ONLY
 
-    if (Tobago.resizeAction) {
-      // firefox submits an onresize event
-      window.setTimeout(Tobago.registerResizeAction, 1000);
-    }
-
     window.setTimeout(Tobago.finishPageLoading, 1);
     console.timeEnd("[tobago] init (main thread)"); // @DEV_ONLY
   },
@@ -197,10 +185,6 @@ var Tobago = {
     console.timeEnd("[tobago] init"); // @DEV_ONLY
   },
 
-  registerResizeAction: function() {
-    Tobago.addEventListener(window, 'resize', Tobago.resizePage);
-  },
-
   onSubmit: function(listenerOptions) {
     var result = true; // Do not continue if any function returns false
     for (var order = 0; order < Tobago.listeners.beforeSubmit.length; order++) {
@@ -426,18 +410,6 @@ var Tobago = {
     Tobago.reloadTimer[id] = setTimeout(func, time);
   },
 
-  resizePage: function(event) {
-    Tobago.resizeEventCount++;
-    window.setTimeout(Tobago.resizePageAction, 250);
-  },
-
-  resizePageAction: function() {
-    Tobago.resizeEventCount--;
-    if (Tobago.resizeEventCount == 0) {
-      Tobago.resizeAction();
-    }
-  },
-
   initCommand: function(command) {
     // command is jQuery object
     // setupInputFacetCommand
@@ -516,9 +488,10 @@ var Tobago = {
       }
     }
     if (commands.resize) {
-      Tobago.resizeAction = function() {
+      jQuery(window).resize(function() {
+        console.debug("window resize event: " + commands.resize); // @DEV_ONLY
         Tobago.submitAction(this, commands.resize.action, commands.resize);
-      }
+      });
     }
     if (commands.action) {
       setTimeout(function () {



Mime
View raw message