Навигация на bash.im

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

Version vom 30.03.2016. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Навигация на bash.im
// @description Стрелки вперёд-назад у номера цитаты
// @include     http://bash.im/quote/*
// @icon        http://bash.im/favicon.ico
// @grant       none
// @version 0.0.1.20160330050710
// @namespace https://greasyfork.org/users/7568
// ==/UserScript==

var link = document.getElementsByClassName('id')[0]; // ссылка на текущий номер
    number = link.href.match(/[^\/]+$/), // выдрать из неё номер
    numberback = parseInt(number) - 1, // предыдущий
    numbernext = numberback + 2, // следующий
    linkback = document.createElement('a'), // заготовка новых ссылок
    linknext = document.createElement('a'),
    textback = document.createTextNode('[<<]'), // и текстов
    textnext = document.createTextNode('[>>]');
linkback.href = '/quote/'+numberback; // одевание на новые ссылки путей с номерами
linknext.href = '/quote/'+numbernext;
linkback.className = linknext.className = 'id'; // присвоение класса
linkback.style = link.style = linknext.style = 'margin: -3px; position: relative;'; // группирование всех трёх элементов
linkback.appendChild(textback); // вставка текстов
linknext.appendChild(textnext);
link.parentNode.insertBefore(linkback,link); // вставка новых ссылок
link.parentNode.appendChild(linknext);