KG - default sort by Added

affects browse tab and search form

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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