사용자:Gomdoli/vector.js

이 문서는 2020년 10월 27일 (화) 18:49에 마지막으로 편집되었습니다.
< 사용자:Gomdoli
Gomdoli (토론 | 기여)님의 2020년 8월 16일 (일) 00:04 판

참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다.

  • 파이어폭스 / 사파리: Shift 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5 또는 Ctrl-R을 입력 (Mac에서는 ⌘-R)
  • 구글 크롬: Ctrl-Shift-R키를 입력 (Mac에서는 ⌘-Shift-R)
  • 인터넷 익스플로러 / 엣지: Ctrl 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5를 입력.
  • 오페라: Ctrl-F5를 입력.
$(".body ul:first").append('<li id="n-portal2"><a href="/wiki/사용자:Gomdoli4696/작업장" title="내 작업장">내 작업장</a></li>');
$("#bottom-button").click(function(){
	$('html, body').scrollTop( $(document).height() );
});
/*

[[Wikipedia:ko:미디어위키:Gadget-quickeditcounter.js]]에서 가져옴.
*/
window.qecGadget = {
	version: 9,
 
	init: function() {
		if ( mw.config.get( 'wgNamespaceNumber' ) != 2 && mw.config.get( 'wgNamespaceNumber' ) != 3 ) {
			return;
		}
 
		if ( mw.util.getParamValue('printable') == 'yes' ) {
			return;
		}
 
		this.username = mw.config.get( 'wgTitle' ).replace(/\/.*$/, '');
 
		var that = this;
 
		var request = {
			action:	'query',
			list:	'users',
			usprop:	'editcount|gender',
			format:	'json',
			ususers:	this.username,
			requestid:	new Date().getTime()
		};
 
		jQuery.getJSON( mw.util.wikiScript( 'api' ), request, function(result) {
			jQuery(document).ready(function() {
				if (result) {
					that.showResults(result);
				}
			});
		});
	},
	showResults: function(data) {
		data = data.query.users[0];
		if (!data || data.name != this.username || data.invalid != null || data.editcount === undefined)
			return;
 
		var firstHeading;
		var headers = document.getElementsByTagName( 'h1' );
 
		for ( var i = 0; i < headers.length; i++ ) {
			var header = headers[i];
			if(header.className == "firstHeading" || header.id == "firstHeading" || header.className == "pagetitle") {
				firstHeading = header; break;
			}
		}
 
		if( !firstHeading ) {
			firstHeading = document.getElementById("section-0");
		}
 
		if( !firstHeading ) {
			return;
		}
 
		var html = '이 사용자는';
		var lang = 'ko';
		var wiki = 'wikipedia';
 
		var m;
		if (m = mw.config.get( 'wgServer' ).match(/^(?:http:)?\/\/(.+?).([^.]+).org$/)) {
			lang = m[1];
			wiki = m[2];
		}
		else if (m = mw.config.get( 'wgScriptPath' ).match(/\/(.+?)\/(.+?)\//)) {
			lang = m[2];
			wiki = m[1];
		}
		html += ' 총 ' + data.editcount + '회 편집했습니다.';
 
		var div = document.createElement("div");
		div.style.cssText = "font-size:0.5em; line-height:1em; margin-bottom:5px;";
		div.className = 'plainlinks';
		div.innerHTML = html;
 
		if ( mw.config.get( 'skin' ) == 'modern' ) {
			div.style.marginLeft = "10px";
			div.style.display = "inline-block";
		}
 
		firstHeading.appendChild(div);
	}
};
qecGadget.init();