Author: [email protected]
Date: Mon Jan  9 16:31:59 2012
New Revision: 1899

Log:
[AMDATUOPENSOCIAL-176] With this fix, theme switching also works in IE. Initial 
theme still not loaded however.

Modified:
   
trunk/amdatu-opensocial/dashboard-plugin/src/main/resources/static/js/themeroller.js
   
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/jsp/dashboard.js.jsp

Modified: 
trunk/amdatu-opensocial/dashboard-plugin/src/main/resources/static/js/themeroller.js
==============================================================================
--- 
trunk/amdatu-opensocial/dashboard-plugin/src/main/resources/static/js/themeroller.js
        (original)
+++ 
trunk/amdatu-opensocial/dashboard-plugin/src/main/resources/static/js/themeroller.js
        Mon Jan  9 16:31:59 2012
@@ -87,16 +87,16 @@
 
   //function to append a new theme stylesheet with the new style changes
   function updateCSS(locStr){
-    // Append new CSS link
-    var cssLink = $('<link href="'+locStr+'" type="text/css" rel="Stylesheet" 
class="ui-theme" />');
-    $("head").append(cssLink);
-
-    // Remove old CSS links
+    // Update existing CSS links
     var uithemes = $("link.ui-theme");
-    if (uithemes.length > 1) {
-      for (var i=1; i<uithemes.length;i++) {
-        $("link.ui-theme")[0].remove();
+    if (uithemes.length > 0) {
+      for (var i=0; i<uithemes.length;i++) {
+        $("link.ui-theme")[i].setAttribute("href", locStr);
       }
+    } else {
+      // Append new CSS link
+      var cssLink = $('<link href="'+locStr+'" type="text/css" 
rel="Stylesheet" class="ui-theme" />');
+      $("head").append(cssLink);
     }
   }
 

Modified: 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/jsp/dashboard.js.jsp
==============================================================================
--- 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/jsp/dashboard.js.jsp
        (original)
+++ 
trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/jsp/dashboard.js.jsp
        Mon Jan  9 16:31:59 2012
@@ -42,13 +42,14 @@
     link.setAttribute("class","ui-theme");
     link.setAttribute("rel","stylesheet");
     link.setAttribute("href",cssLink);
+
     iframe.contentDocument.getElementsByTagName("head")[0].appendChild(link);
 
     // Remove old CSS links
     var uithemes = $("link.ui-theme");
     if (uithemes.length > 1) {
       for (var i=1; i<uithemes.length;i++) {
-        $("link.ui-theme")[0].remove();
+        $($("link.ui-theme")[0]).remove();
       }
     }
   }
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to