おぐCOJ

COJは終わった

フォイルリスト作成用スクリプト書き換えたりしました

日本全国に12000のファンを持つ人気者、おぐなーだよ~!!


僕のフォイルリスト作成用スクリプト作ったもの カテゴリーの記事一覧 - おぐCOJ
参照)を使って下さっている方々から、細々とした要望を頂いていたので、頑張って実装しました。


増えたやつ

そのほか既存スクリプトを含めた変更点

  • スクリプト1: 消してしまったカードを戻す機能を1つだけでなく無制限に
  • スクリプト2: 出力された画像を左クリックすると消せるように(やり直ししやすい)

リンクからコピーとか直接お気に入り保存できる環境の人は
http://ogner.ehoh.net/scripts.html
こっちを使うといいかも

質問とかはTwitter: biree100まで



www.youtube.com



スクリプト1(リスト編集モードに入るやつ)

通常版
javascript:(function(d){(w=box_wrapper).style.top=0;(c=box_container).style.background='#000';w.style.height=c.style.height=(innerHeight-110)+'px';card_detail_wrapper.style.top='100%';pv=[];Array.prototype.forEach.call(c.childNodes[1].childNodes,function(e){if(!(e.n=+(e.q=e.childNodes[3]).innerHTML.match(/\d/)))e.style.display='none';e.onclick=function(){this.style.display='none';pv.push(this);};e.oncontextmenu=function(){this.q.innerHTML='x'+(this.n=this.n-1||9);return false;};});box_search.onclick=function(){pv.length&&(pv.pop().style.display='inline-block');};})(document);
4枚以上所持している余剰分だけを残すバージョン
javascript:(function(d){(w=box_wrapper).style.top=0;(c=box_container).style.background='#000';w.style.height=c.style.height=(innerHeight-110)+'px';card_detail_wrapper.style.top='100%';pv=[];Array.prototype.forEach.call(c.childNodes[1].childNodes,function(e){if((e.n=+(e.q=e.childNodes[3]).innerHTML.match(/\d/))<4)e.style.display='none';e.n-=3;e.q.innerHTML='x'+e.n;e.onclick=function(){this.style.display='none';pv.push(this);};e.oncontextmenu=function(){this.q.innerHTML='x'+(this.n=this.n-1||9);return false;};});box_search.onclick=function(){pv.length&&(pv.pop().style.display='inline-block');};})(document);
3枚に達していない不足分を計算するバージョン フルフォイラー向け
javascript:(function(d){xc=new XMLHttpRequest();xc.onreadystatechange=function(){if(xc.readyState==4&&xc.status==200){jc=JSON.parse(xc.responseText);ac=[];t=jc.card_master_list;for(i in t)ac[t[i].no]=t[i];xq=new XMLHttpRequest();xq.onreadystatechange=function(){if(xq.readyState==4&&xq.status==200){jq=JSON.parse(xq.responseText);aq=[];t=jq.result.user_card_list;for(i=0;i<t.length;i++)aq[t[i].card_id]=t[i].card_count;tx=[];for(t in ac)if(n=Math.max(3-(aq[ac[t].id+10000]||0),0))tx.push('<li>\n<div class="foil_thum"></div>\n<div class="card_quantity">x'+n+'</div>\n<div class="card_image" style="background:url(..'+ac[t].s_img+'.jpg)"></div>\n</li>');(w=box_wrapper).style.top=0;(c=box_container).style.background='#000';w.style.height=c.style.height=(innerHeight-110)+'px';card_detail_wrapper.style.top='100%';(ul=c.childNodes[1]).className='cardbox_rotate_end';ul.innerHTML=tx.join('');pv=[];Array.prototype.forEach.call(ul.childNodes,function(e){if(!(e.n=+(e.q=e.childNodes[3]).innerHTML.match(/\d/)))e.style.display='none';e.onclick=function(){this.style.display='none';pv.push(this);};e.oncontextmenu=function(){this.q.innerHTML='x'+(this.n=this.n-1||9);return false;};});box_search.onclick=function(){pv.length&&(pv.pop().style.display='inline-block');};}};xq.open('GET','card_list_detail/hi-pixels',true);xq.send();}};xc.open('GET','get_card_master',true);xc.send();})(document);

スクリプト2(リストの画像出力するやつ)

