Skip to content

Instantly share code, notes, and snippets.

@sorz
Last active March 17, 2017 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorz/6731d31fdee49cdf0a9fc6264d592039 to your computer and use it in GitHub Desktop.
Save sorz/6731d31fdee49cdf0a9fc6264d592039 to your computer and use it in GitHub Desktop.
以固定顺序显示 ipn.li 首页的节目列表。
// ==UserScript==
// @name IPN - Fixed show list on homepage
// @namespace org.sorz.lab.ipn
// @include https://ipn.li/
// @version 1
// @grant none
// @require http://code.jquery.com/jquery-3.2.0.slim.min.js
// ==/UserScript==
let items = $('.showList > li').toArray();
let link = (i) => $(i).children('a').attr('href');
items.sort((a, b) => link(a) > link(b) ? 1 : -1);
$('.showList').empty().append(items);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment