Skip to content

Instantly share code, notes, and snippets.

@swifee
Last active August 29, 2015 13:56
Show Gist options
  • Save swifee/8845176 to your computer and use it in GitHub Desktop.
Save swifee/8845176 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name バンブラP整理番号表示
// @namespace http://gbm.yh.land.to
// @description バンブラP最新追加曲リストに楽曲の整理番号を表示させます。
// @include http://bandbros-p.nintendo.co.jp/release/newRelease/
// @version 1.0
// ==/UserScript==
var list = document.getElementsByTagName("table")[0];
var t;
t=list.getElementsByTagName("th")[1]; //th
t.style.width="16px";
t.style.padding="8px 0px";
t.style.overflow="hidden";
t=t.firstChild; //th.img
t.style.margin="0 -58px 0 0";
t.style.padding="0";
var anchors = list.getElementsByTagName("a");
var id_arr=new Array();
var s = /\d+$/g;
for (var i=0; i<anchors.length; i++){
var id = anchors[i].href.match(s);
if(id){
t = document.createElement('span');
t.textContent = "("+id+") ";
anchors[i].parentNode.insertBefore(t,anchors[i].parentNode.firstChild);
id_arr.push(Number(id));
}
}
id_arr.sort(function(a, b){
return b - a;
});
id_arr=id_arr.slice(0,5).join(", ");
t = document.createElement('p');
t.textContent = "整理番号最新5件:"+id_arr+"";
list.parentNode.insertBefore(t,list);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment