Jeremy Newman : rewrite the PNG fix to only load the script if the browser is actually IE6

Jeremy Newman jnewman at winehq.org
Wed Mar 24 10:44:19 CDT 2010


Module: website
Branch: master
Commit: ed59b0c8d91988b59a73428d78e6ebd1d164b813
URL:    http://source.winehq.org/git/website.git/?a=commit;h=ed59b0c8d91988b59a73428d78e6ebd1d164b813

Author: Jeremy Newman <jnewman at codeweavers.com>
Date:   Wed Mar 24 10:43:37 2010 -0500

rewrite the PNG fix to only load the script if the browser is actually IE6

---

 utils.js |   28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/utils.js b/utils.js
index 0ad1248..90e6ecb 100644
--- a/utils.js
+++ b/utils.js
@@ -2,22 +2,18 @@
   Misc JavaScipt for WineHQ
 */
 
-// include a file from js scripts dir
-function include_dom (script_filename) {
-    var html_doc = document.getElementsByTagName('head').item(0);
-    var js = document.createElement('script');
-    js.setAttribute('language', 'javascript');
-    js.setAttribute('type', 'text/javascript');
-    js.setAttribute('src', web_root + "/" + script_filename);
-    html_doc.appendChild(js);
-    return false;
-}
-
-// load and execute jquery IE6 PNG fix
-include_dom("jquery.pngfix.js");
-jQuery(function($) {
-    $("img[@src$=png]").pngfix(); /* all img tags with .png extension */
-    $("#tabs li").pngfix(); /* top tabs li backgrounds */
+// global document operations
+$(document).ready(function()
+{
+    // fix PNG images for IE6
+    if ($.browser.msie && $.browser.version == "6.0")
+    {
+        $.getScript("jquery.pngfix.js",function()
+        {
+            $("img[@src$=png]").pngfix(); /* all img tags with .png extension */
+            $("#tabs li").pngfix(); /* top tabs li backgrounds */
+        });
+    }
 });
 
 // done




More information about the wine-cvs mailing list