Hello, you have come here looking for the meaning of the word
User:Erutuon/scripts/editableHeading.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word
User:Erutuon/scripts/editableHeading.js, but we will also tell you about its etymology, its characteristics and you will know how to say
User:Erutuon/scripts/editableHeading.js in singular and plural. Everything you need to know about the word
User:Erutuon/scripts/editableHeading.js you have here. The definition of the word
User:Erutuon/scripts/editableHeading.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition of
User:Erutuon/scripts/editableHeading.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
/*
Makes page name in top header editable, and usable as a search box.
This makes it easier to copy the page title, and allows you to easily
search for a modification of the page title.
Based on ], with modifications to hopefully
allow it to be used when ] is enabled.
Buggy on certain pages.
*/
mw.loader.using("mediawiki.util", function () {
var pageName = mw.config.values.wgPageName;
/* Take pagename, then
replace underscores with spaces,
escape periods and slashes,
make sure pagename is not before &,
which would indicate it is in a href attribute. */
if ( pageName && pageName.match("&") )
pageName = "&";
else
pageName = pageName.replace(/_/g, " ").replace(/()/g, "\\$1");
// Avoid finding page name inside of HTML attributes by requiring it to be
// surrounded by ends of string or spacing characters.
var pageNameRegex = new RegExp("(\\s|^)(" + mw.util.escapeRegExp(pageName) + ")(\\s|$)");
var makeEditable = function(number, text) {
return text.replace(
pageNameRegex,
'$1<span id="editable-title" contenteditable="true">$2</span>$3'
);
};
$(function () {
$("#firstHeading").html(makeEditable);
$('#editable-title').keypress(function (event) {
if(event.which === 13) { // enter key
window.location = mw.util.getUrl("", {
search: $('#editable-title').text(),
});
return false;
}
});
});
});