Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Wikipedia Vector full-width
- // @namespace sfghjs4uzrtjhgndh
- // @description Expands Wikipedia's Vector skin's interface
- // @include https://fr.wikipedia.org/*
- // @include https://he.wikipedia.org/*
- // @include https://eu.wikipedia.org/*
- // @include https://fa.wikipedia.org/*
- // @include https://fr.wiktionary.org/*
- // @include https://pt.wikiversity.org/*
- // @include https://office.wikimedia.org/*
- // @include https://pt.wikipedia.org/*
- // @include https://tr.wikipedia.org/*
- // @include https://ko.wikipedia.org/*
- // @include https://sr.wikipedia.org/*
- // @include https://de.wikivoyage.org/*
- // @version 1.0
- // @grant none
- // ==/UserScript==
- var querystring = location.search;
- if (querystring == '') // empty
- {
- window.location.replace(window.location.href + '?useskinversion=1');
- }
- else
- {
- var query = querystring.substr(1);
- var skinset = false;
- query.split('&').forEach(function (part) {
- var item = part.split('=');
- if (decodeURIComponent(item[0]) == 'useskinversion')
- {
- skinset = decodeURIComponent(item[1]);
- }
- });
- if (!skinset)
- {
- window.location.replace(window.location.href + '&useskinversion=1');
- }
- }
- if (skinset == '1' || true) // replace the urls
- {
- var links = document.getElementsByTagName('A');
- anum = links.length;
- for (var i = 0; i < anum; i++)
- {
- var href = links[i].href;
- if (href == '' || href == null)
- continue;
- var hash = href.split('#');
- var question = hash[0].split('?');
- var final = '';
- if (question.length > 1)
- {
- var thestring = hash[0].substr(question[0].length + 1);
- var thisskinset = false;
- thestring.split('&').forEach(function (part) {
- var item = part.split('=');
- if (decodeURIComponent(item[0]) == 'useskinversion')
- {
- thisskinset = true; //decodeURIComponent(item[1]);
- }
- });
- if (thisskinset)
- {
- continue;
- }
- else
- final = hash[0] + '&useskinversion=1';
- }
- else
- final = hash[0] + '?useskinversion=1';
- if (hash.length > 1)
- final += href.substr(hash[0].length);
- links[i].href = final;
- }
- }
- // Copyright 2021 Vectorman007
- // Comments, thanks, bug reports @ https://www.mediawiki.org/wiki/User_talk:Vectorman007
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement