User:Sun8908/js/chouette.js
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
/*
源碼說明: https://fr.wikipedia.org/wiki/Utilisateur:PAC2/Chouette
(已部份本地化)
*/
mw.loader.using('mediawiki.util', function () {
if (mw.config.get('wgNamespaceNumber') == 0) {
var chouette = function($) {
var wikidata = 'https://www.wikidata.org/wiki/' + mw.config.get('wgWikibaseItemId') ;
var reasonator = 'https://tools.wmflabs.org/reasonator/?q=' + mw.config.get('wgWikibaseItemId') + '&lang=zh-hk' ;
var pageviews = 'https://tools.wmflabs.org/pageviews/?project=zh.wikipedia.org&platform=all-access&agent=user&range=latest-90&pages=' + mw.config.get('wgPageName') ;
var searchinwp = 'https://zhwiki.oracleblog.org/w/index.php?search="' + mw.util.rawurlencode( mw.config.get( 'wgTitle' ) ) + ' "&ns0=1' ;
var rename = 'https://zhwiki.oracleblog.org/wiki/Special:%E7%A7%BB%E5%8A%A8%E9%A1%B5%E9%9D%A2/' + mw.config.get('wgPageName');
var p180 = 'https://commons.wikimedia.org/w/index.php?title=Special:Search&search=haswbstatement%3AP180%3D' + mw.config.get('wgWikibaseItemId') ;
$("#page-secondary-actions").append("<a href=" + wikidata + " data-title='reasonator' class='reasonator mw-ui-button button'>維基數據</a>") ;
$("#page-secondary-actions").append("<a href=" + reasonator + " data-title='reasonator' class='reasonator mw-ui-button button'>Reasonator</a>") ;
$("#page-secondary-actions").append("<a href=" + searchinwp + " data-title='search' class='search mw-ui-button button'>在維基百科搜索</a>") ;
$("#page-secondary-actions").append("<a href=" + pageviews + " data-title='pageviews' class='pageviews mw-ui-button button'>頁面瀏覽</a>") ;
$("#page-secondary-actions").append("<a href=" + rename + " data-title='rename' class='mw-ui-button button'>移動頁面</a>") ;
$("#page-secondary-actions").append("<a href=" + p180 + " data-title='p180' class='infos mw-ui-button button'>描繪內容</a>") ;
};
$(document).ready(chouette) ;
}
var chouette_revert = function($){
var currentpage = 'https://zhwiki.oracleblog.org/wiki/' + mw.config.get( 'wgPageName' ) ;
var revert = 'https://zhwiki.oracleblog.org/w/index.php?title=' + mw.config.get( 'wgRelevantPageName' ) + '&action=edit&undoafter=' + mw.config.get('wgRevisionId') + '&undo=' + mw.config.get('wgCurRevisionId') ;
$("#mw-revision-nav").after("<div><a href=" + currentpage + " data-title='currentpage'>查看當前頁面</a> - <a href=" + revert + " data-title='revert'>回退到這個版本</a></div>") ;
} ;
$(document).ready(chouette_revert) ;
});