From f719dca05fcb6582b1ea79d3e0c2d7ce58ca33b4 Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Wed, 9 Jun 2004 13:04:52 +0000 Subject: [PATCH] Reworked css include/pref/tooltip/accesskey subsystem * accesskeys and tooltips moved to js, needs to be customized/localized at MediaWiki:Monobook.js. Saves many calls to wfMsg, reduces page size, shows access key prefix depending on browser/os. Easy to customize by changing the ta array. * skinphptal underline and justification wired up to produce generated css * MediaWiki:Skin.css used for anons as well * addcss call removed from header * separate js var file included that holds things like the stylepath and the tooltip/accesskey array * rtl css included from generated css --- includes/Article.php | 2 +- includes/RawPage.php | 44 +++++-- includes/Skin.php | 40 +++++- includes/SkinCologneBlue.php | 7 +- includes/SkinNostalgia.php | 3 + includes/SkinPHPTal.php | 213 +++++++++++++++----------------- includes/SkinStandard.php | 4 +- includes/SpecialPreferences.php | 2 + languages/Language.php | 137 +++++++++----------- stylesheets/monobook/main.css | 2 +- stylesheets/monobook/rtl.css | 2 +- stylesheets/wikibits.js | 39 ++++-- templates/xhtml_slim.pt | 51 +++----- 13 files changed, 294 insertions(+), 252 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index f595cb62db..87e5633ba4 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -589,7 +589,7 @@ class Article { $this->mTitle->getNamespace() == Namespace::getUser() && preg_match('/\\/[\\w]+\\.(css|js)$/', $this->mTitle->getDBkey()) ) { - $wgOut->addWikiText( wfMsg('usercssjs')); + $wgOut->addWikiText( wfMsg('clearyourcache')); $wgOut->addHTML( '
'.htmlspecialchars($this->mContent)."\n
" ); } else if ( $pcache ) { $wgOut->addWikiText( $text, true, $this ); diff --git a/includes/RawPage.php b/includes/RawPage.php index d0b029750e..6705b83091 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -8,28 +8,54 @@ class RawPage { function RawPage( $article ) { - global $wgRequest, $wgInputEncoding; + global $wgRequest, $wgInputEncoding, $wgSquidMaxage; $allowedCTypes = array('text/x-wiki', 'text/javascript', 'text/css', 'application/x-zope-edit'); $this->mArticle =& $article; $this->mTitle =& $article->mTitle; + $ctype = $wgRequest->getText( 'ctype' ); + $charset = $wgRequest->getText( 'charset' ); + $smaxage = $wgRequest->getText( 'smaxage' ); + $maxage = $wgRequest->getText( 'maxage' ); + $this->mOldId = $wgRequest->getInt( 'oldid' ); + # special case for 'generated' raw things: user css/js + $gen = $wgRequest->getText( 'gen' ); + if($gen == 'css') { + $this->mGen = $gen; + if($smaxage == '') $smaxage = $wgSquidMaxage; + if(empty($ctype)) $ctype = 'text/css'; + } else if ($gen == 'js') { + $this->mGen = $gen; + if($smaxage == '') $smaxage = $wgSquidMaxage; + if(empty($ctype)) $ctype = 'text/javascript'; + } else { + $this->mGen = false; + } + $this->mCharset = !empty($charset) ? $charset : $wgInputEncoding; + $this->mSmaxage = ($smaxage != '') ? $smaxage : 0; + $this->mMaxage = ($maxage != '') ? $maxage : 86400; if(empty($ctype) or !in_array($ctype, $allowedCTypes)) { $this->mContentType = 'text/x-wiki'; } else { $this->mContentType = $ctype; } - - $charset = $wgRequest->getText( 'charset' ); - $this->mCharset = !empty($charset) ? $charset : $wgInputEncoding; - $smaxage = $wgRequest->getText( 'smaxage' ); - $this->mSmaxage = !empty($smaxage) ? $smaxage : 0; - $this->mOldId = $wgRequest->getInt( 'oldid' ); } function view() { + global $wgUser, $wgOut; header( "Content-type: ".$this->mContentType.'; charset='.$this->mCharset ); # allow the client to cache this for 24 hours - header( 'Cache-Control: s-maxage='.$this->mSmaxage.', max-age=86400' ); - echo $this->getrawtext(); + header( 'Cache-Control: s-maxage='.$this->mSmaxage.', max-age='.$this->mMaxage ); + if($this->mGen) { + $sk = $wgUser->getSkin(); + $sk->initPage($wgOut); + if($this->mGen == 'css') { + echo $sk->getUserStylesheet(); + } else if($this->mGen == 'js') { + echo $sk->getUserJs(); + } + } else { + echo $this->getrawtext(); + } wfAbruptExit(); } diff --git a/includes/Skin.php b/includes/Skin.php index 2e23733f81..3e6711dbbd 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -63,6 +63,9 @@ class Skin { { return 'wikistandard.css'; } + function getSkinName() { + return "standard"; + } function qbSetting() { @@ -152,20 +155,47 @@ class Skin { } function getHeadScripts() { - global $wgStylePath; + global $wgStylePath, $wgUser, $wgLang; $r = "\n"; + if( $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 .= '\n"; + } return $r; } + # get the user/site-specific stylesheet, SkinPHPTal called from RawPage.php (settings are cached that way) + function getUserStylesheet() { + global $wgOut, $wgStylePath, $wgLang, $wgUser, $wgRequest, $wgTitle; + $sheet = $this->getStylesheet(); + $action = $wgRequest->getText('action'); + $s = "@import url(\"$wgStylePath/$sheet\");\n"; + if($wgLang->isRTL()) $s .= "@import url(\"$wgStylePath/common_rtl.css\");\n"; + if( $wgUser->getID() != 0 ) { # logged in + if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { + $s .= '@import url('.$this->makeUrl('-','action=raw&gen=css&smaxage=0&maxage=0').');'."\n"; + $s .= $wgRequest->getText('wpTextbox1'); + } else { + $s .= '@import url('.$this->makeUrl('-','action=raw&gen=css&smaxage=0&maxage=0').');'."\n"; + $userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName(); + $s.= '@import url("'.$this->makeUrl($userpage.'/'.$this->getSkinName(), 'action=raw&ctype=text/css').'");'."\n"; + } + } + $s .= $this->doGetUserStyles(); + return $s."\n"; + } + # placeholder, returns generated js in monobook + function getUserJs() { + return; + } + function getUserStyles() { global $wgOut, $wgStylePath, $wgLang; - $sheet = $this->getStylesheet(); $s = "\n"; return $s; diff --git a/includes/SkinCologneBlue.php b/includes/SkinCologneBlue.php index c0c2a3b6c7..212e3939fd 100644 --- a/includes/SkinCologneBlue.php +++ b/includes/SkinCologneBlue.php @@ -7,6 +7,9 @@ class SkinCologneBlue extends Skin { { return "cologneblue.css"; } + function getSkinName() { + return "cologneblue"; + } function doBeforeContent() { @@ -81,8 +84,7 @@ class SkinCologneBlue extends Skin { function doGetUserStyles() { global $wgUser, $wgOut, $wgStyleSheetPath; - - $s = parent::doGetUserStyles(); + $s = ''; $qb = $this->qbSetting(); if ( 2 == $qb ) { # Right @@ -97,6 +99,7 @@ class SkinCologneBlue extends Skin { "#article { margin-left:148px; margin-right: 4px; } \n" . "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE } + $s .= parent::doGetUserStyles(); return $s; } function sysLinks() diff --git a/includes/SkinNostalgia.php b/includes/SkinNostalgia.php index e402ba6e08..c97c681ddd 100644 --- a/includes/SkinNostalgia.php +++ b/includes/SkinNostalgia.php @@ -12,6 +12,9 @@ class SkinNostalgia extends Skin { { return "nostalgia.css"; } + function getSkinName() { + return "nostalgia"; + } function doBeforeContent() { diff --git a/includes/SkinPHPTal.php b/includes/SkinPHPTal.php index f80fb5c82f..44f3c9ada8 100644 --- a/includes/SkinPHPTal.php +++ b/includes/SkinPHPTal.php @@ -83,7 +83,7 @@ $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage); $this->usercss = $this->userjs = $this->userjsprev = false; - if( $this->loggedin ) { $this->setupUserCssJs(); } + $this->setupUserCssJs(); $this->titletxt = $wgTitle->getPrefixedText(); @@ -143,6 +143,11 @@ $tpl->setRef( "usercss", &$this->usercss); $tpl->setRef( "userjs", &$this->userjs); $tpl->setRef( "userjsprev", &$this->userjsprev); + if($this->loggedin) { + $tpl->set( "jsvarurl", $this->makeUrl('-','action=raw&gen=js&smaxage=0') ); + } else { + $tpl->set( "jsvarurl", $this->makeUrl('-','action=raw&gen=js') ); + } if( $wgUser->getNewtalk() ) { $usertitle = Title::newFromText( $this->userpage ); $usertalktitle = $usertitle->getTalkPage(); @@ -227,72 +232,52 @@ $personal_urls['userpage'] = array( 'text' => $this->username, 'href' => &$this->userpageUrlDetails['href'], - 'class' => $this->userpageUrlDetails['exists']?false:'new', - 'ttip' => wfMsg('tooltip-userpage'), - 'akey' => wfMsg('accesskey-userpage') + 'class' => $this->userpageUrlDetails['exists']?false:'new' ); $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage); $personal_urls['mytalk'] = array( 'text' => wfMsg('mytalk'), 'href' => &$usertalkUrlDetails['href'], - 'class' => $usertalkUrlDetails['exists']?false:'new', - 'ttip' => wfMsg('tooltip-mytalk'), - 'akey' => wfMsg('accesskey-mytalk') + 'class' => $usertalkUrlDetails['exists']?false:'new' ); $personal_urls['preferences'] = array( 'text' => wfMsg('preferences'), - 'href' => $this->makeSpecialUrl('Preferences'), - 'ttip' => wfMsg('tooltip-preferences'), - 'akey' => wfMsg('accesskey-preferences') + 'href' => $this->makeSpecialUrl('Preferences') ); $personal_urls['watchlist'] = array( 'text' => wfMsg('watchlist'), - 'href' => $this->makeSpecialUrl('Watchlist'), - 'ttip' => wfMsg('tooltip-watchlist'), - 'akey' => wfMsg('accesskey-watchlist') + 'href' => $this->makeSpecialUrl('Watchlist') ); $personal_urls['mycontris'] = array( 'text' => wfMsg('mycontris'), - 'href' => $this->makeSpecialUrl('Contributions','target=' . urlencode( $this->username ) ), - 'ttip' => wfMsg('tooltip-mycontris'), - 'akey' => wfMsg('accesskey-mycontris') + 'href' => $this->makeSpecialUrl('Contributions','target=' . urlencode( $this->username ) ) ); $personal_urls['logout'] = array( 'text' => wfMsg('userlogout'), - 'href' => $this->makeSpecialUrl('Userlogout','returnto=' . $this->thisurl ), - 'ttip' => wfMsg('tooltip-logout'), - 'akey' => wfMsg('accesskey-logout') + 'href' => $this->makeSpecialUrl('Userlogout','returnto=' . $this->thisurl ) ); } else { if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) { $personal_urls['anonuserpage'] = array( 'text' => $this->username, 'href' => &$this->userpageUrlDetails['href'], - 'class' => $this->userpageUrlDetails['exists']?false:'new', - 'ttip' => wfMsg('tooltip-anonuserpage'), - 'akey' => wfMsg('accesskey-anonuserpage') + 'class' => $this->userpageUrlDetails['exists']?false:'new' ); $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage); $personal_urls['anontalk'] = array( 'text' => wfMsg('anontalk'), 'href' => &$usertalkUrlDetails['href'], - 'class' => $usertalkUrlDetails['exists']?false:'new', - 'ttip' => wfMsg('tooltip-anontalk'), - 'akey' => wfMsg('accesskey-anontalk') + 'class' => $usertalkUrlDetails['exists']?false:'new' ); $personal_urls['anonlogin'] = array( 'text' => wfMsg('userlogin'), - 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl ), - 'ttip' => wfMsg('tooltip-login'), - 'akey' => wfMsg('accesskey-login') + 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl ) ); } else { $personal_urls['login'] = array( 'text' => wfMsg('userlogin'), - 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl ), - 'ttip' => wfMsg('tooltip-login'), - 'akey' => wfMsg('accesskey-login') + 'href' => $this->makeSpecialUrl('Userlogin', 'returnto=' . $this->thisurl ) ); } } @@ -311,11 +296,10 @@ if( $this->iscontent ) { - $content_actions['article'] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : false, - 'text' => $this->getNameSpaceWord(), - 'href' => $this->makeArticleUrl($this->thispage), - 'ttip' => wfMsg('tooltip-article'), - 'akey' => wfMsg('accesskey-article')); + $nskey = $this->getNameSpaceKey(); + $content_actions[$nskey] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : false, + 'text' => wfMsg($nskey), + 'href' => $this->makeArticleUrl($this->thispage)); /* set up the classes for the talk link */ $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ? 'selected' : false); @@ -326,17 +310,13 @@ $content_actions['talk'] = array( 'class' => $talk_class, 'text' => wfMsg('talk'), - 'href' => $this->makeTalkUrl($this->titletxt), - 'ttip' => wfMsg('tooltip-talk'), - 'akey' => wfMsg('accesskey-talk') + 'href' => $this->makeTalkUrl($this->titletxt) ); } else { $content_actions['talk'] = array( 'class' => $talk_class?$talk_class.' new':'new', 'text' => wfMsg('talk'), - 'href' => $this->makeTalkUrl($this->titletxt,'action=edit'), - 'ttip' => wfMsg('tooltip-talk'), - 'akey' => wfMsg('accesskey-talk') + 'href' => $this->makeTalkUrl($this->titletxt,'action=edit') ); } @@ -347,35 +327,27 @@ $content_actions['edit'] = array( 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ? 'selected' : '').$istalkclass, 'text' => wfMsg('edit'), - 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid), - 'ttip' => wfMsg('tooltip-edit'), - 'akey' => wfMsg('accesskey-edit') + 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid) ); if ( $istalk ) { $content_actions['addsection'] = array( 'class' => $section == 'new'?'selected':false, 'text' => wfMsg('addsection'), - 'href' => $this->makeUrl($this->thispage, 'action=edit§ion=new'), - 'ttip' => wfMsg('tooltip-addsection'), - 'akey' => wfMsg('accesskey-addsection') + 'href' => $this->makeUrl($this->thispage, 'action=edit§ion=new') ); } } else { $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : ''; - $content_actions['edit'] = array('class' => ($action == 'edit') ? 'selected' : false, + $content_actions['viewsource'] = array('class' => ($action == 'edit') ? 'selected' : false, 'text' => wfMsg('viewsource'), - 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid), - 'ttip' => wfMsg('tooltip-viewsource'), - 'akey' => wfMsg('accesskey-viewsource')); + 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid)); } if ( $wgTitle->getArticleId() ) { $content_actions['history'] = array('class' => ($action == 'history') ? 'selected' : false, 'text' => wfMsg('history_short'), - 'href' => $this->makeUrl($this->thispage, 'action=history'), - 'ttip' => wfMsg('tooltip-history'), - 'akey' => wfMsg('accesskey-history')); + 'href' => $this->makeUrl($this->thispage, 'action=history')); # XXX: is there a rollback action anywhere or is it planned? # Don't recall where i got this from... @@ -392,41 +364,32 @@ $content_actions['protect'] = array( 'class' => ($action == 'protect') ? 'selected' : false, 'text' => wfMsg('protect'), - 'href' => $this->makeUrl($this->thispage, 'action=protect'), - 'ttip' => wfMsg('tooltip-protect'), - 'akey' => wfMsg('accesskey-protect') + 'href' => $this->makeUrl($this->thispage, 'action=protect') ); } else { $content_actions['unprotect'] = array( 'class' => ($action == 'unprotect') ? 'selected' : false, 'text' => wfMsg('unprotect'), - 'href' => $this->makeUrl($this->thispage, 'action=unprotect'), - 'ttip' => wfMsg('tooltip-protect'), - 'akey' => wfMsg('accesskey-protect') + 'href' => $this->makeUrl($this->thispage, 'action=unprotect') ); } $content_actions['delete'] = array( 'class' => ($action == 'delete') ? 'selected' : false, 'text' => wfMsg('delete'), - 'href' => $this->makeUrl($this->thispage, 'action=delete'), - 'ttip' => wfMsg('tooltip-delete'), - 'akey' => wfMsg('accesskey-delete') + 'href' => $this->makeUrl($this->thispage, 'action=delete') ); } if ( $wgUser->getID() != 0 ) { if ( $wgTitle->userCanEdit()) { $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace == Namespace::getSpecial()) ? 'selected' : false, 'text' => wfMsg('move'), - 'href' => $this->makeSpecialUrl('Movepage', 'target='. urlencode( $this->thispage )), - 'ttip' => wfMsg('tooltip-move'), - 'akey' => wfMsg('accesskey-move')); + 'href' => $this->makeSpecialUrl('Movepage', 'target='. urlencode( $this->thispage )) + ); } else { $content_actions['move'] = array('class' => 'inactive', 'text' => wfMsg('move'), - 'href' => false, - 'ttip' => wfMsg('tooltip-nomove'), - 'akey' => false); + 'href' => false); } } @@ -437,9 +400,7 @@ $content_actions['delete'] = array( 'class' => false, 'text' => wfMsg( "undelete_short", $n ), - 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage), - 'ttip' => wfMsg('tooltip-undelete', $n), - 'akey' => wfMsg('accesskey-undelete') + 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage) ); } } @@ -449,16 +410,11 @@ if( !$wgTitle->userIsWatching()) { $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : false, 'text' => wfMsg('watch'), - 'href' => $this->makeUrl($this->thispage, 'action=watch'), - 'ttip' => wfMsg('tooltip-watch'), - 'akey' => wfMsg('accesskey-watch')); + 'href' => $this->makeUrl($this->thispage, 'action=watch')); } else { $content_actions['watch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : false, 'text' => wfMsg('unwatch'), - 'href' => $this->makeUrl($this->thispage, 'action=unwatch'), - 'ttip' => wfMsg('tooltip-unwatch'), - 'akey' => wfMsg('accesskey-unwatch')); - + 'href' => $this->makeUrl($this->thispage, 'action=unwatch')); } } } else { @@ -466,9 +422,7 @@ $content_actions['article'] = array('class' => 'selected', 'text' => wfMsg('specialpage'), - 'href' => false, - 'ttip' => wfMsg('tooltip-specialpage'), - 'akey' => false); + 'href' => false); } return $content_actions; @@ -523,62 +477,101 @@ return $nav_urls; } - function getNameSpaceWord () { + function getNameSpaceKey () { global $wgTitle; switch ($wgTitle->getNamespace()) { case NS_MAIN: case NS_TALK: - return wfMsg('nstab-main'); + return 'nstab-main'; case NS_USER: case NS_USER_TALK: - return wfMsg('nstab-user'); + return 'nstab-user'; case NS_MEDIA: - return wfMsg('nstab-media'); + return 'nstab-media'; case NS_SPECIAL: - return wfMsg('nstab-special'); + return 'nstab-special'; case NS_WP: case NS_WP_TALK: - return wfMsg('nstab-wp'); + return 'nstab-wp'; case NS_IMAGE: case NS_IMAGE_TALK: - return wfMsg('nstab-image'); + return 'nstab-image'; case NS_MEDIAWIKI: case NS_MEDIAWIKI_TALK: - return wfMsg('nstab-mediawiki'); + return 'nstab-mediawiki'; case NS_TEMPLATE: case NS_TEMPLATE_TALK: - return wfMsg('nstab-template'); + return 'nstab-template'; case NS_HELP: case NS_HELP_TALK: - return wfMsg('nstab-help'); + return 'nstab-help'; case NS_CATEGORY: case NS_CATEGORY_TALK: - return wfMsg('nstab-category'); + return 'nstab-category'; default: - return wfMsg('nstab-main'); + return 'nstab-main'; } } /* private */ function setupUserCssJs () { - global $wgRequest, $wgTitle, $wgSquidMaxage; + global $wgRequest, $wgTitle; $action = $wgRequest->getText('action'); - # global site css from MediaWiki NS - $this->usercss = '@import url('. - $this->makeNSUrl(ucfirst($this->skinname).'.css', 'action=raw&ctype=text/css&smaxage='.$wgSquidMaxage, NS_MEDIAWIKI).');'."\n"; + # generated css + $this->usercss = '@import url('.$this->makeUrl('-','action=raw&gen=css').');'."\n"; - if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { - // css preview - $this->usercss .= $wgRequest->getText('wpTextbox1'); - } else { - $this->usercss .= '@import url('. - $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css').');'; + if( $this->loggedin ) { + if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { + # generated css + $this->usercss = '@import url('.$this->makeUrl('-','action=raw&gen=css&smaxage=0&maxage=0').');'."\n"; + // css preview + $this->usercss .= $wgRequest->getText('wpTextbox1'); + } else { + # generated css + $this->usercss .= '@import url('.$this->makeUrl('-','action=raw&gen=css&smaxage=0').');'."\n"; + # import user stylesheet + $this->usercss .= '@import url('. + $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css').');'."\n"; + } + if($wgTitle->isJsSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { + # XXX: additional security check/prompt? + $this->userjsprev = $wgRequest->getText('wpTextbox1'); + } else { + $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript'); + } } - if($wgTitle->isJsSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { - # XXX: additional security check/prompt? - $this->userjsprev = $wgRequest->getText('wpTextbox1'); - } else { - $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript'); + } + # returns css with user-specific options + function getUserStylesheet() { + global $wgUser, $wgRequest, $wgTitle, $wgLang, $wgSquidMaxage, $wgStylePath; + $action = $wgRequest->getText('action'); + $maxage = $wgRequest->getText('maxage'); + $s = "/* generated user stylesheet */\n"; + if($wgLang->isRTL()) $s .= '@import url('.$wgStylePath.'/'.$this->skinname.'/rtl.css);'."\n"; + $s .= '@import url('. + $this->makeNSUrl(ucfirst($this->skinname).'.css', 'action=raw&ctype=text/css&smaxage='.$wgSquidMaxage, NS_MEDIAWIKI).');'."\n"; + if($wgUser->getID() != 0) { + if ( 1 == $wgUser->getOption( "underline" ) ) { + $s .= "a { text-decoration: underline; }\n"; + } else { + $s .= "a { text-decoration: none; }\n"; + } + } + if ( 1 != $wgUser->getOption( "highlightbroken" ) ) { + $s .= "a.new, #quickbar a.new { color: #CC2200; }\n"; + } + if ( 1 == $wgUser->getOption( "justify" ) ) { + $s .= "#bodyContent { text-align: justify; }\n"; } + return $s; } + function getUserJs() { + global $wgUser, $wgStylePath; + $s = "/* generated javascript */"; + $s .= "var skin = '{$this->skinname}';\nvar stylepath = '{$wgStylePath}';"; + $s .= '/* MediaWiki:'.ucfirst($this->skinname)." */\n"; + $s .= wfMsg(ucfirst($this->skinname).'.js'); + return $s; + } + } class SkinDaVinci extends SkinPHPTal { diff --git a/includes/SkinStandard.php b/includes/SkinStandard.php index 929fc3e918..ba367a370d 100644 --- a/includes/SkinStandard.php +++ b/includes/SkinStandard.php @@ -18,12 +18,12 @@ class SkinStandard extends Skin { function getUserStyles() { global $wgStylePath; - - $s = parent::getUserStyles(); + $s = ''; if ( 3 == $this->qbSetting() ) { # Floating left $s .= "\n"; } + $s .= parent::getUserStyles(); return $s; } diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 49904c03ea..e060dcb06b 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -278,6 +278,7 @@ class PreferencesForm { $uid = $wgUser->getID(); $wgOut->addWikiText( wfMsg( "prefslogintext", $uname, $uid ) ); + $wgOut->addWikiText( wfMsg('clearyourcache')); $qbs = $wgLang->getQuickbarSettings(); $skinNames = $wgLang->getSkinNames(); @@ -368,6 +369,7 @@ class PreferencesForm { $wgOut->addHTML( "
\n" ); } + $wgOut->addHtml('
'.wfMsg('qbsettingsnote').'
'); $wgOut->addHtml( "\n\n" ); # Skin setting diff --git a/languages/Language.php b/languages/Language.php index 8b9185ddba..473913523f 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -729,7 +729,7 @@ If you are here by mistake, just click your browser's '''back''' button.", 'talkpagetext' => '', 'anontalkpagetext' => "----''This is the discussion page for an anonymous user who has not created an account yet or who does not use it. We therefore have to use the numerical [[IP address]] to identify him/her. Such an IP address can be shared by several users. If you are an anonymous user and feel that irrelevant comments have been directed at you, please [[Special:Userlogin|create an account or log in]] to avoid future confusion with other anonymous users.'' ", 'noarticletext' => '(There is currently no text in this page)', -'usercssjs' => "'''Note:''' After saving, you have to tell your bowser to get the new version: '''Mozilla:''' click ''reload''(or ''ctrl-r''), '''IE / Opera:''' ''ctrl-f5'', '''Safari:''' ''cmd-r'', '''Konqueror''' ''ctrl-r''.", +'clearyourcache' => "'''Note:''' After saving, you have to clear your browser cache to see the changes: '''Mozilla:''' click ''reload''(or ''ctrl-r''), '''IE / Opera:''' ''ctrl-f5'', '''Safari:''' ''cmd-r'', '''Konqueror''' ''ctrl-r''.", 'usercssjsyoucanpreview' => "Tip: Use the 'Show preview' button to test your new css/js before saving.", 'usercsspreview' => "'''Remember that you are only previewing your user css, it has not yet been saved!'''", 'userjspreview' => "'''Remember that you are only testing/previewing your user javascript, it has not yet been saved!'''", @@ -872,6 +872,7 @@ Your internal ID number is $2. See [[{{ns:4}}:User preferences help]] for help deciphering the options.", 'prefsreset' => 'Preferences have been reset from storage.', 'qbsettings' => 'Quickbar settings', +'qbsettingsnote' => 'This preference only works in the \'Standard\' and the \'CologneBlue\' skin.', 'changepassword' => 'Change password', 'skin' => 'Skin', 'math' => 'Rendering math', @@ -1455,90 +1456,15 @@ amusement.', 'importhistoryconflict' => 'Conflicting history revision exists (may have imported this page before)', # Keyboard access keys for power users -'accesskey-article' => 'a', -'accesskey-talk' => 't', -'accesskey-edit' => 'e', -'accesskey-addsection' => '+', -'accesskey-viewsource' => 'e', -'accesskey-history' => 'h', -'accesskey-protect' => '=', -'accesskey-delete' => 'd', -'accesskey-undelete' => 'd', -'accesskey-move' => 'm', -'accesskey-watch' => 'w', -'accesskey-unwatch' => 'w', -'accesskey-watchlist' => 'l', -'accesskey-userpage' => '.', -'accesskey-anonuserpage' => '.', -'accesskey-mytalk' => 'n', -'accesskey-anontalk' => 'n', -'accesskey-preferences' => '', -'accesskey-mycontris' => 'y', -'accesskey-login' => 'o', -'accesskey-logout' => 'o', -'accesskey-search' => 'f', -'accesskey-mainpage' => 'z', -'accesskey-portal' => '', -'accesskey-randompage' => 'x', -'accesskey-currentevents' => '', -'accesskey-sitesupport' => '', -'accesskey-help' => '', -'accesskey-recentchanges' => 'r', -'accesskey-recentchangeslinked' => 'c', -'accesskey-whatlinkshere' => 'b', -'accesskey-specialpages' => 'q', -'accesskey-specialpage' => '', -'accesskey-upload' => 'u', 'accesskey-minoredit' => 'i', 'accesskey-save' => 's', 'accesskey-preview' => 'p', -'accesskey-contributions' => '', -'accesskey-emailuser' => '', 'accesskey-compareselectedversions' => 'v', -# tooltip help for the main actions -'tooltip-atom' => 'Atom feed for this page', -'tooltip-article' => 'View the content page [alt-a]', -'tooltip-talk' => 'Discussion about the content page [alt-t]', -'tooltip-edit' => 'You can edit this page. Please use the preview button before saving. [alt-e]', -'tooltip-addsection' => 'Add a comment to this page. [alt-+]', -'tooltip-viewsource' => 'This page is protected. You can view its source. [alt-e]', -'tooltip-history' => 'Past versions of this page, [alt-h]', -'tooltip-protect' => 'Protect this page [alt-=]', -'tooltip-delete' => 'Delete this page [alt-d]', -'tooltip-undelete' => "Restore the $1 edits done to this page before it was deleted [alt-d]", -'tooltip-move' => 'Move this page [alt-m]', -'tooltip-nomove' => 'You don\'t have the permissions to move this page', -'tooltip-watch' => 'Add this page to your watchlist [alt-w]', -'tooltip-unwatch' => 'Remove this page from your watchlist [alt-w]', -'tooltip-watchlist' => 'The list of pages you\'re monitoring for changes. [alt-l]', -'tooltip-userpage' => 'My user page [alt-.]', -'tooltip-anonuserpage' => 'The user page for the ip you\'re editing as [alt-.]', -'tooltip-mytalk' => 'My talk page [alt-n]', -'tooltip-anontalk' => 'Discussion about edits from this ip address [alt-n]', -'tooltip-preferences' => 'My preferences', -'tooltip-mycontris' => 'List of my contributions [alt-y]', -'tooltip-login' => 'You are encouraged to log in, it is not mandatory however. [alt-o]', -'tooltip-logout' => 'Log out [alt-o]', -'tooltip-search' => 'Search this wiki [alt-f]', -'tooltip-mainpage' => 'Visit the Main Page [alt-z]', -'tooltip-portal' => 'About the project, what you can do, where to find things', -'tooltip-randompage' => 'Load a random page [alt-x]', -'tooltip-currentevents' => 'Find background information on current events', -'tooltip-sitesupport' => 'Support {{SITENAME}}', -'tooltip-help' => 'The place to find out.', -'tooltip-recentchanges' => 'The list of recent changes in the wiki. [alt-r]', -'tooltip-recentchangeslinked' => 'Recent changes in pages linking to this page [alt-c]', -'tooltip-whatlinkshere' => 'List of all wiki pages that link here [alt-b]', -'tooltip-specialpages' => 'List of all special pages [alt-q]', -'tooltip-upload' => 'Upload images or media files [alt-u]', -'tooltip-specialpage' => 'This is a special page, you can\'t edit the page itself.', +# tooltip help for some actions, most are in Monobook.js 'tooltip-minoredit' => 'Mark this as a minor edit [alt-i]', 'tooltip-save' => 'Save your changes [alt-s]', 'tooltip-preview' => 'Preview your changes, please use this before saving! [alt-p]', -'tooltip-contributions' => 'View the list of contributions of this user', -'tooltip-emailuser' => 'Send a mail to this user', -'tooltip-rss' => 'RSS feed for this page', 'tooltip-compareselectedversions' => 'See the differences between the two selected versions of this page. [alt-v]', # stylesheets @@ -1565,7 +1491,62 @@ amusement.', You might want to check the following regular expression for patterns that are currently blocked:', 'subcategorycount' => "There are $1 subcategories to this category.", 'categoryarticlecount' => "There are $1 articles in this category.", -'usenewcategorypage' => "1\n\nSet first character to \"0\" to disable the new category page layout." +'usenewcategorypage' => "1\n\nSet first character to \"0\" to disable the new category page layout.", + +# Monobook.js: tooltips and access keys for monobook +'Monobook.js' => '/* tooltips and access keys */ +ta = new Object(); +ta[\'pt-userpage\'] = new Array(\'.\',\'My user page\'); +ta[\'pt-anonuserpage\'] = new Array(\'.\',\'The user page for the ip you\\\'re editing as\'); +ta[\'pt-mytalk\'] = new Array(\'n\',\'My talk page\'); +ta[\'pt-anontalk\'] = new Array(\'n\',\'Discussion about edits from this ip address\'); +ta[\'pt-preferences\'] = new Array(\'\',\'My preferences\'); +ta[\'pt-watchlist\'] = new Array(\'l\',\'The list of pages you\\\'re monitoring for changes.\'); +ta[\'pt-mycontris\'] = new Array(\'y\',\'List of my contributions\'); +ta[\'pt-login\'] = new Array(\'o\',\'You are encouraged to log in, it is not mandatory however.\'); +ta[\'pt-anonlogin\'] = new Array(\'o\',\'You are encouraged to log in, it is not mandatory however.\'); +ta[\'pt-logout\'] = new Array(\'o\',\'Log out\'); +ta[\'ca-article\'] = new Array(\'a\',\'View the content page\'); +ta[\'ca-talk\'] = new Array(\'t\',\'Discussion about the content page\'); +ta[\'ca-edit\'] = new Array(\'e\',\'You can edit this page. Please use the preview button before saving.\'); +ta[\'ca-addsection\'] = new Array(\'+\',\'Add a comment to this discussion.\'); +ta[\'ca-viewsource\'] = new Array(\'e\',\'This page is protected. You can view its source.\'); +ta[\'ca-history\'] = new Array(\'h\',\'Past versions of this page.\'); +ta[\'ca-protect\'] = new Array(\'=\',\'Protect this page\'); +ta[\'ca-delete\'] = new Array(\'d\',\'Delete this page\'); +ta[\'ca-undelete\'] = new Array(\'d\',\'Restore the edits done to this page before it was deleted\'); +ta[\'ca-move\'] = new Array(\'m\',\'Move this page\'); +ta[\'ca-nomove\'] = new Array(\'\',\'You don\\\'t have the permissions to move this page\'); +ta[\'ca-watch\'] = new Array(\'w\',\'Add this page to your watchlist\'); +ta[\'ca-unwatch\'] = new Array(\'w\',\'Remove this page from your watchlist\'); +ta[\'search\'] = new Array(\'f\',\'Search this wiki\'); +ta[\'p-logo\'] = new Array(\'\',\'Main Page\'); +ta[\'n-mainpage\'] = new Array(\'z\',\'Visit the Main Page\'); +ta[\'n-portal\'] = new Array(\'\',\'About the project, what you can do, where to find things\'); +ta[\'n-currentevents\'] = new Array(\'\',\'Find background information on current events\'); +ta[\'n-recentchanges\'] = new Array(\'r\',\'The list of recent changes in the wiki.\'); +ta[\'n-randompage\'] = new Array(\'x\',\'Load a random page\'); +ta[\'n-help\'] = new Array(\'\',\'The place to find out.\'); +ta[\'n-sitesupport\'] = new Array(\'\',\'Support us\'); +ta[\'t-whatlinkshere\'] = new Array(\'b\',\'List of all wiki pages that link here\'); +ta[\'t-recentchangeslinked\'] = new Array(\'c\',\'Recent changes in pages linking to this page\'); +ta[\'feed-rss\'] = new Array(\'\',\'RSS feed for this page\'); +ta[\'feed-atom\'] = new Array(\'\',\'Atom feed for this page\'); +ta[\'t-contributions\'] = new Array(\'\',\'View the list of contributions of this user\'); +ta[\'t-emailuser\'] = new Array(\'\',\'Send a mail to this user\'); +ta[\'t-upload\'] = new Array(\'u\',\'Upload images or media files\'); +ta[\'t-specialpages\'] = new Array(\'q\',\'List of all special pages\'); +ta[\'ca-nstab-main\'] = new Array(\'a\',\'View the content page\'); +ta[\'ca-nstab-user\'] = new Array(\'a\',\'View the user page\'); +ta[\'ca-nstab-media\'] = new Array(\'a\',\'View the media page\'); +ta[\'ca-nstab-special\'] = new Array(\'\',\'This is a special page, you can\\\'t edit the page itself.\'); +ta[\'ca-nstab-wp\'] = new Array(\'a\',\'View the project page\'); +ta[\'ca-nstab-image\'] = new Array(\'a\',\'View the image page\'); +ta[\'ca-nstab-mediawiki\'] = new Array(\'a\',\'View the system message\'); +ta[\'ca-nstab-template\'] = new Array(\'a\',\'View the template\'); +ta[\'ca-nstab-help\'] = new Array(\'a\',\'View the help page\'); +ta[\'ca-nstab-category\'] = new Array(\'a\',\'View the category page\'); +' ); diff --git a/stylesheets/monobook/main.css b/stylesheets/monobook/main.css index a354ec4f0a..5e37b384b5 100644 --- a/stylesheets/monobook/main.css +++ b/stylesheets/monobook/main.css @@ -762,7 +762,7 @@ li#pt-login { } /* offsets to distinguish the tab groups */ li#ca-talk { margin-right: 1.6em; } -li#ca-watch { margin-left: 1.6em; } +li#ca-watch, li#ca-watch { margin-left: 1.6em; } /* diff --git a/stylesheets/monobook/rtl.css b/stylesheets/monobook/rtl.css index b382056952..aafcd59ea8 100644 --- a/stylesheets/monobook/rtl.css +++ b/stylesheets/monobook/rtl.css @@ -102,7 +102,7 @@ li#ca-talk { margin-right: auto; margin-left: 1.6em; } -li#ca-watch { +li#ca-watch,li#ca-unwatch { margin-right: 1.6em !important; } diff --git a/stylesheets/wikibits.js b/stylesheets/wikibits.js index b5768e1fe0..6a45333e77 100644 --- a/stylesheets/wikibits.js +++ b/stylesheets/wikibits.js @@ -1,5 +1,4 @@ // Wikipedia JavaScript support functions - // if this is true, the toolbar will no longer overwrite the infobox when you move the mouse over individual items var noOverwrite=false; var alertText; @@ -21,21 +20,19 @@ function onloadhook () { histrowinit(); unhidetzbutton(); tabbedprefs(); + akeytt(); } if (window.addEventListener) window.addEventListener("load",onloadhook,false); else if (window.attachEvent) window.attachEvent("onload",onloadhook); // document.write special stylesheet links -function addcss ( stylepath ) { - if (is_opera_preseven) { - document.write(''); - } else if (is_opera_seven) { - document.write(''); - } else if (is_khtml) { - document.write(''); - } - return; +if (is_opera_preseven) { + document.write(''); +} else if (is_opera_seven) { + document.write(''); +} else if (is_khtml) { + document.write(''); } // Un-trap us from framesets @@ -361,3 +358,25 @@ function insertTags(tagOpen, tagClose, sampleText) { // reposition cursor if possible if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate(); } + +function akeytt() { + if(!ta) return; + pref = 'alt-'; + if(is_safari || navigator.userAgent.toLowerCase().indexOf( 'mac' ) + 1 ) pref = 'cmd-'; + if(is_opera) pref = 'shift-esc-'; + for(id in ta) { + n = document.getElementById(id); + if(n){ + a = n.childNodes[0]; + if(a){ + if(ta[id][0].length > 0) { + a.accesskey = ta[id][0]; + ak = ' ['+pref+ta[id][0]+']'; + } else { + ak = ''; + } + a.title = ta[id][1]+ak; + } + } + } +} diff --git a/templates/xhtml_slim.pt b/templates/xhtml_slim.pt index b1ad90f836..f5dac638d1 100644 --- a/templates/xhtml_slim.pt +++ b/templates/xhtml_slim.pt @@ -5,15 +5,13 @@ ${headlinks} Exciting xhtml slimfast - - + + - - @@ -54,7 +52,7 @@ @@ -65,7 +63,7 @@ @@ -78,26 +76,19 @@
Navigation
@@ -120,30 +111,24 @@
Toolbox
-- 2.20.1