Skip to content
Extraits de code Groupes Projets
Valider 865b6e77 rédigé par Fil's avatar Fil
Parcourir les fichiers

on isole la gestion du fix pour MSIE (et on le rend surchargeable) ; le script...

on isole la gestion du fix pour MSIE (et on le rend surchargeable) ; le script est maintenant envoye inline, c'est plus rapide et meilleur en bande passante (et encore plus moche en 'voir source' mais peu importe)
parent 8b178689
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -618,6 +618,7 @@ ecrire/inc/lien.php -text ...@@ -618,6 +618,7 @@ ecrire/inc/lien.php -text
ecrire/inc/message_select.php -text ecrire/inc/message_select.php -text
ecrire/inc/minipres.php -text ecrire/inc/minipres.php -text
ecrire/inc/modifier.php -text ecrire/inc/modifier.php -text
ecrire/inc/msiefix.php -text
ecrire/inc/nfslock.php -text ecrire/inc/nfslock.php -text
ecrire/inc/notifications.php -text ecrire/inc/notifications.php -text
ecrire/inc/petitionner.php -text ecrire/inc/petitionner.php -text
......
<?php
/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
* Copyright (c) 2001-2007 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
\***************************************************************************/
if (!defined("_ECRIRE_INC_VERSION")) return;
// Pour MSIE: reparer le cache des images de background
// Inserer le script jquery.ifixpng.js si necessaire
// Comme MSIE est goret, on n'a pas honte d'inserer comme un goret
// en fin de page
// http://doc.spip.org/@msiefix
function inc_msiefix_dist($texte) {
$texte .= "<script type='text/javascript'><!--
try { document.execCommand('BackgroundImageCache', false, true); } catch(err) {};
// --></script>\n";
// Si jQuery n'est pas la on ne fixe pas les PNG
if (strpos($texte, 'jquery.js')
AND strpos($texte, '.png')
AND true /* ... autres tests si on veut affiner ... */
AND lire_fichier(_DIR_RACINE.'dist/javascript/jquery.ifixpng.js', $ifixpng)) {
$texte .=
"<script type='text/javascript'><!--
if (window.jQuery && jQuery.browser.msie) {
$ifixpng
jQuery.ifixpng('".str_repeat('../', $GLOBALS['profondeur_url']).'rien.gif'."');
}
// --></script>\n";
}
return $texte;
}
function presentation_msiefix() {
lire_fichier(_DIR_RACINE.'dist/javascript/jquery.ifixpng.js', $ifixpng);
return "<script type='text/javascript'><!--
try { document.execCommand('BackgroundImageCache', false, true); } catch(err) {};
if (window.jQuery && jQuery.browser.msie) {
$ifixpng
jQuery.ifixpng('".str_repeat('../', $GLOBALS['profondeur_url']).'rien.gif'."');
}
// --></script>";
}
?>
...@@ -1258,16 +1258,14 @@ function fin_page() ...@@ -1258,16 +1258,14 @@ function fin_page()
// cf. public/assembler, fonction f_msie() // cf. public/assembler, fonction f_msie()
// test si MSIE et sinon quitte // test si MSIE et sinon quitte
$msie = strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie') if (
AND preg_match('/MSIE /i', $_SERVER['HTTP_USER_AGENT']); strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie')
$fix_png = $msie AND preg_match('/MSIE /i', $_SERVER['HTTP_USER_AGENT'])
? "<script type='text/javascript'><!-- AND $msiefix = charger_fonction('msiefix', 'inc')
try { document.execCommand('BackgroundImageCache', false, true); } catch(err) {}; )
if (window.jQuery && jQuery.browser.msie) jQuery.getScript( '" $fix_png = presentation_msiefix();
.url_absolue(find_in_path('javascript/jquery.ifixpng.js')) else
."' , function() { $.ifixpng('".url_absolue(_DIR_RACINE.'rien.gif')."'); jQuery('img').ifixpng(); } ); $fix_png = '';
// --></script>"
: '';
return debut_grand_cadre(true) return debut_grand_cadre(true)
. (($spip_display == 4) . (($spip_display == 4)
......
...@@ -400,33 +400,18 @@ function f_msie ($texte) { ...@@ -400,33 +400,18 @@ function f_msie ($texte) {
if (!$GLOBALS['html']) return $texte; if (!$GLOBALS['html']) return $texte;
// test si MSIE et sinon quitte // test si MSIE et sinon quitte
$msie = strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie') if (
AND preg_match('/MSIE /i', $_SERVER['HTTP_USER_AGENT']); strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie')
if (!$msie) return $texte; AND preg_match('/MSIE /i', $_SERVER['HTTP_USER_AGENT'])
AND $msiefix = charger_fonction('msiefix', 'inc')
// Comme MSIE est goret, on n'a pas honte d'inserer comme un goret )
// en fin de page return $msiefix($texte);
else
// fixer les images background return $texte;
$texte .= "<script type='text/javascript'><!--
try { document.execCommand('BackgroundImageCache', false, true); } catch(err) {};
// --></script>\n";
// Si jQuery n'est pas la on ne fixe pas les PNG
if (strpos(strtolower($texte), 'jquery.js')
AND strpos(strtolower($texte), '.png')
AND true /* ... autres tests si on veut affiner ... */) {
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.ifixpng.js'))."' , function() { $.ifixpng('".url_absolue(_DIR_RACINE.'rien.gif')."'); jQuery('img').ifixpng(); } );
// --></script>\n";
}
return $texte;
} }
//ajoute a la volee scripts a le squelette jquery.js.html
// Ajoute a la volee scripts a le squelette jquery.js.html
// http://doc.spip.org/@ajouter_js_affichage_final // http://doc.spip.org/@ajouter_js_affichage_final
function ajouter_js_affichage_final($page,$scripts,$inline = false) { function ajouter_js_affichage_final($page,$scripts,$inline = false) {
if(!$scripts || (!$inline && !preg_match(",\w+\|?,",$scripts)) || ($inline && !preg_match(",^\s*<script.*</script>\s*$,Us",$scripts))) { if(!$scripts || (!$inline && !preg_match(",\w+\|?,",$scripts)) || ($inline && !preg_match(",^\s*<script.*</script>\s*$,Us",$scripts))) {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter