Uwaga: aby zobaczyć zmiany po opublikowaniu, może zajść potrzeba wyczyszczenia pamięci podręcznej przeglądarki.
- Firefox / Safari: Przytrzymaj Shift podczas klikania Odśwież bieżącą stronę, lub naciśnij klawisze Ctrl+F5, lub Ctrl+R (⌘-R na komputerze Mac)
- Google Chrome: Naciśnij Ctrl-Shift-R (⌘-Shift-R na komputerze Mac)
- Edge: Przytrzymaj Ctrl, jednocześnie klikając Odśwież, lub naciśnij klawisze Ctrl+F5.
- Opera: Naciśnij klawisze Ctrl+F5.
/** @file Odpowiedzi z linkami (Reply links with backtrack links) Opis (pl): - http://pl.wikipedia.org/wiki/Wikipedia:Narz%C4%99dzia/Odpowiedzi_z_linkami Main functions: - adding reply links near user links - inserting text given in newsectionname (as PHP param in the location string of the page) Copyright: ©2006-2011 Maciej Jaros (pl:User:Nux, en:User:EcceNux) Licencja: GNU General Public License v2 http://opensource.org/licenses/gpl-license.php @note Please keep MW 1.16 compatible (i.e. do not use mw.config) @note jQuery is required though @note Dev version contains more comments see: http://pl.wikipedia.org/wiki/Wikipedysta:Nux/replylinks.dev.js */ // EOC@line#21 if (typeof(window.oRepLinks) != 'undefined') { throw ("oRepLinks already used"); } var oRepLinks = {}; // EOC@line#30 oRepLinks.version = oRepLinks.ver = '1.6.5'; // EOC@line#36 oRepLinks.i18n = {'':'' ,'en' : {'':'' ,'std prefix' : 'Re:' ,'no section prefix' : 'Ad:' ,'reply link text' : 'reply' } ,'pl' : {'':'' ,'std prefix' : 'Odp:' ,'no section prefix' : 'Ad:' ,'reply link text' : 'odp' } }; oRepLinks.hrefOnlineIPwhois = 'http://www.ripe.net/perl/whois?form_type=simple&searchtext='; // EOC@line#55 (function($G){ $G.Lang = "en"; if (wgUserLanguage in $G.i18n) { $G.Lang = wgUserLanguage; } $G.i18n = $G.i18n[$G.Lang]; // EOC@line#72 $G.getNamespaceNames = function(namespaceNumber, encodingFunction) { var found = []; for (var id in mw.config.get('wgNamespaceIds')) { if (mw.config.get('wgNamespaceIds')[id] == namespaceNumber) { if (encodingFunction) { id = encodingFunction(id); } found.push(id); } } return found; } $G.strReHrefBase = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace('$1', '(?:' + $G.getNamespaceNames(2, encodeURIComponent).join('|') + ')') + ':'; $G.strReHrefNewBase = mw.config.get('wgServer') + mw.config.get('wgScript') + '\\?title=' + '(?:' + $G.getNamespaceNames(2, encodeURIComponent).join('|') + ')' + ':'; $G.strReHrefAnonimBase = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace('$1', encodeURIComponent(wgFormattedNamespaces[-1])) + ':(?:Contributions|Wk%C5%82ad)/'; $G.strBaseUserTalkURL = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace('$1', encodeURIComponent(wgFormattedNamespaces[3])) + ':'; // EOC@line#156 $G.autoNewSectionName = function() { // // var elInput = document.getElementById('wpTextbox1'); if (elInput) { // // var reParam = new RegExp ("&newsectionname=([^&]*)", "i"); var matches = reParam.exec(location.search); var sectxt; if (matches) { sectxt = decodeURIComponent(matches[1]); elInput.value += ';'+sectxt+'\n\n'; } // elInput = document.getElementById('wpSummary'); if (elInput) { matches = /[ ](.*)\]/.exec(sectxt); if (matches) { elInput.value += decodeURIComponent(matches[1]); } } } }; // EOC@line#195 $G.addReplyLinks = function() { // // // if (!document.getElementById('t-permalink') && !document.getElementById('t-ispermalink') ) if (wgCurRevisionId==0) { return; } // // var hrefPermalink; if (document.location.href.indexOf('&oldid=')!=-1) { hrefPermalink = document.location.href.replace(/#.+$/,''); } else { hrefPermalink = '{{fullurl:' + mw.config.get('wgPageName') + '|oldid=' + wgCurRevisionId + '}}'; } // // // var reHref = new RegExp ($G.strReHrefBase + "([^/]*)$", "i"); var reHrefNew = new RegExp ($G.strReHrefNewBase + "([^/?&]*)", "i"); var reHrefAnonim = new RegExp ($G.strReHrefAnonimBase + "([\\.0-9]*)$"); var content = document.getElementById('content'); if (!content) { content = document.getElementById('mw_content'); if (!content) { return; } } var bodyContent_id = 'bodyContent'; var bodyContent = document.getElementById(bodyContent_id); if (!bodyContent) { bodyContent = document.getElementById('mw_contentholder'); } // var secAbove = { 'id' : bodyContent_id, 'text' : $G.parseSectionText(mw.config.get('wgPageName')) }; var secReplyText = $G.i18n['no section prefix']; // var a = $G.getElementsByTagNames ('A,SPAN', bodyContent); for (var i = 0; i < a.length; i++) { // if (a[i].nodeName.toLowerCase()=='a' && a[i].href != '' && a[i].getAttribute('href').indexOf('#')==-1) { var anonimous = false; var matches = (a[i].className.indexOf('new')>=0) ? reHrefNew.exec(a[i].href) : reHref.exec(a[i].href); if (!matches) { matches = reHrefAnonim.exec(a[i].href); anonimous = true; } else if ($G.oBotToOwner[matches[1]] != undefined) { matches[1] = $G.oBotToOwner[matches[1]]; } if (matches) { // var hrefReply = $G.strBaseUserTalkURL + matches[1] + '?action=edit§ion=new'; // var newSectionName = '['+hrefPermalink+'#'+secAbove.id+' '+secReplyText+secAbove.text+']'; hrefReply += '&newsectionname=' + encodeURIComponent(newSectionName); var newEl = document.createElement('small'); var newA = document.createElement('a'); newA.setAttribute('href', hrefReply); newA.setAttribute('title', $G.i18n['std prefix']+secAbove.text); newA.appendChild(document.createTextNode('['+$G.i18n['reply link text']+']')); newEl.appendChild(newA); $G.insertAfterGivenElement(a[i],newEl); if (anonimous) { newA = document.createElement('a'); newA.setAttribute('href', $G.hrefOnlineIPwhois+matches[1]); newA.setAttribute('title', 'IP whois'); newA.appendChild(document.createTextNode('[?]')); newEl.appendChild(newA); } } } // if (a[i].nodeName.toLowerCase()=='a' && mw.config.get('wgNamespaceNumber') != 6 && a[i].id != '' && a[i].parentNode.nodeName=='P') { var header = a[i].parentNode; var found; for (found=3; found; found--) { header = header.nextSibling; if (header!=null && header.nodeType==document.ELEMENT_NODE && header.nodeName.search(/h[0-9]/i)==0) { break; } } if (found) { secAbove.id = a[i].id; secAbove.text = $G.parseSectionText(header.innerHTML); // should be set only once (as it is always the same), but let's leave it that way secReplyText = $G.i18n['std prefix']; //header.innerHTML = '['+secAbove.id+'@'+found+']→'+secAbove.text; } } // if (a[i].className=='mw-headline') { secAbove.id = a[i].id; secAbove.text = $G.parseSectionText(a[i].innerHTML); // should be set only once (as it is always the same), but let's leave it that way secReplyText = $G.i18n['std prefix']; //header.innerHTML = '['+secAbove.id+'@'+found+']→'+secAbove.text; } // if (secAbove.text.search(/^[0-9.]+ /) > -1) { var isNumbered = true; if (secAbove.id.search(/^[0-9.]+_/) > -1) { if (secAbove.text.replace(/^([0-9. ]+) .*/, '$1').length == secAbove.id.replace(/^([0-9._]+)_.*/, '$1').length) { isNumbered = false; } } if (isNumbered) { secAbove.text = secAbove.text.replace(/^[0-9.]+ (.*)/, '$1'); } } } }; // EOC@line#371 $G.insertAfterGivenElement = function (el, newEl) { if (el.nextSibling) { el.parentNode.insertBefore(newEl, el.nextSibling); } else { el.parentNode.appendChild(newEl); } }; // EOC@line#392 $G.parseSectionText = function (html) { html = html.replace(/<\S[^<>]*>/g, ''); html = html.replace(/\[[^\]]*\]/,''); html = html.replace(/[\{\}]/g,''); html = html.replace(/[ \t]*$/,'').replace(/^[ \t]*/,''); return html; }; // EOC@line#416 $G.getElementsByTagNames = function (list, obj) { // for some reason sourceIndex doesn't work in Opera when NOT in debug mode (returns -1)... var resultArray = new Array(); $(list, obj).each(function(){ resultArray.push(this); }) return resultArray; }; if (mw.config.get('wgAction')=='edit' && mw.config.get('wgCanonicalNamespace')=='User_talk') { $($G.autoNewSectionName); } if (mw.config.get('wgAction')!='edit' && mw.config.get('wgAction')!='submit') { $($G.addReplyLinks); } // EOC@line#444 })(oRepLinks);