diff --git a/.gitattributes b/.gitattributes index 6ca4a0aef35ae51d6fa3d4ec5d1c3a911dc87abd..6baf50f2ee6011487f6cb6fa44b77bccb7f0be49 100644 --- a/.gitattributes +++ b/.gitattributes @@ -240,7 +240,7 @@ dist/javascript/async_upload.js -text dist/javascript/bgiframe.js -text dist/javascript/dragdrop_interface.js -text dist/javascript/jquery.form.js -text -dist/javascript/jquery.iepnghack.js -text +dist/javascript/jquery.ifixpng.js -text dist/javascript/jquery.js -text dist/javascript/multilang.js -text dist/javascript/pause.js -text diff --git a/dist/javascript/jquery.iepnghack.js b/dist/javascript/jquery.ifixpng.js similarity index 65% rename from dist/javascript/jquery.iepnghack.js rename to dist/javascript/jquery.ifixpng.js index f3fd9db675a9e48394ffe81093343187c55c6532..ef98032955d74ba25ecd4d4214f7cbb80c372586 100644 --- a/dist/javascript/jquery.iepnghack.js +++ b/dist/javascript/jquery.ifixpng.js @@ -1,125 +1,132 @@ -/* - * jQuery pngfix plugin - * Version 1.6 (05/09/2007) - * @requires jQuery v1.1.3 - * - * Examples at: http://khurshid.com/jquery/iepnghack/ - * Copyright (c) 2007 Kush M. - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - */ - /** - * - * @example - * - * optional if location of pixel.gif if different to default which is images/pixel.gif - * $.pngfix('media/pixel.gif'); - * - * $('img[@src$=.png], #panel').pngfix(); - * - * @apply hack to all png images and #panel which icluded png img in its css - * - * @name pngfix - * @type jQuery - * @cat Plugins/Image - * @return jQuery - * @author jQuery Community - */ - -(function($) { - - /** - * helper variables and function - */ - $.pngfix = function(customPixel) { - $.pngfix.pixel = customPixel; - }; - - $.pngfix.getPixel = function() { - return $.pngfix.pixel || 'images/pixel.gif'; - }; - - var hack = { - ltie7 : $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent), - filter : function(src) { - return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')"; - } - }; - /** - * Applies ie png hack to selected dom elements - * - * $('img[@src$=.png]').pngfix(); - * @desc apply hack to all images with png extensions - * - * $('#panel, img[@src$=.png]').pngfix(); - * @desc apply hack to element #panel and all images with png extensions - * - * @name pngfix - * @type jQuery - * @cat Plugins/pngfix - */ - $.fn.pngfix = hack.ltie7 ? function() { - return this.each(function() { - var $$ = $(this); - var base = $('base').attr('href'); // need to use this in case you are using rewriting urls - if ($$.is('img') || $$.is('input')) { // hack image tags present in dom - if ($$.attr('src').match(/.*\.png([?].*)?$/i)) { // make sure it is png image - // use source tag value if set - var source = (base && $$.attr('src').substring(0,1)!='/') ? base + $$.attr('src') : $$.attr('src'); - // apply filter - $$.css({filter:hack.filter(source), width:$$.width(), height:$$.height()}) - .attr({src:$.pngfix.getPixel()}) - .positionFix(); - } - } else { // hack png css properties present inside css - var image = $$.css('backgroundImage'); - if (image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)) { - image = RegExp.$1; - $$.css({backgroundImage:'none', filter:hack.filter(image)}) - .positionFix(); - } - } - }); - } : function() { return this; }; - /** - * Removes any png hack that may have been applied previously - * - * $('img[@src$=.png]').pngunfix(); - * @desc revert hack on all images with png extensions - * - * $('#panel, img[@src$=.png]').iepnghack(); - * @desc revert hack on element #panel and all images with png extensions - * - * @name pngunfix - * @type jQuery - * @cat Plugins/iepnghack - */ - $.fn.pngunfix = hack.ltie7 ? function() { - return this.each(function() { - var $$ = $(this); - var src = $$.css('filter'); - if (src.match(/src=["']?(.*\.png([?].*)?)["']?/i)) { // get img source from filter - src = RegExp.$1; - if ($$.is('img') || $$.is('input')) { - $$.attr({src:src}).css({filter:''}); - } else { - $$.css({filter:'', background:'url('+src+')'}); - } - } - }); - } : function() { return this; }; - /** - * positions selected item relatively - */ - $.fn.positionFix = function() { - return this.each(function() { - var $$ = $(this); - var position = $$.css('position'); - if (position != 'absolute' && position != 'relative') { - $$.css({position:'relative'}); - } - }); - }; - -})(jQuery); +/* + * jQuery ifixpng plugin + * (previously known as pngfix) + * with another plugin + * Version 1.9 (27/09/2007) + * @requires jQuery v1.1.3 or above + * + * Examples at: http://jquery.khurshid.com + * Copyright (c) 2007 Kush M. + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + + /** + * + * @example + * + * optional if location of pixel.gif if different to default which is images/pixel.gif + * $.ifixpng('media/pixel.gif'); + * + * $('img[@src$=.png], #panel').ifixpng(); + * + * @apply hack to all png images and #panel which icluded png img in its css + * + * @name ifixpng + * @type jQuery + * @cat Plugins/Image + * @return jQuery + * @author jQuery Community + */ + +(function($) { + + /** + * helper variables and function + */ + $.ifixpng = function(customPixel) { + $.ifixpng.pixel = customPixel; + }; + + $.ifixpng.getPixel = function() { + return $.ifixpng.pixel || 'images/pixel.gif'; + }; + + var hack = { + ltie7 : $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent), + filter : function(src) { + return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')"; + } + }; + + /** + * Applies ie png hack to selected dom elements + * + * $('img[@src$=.png]').ifixpng(); + * @desc apply hack to all images with png extensions + * + * $('#panel, img[@src$=.png]').ifixpng(); + * @desc apply hack to element #panel and all images with png extensions + * + * @name ifixpng + */ + + $.fn.ifixpng = hack.ltie7 ? function() { + return this.each(function() { + var $$ = $(this); + var base = $('base').attr('href'); // need to use this in case you are using rewriting urls + if ($$.is('img') || $$.is('input')) { // hack image tags present in dom + if ($$.attr('src')) { + if ($$.attr('src').match(/.*\.png([?].*)?$/i)) { // make sure it is png image + // use source tag value if set + var source = (base && $$.attr('src').substring(0,1)!='/') ? base + $$.attr('src') : $$.attr('src'); + // apply filter + $$.css({filter:hack.filter(source), width:$$.width(), height:$$.height()}) + .attr({src:$.ifixpng.getPixel()}) + .positionFix(); + } + } + } else { // hack png css properties present inside css + var image = $$.css('backgroundImage'); + if (image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)) { + image = RegExp.$1; + $$.css({backgroundImage:'none', filter:hack.filter(image)}) + .children().positionFix(); + } + } + }); + } : function() { return this; }; + + /** + * Removes any png hack that may have been applied previously + * + * $('img[@src$=.png]').iunfixpng(); + * @desc revert hack on all images with png extensions + * + * $('#panel, img[@src$=.png]').iunfixpng(); + * @desc revert hack on element #panel and all images with png extensions + * + * @name iunfixpng + */ + + $.fn.iunfixpng = hack.ltie7 ? function() { + return this.each(function() { + var $$ = $(this); + var src = $$.css('filter'); + if (src.match(/src=["']?(.*\.png([?].*)?)["']?/i)) { // get img source from filter + src = RegExp.$1; + if ($$.is('img') || $$.is('input')) { + $$.attr({src:src}).css({filter:''}); + } else { + $$.css({filter:'', background:'url('+src+')'}); + } + } + }); + } : function() { return this; }; + + /** + * positions selected item relatively + */ + + $.fn.positionFix = function() { + return this.each(function() { + var $$ = $(this); + var position = $$.css('position'); + if (position != 'absolute' && position != 'relative') { + $$.css({position:'relative'}); + } + }); + }; + +})(jQuery); \ No newline at end of file diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php index 1272b60ae967b215116819eeba3156daadbb22c1..7f83f7cd23d504470a48771ada6b3a9d99c7a156 100644 --- a/ecrire/inc/presentation.php +++ b/ecrire/inc/presentation.php @@ -1264,8 +1264,8 @@ function fin_page() ? "<script type='text/javascript'><!-- try { document.execCommand('BackgroundImageCache', false, true); } catch(err) {}; if (window.jQuery && jQuery.browser.msie) jQuery.getScript( '" - .url_absolue(find_in_path('javascript/jquery.iepnghack.js')) - ."' , function() { $.pngfix('".url_absolue(_DIR_RACINE.'rien.gif')."'); jQuery('img').pngfix(); } ); + .url_absolue(find_in_path('javascript/jquery.ifixpng.js')) + ."' , function() { $.ifixpng('".url_absolue(_DIR_RACINE.'rien.gif')."'); jQuery('img').ifixpng(); } ); // --></script>" : ''; diff --git a/ecrire/public/assembler.php b/ecrire/public/assembler.php index 53b6b0c6d494c42de02ccea9c78345dcc2fb56b7..522d8b82e22651c0dd9f98cd2b520c9fdec27541 100644 --- a/ecrire/public/assembler.php +++ b/ecrire/public/assembler.php @@ -419,7 +419,7 @@ function f_msie ($texte) { include_spip('inc/filtres'); # pour url_absolue :( $texte .= "<script type='text/javascript'><!-- -if (window.jQuery && jQuery.browser.msie) jQuery.getScript( '".url_absolue(find_in_path('javascript/jquery.iepnghack.js'))."' , function() { $.pngfix('".url_absolue(_DIR_RACINE.'rien.gif')."'); jQuery('img').pngfix(); } ); +if (window.jQuery && jQuery.browser.msie) jQuery.getScript( '".url_absolue(find_in_path('javascript/jquery.ifixpng.js'))."' , function() { $.ifixpng('".url_absolue(_DIR_RACINE.'rien.gif')."'); jQuery('img').ifixpng(); } ); // --></script>\n"; }