FlightGear wiki:Instant-Refs: Difference between revisions

Jump to navigation Jump to search
m
→‎The Script: implement jQuery stubs for an actual setup dialog with persistent settings
m (→‎The Script: implement jQuery stubs for an actual setup dialog with persistent settings)
Line 314: Line 314:
}
}
'use strict';
'use strict';
// Define constants
 
var DEBUG = false;
 
// move DEBUG handling to a persistent configuration flag so that we can configure this using a jQuery dialog
var DEBUG = get_persistent("debug_mode_enabled",false);
 
function DEBUG_mode() {
  // reset script invocation counter for testing purposes
  dbLog("Resetting script invocation counter");
  set_persistent(GM_info.script.version,0);
}
 
if (DEBUG)
  DEBUG_mode();


// set this to true continue working on the new mode supporting
// set this to true continue working on the new mode supporting
Line 324: Line 335:
   // https://wiki.greasespot.net/GM_setValue
   // https://wiki.greasespot.net/GM_setValue
   GM_setValue(key,value);
   GM_setValue(key,value);
} //make_persistent
} //set_persistent


function get_persistent(key, default_value) {
function get_persistent(key, default_value) {
Line 423: Line 434:
  updateFormat: function() {alert("not yet implement");},
  updateFormat: function() {alert("not yet implement");},
}; // EventHandlers
}; // EventHandlers
function handleDebugMode(cb) {
  display("Debug clicked, new value = " + cb.checked);
}


// output methods (alert and jQuery for now)
// output methods (alert and jQuery for now)
Line 612: Line 627:
// Gets to correct profile
// Gets to correct profile


// show a configuration dialog (WIP)
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>');
  setupDiv.dialog();
} // setupDialog
} // setupDialog


Navigation menu