User:Interiot/js/RealTitle.js: Difference between revisions

Content deleted Content added
start working on the bulletproof isPasteable verification
No edit summary
Line 11:
if (realTitle) {
var isPasteable = 0;
var hadNamespace = 0;
// calculate whether the title is pasteable
Line 17 ⟶ 16:
verifyTitle = verifyTitle.replace(/ /g, "_"); // spaces to underscores
verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
alert("1. '" + verifyTitle + "'");
 
// if the namespace prefix is there, remove it on our verification copy. If it isn't there, add it to the original realValue copy.
if (wgNamespaceNumber != 0) {
if (wgCanonicalNamespace == verifyTitle.substr(0, wgCanonicalNamespace.length) && verifyTitle.charAt(wgCanonicalNamespace.length) == ":") {
hadNamespace = 1;
verifyTitle = verifyTitle.substr(wgCanonicalNamespace.length + 1);
} else {
Line 27 ⟶ 26:
}
}
alert("2a. '" + verifyTitle + "'");
alert("2b. '" + realTitle + "'");
 
// verify whether wgTitle matches
Line 32 ⟶ 33:
verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
isPasteable = (verifyTitle == wgTitle);
alert("3. '" + verifyTitle + "'");
 
var h1 = document.getElementsByTagName("h1")[0];