「MediaWiki:Common.js」の版間の差分

提供:sufeeWiki
ナビゲーションに移動 検索に移動
編集の要約なし
編集の要約なし
 
(同じ利用者による、間の33版が非表示)
1行目: 1行目:
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
mw.loader.using(['mediawiki.util'], function (){
mw.loader.using(['mediawiki.util'], function (){
function addInitialize(){
function pageConfig(){
try{
function addInitialize(){
const body = document.getElementsByTagName("body")[0];
const body = document.getElementsByTagName("body")[0];
const bodyScript_data = {
try{
"id":"myScript-mw-script",
const bodyScript_data = {
"element":"div",
"id":"myScript-mw-script",
"display":"none",
"element":"div",
};
"display":"none",
const bodyScript = document.createElement(bodyScript_data.element);
};
bodyScript.id = bodyScript_data.id;
const bodyScript = document.createElement(bodyScript_data.element);
bodyScript.style.display = bodyScript_data.display;
bodyScript.id = bodyScript_data.id;
body.appendChild(bodyScript);
bodyScript.style.display = bodyScript_data.display;
}catch(err){
body.appendChild(bodyScript);
console.log(err);
}catch(err){
console.log(err);
}
try{
const bodyCSS_data = {
"id":"myScript-mw-css",
"element":"div",
"display":"none",
};
const bodyCss = document.createElement(bodyCSS_data.element);
bodyCss.id = bodyCSS_data.id;
bodyCss.style.display = bodyCSS_data.display;
body.appendChild(bodyCss);
}catch(err){
console.log(err);
}
}
function getList(doc){
try{
const item = [];
if(doc != null){
const temp = doc.getElementsByTagName("li");
if(temp != null){
for(var i = 0 , l = temp.length;i < l;i++){
item[i] = temp[i];
}
}
}
if(item.length >= 1){
return item;
}
return null;
}catch(err){
console.log(err);
return null;
}
}
}
}
function getList(doc){
addInitialize();
try{
const addScriptFile = getList(document.getElementById("Script-files"));
const item = [];
const addCSSFile = getList(document.getElementById("CSS-files"));
if(doc != null){
if(addScriptFile != null){
const temp = doc.getElementsByTagName("li");
const mw_script = document.getElementById("myScript-mw-script");
for(let index = 0; index < 5;index++){
for(var i = 0,l = addScriptFile.length;i < l; i++){
item.push(temp[index]);
var scriptElement = document.createElement("script");
if(addScriptFile[i].type == "file"){
scriptElement.src = addScriptFile[i].innerText;
}else if(addScriptFile[i].type == "inner"){
scriptElement.innerHTML = addScriptFile[i].innerText;
}else{
scriptElement.src = addScriptFile[i].innerText;
}
}
mw_script.appendChild(scriptElement);
}
}
if(item.length >= 1){
}
return item;
if(addCSSFile != null){
const mw_css = document.getElementById("myScript-mw-css");
for(var i = 0,l = addCSSFile.length;i < l; i++){
var css = document.createElement("link");
if(addCSSFile[i].type == "file"){
css.href = addCSSFile[i].innerText;
css.rel = "stylesheet";
}else if(addCSSFile[i].type == "inner"){
css.innerHTML = addCSSFile[i].innerText;
}else{
css.href = addCSSFile[i].innerText;
css.rel = "stylesheet";
}
mw_css.appendChild(css);
}
}
return null;
}catch(err){
console.log(err);
return null;
}
}
}
}
addInitialize();
function left_action(){
const addScriptFile = getList(document.getElementById("Script-files"));
const panel = document.getElementById("mw-panel");
const addCSSFile = getList(document.getElementById("CSS-files"));
const div = document.createElement("div");
//if(addScriptFile != null){
div.className = "promotion";
// ;
div.innerHTML = '<a href="https://twitter.com/real_sufee?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-screen-name="false" data-lang="ja" data-show-count="false"> <i></i> </a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>'
//}
panel.appendChild(div);
}
left_action();
pageConfig();
});
});

2022年1月27日 (木) 21:15時点における最新版

/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
mw.loader.using(['mediawiki.util'], function (){
	function pageConfig(){
		function addInitialize(){
			const body = document.getElementsByTagName("body")[0];
			try{
				const bodyScript_data = {
					"id":"myScript-mw-script",
					"element":"div",
					"display":"none",
				};
				const bodyScript = document.createElement(bodyScript_data.element);
				bodyScript.id = bodyScript_data.id;
				bodyScript.style.display = bodyScript_data.display;
				body.appendChild(bodyScript);
			}catch(err){
				console.log(err);
			}
			try{
				const bodyCSS_data = {
					"id":"myScript-mw-css",
					"element":"div",
					"display":"none",
				};
				const bodyCss = document.createElement(bodyCSS_data.element);
				bodyCss.id = bodyCSS_data.id;
				bodyCss.style.display = bodyCSS_data.display;
				body.appendChild(bodyCss);
			}catch(err){
				console.log(err);
			}
		}
		function getList(doc){
			try{
				const item = [];
				if(doc != null){
					const temp = doc.getElementsByTagName("li");
					if(temp != null){
						for(var i = 0 , l = temp.length;i < l;i++){
							item[i] = temp[i];
						}
					}
				}
				if(item.length >= 1){
					return item;
				}
				return null;
			}catch(err){
				console.log(err);
				return null;
			}
		}
		
		addInitialize();
		const addScriptFile = getList(document.getElementById("Script-files"));
		const addCSSFile = getList(document.getElementById("CSS-files"));
		if(addScriptFile != null){
			const mw_script = document.getElementById("myScript-mw-script");
			for(var i = 0,l = addScriptFile.length;i < l; i++){
				var scriptElement = document.createElement("script");
				if(addScriptFile[i].type == "file"){
					scriptElement.src = addScriptFile[i].innerText;
				}else if(addScriptFile[i].type == "inner"){
					scriptElement.innerHTML = addScriptFile[i].innerText;
				}else{
					scriptElement.src = addScriptFile[i].innerText;
				}
				mw_script.appendChild(scriptElement);
			}
		}
		if(addCSSFile != null){
			const mw_css = document.getElementById("myScript-mw-css");
			for(var i = 0,l = addCSSFile.length;i < l; i++){
				var css = document.createElement("link");
				if(addCSSFile[i].type == "file"){
					css.href = addCSSFile[i].innerText;
					css.rel = "stylesheet";
				}else if(addCSSFile[i].type == "inner"){
					css.innerHTML = addCSSFile[i].innerText;
				}else{
					css.href = addCSSFile[i].innerText;
					css.rel = "stylesheet";
				}
				mw_css.appendChild(css);
			}
		}
	}
	
	function left_action(){
		const panel = document.getElementById("mw-panel");
		const div = document.createElement("div");
		div.className = "promotion";
		div.innerHTML = '<a href="https://twitter.com/real_sufee?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-screen-name="false" data-lang="ja" data-show-count="false"> <i></i> </a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>'
		panel.appendChild(div);
	}
	left_action();
	pageConfig();
});