スクリプト置き場 > 属性データ作成

「スクリプト置き場/属性データ作成」の編集履歴(バックアップ)一覧に戻る

スクリプト置き場/属性データ作成 - (2014/03/08 (土) 21:49:34) のソース

#js()
{{{{
	var r = []
	var y = []

window.onload = function(){
	r = document.getElementsByName("dataform")[0].getElementsByTagName("input")
	var input = document.getElementById("proc1").innerHTML="1.精霊データを入力してください。※は必須項目です";
    for (var i = 0; i < r.length; i++) {
    	y[r[i].placeholder] = i
        var input = r[i]
        input.onkeypress = inputenter;
        input.disabled = false;
    }
    document.getElementById("createdata").onclick = create;
	document.getElementById("createdata").disabled = false;
    document.getElementById("resetinput").onclick = inputc;
    document.getElementById("resetinput").disabled = false;
    document.getElementById("copytext").onfocus = copyfocus;
}



function inputenter(event){
    if( event.keyCode == 13 ){
		var tab = y[document.activeElement.placeholder];
		if( tab == r.length - 1 ){
            create();
            r[0].focus();
        }
        else{
            r[tab+1].focus();
        }
    }
}

function create() {
	switch (r[2].value) {
		  case 'SS': maxlev = 90; break;
		  case 'S+': maxlev = 80; break;
		  case 'S': maxlev = 70; break;
		  case 'A+': maxlev = 60; break;
		  case 'A': maxlev = 50; break;
		  case 'B+': maxlev = 40; break;
		  case 'B': maxlev = 30; break;
		  case 'C+': maxlev = 20; break;
		  case 'C': maxlev = 10; break;
		  default: maxlev = ""; break;
	}
	var zelem = document.title.match(/火|水|雷/)
	switch (zelem) {
		  case '火': zcol = "#ffcccc"; break;
		  case '水': zcol = "#ccffff"; break;
		  case '雷': zcol = "#ffff99"; break;
		  default: zcol = ""; break;
	}
	pren = keisan(r[0].value,-1)
	nexn = keisan(r[0].value,1)
	//if (r[11].value.match(/[0-9][0-9][0-9]/)) {	pren = r[11].value	}
	//if (r[16].value.match(/[0-9][0-9][0-9]/)) {	nexn = r[16].value	}

	for (var i = 0; i < r.length; i++) {
		if (r[i].value == "") {
			r[i].value = "?"
		}
		r[i].value = r[i].value.replace("・","・").replace(" "," ")
    }
	if (r[9].value.match(/^(?|\?|-|-|)$/)) {
	prerank = ""
	} else {
	prerank = "("+r[9].value+")"
	}

	if (r[13].value.match(/^(?|\?|-|-|)$/)) {
	nextrank = ""
	} else {
	nextrank = "("+r[13].value+")"
	}



    var copytext = '<table><tbody><tr><td colspan="15" style="background-color:#303030;"><span style="color:rgb(255,255,255);">'+r[-1+2].value+'</span></td>\n</tr><tr><td rowspan="3" style="text-align:center;"><img width="60" height="60" alt="" style="border-top-style:none;border-bottom-style:none;border-right-style:none;border-left-style:none;" src="http://www51.atwiki.jp/quizmagicianblackcat?cmd=upload&act=open&pageid=1197&file='+r[0].value+'.png" /></td>\n<td width="60" style="text-align:center;background-color:#afafaf;">属性</td>\n<td width="60" style="text-align:center;background-color:'+zcol+';"><a href="http://www51.atwiki.jp/quizmagicianblackcat/?page='+ encodeURIComponent('精霊図鑑/'+zelem+'属性 '+r[-1+3].value+'ランク')+'"> '+zelem+' </a></td>\n<td width="60" style="text-align:center;background-color:#afafaf;">MAX Lv</td>\n<td width="60" style="text-align:center;">'+maxlev+'</td>\n<td width="90" style="text-align:center;background-color:#afafaf;">Aスキル</td>\n<td width="200" nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/66.html#'+r[-1+8].value+'">'+r[-1+8].value+'</a></td>\n<td bgcolor="#AFAFAF" rowspan="4">潜<br />在<br />能<br />力</td>\n<td width="130" nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/4035.html#'+r[-1+1+14].value+'">'+r[-1+1+14].value+'</a></td>\n<td width="130" nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/4035.html#'+r[-1+2+14].value+'">'+r[-1+2+14].value+'</a></td>\n</tr><tr><td style="text-align:center;background-color:#afafaf;">ランク</td>\n<td style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/?page='+ encodeURIComponent('精霊図鑑/'+zelem+'属性 '+r[-1+3].value+'ランク')+'">'+r[-1+3].value+'</a></td>\n<td style="text-align:center;background-color:#afafaf;">HP</td>\n<td style="text-align:center;">'+r[-1+6].value+'</td>\n<td style="text-align:center;background-color:#afafaf;">Sスキル</td>\n<td width="200" nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/67.html#'+r[-1+11].value+'">'+r[-1+11].value+'('+r[-1+12].value+')</a></td>\n<td nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/4035.html#'+r[-1+3+14].value+'">'+r[-1+3+14].value+'</a></td>\n<td nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/4035.html#'+r[-1+4+14].value+'">'+r[-1+4+14].value+'</a></td>\n</tr><tr><td style="text-align:center;background-color:#afafaf;">コスト</td>\n<td style="text-align:center;">'+r[-1+4].value+'</td>\n<td style="text-align:center;background-color:#afafaf;">攻撃</td>\n<td style="text-align:center;">'+r[-1+7].value+'</td>\n<td style="text-align:center;background-color:#afafaf;">進化元</td>\n<td nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/?page=精霊図鑑/'+pren+'">'+r[-1+9].value+ prerank +'</a></td>\n<td nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/4035.html#'+r[-1+5+14].value+'">'+r[-1+5+14].value+'</a></td>\n<td nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/4035.html#'+r[-1+6+14].value+'">'+r[-1+6+14].value+'</a></td>\n</tr><tr><td style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/?page='+r[-1+2].value+'">No.'+r[0].value+'</a></td>\n<td bgcolor="#AFAFAF" style="text-align:center;">種族</td>\n<td nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/3885.html#'+r[-1+5].value+'">'+r[-1+5].value+'</a></td>\n<td colspan="2" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/?cmd=edit&page=精霊図鑑/'+r[0].value+'">編集</a></td>\n<td style="text-align:center;background-color:#afafaf;">進化先</td>\n<td nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/?page=精霊図鑑/'+nexn+'">'+r[-1+13].value + nextrank +'</a></td>\n<td nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/4035.html#'+r[-1+7+14].value+'">'+r[-1+7+14].value+'</a></td>\n<td nowrap="nowrap" style="text-align:center;"><a href="http://www51.atwiki.jp/quizmagicianblackcat/pages/4035.html#'+r[-1+8+14].value+'">'+r[-1+8+14].value+'</a></td>\n</tr></tbody></table>'
    document.getElementById("copytext").value = copytext
    document.getElementById("proc1").innerHTML=" ";
    document.getElementById("proc2").innerHTML="2.下のテキストエリアの内容を全てコピーします ※ctrl+ac";

}



function inputc() {
    for (var i = 0; i < r.length; i++) {
        var input = r[i]
        input.value = ""
    }
}

function keisan(x,y){
		var vAns;
		vAns = parseInt(x) + parseInt(y);
		return vAns;
	}

function copyfocus(input) {
   document.getElementById("edit").href = "http://www51.atwiki.jp/quizmagicianblackcat/?cmd=edit&wysiwyg=1&page=精霊図鑑/"+r[0].value+"&editor=3"
   document.getElementById("edit").innerHTML = "→精霊ページを作成する"
   document.getElementById("copytext").select();
   document.getElementById("proc2").innerHTML=" ";
   document.getElementById("proc3").innerHTML="3.下のリンク先へ行き、全て貼り付けて「ページ保存」をクリック";

}


}}}}

