利用者:優佳/monobook.js

2022年5月16日 (月) 14:14; Ladsgroup (会話 | 投稿記録) による版 (Maintenance: Replacing document.write with mw.loader.load (mw:ResourceLoader/Migration_guide_(users)#Avoid_document.write() - phab:T130879))(日時は個人設定で未設定ならUTC

(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)

お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。

多くの WindowsLinux のブラウザ

  • Ctrl を押しながら F5 を押す。

Mac における Safari

  • Shift を押しながら、更新ボタン をクリックする。

Mac における ChromeFirefox

  • Cmd Shift を押しながら R を押す。

詳細についてはWikipedia:キャッシュを消すをご覧ください。

//written by [http://nasounds.web.fc2.com/wp_tool_installer/wp_tool_installer.html wp_tool_installer]
//support<pre>
var wgNoLiveInstall = [];
//end</pre>
//include start<hr>
//wiki mini atlas2 ([[利用者:Dschwen/wikiminiatlas2.js|page]]/[[利用者:Cave_cattum/WikiMiniAtlasのご紹介|talk]]) - 緯度経度情報を持ったページに、インタラクティブな地図を追加します。<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Dschwen/wikiminiatlas2.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
var wma_settings = {

}
wgNoLiveInstall.push("wiki%20mini%20atlas2");
}
//end</pre><hr>
//InstaView ([http://en.wikipedia.org/w/index.php?title=User:Pilaf/instaview.js&action=raw&ctype=text/javascript&dontcountme=s page]/[http://en.wikipedia.org/wiki/User:Pilaf/InstaView talk]) - ページを移動しないプレビュー機能<pre>
{
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/instaview.js&action=raw&ctype=text/javascript');
var instaview_conf = {
name:'優佳'
}
$(function(){ window.InstaView.conf.user.name = instaview_conf.name;});
wgNoLiveInstall.push("InstaView");
}
//end</pre><hr>
//Navpop ([http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript&dontcountme=s page]/[http://en.wikipedia.org/wiki/Wikipedia:Tools/Navigation_popups talk]) - リンク先の情報をポップアップ表示する<pre>
{
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript');
wgNoLiveInstall.push("Navpop");
}
//end</pre><hr>
//wikipedia script () - Wikipediaで自動的に読み込まれているツールの設定を行います。<pre>
{
NavigationBarShowDefault = true;
wgNoLiveInstall.push("wikipedia%20script");
}
//end</pre><hr>
//submitblock ([[利用者:Tietew/submitblock.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - うっかり投稿防止。「要約」欄でEnterを押したときに投稿して良いか尋ねます。<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/submitblock.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("submitblock");
}
//end</pre><hr>
//jastyle ([[利用者:Tietew/jastyle.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - 自動スタイリング<pre>
if( false || (function(){ return /&action=edit(&|$)/.test(document.documentURI); })() ){
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/jastyle.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("jastyle");
}
//end</pre><hr>
//restore ([[利用者:Tietew/restore.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - (sysop専用)復帰ヘルパー。特別:Undelete で「全てチェック」「チェックを反転」ボタンを追加します。<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/restore.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("restore");
}
//end</pre><hr>
//interlang ([[利用者:Tietew/interlang.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - interlangのツールチップに項目名を載せます。<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/interlang.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("interlang");
}
//end</pre><hr>
//log ([[利用者:Tietew/log.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - ツールボックスに「Page log / User log / Purge cache」リンクを、画像ページのタブに「commons」を追加します。<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/log.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("log");
}
//end</pre><hr>
//preview ([[利用者:Tietew/preview.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - ワンクリックでプレビュー機能のお知らせができます。<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/preview.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("preview");
}
//end</pre><hr>
//vfd ([[利用者:Tietew/vfd.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - 削除依頼ヘルパー<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/vfd.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("vfd");
}
//end</pre><hr>
//blinktalk ([[利用者:Tietew/blinktalk.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - 会話にメッセージが来たとき、<del>目障り</del>でかでかとしたバナーの替わりに「マイ・トーク」を点滅してお知らせします。<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/blinktalk.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("blinktalk");
}
//end</pre><hr>
//logoutconfirm ([[利用者:Tietew/logoutconfirm.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - プレビューしようとして [Alt]+[o] を良く押してしまう人に。<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/logoutconfirm.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("logoutconfirm");
}
//end</pre><hr>
//useralert ([[利用者:Tietew/useralert.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - 他人の利用者ページを編集しようとするとアラートを出します。<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/useralert.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("useralert");
}
//end</pre><hr>
//hatena ([[利用者:Tietew/hatena.js|page]]/[[利用者:Tietew/ユーザースクリプト集|talk]]) - はてブ<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Tietew/hatena.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
wgNoLiveInstall.push("hatena");
}
//end</pre><hr>
//TOC right () - 目次を右に浮かせる。<pre>
{
TOCright_noauto = true;
$(function(){
		var toc = document.getElementById("toc");
		if( !toc ) return;
		var content = document.getElementById("bodyContent");
		var n = content.firstChild;
		var prev = getElementsByClassName( content, "div", "insert_toc" )[0];
		if( !window.TOCright_noauto &&
		    !prev && (document.defaultView && document.defaultView.getComputedStyle) ){
			while( n && !(/h2/i).test(n.nodeName) ){
				if( n.nodeType == 1 && document.defaultView.getComputedStyle(n,null).getPropertyValue("float") == "right" )
					prev = n;
				n = n.nextSibling;
			}
		}
		if( prev ){
			toc = toc.parentNode.removeChild(toc);
			if( prev.nextSibling )
				prev.parentNode.insertBefore( toc, prev.nextSibling );
			else if( n )
				n.parentNode.insertBefore( toc, n );
		}
		if( prev || !window.TOCright_noauto ){
			toc.className = "tocright";
			toc.style.clear = "right";
			toc.style.styleFloat = "right"; //ie
			toc.style.cssFloat = "right";
		}
	});
wgNoLiveInstall.push("TOC%20right");
}
//end</pre><hr>
//TOC split () - 長い目次を二つ折りにする。<pre>
{
TOCsplit_threshold = 20;
$(function(){
		var toc = document.getElementById("toc");
		if( !toc ) return;
		toc.style.verticalAlign = "top";
		var elms = toc.getElementsByTagName("li");
		var threshold = window.TOCsplit_threshold;
		if( !threshold ) threshold = 10;
		if( elms.length > threshold ) {
			var ul = document.createElement("ul");
			var n, p = elms[(elms.length/2).toFixed()-1];
			while( !(/td/i).test(p.parentNode.nodeName) && !(/toclevel-1/).test(p.className) )
				p = p.parentNode;
			n = p.nextSibling;
			while( (p=n) ){
				n = p.nextSibling;
				p = p.parentNode.removeChild(p);
				ul.appendChild(p);
			} 

			var td = document.createElement("td");
			td.appendChild(ul);
			td.style.verticalAlign = "top";
			td.style.paddingTop = "1.5em";
			td.style.paddingLeft = "1.2em";
			var tr = toc.getElementsByTagName("tbody")[0].getElementsByTagName("tr")[0];
			tr.appendChild(td);
		}

		window.toggleToc = function() {
			var tocs = document.getElementById('toc').getElementsByTagName('ul');
			var toggleLink = document.getElementById('togglelink');
			for( var i=0; i<tocs.length; i++ ){
				var toc = tocs[i];
				if (toc && toggleLink && toc.style.display == 'none') {
					changeText(toggleLink, tocHideText);
					toc.style.display = 'block';
					document.cookie = "hidetoc=0";
				} else {
					changeText(toggleLink, tocShowText);
					toc.style.display = 'none';
					document.cookie = "hidetoc=1";
				}
			}
		}
	});
wgNoLiveInstall.push("TOC%20split");
}
//end</pre><hr>
//repackFloatElements () - 連続したfloat要素による[編集]ボタンのレイアウト乱れを解消する。<pre>
{
repackFloatElements_find_all_divs = true;
$(function(){
	var root;
	if( !document.defaultView || !document.defaultView.getComputedStyle ) return;
	if( !(root = document.getElementById("content")) ) return;
	function findSequentialElements( groups, elms, func ){
		for( var i=0; i<elms.length; i++ ){
			if( !func(elms[i]) || (function(){
				for( var j=0; j<groups.length; j++ )
					for( var k=0; k<groups[j].length; k++ )
						if( groups[j][k] == elms[i] ) return true;
			})() ) continue;
			var gn = find_next(elms[i], func, "nextSibling");
			var gp = find_next(elms[i], func, "previousSibling");
			if( gp.length + gn.length > 0 ){
				gp.reverse();
				gp.push(elms[i]);
				groups.push(gp.concat(gn));
			}
		}
		return groups;
		function find_next(e, func, direction, group){
			if( !group ) group = [];
			var next = e[direction];
			while( next && ( next.nodeType==8 || (next.nodeType==3 && !next.data.replace(/\s*/,"").length > 0) ) )
				next = next[direction];
			if( next && func(next) ){
				group.push( next );
				find_next(next, func, direction, group);
			}
			return group;
		}
	}
	var groups = [];
	function float_check(e){
		if( e.nodeType != 1 ) return false;
		return ("right" == document.defaultView.getComputedStyle(e,null).getPropertyValue("float"));
	}
	if( window.repackFloatElements_find_all_divs )
		findSequentialElements( groups, root.getElementsByTagName("div"), float_check );
	else{
		var elms = getElementsByClassName(root, "div", "tright");
		elms = elms.concat( getElementsByClassName(root, "div", "floatright") );
		findSequentialElements( groups, elms, float_check );
	}
	findSequentialElements( groups, root.getElementsByTagName("table"), float_check );
	for( var i=0; i<groups.length; i++ ){
		var div = document.createElement("div");
		div.style.cssFloat = "right"; //ieではstyleFloat
		div.style.margin = div.style.padding = "0";
		if( window.repackFloatElements_clear_right )
			div.style.clear = "right";
		groups[i][0].parentNode.insertBefore( div, groups[i][0] );
		div.setAttribute("align", "right");
		for( var j=0; j<groups[i].length; j++ ){
			var e = groups[i][j].parentNode.removeChild(groups[i][j]);
			div.appendChild(e);
			e.style.cssFloat = "none";
		}
	}
    });
wgNoLiveInstall.push("repackFloatElements");
}
//end</pre><hr>
//replaceTimeText () - UTCの時間表示をJSTに書き換える<pre>
{
$(function(){
	var fmt = "%Y年%M月%D日 (%w) %h:%m";
	if( window.replaceTimeTextFormat )
		fmt = window.replaceTimeTextFormat;
	function foreachElementsByNodeType( root, type, func ){
		for( var i=0; i<root.childNodes.length; i++ ){
			if( (root.childNodes[i].textContent && root.childNodes[i].textContent.length < 26 ) || (root.childNodes[i].innerText && root.childNodes[i].innerText.length < 26 ) ) continue;
			if( root.childNodes[i].nodeType == type )
				func( root.childNodes[i] );
			foreachElementsByNodeType( root.childNodes[i], type, func );
		}
	}
	function zfill(s, len){
		var s = s.toString();
		while( s.length < len ) s = "0" + s;
		return s;
	}
	var re = new RegExp( "(.*)([0-9]{4})年([0-9]{1,2})月([0-9]{1,2})日\\s*\\(.*\\)\\s*([0-9][0-9]):([0-9][0-9])\\s*\\(([A-Z]*)\\)(.*)" );
	var d = new Date();
	var week = ['日','月','火','水','木','金','土'];

	function replace(e){
		var m = e.data.match( re );
		if(m && m[7] == "UTC" ){
			d.setUTCFullYear(m[2]);	d.setUTCMonth(m[3]-1); d.setUTCDate(m[4]);
			d.setUTCHours(m[5]); d.setUTCMinutes(m[6]);
			var s = fmt.replace(/%Y/,d.getFullYear()).replace(/%M/,d.getMonth()+1).replace(/%D/,d.getDate()).replace(/%w/,week[d.getDay()]).replace(/%h/,zfill(d.getHours(),2)).replace(/%m/,zfill(d.getMinutes(),2));
			e.data = m[1] + s + " (JST)" + m[8];
		}
	}
	foreachElementsByNodeType( document.getElementById('content'), 3, replace );
    });
wgNoLiveInstall.push("replaceTimeText");
}
//end</pre><hr>
//na_lib ([[利用者:NA_sounds/na_lib.js|page]]/[[利用者:NA_sounds|talk]]) - N/A sounds's original library<pre>
if( false || /.*\/new_page_watcher/.test(wgPageName) ){
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:NA_sounds/na_lib.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
$(function(){if(window.MLString_languages)na_lib.MLString.prototype.lang = MLString_languages.replace(/\s/g,"").split(",")});
wgNoLiveInstall.push("na_lib");
}
//end</pre><hr>
//new page watcher CSS ([[利用者:NA_sounds/new_page_watcher.css|page]]/[[利用者:NA_sounds|talk]]) - <pre>
if( false || /.*\/new_page_watcher/.test(wgPageName) ){
document.write('<link rel="stylesheet" type="text/css" href="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:NA_sounds/new_page_watcher.css&action=raw&ctype=text/css&dontcountme=s"></link>');
wgNoLiveInstall.push("new%20page%20watcher%20CSS");
}
//end</pre><hr>
//new page watcher ([[利用者:NA_sounds/new_page_watcher.js|page]]/[[利用者:NA_sounds|talk]]) - 新着記事監視サポートのためのアプリケーション(&alpha;版)<pre>
if( false || /.*\/new_page_watcher/.test(wgPageName) ){
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:NA_sounds/new_page_watcher.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
var new_page_watcher_config = {
enable_message_output:true,
enable_section_editor:true,
add_red_link_list:false
}
$(function(){window.new_page_watcher(); var cfg=new_page_watcher_config; for(var k in cfg)if(cfg[k]!=undefined)window.new_page_watcher.opts[k]=cfg[k]; new_page_watcher.run_parts();});
wgNoLiveInstall.push("new%20page%20watcher");
}
//end</pre><hr>
//autoedit ([http://en.wikipedia.org/w/index.php?title=User:Lupin/autoedit.js&action=raw&ctype=text/javascript&dontcountme=s page]/[http://www.mediawiki.org/wiki/Extension:Autoedit talk]) - パラメータをURIとして渡す、正規表現によるページの編集機能。<pre>
{
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Lupin/autoedit.js&action=raw&ctype=text/javascript');
wgNoLiveInstall.push("autoedit");
}
//end</pre><hr>
//live installer ([[利用者:NA_sounds/live_installer/installer_scripts.js|page]]/[[利用者:NA_sounds/live_install_configure|talk]]) - 動的なスクリプトインストーラ<pre>
{
document.write('<script type="text/javascript" src="/w/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:NA_sounds/live_installer/installer_scripts.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
LI_unstable_tools = true;
wgNoLiveInstall.push("live%20installer");
}
//end</pre><hr>