1mw.tools.elementEdit = function (el, textonly, callback, fieldClass) { 2 if (!el || el.querySelector('.mw-live-edit-input') !== null) { 3 return; 4 } 5 textonly = (typeof textonly === 'undefined') ? true : textonly; 6 var input = mwd.createElement('span'); 7 input.className = (fieldClass || "") + ' mw-live-edit-input mw-liveedit-field'; 8 input.contentEditable = true; 9 var $input = $(input); 10 if (textonly === true) { 11 input.innerHTML = el.textContent; 12 input.onblur = function () { 13 var val = $input.text(); 14 var ischanged = true; 15 setTimeout(function () { 16 mw.$(el).text(val); 17 if (typeof callback === 'function' && ischanged) { 18 callback.call(val, el); 19 } 20 }, 3); 21 }; 22 input.onkeydown = function (e) { 23 if (e.keyCode === 13) { 24 e.preventDefault(); 25 mw.$(el).text($input.text()); 26 if (typeof callback === 'function') { 27 callback.call($input.text(), el); 28 } 29 return false; 30 } 31 } 32 } 33 else { 34 input.innerHTML = el.innerHTML; 35 input.onblur = function () { 36 var val = this.innerHTML; 37 var ischanged = this.changed === true; 38 setTimeout(function () { 39 el.innerHTML = val; 40 if (typeof callback === 'function' && ischanged) { 41 callback.call(val, el); 42 } 43 }, 3) 44 } 45 input.onkeydown = function (e) { 46 if (e.keyCode === 13) { 47 e.preventDefault(); 48 var val = this.innerHTML; 49 el.innerHTML = val; 50 if (typeof callback === 'function') { 51 callback.call(val, el); 52 } 53 return false; 54 } 55 } 56 } 57 mw.$(el).empty().append(input); 58 $input.focus(); 59 input.changed = false; 60 $input.change(function () { 61 this.changed = true; 62 }); 63 return input; 64}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.