Bash Navigator

Стрелки вперёд-назад у номера цитаты

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name			Bash Navigator
// @version			2019.08.23
// @description		Стрелки вперёд-назад у номера цитаты
// @include			http*://bash.im/quote/*
// @author			Rainbow-Spike
// @namespace		https://greasyfork.org/users/7568
// @homepage		https://greasyfork.org/ru/users/7568-dr-yukon
// @icon			https://www.google.com/s2/favicons?domain=bash.im
// @grant			none
// @run-at			document-end
// ==/UserScript==

var parent = document.querySelector ( '.quote__header' ),
	link = parent.querySelector ( '.quote__header_permalink' ), // ссылка на текущий номер
    num = link.href.match ( /[^\/]+$/ ), // выдрать из неё номер
    num_back = parseInt ( num ) - 1, // предыдущий
    num_next = num_back + 2, // следующий
    back = document.createElement ( 'a' ), // заготовка новых ссылок
    next = document.createElement ( 'a' ),
    t_back = document.createTextNode ( '[<<]' ), // и текстов
    t_next = document.createTextNode ( '[>>]' );

back.href = '/quote/' + num_back; // одевание на новые ссылки путей с номерами
back.appendChild ( t_back ); // вставка текстов
back.accessKey = 'p';
parent.insertBefore ( back, link ); // вставка новых ссылок

next.href = '/quote/' + num_next;
next.appendChild ( t_next );
next.accessKey = 'n';
parent.appendChild ( next );

back.className = next.className = 'quote__header_permalink'; // общий стиль
parent.style = 'font-size: 20px; position: relative; bottom: 7px;';