diff --git a/webapp/config/licenser/known_exceptions.txt b/webapp/config/licenser/known_exceptions.txt index 7a60eba5e..1974d5453 100644 --- a/webapp/config/licenser/known_exceptions.txt +++ b/webapp/config/licenser/known_exceptions.txt @@ -165,5 +165,4 @@ webapp/web/js/html5.js webapp/web/js/selectivizr.js # Supersleight jQuery Plugin for Transparent PNGs in IE6. allinthehead.com/retro/338/supersleight-jquery-plugin -webapp/web/js/supersleight.js -webapp/web/js/supersleightUtils.js +webapp/web/js/jquery_plugins/supersleight.js diff --git a/webapp/web/js/jquery_plugins/supersleight.js b/webapp/web/js/jquery_plugins/supersleight.js new file mode 100644 index 000000000..39ee3fce8 --- /dev/null +++ b/webapp/web/js/jquery_plugins/supersleight.js @@ -0,0 +1,41 @@ +//Fix Transparent PNGs in IE6 +jQuery.fn.supersleight = function(settings) { + settings = jQuery.extend({ + imgs: true, + backgrounds: true, + shim: 'x.gif', + apply_positioning: true + }, settings); + + return this.each(function(){ + if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) { + jQuery(this).find('*').andSelf().each(function(i,obj) { + var self = jQuery(obj); + // background pngs + if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) { + var bg = self.css('background-image'); + var src = bg.substring(5,bg.length-2); + var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale'); + var styles = { + 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')", + 'background-image': 'url('+settings.shim+')' + }; + self.css(styles); + }; + // image elements + if (settings.imgs && self.is('img[src$=png]')){ + var styles = { + 'width': self.width() + 'px', + 'height': self.height() + 'px', + 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')" + }; + self.css(styles).attr('src', settings.shim); + }; + // apply position to 'active' elements + if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')){ + self.css('position', 'relative'); + }; + }); + }; + }); +}; \ No newline at end of file diff --git a/webapp/web/js/supersleightUtils.js b/webapp/web/js/supersleightUtils.js deleted file mode 100644 index da0356090..000000000 --- a/webapp/web/js/supersleightUtils.js +++ /dev/null @@ -1,3 +0,0 @@ -<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -//Fix Transparent PNGs in IE6 -$('body').supersleight(); \ No newline at end of file