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

提供: Yourpedia
移動: 案内検索
(仮作成)
 
(スタイルのバグ修正追加)
19行目: 19行目:
 
numC.innerText = Number(numA) + Number(numB);
 
numC.innerText = Number(numA) + Number(numB);
 
break;
 
break;
 +
}
 +
}
 +
}
 +
 +
/* スタイルのバグ修正 */
 +
if(location.host == 'ja.yourpedia.org'){
 +
var link = document.getElementsByTagName('link');
 +
for(var i in link){
 +
if(link[i].rel == 'stylesheet' && link[i].href.indexOf('yourpedia.org/mediawiki/load.php') != -1){
 +
link[i].href = link[i].href.replace(/https:\/\/(.+).yourpedia.org\//, 'https://ja.yourpedia.org/');
 
}
 
}
 
}
 
}

2019年6月7日 (金) 01:30時点における版

/* Any JavaScript here will be loaded for all users on every page load. */

/* 計算スクリプト */
	var Keisans = document.getElementsByClassName('tashizan');
	
	var Childs;
	var numA;
	var numB;
	var numC;
	
	for(var i in Keisans){
		Childs = Keisans[i].childNodes;
		for(var i2 in Childs){
			if(Childs[i2].className == 'numA') numA = Childs[i2].innerText;
			if(Childs[i2].className == 'numB') numB = Childs[i2].innerText;
			if(Childs[i2].className == 'numC') numC = Childs[i2];
			
			if(numA && numB && numC){
				numC.innerText = Number(numA) + Number(numB);
				break;
			}
		}
	}

/* スタイルのバグ修正 */
	if(location.host == 'ja.yourpedia.org'){
		var link = document.getElementsByTagName('link');
		for(var i in link){
			if(link[i].rel == 'stylesheet' && link[i].href.indexOf('yourpedia.org/mediawiki/load.php') != -1){
				link[i].href = link[i].href.replace(/https:\/\/(.+).yourpedia.org\//, 'https://ja.yourpedia.org/');
			}
		}
	}

// END