KG - default sort by Added

affects browse tab and search form

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        KG - default sort by Added
// @description affects browse tab and search form
// @namespace   KG
// @grant	none
// @include     http*://*karagarga.in/*
// @exclude     http*://forum.karagarga.in/*
// @version     1.3
// ==/UserScript==

// don't run in iFrames
if (window.frameElement) return;

// change Browse tab link to sort by Added date
var links = document.getElementById("ddimagetabs").getElementsByTagName("a");

for (i=0; i < links.length; i++ ) {
        if (links[i].textContent.indexOf("Browse") != -1) {
                links[i].href = links[i].href + "?sort=added&d=DESC";
        }
}


// change search form back to default sort, to see most relevant hits first
var searchForm = document.forms.namedItem("searchform");
var sortField = searchForm.elements.namedItem("sort");
sortField.value = "";