#html2(){{{
<div id="proc1">読み込み中です</div>
<table name="dataform" style="border:none; width:800px; padding:5px;">
<tr>
<td style="padding:1px;" colspan="3" rowspan="1" style="width:100px;"><input type="text"  style="width:296px;height:20px;" disabled="true" placeholder="※精霊番号" /></td>
<td style="padding:1px;" colspan="5" rowspan="1" style="width:100px;"><input type="text"  style="width:497px;height:20px;" disabled="true" placeholder="精霊名" /></td>
</tr><tr>
<td style="padding:1px;" colspan="2"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="※ランク" /></td>
<td style="padding:1px;" colspan="1" rowspan="1"><input type="text"  style="width:95px;height:20px;" disabled="true" placeholder="コスト" /></td>
<td style="padding:1px;" colspan="1"><input type="text"  style="width:95px; height:20px;" disabled="true" placeholder="種族" /></td>
<td style="padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="最大HP" /></td>
<td style="padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="最大攻撃力" /></td>
</tr><tr>
<td style="padding:1px;" colspan="4" rowspan="1"><input type="text"  style="width:397px;height:20px;" disabled="true" placeholder="Aスキル" /></td>
<td style="padding:1px; width:300px;" colspan="3" rowspan="1"><input type="text"  style="width:293px;height:20px;" disabled="true" placeholder="進化元" /></td>
<td style="padding:1px; width:100px;" colspan="1" rowspan="1"><input type="text"  style="width:95px;height:20px;" disabled="true" placeholder="ランク " /></td>
</tr><tr>
<td style="padding:1px; width:300px;" colspan="3" rowspan="1"><input type="text"  style="width:295px;height:20px;" disabled="true" placeholder="Sスキル" /></td>
<td style="padding:1px; width:100px;" colspan="1" rowspan="1"><input type="text"  style="width:95px;height:20px;" disabled="true" placeholder="ターン数" /></td>
<td style="padding:1px; width:300px;" colspan="3" rowspan="1"><input type="text"  style="width:293px;height:20px;" disabled="true" placeholder="進化先" /></td>
<td style="padding:1px; width:100px;" colspan="1"><input type="text"  style="width:95px;height:20px;" disabled="true" placeholder="ランク  " /></td>