通常版(PC用)
javascript:(function(d){a=[];Array.prototype.forEach.call(c.childNodes[1].childNodes,function(e){if(e.style.display!='none'){s=e.childNodes;b=new Image();b.src=s[5].getAttribute('style').match(/img.+jpg/);b.f=s[1].className;b.n=e.n;a.push(b);}});f=new Image();f.src='../img/pc/foil/foil_thum.png';q=new Image();q.src='../img/pc/deck/card_quantity_bg.png';v=d.createElement('canvas');v.width=o=Math.min(16,a.length)*40;v.height=p=(((a.length-1)/16|0)+1)*56;t=v.getContext('2d');t.font='12pt Arial';t.fillRect(0,0,o,p);t.fillStyle='#FFF';for(m=0;m<a.length;m++){x=(m%(16))*40;y=(m/16|0)*56;t.drawImage(a[m],x,y,40,56);if(a[m].f)t.drawImage(f,x,y,40,56);t.drawImage(q,x+19,y+40,21,16);t.fillText('x'+a[m].n,x+22,y+54);}i=new Image();with(i.style){display='block';position='fixed';top=0;right=0;zIndex=100;}i.src=v.toDataURL();d.body.appendChild(i);i.onclick=function(){d.body.removeChild(this);};})(document);
モバイル端末用 時間かかるかも
javascript:(function(d){a=[];Array.prototype.forEach.call(c.childNodes[1].childNodes,function(e){if(e.style.display!='none'){s=e.childNodes;b=new Image();b.src=(cs=d.defaultView.getComputedStyle(s[5],'')).backgroundImage.match(/i.+?_.+?\//)+'thum/thum_'+e.id.slice(-3)+'.jpg';b.f=s[1].className;b.n=e.n;a.push(b);}});f=new Image();f.src='img/mobile/foil/foil_m_thum.png';q=new Image();q.src='img/pc/deck/card_quantity_bg.png';v=d.createElement('canvas');v.width=o=Math.min(16,a.length)*40;v.height=p=(((a.length-1)/16|0)+1)*56;t=v.getContext('2d');t.font='12pt ArialMT';t.fillRect(0,0,o,p);t.fillStyle='#FFF';ct=0;for(m=0;m<a.length;m++){x=(m%(16))*40;y=(m/16|0)*56;a[m].onload=(function(x,y,z){return function(){t.drawImage(z,x,y,40,56);if(z.f)t.drawImage(f,x,y,40,56);t.drawImage(q,x+19,y+40,21,16);t.fillText('x'+z.n,x+22,y+54);if(++ct==a.length){i.src=v.toDataURL();d.body.appendChild(i);}};})(x,y,a[m]);}i=new Image();with(i.style){display='block';position='fixed';top=0;right=0;zIndex=100;}i.onclick=function(){d.body.removeChild(this);};})(document);
(モバイル端末用 テスト段階 動かないという報告アリ)
javascript:(function(d){a=[];Array.prototype.forEach.call(c.childNodes[1].childNodes,function(e){if(e.style.display!='none'){s=e.childNodes;b=new Image();b.src=(cs=d.defaultView.getComputedStyle(s[5],'')).backgroundImage.match(/i.+?jpg/);b.px=-2*parseInt(cs.backgroundPosition);b.py=-2*parseInt(cs.backgroundPosition.split(' ')[1]);b.f=s[1].className;b.n=e.n;a.push(b);}});f=new Image();f.src='img/mobile/foil/foil_m_thum.png';q=new Image();q.src='img/pc/deck/card_quantity_bg.png';v=d.createElement('canvas');v.width=o=Math.min(16,a.length)*40;v.height=p=(((a.length-1)/16|0)+1)*56;t=v.getContext('2d');t.font='12pt ArialMT';t.fillRect(0,0,o,p);t.fillStyle='#FFF';ct=0;for(m=0;m<a.length;m++){x=(m%(16))*40;y=(m/16|0)*56;t.drawImage(a[m],a[m].px,a[m].py,120,169,x,y,40,56);if(a[m].f)t.drawImage(f,x,y,40,56);t.drawImage(q,x+19,y+40,21,16);t.fillText('x'+a[m].n,x+22,y+54);}i=new Image();with(i.style){display='block';position='fixed';top=0;right=0;zIndex=100;}i.src=v.toDataURL();d.body.appendChild(i);i.onclick=function(){d.body.removeChild(this);};})(document);