Skip to content

Instantly share code, notes, and snippets.

@fukayatsu
Created April 15, 2012 18:42
Show Gist options
  • Save fukayatsu/2394284 to your computer and use it in GitHub Desktop.
Save fukayatsu/2394284 to your computer and use it in GitHub Desktop.
ニコニコ動画の毎時総合で24時間以内のものを上位に持ってくるuser-script for chrome
// ==UserScript==
// @name nico-rank-resort
// @namespace nico-rank-resort
// @include http://www.nicovideo.jp/ranking/fav/hourly/all
// @author fukayatsu
// @description resort ranking of nico nico douga
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//code.jquery.com/jquery-latest.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
for(var i=1; i<=100; i++){
var item = jQuery('#item' + i);
var isOld = jQuery(jQuery('span', item)[4]).attr('style') != "color:#C00;";
if( isOld ){
var parent = item.parent();
parent.appendTo(parent.parent());
}
}
}
// load jQuery and execute the main function
addJQuery(main);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment