ファイルはこちら
// ==UserScript== // @name bura3deckext // @version 0.0 // @description // @include http://*.3gokushi.jp/card/deck.php* // ==/UserScript function getListElement() { var list = document.getElementById("sol_list"); if (!list) { list = document.createElement('table'); list.id = "sol_list"; var attrname = ["","コスト","ID","名前","HP","攻撃","知力","歩防", "槍防","弓防","騎防","速度","操作","cid"]; var attr = ["","","cost","cardno","name1","status_hp","status_att", "status_int","status_wdef","status_sdef","status_bdef","status_rdef","status_speed","",""]; var sortable = [0,1,1,0,0,1,1,1,1,1,1,1,0,0]; row = document.createElement('tr'); row.id = "sol_list_header" for (j=0;j<attrname.length;j++) { e = document.createElement('th'); e.id="sol_list_" + attr[j]; e.innerHTML = attrname[j]; row.appendChild(e); } list.appendChild(row); var file = document.getElementById("card_uraomote"); file.insertBefore(list,file.firstChild); sortableTable(list); for (j=0;j<attrname.length;j++) { if (sortable[j]==1) list.setSortable(j); } } return list; } function sortableTable(tbl) { tbl.setSortable = function (col,mode) { var e = tbl.childNodes[0].childNodes[col]; e.style.cursor = "pointer"; e.orgClassName = e.className; e.addEventListener('click',function(s){return function(){tbl.sortTable(s);};}(col),false); e.addEventListener('mouseover',function(){this.className+=" hover";},false); e.addEventListener('mouseout' ,function(){this.className=this.orgClassName;},false); }; tbl.sortTable = function sortTable(col) { rows= new Array(); for (i=1;i<tbl.childNodes.length;i++) {rows[i-1]=tbl.childNodes[i];} rows.sort(function(a,b){ ea=a.childNodes[col]; eb=b.childNodes[col]; if (!ea) return -1; if (!eb) return 1; return parseFloat(eb.firstChild.nodeValue)-parseFloat(ea.firstChild.nodeValue); }); for (i=0;i<rows.length;i++) {tbl.appendChild(rows[i]);} } return tbl; } function addcards(d){ var list = getListElement(); var deckFile = d.getElementsByClassName("file")[0]; var currentDeckFile = document.getElementById("deck_file"); var cards = deckFile.getElementsByClassName("cardStatusDetail"); if (!cards.length) { cards = deckFile.getElementsByClassName("cardColmn"); } var attr = ["cost","cardno","name1","status_hp","status_att", "status_int","status_wdef","status_sdef","status_bdef","status_rdef","status_speed"]; for (i=0;i<cards.length;i++) { row = document.createElement("tr"); row.className="infile"; t = cards[i].getElementsByClassName("soltype"); e = document.createElement('td'); e.innerHTML = t[0].innerHTML; row.appendChild(e); for (j=0;j<attr.length;j++) { t = cards[i].getElementsByClassName(attr[j]); if(!t) continue; e = document.createElement("td"); e.className="cell_" + attr[j]; e.innerHTML = t[0].innerHTML; row.appendChild(e); } t = cards[i].getElementsByClassName("cardWrapper2col"); var cid = undefined; if (t.length) { cid = t[0].parentNode.id.split("_")[1]; } else { t = cards[i].getElementsByClassName("cardDelete")[0].firstChild; if (t.getAttribute) if (re=t.getAttribute('onclick').match(/operationExecution\('[^']*', (\d+), '[^']*', \d+\)/)) { cid = re[1]; } } e = document.createElement("td"); t = cards[i].getElementsByClassName("aboutdeck"); if(t.length && t[0].getAttribute('onclick')) { var link = document.createElement("a"); link.href="javascript:((function(){"+t[0].getAttribute('onclick')+"})(),void(0));"; link.appendChild(document.createTextNode("[セット]")); t=cards[i].getElementsByTagName("select"); if (t.length) { t=t[0]; e.appendChild(t); var v = document.createElement("input"); v.name = t.name; v.value = t.value; currentDeckFile.appendChild(v); t.addEventListener('change',(function (a,b){return function(){a.value=b.value};})(v,t),false); } e.appendChild(link); } else { e.appendChild(document.createTextNode(" セット不可 ")); } row.appendChild(e); e = document.createElement("td"); if (cid) { e.innerHTML = "<a href='status_info.php?cid=" + cid + "'>"+cid+"</a>"; } else { e.innerHTML = "-"; } row.appendChild(e); list.appendChild(row); } } function addcards_deck(d){ var list = getListElement(); var cardListDeck = document.getElementById("cardListDeck"); var cards = cardListDeck.getElementsByClassName("cardColmn"); var attr = ["cost","cardno","name1","status_hp","status_att", "status_int","status_wdef","status_sdef","status_bdef","status_rdef","status_speed"]; for (i=0;i<cards.length;i++) { row = document.createElement('tr'); row.className="indeck"; t = cards[i].getElementsByClassName("soltype"); e = document.createElement('td'); e.innerHTML = t[0].innerHTML; row.appendChild(e); for (j=0;j<attr.length;j++) { t = cards[i].getElementsByClassName(attr[j]); if(!t) continue; e = document.createElement('td'); e.className="cell_" + attr[j]; e.innerHTML = t[0].innerHTML; row.appendChild(e); } t = cards[i].getElementsByTagName("dd")[2]; e = document.createElement('td'); e.innerHTML = t.innerHTML; t = cards[i].getElementsByClassName("aboutdeck"); if(t.length && t[0].getAttribute('onclick')) { var link = document.createElement("a"); link.href="javascript:((function(){"+t[0].getAttribute('onclick')+"})(),void(0));"; link.appendChild(document.createTextNode("[戻す]")); e.appendChild(link); } row.appendChild(e); e = document.createElement("td"); e.innerHTML = "-"; row.appendChild(e); list.appendChild(row); } } function createlist(){ addcards_deck(document); addcards(document); //return; t = document.getElementsByClassName("pager")[0].getElementsByTagName("a"); for(i=0;i<t.length;i++) { if (!t[i].innerHTML.match(/\d/)) continue; httpRequest = new XMLHttpRequest(); httpRequest.open('GET', t[i].href, true); httpRequest.onreadystatechange = function (){ var req = arguments[0]; return function(){ if(req.readyState == 4 && req.status == 200) { var d = document.createElement('html'); d.innerHTML=req.responseText; addcards(d); } }; }(httpRequest); httpRequest.send(null); } } ( function(){ GM_addStyle("" + "#sol_list{border-style:solid;border-spacing: 2px;border-collapse: separate;width:100%;}" + "#sol_list tr{height:22px;}" + "#sol_list tr td{height:1.2em;padding-left:4px;}" + "#sol_list tr th{background-color:#ccc;text-align:center;}" + "#sol_list tr th.hover{background-color:#ddd;}" + " tr.indeck{background-color:#ddf}" + ".cell_name2{font-size:0.5em;color:#888;}" ); var link = document.createElement("a"); link.addEventListener('click',createlist,false); link.href="javascript:void(0)"; link.innerHTML = "武将一覧" var menu = document.getElementById("statMenu"); menu.appendChild(document.createTextNode(" | ")); menu.appendChild(link); }) ();いつものように自己責任で。
4 件のコメント:
ご苦労様です。通りすがりですが、このツールの項目に「LV」が無いので追加できないでしょうか?ご検討よろしくお願いします。
コメントありがとうございます。ただいま色々と立て込んでいまして、空いた時間があれば対応したいと思うのですが。。。もしアップデートできた際は告知します。
とても便利なツールです。ありがとうございます。
レベルはレアリティごとにクラス名が違うみたいなので、確かにちょっと面倒くさいですね。なんでこんな仕様なのか。。。
自分仕様にカスタマイズして使ってます。
コメントありがとうございます!そうなんですよ。レアリティごとの処理が面倒なんで飛ばしてしまいました。
どこかでアップデートしたいと思いながらずるずると。。。。
もともと先人たちが作ったものなので自由にカスタマイズして使ってください〜
コメントを投稿