Content deleted Content added
PleaseStand (talk | contribs) fix SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead |
PleaseStand (talk | contribs) remove check for localStorage (now required by MW JS); don't declare undefined locally (MW no longer does this) |
||
Line 14:
*/
( function (
"use strict";
Line 38:
* @return A string value or null.
*/
get: function ( selection, fallback ) {
var value = localStorage.getItem( settings.storagePrefix + selection );
return value != null ? value : (fallback != null ? fallback : null);
Line 48:
* @param value {mixed} String value to set (null or undefined to remove).
*/
set: function ( key, value ) {
if ( value == null ) {
localStorage.removeItem( settings.storagePrefix + key );
Line 68:
* Shows the user interface for the sandbox editor.
*/
show: function () {
var textareaProps = {
Line 115:
* Called when a form field's value changes or a key is pressed.
*/
handleChange: function (event) {
// Ignore arrow keys in Firefox.
Line 129:
* Loads the contents of the sandbox editor from localStorage.
*/
loadSandbox: function () {
editor.$saveLocal.prop( "disabled", true );
editor.$enabled.prop( "checked", +storage.get( "enabled" ) );
Line 140:
* Saves the contents of the sandbox editor to localStorage.
*/
saveSandbox: function () {
editor.$saveLocal.prop( "disabled", true );
storage.set( "enabled", editor.$enabled.prop("checked") ? "1" : "0" );
Line 166:
dependencies = $.trim( storage.get("dependencies", "") ).split( /\s*,\s*/ );
mw.loader.using( "mediawiki.util", function () {
mw.util.addCSS( css );
});
mw.loader.using( dependencies[0] ? dependencies : [], function () {
$.globalEval( js + "\n//# sourceURL=localSandbox.js" );
});
Line 180:
*/
function main() {
// On the sandbox page, run the editor instead of the code in the sandbox.
Line 197 ⟶ 192:
}
mw.loader.using( editor.dependencies, function () {
$( editor.show );
});
Line 211 ⟶ 206:
main();
}
|