Deprecated: Required parameter $vars follows optional parameter $args in /home/public/f/extensions/SemanticMediaWiki/src/SetupFile.php on line 333
Warning: Private methods cannot be final as they are never overridden by other classes in /home/public/f/includes/actions/Action.php on line 69
Deprecated: Required parameter $key follows optional parameter $subject in /home/public/f/extensions/SemanticMediaWiki/src/EntityCache.php on line 213
https://www.serhii.net/f/index.php?title=Current_scripts&feed=atom&action=history
Current scripts - Revision history
2024-03-29T07:43:09Z
Revision history for this page on the wiki
MediaWiki 1.34.0
https://www.serhii.net/f/index.php?title=Current_scripts&diff=1156&oldid=prev
Pchr8: Created page with "Script one, adding links: <pre> var str = document.title; var res = str.replace("|", "-"); res = res.replace("#", "-"); res = res.replace("<", "("); res = res.replace(">", ")"..."
2017-02-18T14:46:09Z
<p>Created page with "Script one, adding links: <pre> var str = document.title; var res = str.replace("|", "-"); res = res.replace("#", "-"); res = res.replace("<", "("); res = res.replace(">", ")"..."</p>
<p><b>New page</b></p><div>Script one, adding links:<br />
<pre><br />
var str = document.title;<br />
var res = str.replace("|", "-");<br />
res = res.replace("#", "-");<br />
res = res.replace("<", "(");<br />
res = res.replace(">", ")");<br />
res = res.replace("[", "(");<br />
res = res.replace("]", ")");<br />
res = res.replace("{", "(");<br />
res = res.replace("}", ")");<br />
window.open('http://pchr8.net/f/index.php?title='+encodeURIComponent(res)+'&action=edit&preload=Template:NewLink&preloadparams[]='+encodeURIComponent(location.href)+'&preloadparams[]='+encodeURIComponent(res))<br />
<br />
javascript:var str = document.title; var res = str.replace("|", "-"); res = res.replace("#", "-"); res = res.replace("<", "("); res = res.replace(">", ")"); res = res.replace("[", "("); res = res.replace("]", ")"); res = res.replace("{", "("); res = res.replace("}", ")"); window.open('http://pchr8.net/f/index.php?title='+encodeURIComponent(res)+'&action=edit&preload=Template:NewLink&preloadparams[]='+encodeURIComponent(location.href)+'&preloadparams[]='+encodeURIComponent(res))<br />
<br />
</pre><br />
<br />
Script two, formatting:<br />
<br />
<pre><br />
<br />
var lines = '';<br />
var lines = $('#wpTextbox1').val().split('\n'); <br />
for (i=0; i<7; i++) {<br />
if (typeof lines[i] == 'undefined') {lines[i]='';}<br />
}<br />
<br />
if (!ValidURL(lines[0])) {alert(lines[0]+" doesn't look like a valid URL.")};<br />
if (lines[1]=='') {lines[1]=lines[0]};<br />
if (lines[2]=='') {lines[2]='5'};<br />
if (lines[3]=='') {lines[3]='5'};<br />
<br />
if (parseInt(lines[2]) > 10 || parseInt(lines[2])<0 || isNaN(lines[2])) {<br />
alert(lines[2]+'is not a valid value, setting to default 5');<br />
lines[2]='5';<br />
}<br />
<br />
if (parseInt(lines[3]) > 10 || parseInt(lines[3])<0 || isNaN(lines[3])) {<br />
alert(lines[3]+'is not a valid value, setting to default 5');<br />
lines[3]='5';<br />
}<br />
<br />
var keywords="\n{{#set:\n";<br />
keywords+="k=";<br />
keywords+=lines[5]; <br />
keywords+="\n|+sep=, }}\n";<br />
<br />
var categories="\n";<br />
for (i=0; i<lines.length-7; i++){<br />
categories+="[[Category: ";<br />
categories+=lines[i+7];<br />
categories+="]]\n";<br />
}<br />
<br />
var text="{{B|\n"+lines[0]+"\n|"+lines[1]+"\n|"+lines[2]+"\n|"+lines[3];<br />
if (lines[4]!='') text+="\n|"+lines[4];<br />
text+="\n}}";<br />
text+=keywords;<br />
text+=categories;<br />
<br />
var field = document.getElementById('wpTextbox1');<br />
var textArray = field.value.split("\n");<br />
textArray.splice(0, lines.length);<br />
textArray[0] = text;<br />
field.value = textArray.join("\n");<br />
<br />
<br />
function ValidURL(str) {<br />
var pattern = new RegExp('^(https?:\\/\\/)?'+<br />
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+<br />
'((\\d{1,3}\\.){3}\\d{1,3}))'+<br />
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+<br />
'(\\?[;&a-z\\d%_.~+=-]*)?'+<br />
'(\\#[-a-z\\d_]*)?$','i');<br />
return pattern.test(str);<br />
}<br />
<br />
javascript:var lines = ''; var lines = $('#wpTextbox1').val().split('\n'); for (i=0; i<7; i++) { if (typeof lines[i] == 'undefined') {lines[i]='';} } if (!ValidURL(lines[0])) {alert(lines[0]+" doesn't look like a valid URL.")}; if (lines[1]=='') {lines[1]=lines[0]}; if (lines[2]=='') {lines[2]='5'}; if (lines[3]=='') {lines[3]='5'}; if (parseInt(lines[2]) > 10 || parseInt(lines[2])<0 || isNaN(lines[2])) { alert(lines[2]+'is not a valid value, setting to default 5'); lines[2]='5'; } if (parseInt(lines[3]) > 10 || parseInt(lines[3])<0 || isNaN(lines[3])) { alert(lines[3]+'is not a valid value, setting to default 5'); lines[3]='5'; } var keywords="\n{{#set:\n"; keywords+="k="; keywords+=lines[5]; keywords+="\n|+sep=, }}\n"; var categories="\n"; for (i=0; i<lines.length-7; i++){ categories+="[[Category: "; categories+=lines[i+7]; categories+="]]\n"; } var text="{{B|\n"+lines[0]+"\n|"+lines[1]+"\n|"+lines[2]+"\n|"+lines[3]; if (lines[4]!='') text+="\n|"+lines[4]; text+="\n}}"; text+=keywords; text+=categories; var field = document.getElementById('wpTextbox1'); var textArray = field.value.split("\n"); textArray.splice(0, lines.length); textArray[0] = text; field.value = textArray.join("\n"); function ValidURL(str) { var pattern = new RegExp('^(https?:\\/\\/)?'+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+ '((\\d{1,3}\\.){3}\\d{1,3}))'+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ '(\\?[;&a-z\\d%_.~+=-]*)?'+ '(\\#[-a-z\\d_]*)?$','i'); return pattern.test(str); }<br />
<br />
<br />
</pre></div>
Pchr8