mods.de Forum - Thread Navigation

Verbessert die Navigation innerhalb von Threads

当前为 2015-11-08 提交的版本,查看 最新版本

// ==UserScript==
// @name          mods.de Forum - Thread Navigation
// @description   Verbessert die Navigation innerhalb von Threads
// @author        TheRealHawk
// @namespace     http://forum.mods.de
// @match         http://forum.mods.de/bb/thread.php*
// @match         http://forum.mods.de/bb/newthread.php*
// @match         http://forum.mods.de/bb/newreply.php*
// @match         http://forum.mods.de/bb/editreply.php*
// @icon          http://i.imgur.com/wwA18B8.png
// @version       1.2
// @require       https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @require       https://greasyfork.org/scripts/8984-jquery-hotkeys-plugin/code/jQuery%20Hotkeys%20Plugin.js
// ==/UserScript==

if ($(location).attr('pathname') == '/bb/thread.php'){
    $(document).bind('keydown', 'ctrl+left', function(){
        var href = $('a:contains("« erste"):first').attr('href');
        if (href){
            window.location.replace(href);
        }
    });

    $(document).bind('keydown', 'left', function(){
        var href = $('a:contains("« vorherige"):first').attr('href');
        if (href){
            window.location.replace(href);
        }
    });

    $(document).bind('keydown', 'right', function(){
        var href = $('a:contains("nächste »"):first').attr('href');
        if (href){
            window.location.replace(href);
        }
    });

    $(document).bind('keydown', 'ctrl+right', function(){
        var href = $('a:contains("letzte »"):first').attr('href');
        if (href){
            window.location.replace(href);
        }
    });

    $(document).bind('keydown', 'ctrl+up', function(){
        window.scrollTo(0, 0);
    });

    $(document).bind('keydown', 'ctrl+down', function(){
        window.scrollTo(0, document.body.scrollHeight);
    });

    if ($('a:contains("lesezeichen"):last').parent().text().match(/.*\+lesezeichen.*/)){
        $(document).bind('keydown', 'l', function(){
            eval('unsafeWindow.' + $('a:contains("lesezeichen"):last').attr('href').match(/setBookmark\(.*\)/));
        });
    }

    $(document).bind('keydown', 'i', function(){
        window.location.replace('http://forum.mods.de/bb/index.php');
    });

    $(document).bind('keydown', 'p', function(){
        window.location.replace($('a[href^="newreply.php"]').attr('href'));
    });
}

$('textarea[name="message"]').bind('keydown', 'ctrl+return', function(){
    $('input[value="Eintragen"]').click()
});

content = $('meta[http-equiv="refresh"]').attr('content');
if (content){
    href = content.substring(content.indexOf('url=') + 4);
    window.location.replace(href);
}