Gebruiker:Pynappel/Ruim skakels op: Verskil tussen weergawes
Content deleted Content added
No edit summary |
No edit summary |
||
Lyn 1: | Lyn 1: | ||
# Indien jy nog nie het nie, plaas 'n boekmerk in jou webblaaier met <code>javascript:</code> gevolg deur die bronkode hieronder in die URL-veld |
|||
# Besoek 'n bladsy wat jy wil opruim en klik op "Wysig bron" |
|||
# Klik op die boekmerk |
|||
<source lang="js"> |
<source lang="js"> |
||
(function() { |
(function() { |
Wysiging soos op 15:17, 22 Junie 2019
- Indien jy nog nie het nie, plaas 'n boekmerk in jou webblaaier met
javascript:
gevolg deur die bronkode hieronder in die URL-veld - Besoek 'n bladsy wat jy wil opruim en klik op "Wysig bron"
- Klik op die boekmerk
(function() {
var pageText = document.getElementById('wpTextbox1').value;
var links = pageText.match(/\[\[([^\]\|]+)\|([^\]\|]+)\]\]/gm);
var $textbox = $( '#wpTextbox1' );
links.forEach(link => {
var parts = link.split('|');
var part1 = parts[0].substring(2);
var part2 = parts[1].substring(0, parts[1].length-2);
if (part1.toLowerCase() == part2.toLowerCase().substring(0, part1.length)) {
var suffix = part2.substring(part1.length);
if (suffix.substring(0, 1) != '-') {
var old = '[[' + part1 + '|' + part2 + ']]';
var _new = '[[' + part2.substring(0, part1.length) + ']]' + suffix;
pageText = pageText.replace(old, _new);
}
};
});
$textbox.textSelection( 'setContents', pageText );
document.getElementById('wpSummary').value = '[[Gebruiker:K175/Ruim skakels op|Ruim skakels op]]';
document.evaluate('//*[@id="wpDiff"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();
})();