Wikipedia:Amisch.de history overview import/script.js
Erscheinungsbild
// addLink function (origin)
function addLink(where, url, name, id, title, key, after) { var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if (id) li.id = id; li.appendChild(na); var tabs = document.getElementById(where).getElementsByTagName('ul')[0]; if (after) { tabs.insertBefore(li,document.getElementById(after)); } else { tabs.appendChild(li); } if (id) { if (key && title) {ta[id] = [key, title];} else if (key) {ta[id] = [key, ];} else if (title) {ta[id] = [, title];} } akeytt(); return li; }
// HTML replace function for history overview import (partial source; *)
function replaceHistory() { var editForm = document.editform.wpTextbox1; editForm.value = editForm.value.replace(/\&\;/g, "&"); editForm.value = editForm.value.replace(/(\<\/?(input|span)[^\>]*\>|\([^\)]+\) |\&action\=edit| class\=\"new\")/g, ""); editForm.value = editForm.value.replace(/.*\<ul id\=\"pagehistory\"\>/, "== Former article versions at http://amisch.de/penn/ ==\r\n\n:Article revision date – User at amisch.de <sup>(Local user contributions)</sup> – ''(Summary)''\r\n\n<div style=\"background-color: #F8F8FF; border: 1px solid #AAAAAA; padding: 5px;\">\r\n\n"); editForm.value = editForm.value.replace(/\<li\>/g, "*"); editForm.value = editForm.value.replace(/\<a href\=\"/g, "[http://amisch.de"); editForm.value = editForm.value.replace(/\" title\=\"[^\"]+\"\>/g, " "); editForm.value = editForm.value.replace(/\<\/a\>/g, "] – "); editForm.value = editForm.value.replace(/\[http(\S+)(Benutzer\:|target\=)(\S+) ([^\]]+)\]/g, "[http$1$2$3 $4] <sup> ([[Special:Contributions/$3|$3]])</sup>"); editForm.value = editForm.value.replace(/\<\/li\>/g, "\r\n"); editForm.value = editForm.value.replace(/sup\> \ \;\&ndash\;\ \;([\r\n])/g, "sup>\r\n"); editForm.value = editForm.value.replace(/→\] \ \;\&ndash\;\ \;/g, "→] "); editForm.value = editForm.value.replace(/ \((.+)\)([\r\n])/g, " ''($1)''\r\n"); editForm.value = editForm.value.replace(/\<\/ul\>.*/, "\r\n</div>\r\n\n:Article revision date – User at amisch.de <sup>(Local user contributions)</sup> – ''(Summary)''"); document.editform.wpSummary.value = "[[Wikipedia:Amisch.de history overview import|Article history from Amisch.de/penn/]]"; } addOnloadHook(function () { var title; if (!(title = document.getElementById('t-whatlinkshere') )) return; if (!(title = title.getElementsByTagName('a')[0] )) return; if (!(title = title.href )) return; if (!(title = title.replace(/^.*\/wiki\/Spe(c|z)ial:Whatlinkshere\//, '') )) return; addLink('p-navigation', 'http://amisch.de/penn/index.php?title='+title, 'Amisch.de/penn/', 't-amisch', 'amisch.de', '', null); if (document.forms.editform) { addLink('p-cactions', 'javascript:replaceHistory()', 'HTML replacement', 'ca-replacehistory', 'HTML replace function for history overview import', '', 'ca-watch'); } }); // End of script