🏠

Greasy Fork is available in English.

aibtba搜索结果按照年份倒序

aibtba.com的搜索结果按照年份倒序


安装此脚本?
提问、发表评价,或者 举报这个脚本
// ==UserScript==
// @name         aibtba搜索结果按照年份倒序
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  aibtba.com的搜索结果按照年份倒序
// @author       tcatche
// @match        so.aibtba.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=aibtba.com
// @grant        none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Your code here...
const listUlEles = document.querySelector('.lists ul');
const liEles = [...listUlEles.children];
listUlEles.textContent = '';
liEles.sort(function(ele1, ele2) {
const year1Text = ele1.querySelector('div > p:nth-child(5) > i').textContent;
const year2Text = ele2.querySelector('div > p:nth-child(5) > i').textContent;
return year1Text > year2Text ? -1 : 1;
}).forEach(function(ele) {
listUlEles.appendChild(ele);
})
})();