User:Waldyrious/autoFill.js
(Redirected from User:Waldir/autoFill.js)
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
$( document ).ready( function() {
var labelBox = $(".wb-firstHeading > span > span.wb-value > input");
// check if input box exists (means label for current language doesn't exist)
if( labelBox.length !== 0) {
// get current language
lang = mw.user.options.get("language");
// get text of current language article title
var label = $(".wb-sitelinks-link-"+lang+" > a");
// check if it exists
if(label.text() !== "") {
// set the input box
labelBox.val(label.text());
// highlight changes to remind about saving
saveBtn = $("div.wb-ui-toolbar-group > span")[0]
//TODO: make "save" change to a link
}
}
});