| Index: trunk/phase3/skins/Amethyst.pt |
| — | — | @@ -9,7 +9,7 @@ |
| 10 | 10 | <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${stylename}/IEFixes.css";</style> |
| 11 | 11 | <script type="text/javascript" src="${stylepath}/common/IEFixes.js"></script> |
| 12 | 12 | <meta http-equiv="imagetoolbar" content="no" /><![endif]--> |
| 13 | | - <script type="text/javascript" tal:attributes="src jsvarurl"></script> |
| | 13 | + <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script> |
| 14 | 14 | <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script> |
| 15 | 15 | <style tal:condition="usercss" type="text/css">/*<![CDATA[*/ ${usercss} /*]]>*/</style> |
| 16 | 16 | <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script |
| Index: trunk/phase3/skins/Chick.pt |
| — | — | @@ -5,7 +5,7 @@ |
| 6 | 6 | <div tal:replace="structure headlinks"></div> |
| 7 | 7 | <title tal:content="pagetitle">Exciting xhtml slimfast</title> |
| 8 | 8 | <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${stylename}/main.css"; /*]]>*/</style> |
| 9 | | - <script type="text/javascript" tal:attributes="src jsvarurl"></script> |
| | 9 | + <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script> |
| 10 | 10 | <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script> |
| 11 | 11 | <style tal:condition="usercss" tal:content="structure usercss" type="text/css"></style> |
| 12 | 12 | <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script |
| Index: trunk/phase3/skins/MonoBook.pt |
| — | — | @@ -9,7 +9,7 @@ |
| 10 | 10 | <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${stylename}/IEFixes.css";</style> |
| 11 | 11 | <script type="text/javascript" src="${stylepath}/common/IEFixes.js"></script> |
| 12 | 12 | <meta http-equiv="imagetoolbar" content="no" /><![endif]--> |
| 13 | | - <script type="text/javascript" tal:attributes="src jsvarurl"></script> |
| | 13 | + <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script> |
| 14 | 14 | <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script> |
| 15 | 15 | <style tal:condition="usercss" tal:content="structure usercss" type="text/css"></style> |
| 16 | 16 | <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script |
| Index: trunk/phase3/skins/WikimediaWiki.pt |
| — | — | @@ -9,7 +9,7 @@ |
| 10 | 10 | <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${stylename}/common/IEFixes.css";</style> |
| 11 | 11 | <script type="text/javascript" src="${stylepath}/IEFixes.js"></script> |
| 12 | 12 | <meta http-equiv="imagetoolbar" content="no" /><![endif]--> |
| 13 | | - <script type="text/javascript" tal:attributes="src jsvarurl"></script> |
| | 13 | + <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script> |
| 14 | 14 | <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script> |
| 15 | 15 | <style tal:condition="usercss" type="text/css">/*<![CDATA[*/ ${usercss} /*]]>*/</style> |
| 16 | 16 | <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script |
| Index: trunk/phase3/includes/SkinPHPTal.php |
| — | — | @@ -159,8 +159,8 @@ |
| 160 | 160 | $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage); |
| 161 | 161 | |
| 162 | 162 | $this->usercss = $this->userjs = $this->userjsprev = false; |
| 163 | | - $this->setupUserCssJs(); |
| 164 | | - |
| | 163 | + $this->setupUserCss(); |
| | 164 | + $this->setupUserJs(); |
| 165 | 165 | $this->titletxt = $wgTitle->getPrefixedText(); |
| 166 | 166 | |
| 167 | 167 | $tpl->set( 'title', $wgOut->getPageTitle() ); |
| — | — | @@ -223,10 +223,15 @@ |
| 224 | 224 | $tpl->setRef( 'usercss', $this->usercss); |
| 225 | 225 | $tpl->setRef( 'userjs', $this->userjs); |
| 226 | 226 | $tpl->setRef( 'userjsprev', $this->userjsprev); |
| 227 | | - if($this->loggedin) { |
| 228 | | - $tpl->set( 'jsvarurl', $this->makeUrl('-','action=raw&smaxage=0&gen=js') ); |
| | 227 | + global $wgUseSiteJs; |
| | 228 | + if ($wgUseSiteJs) { |
| | 229 | + if($this->loggedin) { |
| | 230 | + $tpl->set( 'jsvarurl', $this->makeUrl('-','action=raw&smaxage=0&gen=js') ); |
| | 231 | + } else { |
| | 232 | + $tpl->set( 'jsvarurl', $this->makeUrl('-','action=raw&gen=js') ); |
| | 233 | + } |
| 229 | 234 | } else { |
| 230 | | - $tpl->set( 'jsvarurl', $this->makeUrl('-','action=raw&gen=js') ); |
| | 235 | + $tpl->set('jsvarurl', false); |
| 231 | 236 | } |
| 232 | 237 | if( $wgUser->getNewtalk() ) { |
| 233 | 238 | $usertitle = Title::newFromText( $this->userpage ); |
| — | — | @@ -670,40 +675,63 @@ |
| 671 | 676 | } |
| 672 | 677 | } |
| 673 | 678 | |
| 674 | | - |
| 675 | 679 | /** |
| 676 | 680 | * @access private |
| 677 | 681 | */ |
| 678 | | - function setupUserCssJs () { |
| 679 | | - global $wgRequest, $wgTitle; |
| 680 | | - $action = $wgRequest->getText('action'); |
| 681 | | - # generated css |
| 682 | | - $this->usercss = '@import "'.$this->makeUrl('-','action=raw&gen=css').'";'."\n"; |
| | 682 | + |
| | 683 | + function setupUserCss () { |
| | 684 | + |
| | 685 | + global $wgRequest, $wgTitle, $wgAllowUserCss, $wgUseSiteCss; |
| 683 | 686 | |
| 684 | | - if( $this->loggedin ) { |
| | 687 | + $sitecss = ""; |
| | 688 | + $usercss = ""; |
| | 689 | + $siteargs = ""; |
| | 690 | + |
| | 691 | + # Add user-specific code if this is a user and we allow that kind of thing |
| | 692 | + |
| | 693 | + if ( $wgAllowUserCss && $this->loggedin ) { |
| | 694 | + $action = $wgRequest->getText('action'); |
| | 695 | + |
| | 696 | + # if we're previewing the CSS page, use it |
| 685 | 697 | if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { |
| 686 | | - # generated css |
| 687 | | - $this->usercss = '@import "'.$this->makeUrl('-','action=raw&smaxage=0&maxage=0&gen=css').'";'."\n"; |
| 688 | | - // css preview |
| 689 | | - $this->usercss .= $wgRequest->getText('wpTextbox1'); |
| | 698 | + $siteargs .= "&smaxage=0&maxage=0"; |
| | 699 | + $usercss = $wgRequest->getText('wpTextbox1'); |
| 690 | 700 | } else { |
| 691 | | - # generated css |
| 692 | | - $this->usercss .= '@import "'.$this->makeUrl('-','action=raw&smaxage=0&gen=css').'";'."\n"; |
| 693 | | - # import user stylesheet |
| 694 | | - $this->usercss .= '@import "'. |
| 695 | | - $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css').'";'."\n"; |
| | 701 | + $siteargs .= "&maxage=0"; |
| | 702 | + $usercss = '@import "' . |
| | 703 | + $this->makeUrl($this->userpage . '/'.$this->skinname.'.css', |
| | 704 | + 'action=raw&ctype=text/css') . '";' ."\n"; |
| 696 | 705 | } |
| | 706 | + } |
| | 707 | + |
| | 708 | + # If we use the site's dynamic CSS, throw that in, too |
| | 709 | + |
| | 710 | + if ( $wgUseSiteCss ) { |
| | 711 | + $sitecss = '@import "'.$this->makeUrl('-','action=raw&gen=css' . $siteargs).'";'."\n"; |
| | 712 | + } |
| | 713 | + |
| | 714 | + # If we use any dynamic CSS, make a little CDATA block out of it. |
| | 715 | + |
| | 716 | + if ( !empty($sitecss) || !empty($usercss) ) { |
| | 717 | + $this->usercss = '/*<![CDATA[*/ ' . $sitecss . ' ' . $usercss . ' /*]]>*/'; |
| | 718 | + } |
| | 719 | + } |
| | 720 | + |
| | 721 | + /** |
| | 722 | + * @access private |
| | 723 | + */ |
| | 724 | + function setupUserJs () { |
| | 725 | + global $wgRequest, $wgTitle, $wgAllowUserJs; |
| | 726 | + $action = $wgRequest->getText('action'); |
| | 727 | + |
| | 728 | + if( $wgAllowUserJs && $this->loggedin ) { |
| 697 | 729 | if($wgTitle->isJsSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { |
| 698 | 730 | # XXX: additional security check/prompt? |
| 699 | | - $this->userjsprev = $wgRequest->getText('wpTextbox1'); |
| | 731 | + $this->userjsprev = '/*<![CDATA[*/ ' . $wgRequest->getText('wpTextbox1') . ' /*]]>*/'; |
| 700 | 732 | } else { |
| 701 | 733 | $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript&dontcountme=s'); |
| 702 | 734 | } |
| 703 | 735 | } |
| 704 | | - $this->usercss = '/*<![CDATA[*/ ' . $this->usercss . ' /*]]>*/'; |
| 705 | | - if( $this->userjsprev ) { |
| 706 | | - $this->userjsprev = '/*<![CDATA[*/ ' . $this->userjsprev . ' /*]]>*/'; |
| 707 | | - } |
| 708 | 736 | } |
| 709 | 737 | |
| 710 | 738 | /** |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -721,6 +721,12 @@ |
| 722 | 722 | # Allow user Cascading Style Sheets (CSS)? |
| 723 | 723 | $wgAllowUserCss = true; |
| 724 | 724 | |
| | 725 | +# Use the site's Javascript page? |
| | 726 | +$wgUseSiteJs = true; |
| | 727 | + |
| | 728 | +# Use the site's Cascading Style Sheets (CSS)? |
| | 729 | +$wgUseSiteCss = true; |
| | 730 | + |
| 725 | 731 | # Filter for Special:Randompage. Part of a WHERE clause |
| 726 | 732 | $wgExtraRandompageSQL = false; |
| 727 | 733 | |