hub_navigator

Website Navigator With Arrow Key Press

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

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.

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

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

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!)

Tekijä
krishnachaitanya9
Päivittäiset asennukset
0
Asennuskerrat
41
Arvostelut
1 0 0
Versio
1.0
Luotu
13.7.2016
Päivitetty
29.9.2024
Size
1,4 kt
Lisenssi
N/A
Käytössä

// ==UserScript== // @name hub_navigator // @namespace http://your.homepage/ // @version 1.0 // @description Website Navigator With Arrow Key Press // @match https://./* // ==/UserScript== function updatePageNumber(increment) { const url = window.location.href;

// Use regex to find the last numeric sequence in the URL
const regex = /(\d+)(?!.*\d)/;
const match = url.match(regex);

if (match) {
    // Extract the matched number
    let number = parseInt(match[0]);

    // Adjust the number based on the increment (positive for next, negative for previous)
    number += increment;

    // Replace the old number in the URL with the updated number
    const updatedUrl = url.replace(regex, number.toString());

    // Log the updated URL to the console
    console.log('Updated URL:', updatedUrl);

    // Navigate to the updated URL
    window.open(updatedUrl, "_self");
} else {
    console.log("No number found in the URL to increment/decrement.");
}

}

function checkKeyPressed(e) { // Right arrow key for increment if (e.keyCode === 39) { updatePageNumber(1); // Increment page number } // Left arrow key for decrement if (e.keyCode === 37) { updatePageNumber(-1); // Decrement page number } }

// Listen for keydown events window.addEventListener("keydown", checkKeyPressed, false);