[Mediawiki-l] new template and user-specific js / css

N. M. Buzdor mediawiki at buzdor.com
Wed Mar 9 22:52:15 UTC 2005


> Can anyone advise what I need to do to either (1) disable the opportunity to
> run user specific css / js in my new "test" template; or ...

I did this in 1.3.9, though I don't think it'll work in 1.4.x.  But if you're running 1.3.x,

Comment out line 89ish in SkinPHPTal.php:
   //$this->setupUserCssJs();

and lines 150ish through 155ish
   /*
   if($this->loggedin) {
    $tpl->set( "jsvarurl", $this->makeUrl('-','action=raw&gen=js&smaxage=0') );
   } else {
    $tpl->set( "jsvarurl", $this->makeUrl('-','action=raw&gen=js') );
   }
   */

Then in Skin.php lines 158-170ish,
 function getHeadScripts() {
  /*
  global $wgStylePath, $wgUser, $wgLang, $wgAllowUserJs;
  $r = "<script type=\"text/javascript\" src=\"{$wgStylePath}/wikibits.js\"></script>\n";
  if( $wgAllowUserJs && $wgUser->getID() != 0 ) { # logged in
   $userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
   $userjs = htmlspecialchars($this->makeUrl($userpage.'/'.$this->getSkinName().'.js', 'action=raw&ctype=text/javascript'));
   $r .= '<script type="text/javascript" src="'.$userjs."\"></script>\n";
  }
  return $r;
  */
  return '';
 }

and then lines 195ish-205ish:
 function getUserStyles()
 {
  //global $wgOut, $wgStylePath, $wgLang;
  //$s = "<style type='text/css'>\n";
  //$s .= "/*/*/ /*<![CDATA[*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
  //$s .= $this->getUserStylesheet();
  //$s .= "/*]]>*/ /* */\n";
  //$s .= "</style>\n";
  //return $s;
  return '';
 }

This worked well to clear up the loopback for user styles and user JavaScript.

Good Luck.

--N. Buzdor


More information about the MediaWiki-l mailing list