User:PleaseStand/userScriptSandbox.js: Difference between revisions

Content deleted Content added
m debug storage and change prefix
m wrap > wrapAll. wrap copies the nodes we are trying to attach event handlers to.
Line 39:
*/
get: function( selection, fallback ) {
console.log( "[get] selection:" + selection + " fallback:" + fallback );
var value = localStorage.getItem( settings.storagePrefix + selection );
return value != null ? value : (fallback != null ? fallback : null);
Line 50 ⟶ 49:
*/
set: function( key, value ) {
console.log( "[set] key:" + key + " value:" + value );
if ( value == null ) {
localStorage.removeItem( settings.storagePrefix + key );
Line 91 ⟶ 89:
// Modifications to wiki page
$("#sandbox-enabled-placeholder").replaceWith( editor.$enabled );
$("#sandbox-enabled-label").wrapwrapAll("<label for='sandbox-enabled'></label>");
$("#sandbox-dependencies-label").wrapwrapAll("<label for='sandbox-dependencies'></label>");
$("#sandbox-dependencies-placeholder").replaceWith( editor.$dependencies );
$("#sandbox-tabs").tabs();
$("#sandbox-js-area-placeholder").replaceWith( editor.$jsArea );
$("#sandbox-css-area-placeholder").replaceWith( editor.$cssArea );
$("#sandbox-save-local-text").wrapwrapAll( editor.$saveLocal );
// Event handling functions