Yves_W / NyaaSelectFix

// ==UserScript==
// @name           NyaaSelectFix
// @namespace      yveswscripts
// @description    Changes the default nyaa.si filters to "No remakes" & "Anime - English-translated" instead of "No filter" & "All categories". It does this by immediately redirecting to https://nyaa.si/?f=1&c=1_2&q= and letting the banner redirect to it as well. Also redirects default searches to "No remakes" & "Anime - English-translated" when searching from a torrent view. 
// @author         Yves W
// @version        0.1.2
// @copyright      2017+, Yves W (openuserjs.org/users/Yves_W)
// @license      MIT
// @homepageURL    https://openuserjs.org/scripts/Yves_W/NyaaSelectFix
// @supportURL     https://github.com/YvesW
// @updateURL      https://openuserjs.org/meta/Yves_W/NyaaSelectFix.meta.js
// @downloadURL    https://openuserjs.org/install/Yves_W/NyaaSelectFix.user.js
// @include        *nyaa.si*
// @require        http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @run-at         document-start
// ==/UserScript==


if (window.location.href == "https://nyaa.si/" || window.location.href == "http://nyaa.si/") {
    window.location.replace("https://nyaa.si/?f=1&c=1_2&q=");
}


var oldURL = document.referrer;
if (oldURL.indexOf("nyaa.si/view/") > -1) {
    if (window.location.href.indexOf("nyaa.si/?f=0&c=0_0&q=") > -1) {
      $modifiedURL = window.location.href.replace("nyaa.si/?f=0&c=0_0&q=","nyaa.si/?f=1&c=1_2&q=");
			window.location.replace($modifiedURL);
    }
}



window.addEventListener('DOMContentLoaded', function(e) {

$("body nav div div.navbar-header a").attr('href', '/?f=1&c=1_2&q=');
  
window.removeEventListener(e.type, arguments.callee, true);
}, true);
    
/*

very old test code here for reference purpose only, please ignore
if($("#navFilter-category div button").attr('title') == "All categories" ) {
    alert("gotcha");
    if($("#navFilter-criteria div button").attr('title') == "No filter" ) {
    alert("gotcha 2");
        $('#navFilter-category div button span.filter-option.pull-left').text('Anime - English');
        $("#navFilter-category div div ul li:nth-child(4)").attr('class', 'selected');
        $("#navFilter-category div div ul li:nth-child(4) a").attr('aria-selected', 'true');
        $("#navFilter-category div div ul li:nth-child(1) a").attr('aria-selected', 'false');
        $("#navFilter-category div div ul li:nth-child(1)").removeAttr('class');
        $("#navFilter-category div button").attr('title', 'Anime - English');
}
}
//.removeAttr

*/