User:Dominic/LowercaseConversion.js

//   This creates a tab "u->l links" in the edit page that, when clicked, changes every first letter of a link to lowercase. // Link will become link. This may help cut down the time of transwiki cleanup, but it might generate // false positives to fix, as it is either the whole article or nothing.

function addlilink(tabs, url, name, id, title, key){ 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); tabs.appendChild(li); if(id) {       if(key && title) {           ta[id] = [key, title]; }       else if(key) {           ta[id] = [key, '']; }       else if(title) {           ta[id] = ['', title]; }   }    // re-render the title and accesskeys from existing code in wikibits.js    akeytt; return li; }

function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return addlilink(tabs, url, name, id, title, key) };

$(addLinkConvtab) function addLinkConvtab { if (document.title.indexOf('Editing ') !=0){return;} addTab("javascript:lowercase_link_starts", "U->L lnks", "ca-clinks", "Non-proper noun links", ""); }

function lowercase_link_starts { var link_reg = /\[\[([^\]])(([^\]])+)\]\]/g; document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(link_reg,non_proper_case); document.editform.wpSummary.value = 'JS: "Link" --> "link".'; }

function non_proper_case(match,f_let,rest) { f_let = f_let.toLowerCase; var string =  + f_let + rest + ; return string; }