Various JavaScript for Wiktionary:
Some bookmarklets that I use for creation of Czech entries:
javascript:rod=prompt('Rod:');eng=prompt('Anglicky:');insertTags('==Czech==\n\n===Noun===\n{{cs-noun|g='+rod+(wgTitle.match(/%20/)?'|sg=]%20]':'')+'}}\n\n#%20]\n','','');document.editform.wpSummary.value='+Czech%20noun';document.editform.wpSave.focus()
javascript:eng=prompt('Anglicky:');insertTags('==Czech==\n\n===Adjective===\n{{cs-adj}}\n\n#%20]\n','','');document.editform.wpSummary.value='+Czech%20adjective';document.editform.wpSave.focus()
javascript:eng=prompt('Anglicky:');insertTags('==Czech==\n\n===Verb===\n{{cs-verb}}\n\n#%20to%20]\n','','');document.editform.wpSummary.value='+Czech%20verb';document.editform.wpSave.focus()
javascript:eng=prompt('Anglicky:');insertTags('==Czech==\n\n===Adverb===\n{{cs-adv}}\n\n#%20]\n','','');document.editform.wpSummary.value='+Czech%20adverb';document.editform.wpSave.focus()
javascript:content=document.editform.wpTextbox1.value;content=content.replace(/(of),?(%20or%20)related(%20to)/gi,'$1$2relating$3');document.editform.wpSummary.value+='of%20or%20related%20to/of%20or%20relating%20to';document.editform.wpTextbox1.value=content;document.editform.wpSave.focus()
A bookmarkjet by JesseW from Wiktionary talk:Random page:
The same bookmarklet formatted:
javascript:void(
(function () {
/** Returns a string of random letters of the length ''n''. */
function rltr(n) {
if (n>0) {
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'+rltr(n-1);}
else {
return ""}; };
/** Processes the result of the XMLHttpRequest, setting a new URL or the page. */
function prc() {
if (req.readyState==4 && req.status==200) {
var q=req.responseXML.documentElement.getElementsByTagName("cm");
document.location="https://dictious.com/en/"+q.getAttribute("title"); }};
//
req=new XMLHttpRequest();
req.onreadystatechange=prc;
req.open("GET",
document.location.protocol + "//" + document.location.host +
"/w/api.php?action=query&list=categorymembers&cmtitle=" +
((document.location.pathname.indexOf("Category") !=-1
? document.location
: document.getElementById("catlinks").firstChild.childNodes.firstChild).pathname.replace("https://dictious.com/en/","")) +
"&cmstartsortkey=" + rltr(3) + "&cmlimit=1&format=xml",
true);
req.send(null)
})())
Issues: