20,741
edits
m (→The Script: change the event handler to actually store checkbox changes persistently) |
m (→The Script: change the setupDialog logic so that the persistent debug flag is used to update the checkbox's checked attribute) |
||
| Line 273: | Line 273: | ||
{{Note|Anybody interested in contributing to the code is invited to directly edit this wiki article. As of 05/2016, the script is in the process of being hosted separately, so that scripts can auto-update. If you'd like to see your changes applied, please bump the version number. Any changes addded below, will be reviewed/integrated manually and then uploaded so that clients receive updates automatically.}} | {{Note|Anybody interested in contributing to the code is invited to directly edit this wiki article. As of 05/2016, the script is in the process of being hosted separately, so that scripts can auto-update. If you'd like to see your changes applied, please bump the version number. Any changes addded below, will be reviewed/integrated manually and then uploaded so that clients receive updates automatically.}} | ||
<syntaxhighlight lang="javascript" enclose="div"> | <syntaxhighlight lang="javascript" enclose="div">// ==UserScript== | ||
// ==UserScript== | |||
// @name Instant-Cquotes | // @name Instant-Cquotes | ||
// @version 0.30 | // @version 0.30 | ||
| Line 438: | Line 437: | ||
function handleDebugMode(cb) { | function handleDebugMode(cb) { | ||
display("Debug clicked, new value = " + cb.checked); | display("Debug clicked, new value = " + cb.checked); | ||
set_persistent("debug_mode_enabled",cb.checked); | // serialize debug flag | ||
set_persistent("debug_mode_enabled", cb.checked); | |||
} | } | ||
| Line 597: | Line 597: | ||
field = { | field = { | ||
}; | }; | ||
try { | try { | ||
var post_id = getPostId(selection, profile); | var post_id = getPostId(selection, profile); | ||
| Line 633: | Line 634: | ||
function setupDialog() { | function setupDialog() { | ||
//alert("configuration dialog is not yet implemented"); | //alert("configuration dialog is not yet implemented"); | ||
var setupDiv = $('<div id="dialog" title="Setup dialog">configuration dialog is not yet implemented</p><label><input type="checkbox">Enable Debug mode</label></div>'); | var checked = (get_persistent("debug_mode_enabled",false)==true) ? 'checked': ''; | ||
dbLog("persistent debug flag is:"+checked); | |||
var setupDiv = $('<div id="dialog" title="Setup dialog">configuration dialog is not yet implemented</p><label><input type="checkbox"'+checked+'>Enable Debug mode</label></div>'); | |||
setupDiv.dialog(); | setupDiv.dialog(); | ||
} // setupDialog | } // setupDialog | ||