「javascript/アイテム要求数」の編集履歴(バックアップ)一覧に戻る

javascript/アイテム要求数 - (2017/01/08 (日) 00:04:08) のソース

#js{{{{{
<style>
div#reiki_check div.plugin_include{display: none;}
div#skill_check div.plugin_include{display: none;}
</style>
<script type="text/javascript">
$(function(){
	var material = [
		'英雄の証','凶骨','竜の牙','虚影の塵','愚者の鎖','万死の毒針',
		'世界樹の種','ゴーストランタン','八連双晶','蛇の宝玉','鳳凰の羽根',
		'無間の歯車','禁断の頁','ホムンクルスベビー','隕蹄鉄','大騎士勲章',
		'追憶の貝殻',
		'混沌の爪','蛮神の心臓','竜の逆鱗','精霊根','戦馬の幼角',
		'血の涙石','黒獣脂','封魔のランプ','智慧のスカラベ',
		'原初の産毛','呪獣胆石',
	];
	$.each(material, function(){
		$('#form1 select.素材').append($('<option>').val(this).text(this));
	});
	
	
	$('#btn').on('click', function() {
		var txt = '';
		var obj = {};
		
		var str = $('#form1 select.素材').val();
		var regexp = new RegExp(str + 'x(\\d+)');
		
		/*** ここから霊基素材 ***/
		$('div#reiki_check table tr').each(function(i, tr){
			if(i < 2){return true;}
			var line = '|';
			var aaaa = '';
			var bbbb = '';
			var count = 0;
			
			$(' td', this).each(function(j, str){
				str_trim = $.trim($(str).text());
				if(j == 0 || j == 1){
					aaaa += '|' + str_trim;
				}
				if(j == 2){
					if($(str).html().match(/title="(.+?) \(.+?\)">(.+?)<\/a>/)){
						var name1 = RegExp.$1;
						var name2 = RegExp.$2;
						
						if(name1 == name2){
							bbbb = '|' + '[[' + name1 + ']]';
						}
						else{
							bbbb = '|' + '[[' + name2 + '>' + name1 + ']]';
						}
						name = name1;
					}
				}
				if(j == 3){
					aaaa += '|' + str_trim + bbbb;
				}
				if(j >= 4){
					if($(str).text().match(regexp)){
						line += RegExp.$1;
						count += parseInt(RegExp.$1);
					}
					else{
						line += ' ';
					}
					if(j == 7){
						if(count == 0){count = ' ';}
						line += '|' + count;
					}
					line += '|';
				}
			});
			if(count > 0){
				txt += aaaa + line + '\n';
			}
			obj[name] = aaaa;
		});
		$('#text1').val(txt);
		/*** ここまで霊基素材 ***/
		/*** ここからスキル素材 ***/
		txt = '';
		var str = $('#form1 select.素材').val();
		if(str == "ゴーストランタン"){str = 'ゴーストランタン';}
		if(str == "ホムンクルスベビー"){str = 'ホムンクルスベビー';}
		
		var regexp = new RegExp(str + 'x(\\d+)');
		
		$('div#skill_check table tr').each(function(i, tr){
			var line = '|';
			var aaaa = '';
			var count = 0;
			
			$(' td', this).each(function(j, str){
				if(j == 0){
					if($(str).html().match(/title="(.+?) \(.+?\)">/)){
						name = RegExp.$1;
					}
				}
				if(j >= 1){
					if($(str).text().match(regexp)){
						line += RegExp.$1;
						count += parseInt(RegExp.$1);
					}
					else{
						line += ' ';
					}
					if(j == 9){
						if(count == 0){count = ' ';}
						line += '|' + count;
					}
					line += '|';
				}
			});
			if(count > 0){
				txt += obj[name] + line + '\n';
			}
		});
		$('#text2').val(txt);
		/*** ここまでスキル素材 ***/
	});
});
</script>
}}}}}
#html2(){{{{{
<form id="form1">
<select class="素材" style="width:12em;"><option value="指定なし">指定なし</option></select>
<input id="btn" type="button" value="実行"></br>
霊基再臨素材</br>
<textarea id="text1" cols="150" rows="20">ここにwiki編集用の文字列が表示されます</textarea></br>
スキル強化素材</br>
<textarea id="text2" cols="150" rows="20">ここにwiki編集用の文字列が表示されます</textarea></br>
</form>
}}}}}
#divid(reiki_check){
#include(サーヴァント/霊基再臨)}
#divid(skill_check){
#include(サーヴァント/サーヴァントスキル/強化素材)}