Bash Navigator

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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;';