Author: [email protected]
Date: Wed Jan 18 11:56:08 2012
New Revision: 1924

Log:
[AMDATUOPENSOCIAL-178] Invoking updateCSS from main frame automatically in all 
gadget frames proved to be very complicated to implement cross-browser. 
Therefore added a 'dashboard_gadget.js' which provides methods that are 
publically available for all gadgets, intended to be loaded by gadgets.

Added:
   
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard_gadget.js
Modified:
   trunk/amdatu-opensocial/opensocial-dashboard/pom.xml
   
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard.js

Modified: trunk/amdatu-opensocial/opensocial-dashboard/pom.xml
==============================================================================
--- trunk/amdatu-opensocial/opensocial-dashboard/pom.xml        (original)
+++ trunk/amdatu-opensocial/opensocial-dashboard/pom.xml        Wed Jan 18 
11:56:08 2012
@@ -109,6 +109,7 @@
                   <excludes>
                     <exclude>**/*-min.js</exclude>
                     <exclude>**/*.min.js</exclude>
+                    <exclude>**/dashboard_gadget.js</exclude>
                   </excludes>
                 </aggregation>
 

Modified: 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard.js
==============================================================================
--- 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard.js
      (original)
+++ 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard.js
      Wed Jan 18 11:56:08 2012
@@ -155,9 +155,6 @@
         shindig.container.addGadget(gadget);
         shindig.container.renderGadget(gadget);
 
-        // Update the CSS as soon as the iframe loads
-        my.updateCSS(widget);
-
         // Override the RPC call set_title to set the title in our custom 
titlebar
         // instead of the default Shindig one, which is hidden
         gadgets.rpc.register('set_title', function(newTitle) {
@@ -169,21 +166,6 @@
       }
     };
 
-    my.updateCSS = function(widgetParent) {
-      var widget = widgetParent.element;
-      var ifr = $(widget).find("iframe")[0];
-
-      var originalOnLoad = ifr.onload;
-      if (originalOnLoad) {
-        ifr.onload = "";
-        $(ifr).load(function() {
-          var ifrDocument = $(widget).find("iframe")[0].contentDocument;
-          updateCSS(ifrDocument);
-          originalOnLoad();
-        });
-      }
-    }
-
     $('.widget').live('widgetShow',function(e, obj){
       if (!obj.widget.loaded) {
         obj.widget.loaded = true;

Added: 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard_gadget.js
==============================================================================
--- (empty file)
+++ 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/js/dashboard_gadget.js
       Wed Jan 18 11:56:08 2012
@@ -0,0 +1,13 @@
+var dashboardgadget = function() {
+
+  // Update the CSS of this gadget to align with the selected theme.
+  // Invoke this method on the ready() or load() event.
+  function updateCSS() {
+    window.parent.updateCSS(document);
+  }
+
+  // Public methods and variables.
+  return {
+    updateCSS:updateCSS
+  }
+}();
\ No newline at end of file
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to