Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @grant none
- // @match https://*.wikipedia.org/*
- // @name Wikipedia
- // ==/UserScript==
- (function() {
- 'use strict';
- function actionFunction() {
- var links = document.querySelectorAll('a');
- var i;
- for (i = 0; i < links.length; i++) {
- var input = document.createElement('input');
- input.type = 'checkbox';
- input.dataset.url = links[i].href;
- input.addEventListener('change', function() {
- let desired_url = this.dataset.url;
- let current_url = window.location.href;
- history.replaceState({}, '', desired_url);
- history.replaceState({}, '', current_url);
- });
- links[i].parentElement.insertBefore(input, links[i].nextSibling);
- }
- }
- actionFunction();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement