KG - default sort by Added

affects browse tab and search form

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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 = "";