Skip to content

Instantly share code, notes, and snippets.

@g8up
Last active June 18, 2019 14:09
Show Gist options
  • Save g8up/9762a347b1d2e8f9c71e to your computer and use it in GitHub Desktop.
Save g8up/9762a347b1d2e8f9c71e to your computer and use it in GitHub Desktop.
让斗鱼房间页面按访问量降序排
javascript: void((function () {
/*
* 斗鱼找福利 V2.3.3
* 日期:2017年2月3日
* 用途:让斗鱼房间页面按访问量降序排列
* 需要[制作成 Chrome 书签](http://pan.baidu.com/s/1skgEosX)。
*/
if( window.location.host.indexOf('douyu') < 0 ){
window.location.href = 'https://www.douyu.com/directory/game/LOL';
}
var p = $('#live-list-content');
var ul = p.find('ul');
var rooms = ul.find('li');
function getPeopleNum( room ){
var view = $(room).find('.dy-num');
var num = view.text();
if (num.indexOf('万') > -1) {
num = num.replace('万', '');
num = num * 10000;
}
return num;
}
[].sort.call(rooms, function (room1, room2) {
return getPeopleNum(room2) - getPeopleNum(room1); /* 按从大到小对 roomView 里的数字进行排序*/
});
ul.append( rooms );
/* https://www.douyu.com/duxing */
p.css({
opacity:0
}).animate({
opacity:1
});
})());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment