ProxyFiend / Booru Downloader

// ==UserScript==
// @name         Booru Downloader
// @namespace    ProxyFiend.BooruDownloader
// @author       ProxyFiend
// @copyright    2017, ProxyFiend (https://twitter.com/ProxyFiend)
// @license      Mozilla Public License 2.0; https://opensource.org/licenses/MPL-2.0
// @version      1.0
// @description  Adds Ctrl + S support for Konachan and Yande.re.
// @match        *://*.konachan.org/*
// @match        *://*.konachan.com/*
// @match        *://*.yande.re/
// @updateURL    https://openuserjs.org/meta/ProxyFiend/Booru_Downloader.meta.js
// @downloadURL  https://openuserjs.org/src/scripts/ProxyFiend/Booru_Downloader.user.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    if ($("a.directlink").length){
        $("a.directlink").attr("download","");
    }

    if ($("#highres").length) {
        $("#highres").attr("download", "");

        $(window).bind('keydown', function (event) {
            if (event.ctrlKey || event.metaKey) {
                switch (String.fromCharCode(event.which).toLowerCase()) {
                    case 's':
                        event.preventDefault();
                        $("#highres")[0].click();
                        break;
                }
            }
        });
    }
})();