krejdowe menu

Dodaje ikony w górnej części strony, aby ułatwić nawigację po Wykopie

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name       krejdowe menu
// @namespace  http://www.wykop.pl/*
// @version    1.2
// @description  Dodaje ikony w górnej części strony, aby ułatwić nawigację po Wykopie
// @match      *://www.wykop.pl/*
// @copyright  krejd
// ==/UserScript==

// Checks protocol
var wykopProtocol = window.location.protocol;

// Goes to next unread tag
$('body').on('click', '#nextTag', function(event) {
    event.preventDefault();

    // Dblclick button to get ajax working as
    // it needs to scrape unread notification urls
    $('body').append('<style id="niewidacheheszki">.menu-list { display:none !important; }</style>');
    $('.notification.m-tag > a.ajax').trigger('click');

    // Checks if ajax complete
    checkIfShownNote = setInterval(function() {
        if(jQuery.active === 0) {
            clearInterval(checkIfShownNote);
            $('body').trigger('click');

            $('.notification.m-tag .menu-list li:first a').each(function(index,value) {
                if($(this).attr('href').match(/wpis/i)) {
                    hashHref = $(this).attr('href');
                    window.location.href = hashHref;
                }
            });

            $('#niewidacheheszki').remove();
        }
    }, 50);
});

// Goes to next unread notification
$('body').on('click', '#nextNote', function(event) {
    event.preventDefault();

    // Dblclick button to get ajax working as
    // it needs to scrape unread notification urls
    $('body').append('<style id="niewidacheheszki">.menu-list { display:none !important; }</style>');
    $('.notification.m-user > a.ajax').trigger('click');

    // Checks if ajax complete
    checkIfShownNote = setInterval(function() {
        if(jQuery.active === 0) {
            clearInterval(checkIfShownNote);
            $('body').trigger('click');

            $('.notification.m-user .menu-list li:first a').each(function(index,value) {
                if($(this).attr('href').match(/wpis/i) || $(this).attr('href').match(/konwersacja/i) || $(this).attr('href').match(/comment/i)) {
                    hashHref = $(this).attr('href');
                    window.location.href = hashHref;
                }
            });

            $('#niewidacheheszki').remove();
        }
    }, 50);
});

// Append new buttons to Wykop interface
// Append new buttons to Wykop interface
// Append new buttons to Wykop interface

$('div#nav ul.clearfix:last > li.notification.m-user').before($('<li/>', {
    id: 'nextNote',
    html: '<a class="dropdown-show" href="'+wykopProtocol+'//www.wykop.pl/powiadomienia/do-mnie/"><i class="fa fa-envelope"></i><b class="" id="hashtagsNotificationsCount" style="background:#FF5917; font-size:0; display:block; padding:1px; top:22px; right:20px; min-width:10px; width:10px; min-height:10px; height:10px; border-radius:5px; overflow:hidden;">&nbsp;</b></a><div class="notificationsContainer"></div>',
    class: "notification m-user krejd-nextnotification",
    title: "Czytaj następne powiadomienie",
    alt: "Czytaj następne powiadomienie"
}));

$('div#nav ul.clearfix:last > li.notification.m-tag').before($('<li/>', {
    id: 'allTags',
    html: '<a class="dropdown-show hashtag" href="'+wykopProtocol+'//www.wykop.pl/powiadomienia/unreadtags/"><b class="" id="hashtagsNotificationsCount" style="background:#924396; font-size:0; display:block; padding:1px; top:22px; right:16px; min-width:10px; width:10px; min-height:10px; height:10px; border-radius:5px; overflow:hidden;">&nbsp;</b>#</a><div class="notificationsContainer"></div>',
    class: "notification m-tag krejd-alltags",
    title: "Pokaż nieprzeczytane wpisy z tagów",
    alt: "Pokaż nieprzeczytane wpisy z tagów"
}));

$('div#nav ul.clearfix:last > li.notification.m-tag:not(.krejd-alltags)').before($('<li/>', {
    id: 'nextTag',
    html: '<a class="dropdown-show hashtag" href="'+wykopProtocol+'//www.wykop.pl/powiadomienia/tagi/"><b class="" id="hashtagsNotificationsCount" style="background:#FF5917; font-size:0; display:block; padding:1px; top:22px; right:16px; min-width:10px; width:10px; min-height:10px; height:10px; border-radius:5px; overflow:hidden;">&nbsp;</b>#</a><div class="notificationsContainer"></div>',
    class: "notification m-tag krejd-nexttag",
    title: "Czytaj następny tag",
    alt: "Czytaj następny tag"
}));