মিডিয়াউইকি:Gadget-TemplatePreloader.js: সংশোধিত সংস্করণের মধ্যে পার্থক্য

বিষয়বস্তু বিয়োগ হয়েছে বিষয়বস্তু যোগ হয়েছে
Phe (আলোচনা | অবদান)
whatlinkshere fix
Phe (আলোচনা | অবদান)
handle existing author
২০৪ নং লাইন:
}
}
 
 
// When creating an author page fill field. Always filled, lastname,
// firstname, lastinitial, wikipedia_link, birth/year filled if an
// article is available on wp:en. Try also to create duplicate author:
// by creating a redirect iff the wikipedia_link is non empty, its title
// is different from the current Author:title, and an Author:new_title
// exists.
function check_redirect(title, text_box)
{
var url = wgServer + wgScriptPath
+ "/api.php?format=xml&action=query&prop=info&titles="
+ encodeURIComponent(title);
var request = sajax_init_object();
request.open('GET', url, true);
request.onreadystatechange = function () {
if (request.readyState == 4) {
var xml = request.responseXML;
if (xml == null) return ;
var page = xml.getElementsByTagName( "page" )[0];
if (page.getAttribute("missing") != "")
text_box.value = '#REDIRECT [[' + title + ']]';
}
};
request.send(null);
}
 
function author_fill_cb(data)
{
২২৬ ⟶ ২৪৯ নং লাইন:
break;
}
// This can undo all the above works by preferring to create a redirect to an existing author:
check_redirect('Author:' + data.query.pages[ids].title, wpTextbox1);
}
}