</tr><tr>
<td style="width:200px; padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="潜在能力1" /></td>
<td style="width:200px; padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="潜在能力2" /></td>
<td style="width:200px; padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="潜在能力3" /></td>
<td style="width:200px; padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;width:250; height:20px;" disabled="true" placeholder="潜在能力4" /></td>
</tr><tr>
<td style="width:200px; padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="潜在能力5" /></td>
<td style="width:200px; padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="潜在能力6" /></td>
<td style="width:200px; padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="潜在能力7" /></td>
<td style="width:200px; padding:1px;" colspan="2" rowspan="1"><input type="text"  style="width:195px;height:20px;" disabled="true" placeholder="潜在能力8" /></td>
</tr>
</table>
<table style="border:none; width:800px; padding:5px;">
<tr style="border:none; padding:1px; border:none">
  <td colspan="8" style="border:none">
   <div align="right">
    <input id="createdata" type="button" value="作成"  style="width:200px;" disabled="true" />
    <input id="resetinput"  type="reset" value="クリア" style="width:200px;" disabled="true" />
 </div></td></tr>
</table>
<div id="proc2"> </div><br>
<textarea id="copytext" style="resize:none; width:800px" rows="5"></textarea><br>
<div id="proc3"> </div>
<a href="http://www51.atwiki.jp/quizmagicianblackcat/" id="edit"> </a>
<hr>
}}}