rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
this.menu2 = document.getElementById("userscript-commands-sb2"); this.menuPopup2 = this.menu2.firstChild; this.menuItems2 = [];
function GM_MenuCommander() { GM_log("> GM_MenuCommander") this.menu = document.getElementById("userscript-commands-sb"); this.keyset = document.getElementById("mainKeyset"); this.menuPopup = this.menu.firstChild; this.menuItems = []; this.keys = []; this.attached = false; GM_log("< GM_MenuCommander")}
function GM_MenuCommander() {
function GM_MenuCommander(contentWindow) {
function GM_MenuCommander() { GM_log("> GM_MenuCommander") this.menu = document.getElementById("userscript-commands"); this.keyset = document.getElementById("mainKeyset"); this.menuPopup = this.menu.firstChild; this.menuItems = []; this.keys = []; this.attached = false; GM_log("< GM_MenuCommander")}
this.contentWindow = contentWindow;
function GM_MenuCommander() { GM_log("> GM_MenuCommander") this.menu = document.getElementById("userscript-commands"); this.keyset = document.getElementById("mainKeyset"); this.menuPopup = this.menu.firstChild; this.menuItems = []; this.keys = []; this.attached = false; GM_log("< GM_MenuCommander")}
this.contentWindow = contentWindow;
function GM_MenuCommander(contentWindow) { GM_log("> GM_MenuCommander") this.menu = document.getElementById("userscript-commands"); this.keyset = document.getElementById("mainKeyset"); this.menuPopup = this.menu.firstChild; this.contentWindow = contentWindow; this.menuItems = []; this.keys = []; this.attached = false; GM_log("< GM_MenuCommander")}
if (oldScriptsDir.exists()) {
if (oldScriptsDir.exists() && oldConfigFile.exists()) {
function GM_pointFourMigrate() { GM_log("> GM_pointFourMigrate"); try { // the following code was copied directly from the old getContentDir() and // getScriptsDir() functions var profDir = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("ProfD", Components.interfaces.nsILocalFile); var contentDir = getContentDir(); var newScriptsDir = getScriptDir(); var newConfigFile = getScriptFile("config.xml"); var oldScriptsDir = contentDir.clone(); oldScriptsDir.append("scripts"); var defaultConfigFile = getContentDir(); defaultConfigFile.append("default-config.xml"); GM_log("old scripts dir exists: " + oldScriptsDir.exists()); GM_log("new scripts dir exists: " + newScriptsDir.exists()); if (oldScriptsDir.exists()) { if (!newScriptsDir.exists()) { oldScriptsDir.moveTo(newScriptsDir.parent, newScriptsDir.leafName); } } else { if (!newScriptsDir.exists()) { newScriptsDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); } GM_log("new config file exists: " + newConfigFile.exists()); if (!newConfigFile.exists()) { defaultConfigFile.copyTo(newConfigFile.parent, newConfigFile.leafName); defaultConfigFile.permissions = 0644; } } } catch (e) { alert("Could not complete Greasemonkey 0.4 migration. Error:\n\n" + e); throw e; } finally { GM_log("< GM_pointFourMigrate"); }}
GM_log("new config file exists: " + newConfigFile.exists());
function GM_pointFourMigrate() { GM_log("> GM_pointFourMigrate"); try { // the following code was copied directly from the old getContentDir() and // getScriptsDir() functions var profDir = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("ProfD", Components.interfaces.nsILocalFile); var contentDir = getContentDir(); var newScriptsDir = getScriptDir(); var newConfigFile = getScriptFile("config.xml"); var oldScriptsDir = contentDir.clone(); oldScriptsDir.append("scripts"); var defaultConfigFile = getContentDir(); defaultConfigFile.append("default-config.xml"); GM_log("old scripts dir exists: " + oldScriptsDir.exists()); GM_log("new scripts dir exists: " + newScriptsDir.exists()); GM_log("new config file exists: " + newConfigFile.exists()); if (oldScriptsDir.exists()) { if (!newScriptDir.exists()) { oldScriptsDir.moveTo(newScriptDir.parent); } } else { if (!newScriptsDir.exists()) { newScriptsDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0644); } if (!newConfigFile.exists()) { defaultConfigFile.copyTo(newConfigFile.parent, newConfigFile.leafName); defaultConfigFile.permissions = 0644; } } } catch (e) { alert("Could not complete Greasemonkey 0.4 migration. See JS Console " + "for error details."); throw e; } finally { GM_log("< GM_pointFourMigrate"); }}
if (!newScriptDir.exists()) { oldScriptsDir.moveTo(newScriptDir.parent);
if (!newScriptsDir.exists()) { oldScriptsDir.moveTo(newScriptsDir.parent, newScriptsDir.leafName);
function GM_pointFourMigrate() { GM_log("> GM_pointFourMigrate"); try { // the following code was copied directly from the old getContentDir() and // getScriptsDir() functions var profDir = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("ProfD", Components.interfaces.nsILocalFile); var contentDir = getContentDir(); var newScriptsDir = getScriptDir(); var newConfigFile = getScriptFile("config.xml"); var oldScriptsDir = contentDir.clone(); oldScriptsDir.append("scripts"); var defaultConfigFile = getContentDir(); defaultConfigFile.append("default-config.xml"); GM_log("old scripts dir exists: " + oldScriptsDir.exists()); GM_log("new scripts dir exists: " + newScriptsDir.exists()); GM_log("new config file exists: " + newConfigFile.exists()); if (oldScriptsDir.exists()) { if (!newScriptDir.exists()) { oldScriptsDir.moveTo(newScriptDir.parent); } } else { if (!newScriptsDir.exists()) { newScriptsDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0644); } if (!newConfigFile.exists()) { defaultConfigFile.copyTo(newConfigFile.parent, newConfigFile.leafName); defaultConfigFile.permissions = 0644; } } } catch (e) { alert("Could not complete Greasemonkey 0.4 migration. See JS Console " + "for error details."); throw e; } finally { GM_log("< GM_pointFourMigrate"); }}
alert("Could not complete Greasemonkey 0.4 migration. See JS Console " + "for error details.");
alert("Could not complete Greasemonkey 0.4 migration. Error:\n\n" + e);
function GM_pointFourMigrate() { GM_log("> GM_pointFourMigrate"); try { // the following code was copied directly from the old getContentDir() and // getScriptsDir() functions var profDir = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("ProfD", Components.interfaces.nsILocalFile); var contentDir = getContentDir(); var newScriptsDir = getScriptDir(); var newConfigFile = getScriptFile("config.xml"); var oldScriptsDir = contentDir.clone(); oldScriptsDir.append("scripts"); var defaultConfigFile = getContentDir(); defaultConfigFile.append("default-config.xml"); GM_log("old scripts dir exists: " + oldScriptsDir.exists()); GM_log("new scripts dir exists: " + newScriptsDir.exists()); GM_log("new config file exists: " + newConfigFile.exists()); if (oldScriptsDir.exists()) { if (!newScriptDir.exists()) { oldScriptsDir.moveTo(newScriptDir.parent); } } else { if (!newScriptsDir.exists()) { newScriptsDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0644); } if (!newConfigFile.exists()) { defaultConfigFile.copyTo(newConfigFile.parent, newConfigFile.leafName); defaultConfigFile.permissions = 0644; } } } catch (e) { alert("Could not complete Greasemonkey 0.4 migration. See JS Console " + "for error details."); throw e; } finally { GM_log("< GM_pointFourMigrate"); }}
oldScriptsDir.moveTo(newScriptsDir.parent, newScriptsDir.leafName);
oldScriptsDir.copyTo(newScriptsDir.parent, newScriptsDir.leafName); try { } catch (e) { }
function GM_pointFourMigrate() { GM_log("> GM_pointFourMigrate"); try { // the following code was copied directly from the old getContentDir() and // getScriptsDir() functions var profDir = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("ProfD", Components.interfaces.nsILocalFile); var contentDir = getContentDir(); var newScriptsDir = getScriptDir(); var newConfigFile = getScriptFile("config.xml"); var oldScriptsDir = contentDir.clone(); oldScriptsDir.append("scripts"); var oldConfigFile = oldScriptsDir.clone(); oldConfigFile.append("config.xml"); var defaultConfigFile = getContentDir(); defaultConfigFile.append("default-config.xml"); GM_log("old scripts dir exists: " + oldScriptsDir.exists()); GM_log("old config file exists: " + oldConfigFile.exists()); GM_log("new scripts dir exists: " + newScriptsDir.exists()); if (oldScriptsDir.exists() && oldConfigFile.exists()) { if (!newScriptsDir.exists()) { oldScriptsDir.moveTo(newScriptsDir.parent, newScriptsDir.leafName); } } else { if (!newScriptsDir.exists()) { newScriptsDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); } GM_log("new config file exists: " + newConfigFile.exists()); if (!newConfigFile.exists()) { defaultConfigFile.copyTo(newConfigFile.parent, newConfigFile.leafName); defaultConfigFile.permissions = 0644; } } } catch (e) { alert("Could not complete Greasemonkey 0.4 migration. Error:\n\n" + e); throw e; } finally { GM_log("< GM_pointFourMigrate"); }}
if (!getScriptFile("config.xml").exists()) {
var configExists = GM_getPointThreeScriptFile("config.xml").exists(); GM_log("config file exists: " + configExists); if (!configExists) {
function GM_pointThreeMigrate() { // check to see whether there's any config to migrate if (!getScriptFile("config.xml").exists()) { return; } GM_log("Starting 0.3 migration..."); // back up the config directory // if an error happens, report it and exit try { var scriptDir = getScriptDir(); var tempDir = getTempFile(); GM_log("script dir: " + scriptDir.path); GM_log("temp dir: " + tempDir.path); scriptDir.copyTo(tempDir.parent, tempDir.leafName); // update the format of the config.xml file and move each file var script = null; var scriptFile = null; var doc = document.implementation.createDocument("", "", null); // first, load config.xml raw and add the new required filename attribute doc.async = false; doc.load(getScriptChrome("config.xml")); GM_log("loaded existing config..."); var nodes = document.evaluate("/UserScriptConfig/Script", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var node; for (var i = 0; (node = nodes.snapshotItem(i)); i++) { if (node.hasAttribute("id")) { node.setAttribute("filename", node.getAttribute("id")); } } // save the config file var configStream = getWriteStream(getScriptFile("config.xml")); new XMLSerializer().serializeToStream(doc, configStream, "utf-8"); configStream.close(); GM_log("config saved.") // now, load config normally and reinitialize all scripts's filenames var config = new Config(); config.load(); GM_log("config reloaded, moving files."); for (var i = 0; (script = config.scripts[i]); i++) { if (script.filename.match(/^\d+$/)) { scriptFile = getScriptFile(script.filename); config.initFilename(script); GM_log("renaming script " + scriptFile.leafName + " to " + script.filename); scriptFile.moveTo(scriptFile.parent, script.filename); } } GM_log("moving complete. saving configuration.") // save the config file config.save(); GM_log("0.3 migration completed successfully!") } catch (e) { alert("Could not complete Greasemonkey 0.3 migration. Some changes may " + "have been made to your scripts directory. See JS Console for " + "error details.\n\nA backup of your old scripts directory is at: " + tempDir.path); throw e; }}
GM_log("Starting 0.3 migration...");
function GM_pointThreeMigrate() { // check to see whether there's any config to migrate if (!getScriptFile("config.xml").exists()) { return; } GM_log("Starting 0.3 migration..."); // back up the config directory // if an error happens, report it and exit try { var scriptDir = getScriptDir(); var tempDir = getTempFile(); GM_log("script dir: " + scriptDir.path); GM_log("temp dir: " + tempDir.path); scriptDir.copyTo(tempDir.parent, tempDir.leafName); // update the format of the config.xml file and move each file var script = null; var scriptFile = null; var doc = document.implementation.createDocument("", "", null); // first, load config.xml raw and add the new required filename attribute doc.async = false; doc.load(getScriptChrome("config.xml")); GM_log("loaded existing config..."); var nodes = document.evaluate("/UserScriptConfig/Script", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var node; for (var i = 0; (node = nodes.snapshotItem(i)); i++) { if (node.hasAttribute("id")) { node.setAttribute("filename", node.getAttribute("id")); } } // save the config file var configStream = getWriteStream(getScriptFile("config.xml")); new XMLSerializer().serializeToStream(doc, configStream, "utf-8"); configStream.close(); GM_log("config saved.") // now, load config normally and reinitialize all scripts's filenames var config = new Config(); config.load(); GM_log("config reloaded, moving files."); for (var i = 0; (script = config.scripts[i]); i++) { if (script.filename.match(/^\d+$/)) { scriptFile = getScriptFile(script.filename); config.initFilename(script); GM_log("renaming script " + scriptFile.leafName + " to " + script.filename); scriptFile.moveTo(scriptFile.parent, script.filename); } } GM_log("moving complete. saving configuration.") // save the config file config.save(); GM_log("0.3 migration completed successfully!") } catch (e) { alert("Could not complete Greasemonkey 0.3 migration. Some changes may " + "have been made to your scripts directory. See JS Console for " + "error details.\n\nA backup of your old scripts directory is at: " + tempDir.path); throw e; }}
var scriptDir = getScriptDir();
var scriptDir = GM_getPointThreeScriptDir();
function GM_pointThreeMigrate() { // check to see whether there's any config to migrate if (!getScriptFile("config.xml").exists()) { return; } GM_log("Starting 0.3 migration..."); // back up the config directory // if an error happens, report it and exit try { var scriptDir = getScriptDir(); var tempDir = getTempFile(); GM_log("script dir: " + scriptDir.path); GM_log("temp dir: " + tempDir.path); scriptDir.copyTo(tempDir.parent, tempDir.leafName); // update the format of the config.xml file and move each file var script = null; var scriptFile = null; var doc = document.implementation.createDocument("", "", null); // first, load config.xml raw and add the new required filename attribute doc.async = false; doc.load(getScriptChrome("config.xml")); GM_log("loaded existing config..."); var nodes = document.evaluate("/UserScriptConfig/Script", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var node; for (var i = 0; (node = nodes.snapshotItem(i)); i++) { if (node.hasAttribute("id")) { node.setAttribute("filename", node.getAttribute("id")); } } // save the config file var configStream = getWriteStream(getScriptFile("config.xml")); new XMLSerializer().serializeToStream(doc, configStream, "utf-8"); configStream.close(); GM_log("config saved.") // now, load config normally and reinitialize all scripts's filenames var config = new Config(); config.load(); GM_log("config reloaded, moving files."); for (var i = 0; (script = config.scripts[i]); i++) { if (script.filename.match(/^\d+$/)) { scriptFile = getScriptFile(script.filename); config.initFilename(script); GM_log("renaming script " + scriptFile.leafName + " to " + script.filename); scriptFile.moveTo(scriptFile.parent, script.filename); } } GM_log("moving complete. saving configuration.") // save the config file config.save(); GM_log("0.3 migration completed successfully!") } catch (e) { alert("Could not complete Greasemonkey 0.3 migration. Some changes may " + "have been made to your scripts directory. See JS Console for " + "error details.\n\nA backup of your old scripts directory is at: " + tempDir.path); throw e; }}
doc.load(getScriptChrome("config.xml"));
doc.load(configURI.spec);
function GM_pointThreeMigrate() { // check to see whether there's any config to migrate if (!getScriptFile("config.xml").exists()) { return; } GM_log("Starting 0.3 migration..."); // back up the config directory // if an error happens, report it and exit try { var scriptDir = getScriptDir(); var tempDir = getTempFile(); GM_log("script dir: " + scriptDir.path); GM_log("temp dir: " + tempDir.path); scriptDir.copyTo(tempDir.parent, tempDir.leafName); // update the format of the config.xml file and move each file var script = null; var scriptFile = null; var doc = document.implementation.createDocument("", "", null); // first, load config.xml raw and add the new required filename attribute doc.async = false; doc.load(getScriptChrome("config.xml")); GM_log("loaded existing config..."); var nodes = document.evaluate("/UserScriptConfig/Script", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var node; for (var i = 0; (node = nodes.snapshotItem(i)); i++) { if (node.hasAttribute("id")) { node.setAttribute("filename", node.getAttribute("id")); } } // save the config file var configStream = getWriteStream(getScriptFile("config.xml")); new XMLSerializer().serializeToStream(doc, configStream, "utf-8"); configStream.close(); GM_log("config saved.") // now, load config normally and reinitialize all scripts's filenames var config = new Config(); config.load(); GM_log("config reloaded, moving files."); for (var i = 0; (script = config.scripts[i]); i++) { if (script.filename.match(/^\d+$/)) { scriptFile = getScriptFile(script.filename); config.initFilename(script); GM_log("renaming script " + scriptFile.leafName + " to " + script.filename); scriptFile.moveTo(scriptFile.parent, script.filename); } } GM_log("moving complete. saving configuration.") // save the config file config.save(); GM_log("0.3 migration completed successfully!") } catch (e) { alert("Could not complete Greasemonkey 0.3 migration. Some changes may " + "have been made to your scripts directory. See JS Console for " + "error details.\n\nA backup of your old scripts directory is at: " + tempDir.path); throw e; }}
var configStream = getWriteStream(getScriptFile("config.xml"));
var configStream = getWriteStream(configFile);
function GM_pointThreeMigrate() { // check to see whether there's any config to migrate if (!getScriptFile("config.xml").exists()) { return; } GM_log("Starting 0.3 migration..."); // back up the config directory // if an error happens, report it and exit try { var scriptDir = getScriptDir(); var tempDir = getTempFile(); GM_log("script dir: " + scriptDir.path); GM_log("temp dir: " + tempDir.path); scriptDir.copyTo(tempDir.parent, tempDir.leafName); // update the format of the config.xml file and move each file var script = null; var scriptFile = null; var doc = document.implementation.createDocument("", "", null); // first, load config.xml raw and add the new required filename attribute doc.async = false; doc.load(getScriptChrome("config.xml")); GM_log("loaded existing config..."); var nodes = document.evaluate("/UserScriptConfig/Script", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var node; for (var i = 0; (node = nodes.snapshotItem(i)); i++) { if (node.hasAttribute("id")) { node.setAttribute("filename", node.getAttribute("id")); } } // save the config file var configStream = getWriteStream(getScriptFile("config.xml")); new XMLSerializer().serializeToStream(doc, configStream, "utf-8"); configStream.close(); GM_log("config saved.") // now, load config normally and reinitialize all scripts's filenames var config = new Config(); config.load(); GM_log("config reloaded, moving files."); for (var i = 0; (script = config.scripts[i]); i++) { if (script.filename.match(/^\d+$/)) { scriptFile = getScriptFile(script.filename); config.initFilename(script); GM_log("renaming script " + scriptFile.leafName + " to " + script.filename); scriptFile.moveTo(scriptFile.parent, script.filename); } } GM_log("moving complete. saving configuration.") // save the config file config.save(); GM_log("0.3 migration completed successfully!") } catch (e) { alert("Could not complete Greasemonkey 0.3 migration. Some changes may " + "have been made to your scripts directory. See JS Console for " + "error details.\n\nA backup of your old scripts directory is at: " + tempDir.path); throw e; }}
var config = new Config();
var config = new Config(GM_getPointThreeScriptFile("config.xml"));
function GM_pointThreeMigrate() { // check to see whether there's any config to migrate if (!getScriptFile("config.xml").exists()) { return; } GM_log("Starting 0.3 migration..."); // back up the config directory // if an error happens, report it and exit try { var scriptDir = getScriptDir(); var tempDir = getTempFile(); GM_log("script dir: " + scriptDir.path); GM_log("temp dir: " + tempDir.path); scriptDir.copyTo(tempDir.parent, tempDir.leafName); // update the format of the config.xml file and move each file var script = null; var scriptFile = null; var doc = document.implementation.createDocument("", "", null); // first, load config.xml raw and add the new required filename attribute doc.async = false; doc.load(getScriptChrome("config.xml")); GM_log("loaded existing config..."); var nodes = document.evaluate("/UserScriptConfig/Script", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var node; for (var i = 0; (node = nodes.snapshotItem(i)); i++) { if (node.hasAttribute("id")) { node.setAttribute("filename", node.getAttribute("id")); } } // save the config file var configStream = getWriteStream(getScriptFile("config.xml")); new XMLSerializer().serializeToStream(doc, configStream, "utf-8"); configStream.close(); GM_log("config saved.") // now, load config normally and reinitialize all scripts's filenames var config = new Config(); config.load(); GM_log("config reloaded, moving files."); for (var i = 0; (script = config.scripts[i]); i++) { if (script.filename.match(/^\d+$/)) { scriptFile = getScriptFile(script.filename); config.initFilename(script); GM_log("renaming script " + scriptFile.leafName + " to " + script.filename); scriptFile.moveTo(scriptFile.parent, script.filename); } } GM_log("moving complete. saving configuration.") // save the config file config.save(); GM_log("0.3 migration completed successfully!") } catch (e) { alert("Could not complete Greasemonkey 0.3 migration. Some changes may " + "have been made to your scripts directory. See JS Console for " + "error details.\n\nA backup of your old scripts directory is at: " + tempDir.path); throw e; }}
scriptFile = getScriptFile(script.filename);
scriptFile = GM_getPointThreeScriptFile(script.filename);
function GM_pointThreeMigrate() { // check to see whether there's any config to migrate if (!getScriptFile("config.xml").exists()) { return; } GM_log("Starting 0.3 migration..."); // back up the config directory // if an error happens, report it and exit try { var scriptDir = getScriptDir(); var tempDir = getTempFile(); GM_log("script dir: " + scriptDir.path); GM_log("temp dir: " + tempDir.path); scriptDir.copyTo(tempDir.parent, tempDir.leafName); // update the format of the config.xml file and move each file var script = null; var scriptFile = null; var doc = document.implementation.createDocument("", "", null); // first, load config.xml raw and add the new required filename attribute doc.async = false; doc.load(getScriptChrome("config.xml")); GM_log("loaded existing config..."); var nodes = document.evaluate("/UserScriptConfig/Script", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var node; for (var i = 0; (node = nodes.snapshotItem(i)); i++) { if (node.hasAttribute("id")) { node.setAttribute("filename", node.getAttribute("id")); } } // save the config file var configStream = getWriteStream(getScriptFile("config.xml")); new XMLSerializer().serializeToStream(doc, configStream, "utf-8"); configStream.close(); GM_log("config saved.") // now, load config normally and reinitialize all scripts's filenames var config = new Config(); config.load(); GM_log("config reloaded, moving files."); for (var i = 0; (script = config.scripts[i]); i++) { if (script.filename.match(/^\d+$/)) { scriptFile = getScriptFile(script.filename); config.initFilename(script); GM_log("renaming script " + scriptFile.leafName + " to " + script.filename); scriptFile.moveTo(scriptFile.parent, script.filename); } } GM_log("moving complete. saving configuration.") // save the config file config.save(); GM_log("0.3 migration completed successfully!") } catch (e) { alert("Could not complete Greasemonkey 0.3 migration. Some changes may " + "have been made to your scripts directory. See JS Console for " + "error details.\n\nA backup of your old scripts directory is at: " + tempDir.path); throw e; }}
} finally { GM_log("< GM_pointThreeMigrate");
function GM_pointThreeMigrate() { // check to see whether there's any config to migrate if (!getScriptFile("config.xml").exists()) { return; } GM_log("Starting 0.3 migration..."); // back up the config directory // if an error happens, report it and exit try { var scriptDir = getScriptDir(); var tempDir = getTempFile(); GM_log("script dir: " + scriptDir.path); GM_log("temp dir: " + tempDir.path); scriptDir.copyTo(tempDir.parent, tempDir.leafName); // update the format of the config.xml file and move each file var script = null; var scriptFile = null; var doc = document.implementation.createDocument("", "", null); // first, load config.xml raw and add the new required filename attribute doc.async = false; doc.load(getScriptChrome("config.xml")); GM_log("loaded existing config..."); var nodes = document.evaluate("/UserScriptConfig/Script", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var node; for (var i = 0; (node = nodes.snapshotItem(i)); i++) { if (node.hasAttribute("id")) { node.setAttribute("filename", node.getAttribute("id")); } } // save the config file var configStream = getWriteStream(getScriptFile("config.xml")); new XMLSerializer().serializeToStream(doc, configStream, "utf-8"); configStream.close(); GM_log("config saved.") // now, load config normally and reinitialize all scripts's filenames var config = new Config(); config.load(); GM_log("config reloaded, moving files."); for (var i = 0; (script = config.scripts[i]); i++) { if (script.filename.match(/^\d+$/)) { scriptFile = getScriptFile(script.filename); config.initFilename(script); GM_log("renaming script " + scriptFile.leafName + " to " + script.filename); scriptFile.moveTo(scriptFile.parent, script.filename); } } GM_log("moving complete. saving configuration.") // save the config file config.save(); GM_log("0.3 migration completed successfully!") } catch (e) { alert("Could not complete Greasemonkey 0.3 migration. Some changes may " + "have been made to your scripts directory. See JS Console for " + "error details.\n\nA backup of your old scripts directory is at: " + tempDir.path); throw e; }}
registerMenuCommand(docId, commandName, commandCallback, accel, access);
registerMenuCommand(docId, commandName, commandCallback, accel, access, e.explicitOriginalTarget.defaultView);
e.explicitOriginalTarget.defaultView.GM_registerMenuCommand = function(commandName, commandCallback, accel, access) { registerMenuCommand(docId, commandName, commandCallback, accel, access); };
document.GM_registerMenuCommand =
e.view.GM_registerMenuCommand =
document.GM_registerMenuCommand = function(commandName, commandCallback) { registerMenuCommand(docId, commandName, commandCallback); };
function(commandName, commandCallback) { registerMenuCommand(docId, commandName, commandCallback);
function(commandName, commandCallback, accel, access) { registerMenuCommand(docId, commandName, commandCallback, accel, access);
e.explicitOriginalTarget.defaultView.GM_registerMenuCommand = function(commandName, commandCallback) { registerMenuCommand(docId, commandName, commandCallback); };
var namespace = script.namespace; if (namespace.substring(namespace.length - 1) != "/") { namespace += "/"; }
function GM_ScriptStorage(script) { var namespace = script.namespace; if (namespace.substring(namespace.length - 1) != "/") { namespace += "/"; } this.prefMan = new GM_PrefManager(["scriptvals.", namespace, "/", script.name, "."].join(""));}
namespace,
script.namespace,
function GM_ScriptStorage(script) { var namespace = script.namespace; if (namespace.substring(namespace.length - 1) != "/") { namespace += "/"; } this.prefMan = new GM_PrefManager(["scriptvals.", namespace, "/", script.name, "."].join(""));}
var foundScript = false;
var foundInjectedScript = false;
function GM_showPopup(aEvent) { var config = new Config(getScriptFile("config.xml")); config.load(); var popup = aEvent.target; var url = getBrowser().contentWindow.document.location.href; // set the enabled/disabled state GM_BrowserUI.statusEnabledItem.setAttribute("checked", GM_getEnabled()); // remove all the scripts from the list for (var i = popup.childNodes.length - 1; i >= 0; i--) { if (popup.childNodes[i].hasAttribute("value")) { popup.removeChild(popup.childNodes[i]); } } var foundScript = false; // build the new list of scripts for (var i = 0, script = null; script = config.scripts[i]; i++) { incloop: for (var j = 0; j < script.includes.length; j++) { var pattern = convert2RegExp(script.includes[j]); if (pattern.test(url)) { for (var k = 0; k < script.excludes.length; k++) { pattern = convert2RegExp(script.excludes[k]); if (pattern.test(url)) { break incloop; } } foundInjectedScript = true; var mi = document.createElement('menuitem'); mi.setAttribute('label', script.name); mi.setAttribute('value', i); mi.setAttribute('type', 'checkbox'); mi.setAttribute('checked', script.enabled.toString()); popup.insertBefore(mi, document.getElementById("gm-status-no-scripts-sep")); break incloop; } } } document.getElementById("gm-status-no-scripts").collapsed = foundInjectedScript;}
.getService(Components.interfaces.nsIExtensionManager);
if( extensionManager ) { extensionManager = extensionManager.getService(Components.interfaces.nsIExtensionManager);
function GM_updateVersion(prefMan) { var extensionManager = Components.classes["@mozilla.org/extensions/manager;1"] .getService(Components.interfaces.nsIExtensionManager); // get the currently installed version according to extension manager if (extensionManager.getItemForID) { var installed = extensionManager.getItemForID(GUID).version; } else { // getItemForID isn't available on the Aviary 1.0 branch installed = extensionManager .getItemList(GUID, Components.interfaces.nsIUpdateItem.TYPE_EXTENSION,{})[0].version; } // this is the last version which has been run at least once var initialized = prefMan.getValue("version"); if (installed == initialized) { return; } // for now, we don't have to do any schmancy version comparisons because // we never had versions before. if (!initialized) { GM_pointThreeMigrate(); } // update the currently initialized version so we don't do this work again. prefMan.setValue("version", installed);}
if (extensionManager.getItemForID) { var installed = extensionManager.getItemForID(GUID).version; } else { installed = extensionManager .getItemList(GUID, Components.interfaces.nsIUpdateItem.TYPE_EXTENSION,{})[0].version;
if (extensionManager.getItemForID) { var installed = extensionManager.getItemForID(GUID).version; } else { installed = extensionManager .getItemList(GUID, Components.interfaces.nsIUpdateItem.TYPE_EXTENSION,{})[0].version; }
function GM_updateVersion(prefMan) { var extensionManager = Components.classes["@mozilla.org/extensions/manager;1"] .getService(Components.interfaces.nsIExtensionManager); // get the currently installed version according to extension manager if (extensionManager.getItemForID) { var installed = extensionManager.getItemForID(GUID).version; } else { // getItemForID isn't available on the Aviary 1.0 branch installed = extensionManager .getItemList(GUID, Components.interfaces.nsIUpdateItem.TYPE_EXTENSION,{})[0].version; } // this is the last version which has been run at least once var initialized = prefMan.getValue("version"); if (installed == initialized) { return; } // for now, we don't have to do any schmancy version comparisons because // we never had versions before. if (!initialized) { GM_pointThreeMigrate(); } // update the currently initialized version so we don't do this work again. prefMan.setValue("version", installed);}
GM_prefRoot.setValue("version", "0.4.9.9");
GM_prefRoot.setValue("version", "0.5");
function GM_updateVersion() { GM_log("> GM_updateVersion"); // this is the last version which has been run at least once var initialized = GM_prefRoot.getValue("version", "0.0"); if (GM_compareVersions(initialized, "0.3") < 0) { GM_pointThreeMigrate(); } if (GM_compareVersions(initialized, "0.4.2") < 0) { GM_pointFourMigrate(); } // update the currently initialized version so we don't do this work again. GM_prefRoot.setValue("version", "0.4.9.9"); GM_log("< GM_updateVersion");}
if (GM_compareVersions(initialized, "0.3") < 0) {
if (!GM_versionIsGreaterOrEqual(initialized, "0.3")) {
function GM_updateVersion() { GM_log("> GM_updateVersion"); // this is the last version which has been run at least once var initialized = GM_prefRoot.getValue("version", "0.0"); if (GM_compareVersions(initialized, "0.3") < 0) { GM_pointThreeMigrate(); } if (GM_compareVersions(initialized, "0.4.2") < 0) { GM_pointFourMigrate(); } // update the currently initialized version so we don't do this work again. GM_prefRoot.setValue("version", "0.5"); GM_log("< GM_updateVersion");}
if (GM_compareVersions(initialized, "0.4.2") < 0) {
if (!GM_versionIsGreaterOrEqual(initialized, "0.4.2")) {
function GM_updateVersion() { GM_log("> GM_updateVersion"); // this is the last version which has been run at least once var initialized = GM_prefRoot.getValue("version", "0.0"); if (GM_compareVersions(initialized, "0.3") < 0) { GM_pointThreeMigrate(); } if (GM_compareVersions(initialized, "0.4.2") < 0) { GM_pointFourMigrate(); } // update the currently initialized version so we don't do this work again. GM_prefRoot.setValue("version", "0.5"); GM_log("< GM_updateVersion");}
var initialized = GM_prefRoot.getValue("version");
var initialized = GM_prefRoot.getValue("version", "0.0");
function GM_updateVersion() { // this is the last version which has been run at least once var initialized = GM_prefRoot.getValue("version"); // for now, we don't have to do any schmancy version comparisons because // we never had versions before. if (!initialized) { GM_pointThreeMigrate(); } // update the currently initialized version so we don't do this work again. GM_prefRoot.setValue("version", "0.4.1");}
if (!initialized) {
if (GM_compareVersions(initialized, "0.3") < 0) {
function GM_updateVersion() { // this is the last version which has been run at least once var initialized = GM_prefRoot.getValue("version"); // for now, we don't have to do any schmancy version comparisons because // we never had versions before. if (!initialized) { GM_pointThreeMigrate(); } // update the currently initialized version so we don't do this work again. GM_prefRoot.setValue("version", "0.4.1");}
GM_prefRoot.setValue("version", "0.4.1");
GM_prefRoot.setValue("version", "0.4.2"); GM_log("< GM_updateVersion");
function GM_updateVersion() { // this is the last version which has been run at least once var initialized = GM_prefRoot.getValue("version"); // for now, we don't have to do any schmancy version comparisons because // we never had versions before. if (!initialized) { GM_pointThreeMigrate(); } // update the currently initialized version so we don't do this work again. GM_prefRoot.setValue("version", "0.4.1");}
GM_prefRoot.setValue("version", "0.5.1");
GM_prefRoot.setValue("version", "0.5.2");
function GM_updateVersion() { GM_log("> GM_updateVersion"); // this is the last version which has been run at least once var initialized = GM_prefRoot.getValue("version", "0.0"); if (!GM_versionIsGreaterOrEqual(initialized, "0.3")) { GM_pointThreeMigrate(); } if (!GM_versionIsGreaterOrEqual(initialized, "0.4.2")) { GM_pointFourMigrate(); } // update the currently initialized version so we don't do this work again. GM_prefRoot.setValue("version", "0.5.1"); GM_log("< GM_updateVersion");}
GM_prefRoot.setValue("version", "0.4.2");
GM_prefRoot.setValue("version", "0.4.9.9");
function GM_updateVersion() { GM_log("> GM_updateVersion"); // this is the last version which has been run at least once var initialized = GM_prefRoot.getValue("version", "0.0"); if (GM_compareVersions(initialized, "0.3") < 0) { GM_pointThreeMigrate(); } if (GM_compareVersions(initialized, "0.4.2") < 0) { GM_pointFourMigrate(); } // update the currently initialized version so we don't do this work again. GM_prefRoot.setValue("version", "0.4.2"); GM_log("< GM_updateVersion");}
this.host='gnats.bbsdev.net';
this.host='bugs.synchro.net';
function GNATS(host,user,pass,email){ // Properties if(host == undefined) this.host='gnats.bbsdev.net'; else this.host=host; if(user == undefined) this.user=guest; else this.user=user; if(pass == undefined) this.pass='' else this.pass=pass; if(email==undefined) this.email='bugs@'+this.host; else this.email=email; this.error=''; this.response=new Object; this.response.message=''; this.response.text=''; this.response.raw=''; this.response.code=0; this.response.type=PR_ERROR; this.socket=new Socket(SOCK_STREAM); this.access=GNATS_LEVEL_DENY; // Methods this.connect=GNATS_connect; this.close=GNATS_close; this.get_fullpr=GNATS_get_fullpr; this.expect=GNATS_expect; this.cmd=GNATS_cmd; this.get_response=GNATS_get_response; this.set_qfmt=GNATS_set_qfmt; this.set_expr=GNATS_set_expr; this.reset_expr=GNATS_reset_expr; this.get_result=GNATS_get_result; this.get_results=GNATS_get_results; this.get_list=GNATS_get_list; this.get_valid=GNATS_get_valid; this.submit=GNATS_submit; this.and_expr=GNATS_and_expr; this.append=GNATS_append; this.replace=GNATS_replace; this.get_field=GNATS_get_field; this.send_followup=GNATS_send_followup;}
email='bugs@'+this.host;
this.email='bugs@'+this.host;
function GNATS(host,user,pass,email){ // Properties if(host == undefined) this.host='gnats.bbsdev.net'; else this.host=host; if(user == undefined) this.user=guest; else this.user=user; if(pass == undefined) this.pass='' else this.pass=pass; if(email==undefined) email='bugs@'+this.host; else this.email=email; this.error=''; this.response=new Object; this.response.message=''; this.response.text=''; this.response.raw=''; this.response.code=0; this.response.type=PR_ERROR; this.socket=new Socket(SOCK_STREAM); // Methods this.connect=GNATS_connect; this.close=GNATS_close; this.get_fullpr=GNATS_get_fullpr; this.expect=GNATS_expect; this.cmd=GNATS_cmd; this.get_response=GNATS_get_response; this.set_qfmt=GNATS_set_qfmt; this.set_expr=GNATS_set_expr; this.reset_expr=GNATS_reset_expr; this.get_result=GNATS_get_result; this.get_results=GNATS_get_results; this.get_list=GNATS_get_list; this.get_valid=GNATS_get_valid; this.submit=GNATS_submit; this.and_expr=GNATS_and_expr; this.append=GNATS_append; this.replace=GNATS_replace; this.get_field=GNATS_get_field; this.send_followup=GNATS_send_followup;}
if(!this.expect("APPN",210,213))
if(!this.expect("APPN2",210,213))
function GNATS_append(pr,field,newval,reason){ if(!this.cmd("APPN",pr,field)) return(false); if(!this.expect("APPN",212)) return(false); lines=newval.split(/\r?\n/); for(i=0; i<lines.length; i++) { if(!this.socket.send(lines[i].replace(/^\./,'..')+"\r\n")) { this.error="Error sending data"; this.close(); return(false); } } if(!this.socket.send(".\r\n")) { this.error="Error sending data"; this.close(); return(true); } if(!this.get_response()) return(false); if(!this.expect("APPN",210,213)) return(false); if(this.response.code==213) { // Need to send a reason var reasonstr; if(typeof(reason)=='function') reasonstr=reason(); else reasonstr=reason; lines=reasonstr.split(/\r?\n/); for(i=0; i<lines.length; i++) { if(!this.socket.send(lines[i].replace(/^\./,'..')+"\r\n")) { this.error="Error sending data"; this.close(); return(false); } } if(!this.socket.send(".\r\n")) { this.error="Error sending data"; this.close(); return(true); } if(!expect("APPN",210)) return(false); } return(true);}
if(!expect("APPN",210))
if(!this.get_response()) return(false); if(!expect("APPN3",210))
function GNATS_append(pr,field,newval,reason){ if(!this.cmd("APPN",pr,field)) return(false); if(!this.expect("APPN",212)) return(false); lines=newval.split(/\r?\n/); for(i=0; i<lines.length; i++) { if(!this.socket.send(lines[i].replace(/^\./,'..')+"\r\n")) { this.error="Error sending data"; this.close(); return(false); } } if(!this.socket.send(".\r\n")) { this.error="Error sending data"; this.close(); return(true); } if(!this.get_response()) return(false); if(!this.expect("APPN",210,213)) return(false); if(this.response.code==213) { // Need to send a reason var reasonstr; if(typeof(reason)=='function') reasonstr=reason(); else reasonstr=reason; lines=reasonstr.split(/\r?\n/); for(i=0; i<lines.length; i++) { if(!this.socket.send(lines[i].replace(/^\./,'..')+"\r\n")) { this.error="Error sending data"; this.close(); return(false); } } if(!this.socket.send(".\r\n")) { this.error="Error sending data"; this.close(); return(true); } if(!expect("APPN",210)) return(false); } return(true);}
note += field+'-Changed-Why:\r\n";
note += field+'-Changed-Why:\r\n';
function GNATS_change_field(pr,field,newval,why){ var old; var note=''; if(!this.set_qfmt('"%s" '+field)) return(false); if(!this.set_expr("Number=="+pr)) return(false); old=this.get_result(); if(old==undefined) return(false); if(old==newval) return(false); if(!this.replace(pr,field,newval)) return(false); note += field+'-Changed-From-To: '+old+'->'+newval+"\r\n"; note += field+'-Changed-By: '+this.user+"\r\n"; note += field+'-Changed-When: '+strftime("%a, %d %b %Y %H:%M:%S %z",new Date())+"\r\n"; note += field+'-Changed-Why:\r\n"; lines=note.split(/\r?\n/); for(i=0; i<lines.length; i++) { note += "\t"+lines[i]+"\r\n"; } if(!this.append(pr,"Audit-Trail",note)) return(false); return(true);}
var send=arguments.join(" ")+"\r\n";
var send; var i; var args=new Array();
function GNATS_cmd(){ var send=arguments.join(" ")+"\r\n"; if(!this.socket.is_connected) { this.error="Socket not connected"; return(false); } this.socket.send(send); return(this.get_response);}
this.socket.send(send); return(this.get_response);
if(!this.socket.send(send)) { this.error="Error sending on socket"; return(false); } return(this.get_response());
function GNATS_cmd(){ var send=arguments.join(" ")+"\r\n"; if(!this.socket.is_connected) { this.error="Socket not connected"; return(false); } this.socket.send(send); return(this.get_response);}
lines.pop();
function GNATS_connect(){ this.socket.connect(this.host,1529); if(!this.socket.is_connected) { this.error="Cannot connect to GNATS database"; return(false); } if(!this.get_response()) return(false); if(!this.expect("CONNECT",200)) return(false); if(!this.cmd("USER",this.user,this.pass)) return(false); if(!this.expect("USER",210)) return(false); if(!this.cmd("USER")) // Get current access level return(false); if(!this.expect("USER",350)) return(false); var lines=this.response.message.split(/\r?\n/); lines.pop(); var level=lines.pop(); level=level.replace(/[\r\n]/g,''); var i; for(i=0; i<GNATS_LEVELS.length; i++) { if(level==GNATS_LEVELS[i]) { this.access=i; break; } } return(true);}
if(!this.expect("USER",210);
if(!this.expect("USER",210))
function GNATS_connect(){ this.socket.connect(this.host,1529); if(!this.socket.is_connected) { this.error="Cannot connect to GNATS database"; return(false); } if(!this.get_response()) return(false); if(!this.expect("CONNECT",200)) return(false); if(!this.cmd("USER",this.user,this.pass)) return(false); if(!this.expect("USER",210); return(false); return(true);}
for(i=1; i<arguments.length; i++) { if(this.response.code == arguments[i])
var args=new Array(); var desc; desc=arguments[0]; for(i=1; i<arguments.length; i++) args.push(arguments[i]); for(i=0; i<args.length; i++) { if(this.response.code == args[i])
function GNATS_expect(){ var i; for(i=1; i<arguments.length; i++) { if(this.response.code == arguments[i]) return(true); } this.error=arguments.unshift()+" expected "+arguments.join(" or ")+"\r\n"+this.response.message; return(false);}
this.error=arguments.unshift()+" expected "+arguments.join(" or ")+"\r\n"+this.response.message;
this.error=desc+" expected "+args.join(" or ")+" got "+this.response.code+"\r\n"+this.response.message;
function GNATS_expect(){ var i; for(i=1; i<arguments.length; i++) { if(this.response.code == arguments[i]) return(true); } this.error=arguments.unshift()+" expected "+arguments.join(" or ")+"\r\n"+this.response.message; return(false);}
if(!this.set_expr("State==State"));
if(!this.set_expr("State==State"))
function GNATS_get_fullpr(num){ if(!this.reset_expr()) // Reset current expression. return(undefined); if(!this.set_expr("State==State")); // Select all PRs return(undefined); if(!this.set_qfmt("full")) // Request full PR return(undefined); if(!this.cmd("QUER",num)) // Get PR return(undefined); if(!this.expect("QUER",300)) return(undefined); return(this.response.text);}
resp.raw+=this.socket.recvline(); m=resp.raw.match(/^([0-9]{3})([- ])(.*)$/);
line=this.socket.recvline(); this.response.raw += line; m=line.match(/^([0-9]{3})([- ])(.*)$/);
function GNATS_get_response(){ var line; var m; this.error=''; this.response.message=''; this.response.text=''; this.response.raw=''; this.response.code=0; this.response.type=PR_ERROR; if(!this.socket.is_connected) { this.error="Socket not connected"; return(false); } while(!done) { if(this.socket.poll(30)) { resp.raw+=this.socket.recvline(); m=resp.raw.match(/^([0-9]{3})([- ])(.*)$/); if(m != undefined && m.index>-1) { this.response.code=parseInt(m[1]); this.response.message+=m[3]; if(m[2]=='-') this.response.message+="\r\n"; else done=true; switch((this.response.code/100).toFixed(0)) { case '2': this.response.type=PR_SUCCESS; break; case '3': if(this.response.code < 350) this.response.type=PR_SENDING_DATA; else this.response.type=PR_QUERY_SUCCESS; break; case '4': case '5': this.response.type=PR_ERROR; this.error+=this.response.message; break; case '6': this.response.type=PR_RETRY; this.error+=this.response.message; break; } } else { this.error="Malformed response"; return(false); } } else { this.error="Timeout waiting for response"; return(false); } } if(this.response.type==PR_SENDING_DATA) { done=false; while(!done) { if(this.socket.poll(30)) { line=this.socket.recvline(); if(line != undefined) { if(line==".") { done=true; } else { line=line.replace(/^\.\./,'.'); this.response.text+=line+"\r\n"; } } else { this.error="Error while recieving data"; return(false); } } else { this.error="Timeout waiting for data"; return(false); } } } return(true);}
if(!this.expect("REPL",210,213))
if(!this.expect("REPL2",210,213,403))
function GNATS_replace(pr,field,newval,reason){ if(!this.cmd("REPL",pr,field)) return(false); if(!this.expect("REPL",212)) return(false); lines=newval.split(/\r?\n/); for(i=0; i<lines.length; i++) { if(!this.socket.send(lines[i].replace(/^\./,'..')+"\r\n")) { this.error="Error sending data"; this.close(); return(false); } } if(!this.socket.send(".\r\n")) { this.error="Error sending data"; this.close(); return(true); } if(!this.get_response()) return(false); if(!this.expect("REPL",210,213)) return(false); if(this.response.code==213) { // Need to send a reason var reasonstr; if(typeof(reason)=='function') reasonstr=reason(); else reasonstr=reason; lines=reasonstr.split(/\r?\n/); for(i=0; i<lines.length; i++) { if(!this.socket.send(lines[i].replace(/^\./,'..')+"\r\n")) { this.error="Error sending data"; this.close(); return(false); } } if(!this.socket.send(".\r\n")) { this.error="Error sending data"; this.close(); return(true); } if(!expect("REPL",210)) return(false); } return(true);}
if(!expect("REPL",210))
if(!this.get_response()) return(false); if(!this.expect("REPL3",210))
function GNATS_replace(pr,field,newval,reason){ if(!this.cmd("REPL",pr,field)) return(false); if(!this.expect("REPL",212)) return(false); lines=newval.split(/\r?\n/); for(i=0; i<lines.length; i++) { if(!this.socket.send(lines[i].replace(/^\./,'..')+"\r\n")) { this.error="Error sending data"; this.close(); return(false); } } if(!this.socket.send(".\r\n")) { this.error="Error sending data"; this.close(); return(true); } if(!this.get_response()) return(false); if(!this.expect("REPL",210,213)) return(false); if(this.response.code==213) { // Need to send a reason var reasonstr; if(typeof(reason)=='function') reasonstr=reason(); else reasonstr=reason; lines=reasonstr.split(/\r?\n/); for(i=0; i<lines.length; i++) { if(!this.socket.send(lines[i].replace(/^\./,'..')+"\r\n")) { this.error="Error sending data"; this.close(); return(false); } } if(!this.socket.send(".\r\n")) { this.error="Error sending data"; this.close(); return(true); } if(!expect("REPL",210)) return(false); } return(true);}
recip.to='bugs'; recip.to_net_type=NET_INTERNET; recip.to_net_addr=this.email; hdrs.rcpt_list = new Array(); hdrs.rcpt_list.push(recip); var orig=this.get_field(pr,'Reply-To'); recip = new Object;
function GNATS_send_followup(pr,name,from,message){ var hdrs = new Object; var recips = new Array(); var recip = new Object; recip.to='bugs'; recip.to_net_type=NET_INTERNET; recip.to_net_addr=this.email; hdrs.rcpt_list = new Array(); hdrs.rcpt_list.push(recip); var orig=this.get_field(pr,'Reply-To'); recip = new Object; recip.to=mail_get_name(orig); recip.to_net_type=NET_INTERNET; recip.to_net_addr=mail_get_address(orig); hdrs.rcpt_list.push(recip); hdrs.from=name; hdrs.from_net_type=NET_INTERNET; hdrs.from_net_addr=from; hdrs.replyto=name; hdrs.replyto_net_type=NET_INTERNET; hdrs.replyto_net_addr=from; if(!this.set_qfmt('"Re: %s/%d: %s" Category Number Synopsis')); return(false); var subject=this.get_result(pr); if(subject==undefined) return(false); hdrs.subject=subject.replace(/[\r\n]/g,''); var msgbase = new MsgBase('mail'); if(msgbase.open!=undefined && msgbase.open()==false) { this.error='Cannot open message base'; return(false); } if(!msgbase.save_msg(hdrs, message)) { this.error=msgbase.error; return(false); } return(true);}
if(!this.set_qfmt('"Re: %s/%d: %s" Category Number Synopsis'));
if(!this.set_qfmt('"Re: %s/%d: %s" Category Number Synopsis'))
function GNATS_send_followup(pr,name,from,message){ var hdrs = new Object; var recips = new Array(); var recip = new Object; recip.to='bugs'; recip.to_net_type=NET_INTERNET; recip.to_net_addr=this.email; hdrs.rcpt_list = new Array(); hdrs.rcpt_list.push(recip); var orig=this.get_field(pr,'Reply-To'); recip = new Object; recip.to=mail_get_name(orig); recip.to_net_type=NET_INTERNET; recip.to_net_addr=mail_get_address(orig); hdrs.rcpt_list.push(recip); hdrs.from=name; hdrs.from_net_type=NET_INTERNET; hdrs.from_net_addr=from; hdrs.replyto=name; hdrs.replyto_net_type=NET_INTERNET; hdrs.replyto_net_addr=from; if(!this.set_qfmt('"Re: %s/%d: %s" Category Number Synopsis')); return(false); var subject=this.get_result(pr); if(subject==undefined) return(false); hdrs.subject=subject.replace(/[\r\n]/g,''); var msgbase = new MsgBase('mail'); if(msgbase.open!=undefined && msgbase.open()==false) { this.error='Cannot open message base'; return(false); } if(!msgbase.save_msg(hdrs, message)) { this.error=msgbase.error; return(false); } return(true);}
this.error=msgbase.error;
this.error='Error saving message: '+msgbase.error; msgbase.close();
function GNATS_send_followup(pr,name,from,message){ var hdrs = new Object; var recips = new Array(); var recip = new Object; recip.to='bugs'; recip.to_net_type=NET_INTERNET; recip.to_net_addr=this.email; hdrs.rcpt_list = new Array(); hdrs.rcpt_list.push(recip); var orig=this.get_field(pr,'Reply-To'); recip = new Object; recip.to=mail_get_name(orig); recip.to_net_type=NET_INTERNET; recip.to_net_addr=mail_get_address(orig); hdrs.rcpt_list.push(recip); hdrs.from=name; hdrs.from_net_type=NET_INTERNET; hdrs.from_net_addr=from; hdrs.replyto=name; hdrs.replyto_net_type=NET_INTERNET; hdrs.replyto_net_addr=from; if(!this.set_qfmt('"Re: %s/%d: %s" Category Number Synopsis')); return(false); var subject=this.get_result(pr); if(subject==undefined) return(false); hdrs.subject=subject.replace(/[\r\n]/g,''); var msgbase = new MsgBase('mail'); if(msgbase.open!=undefined && msgbase.open()==false) { this.error='Cannot open message base'; return(false); } if(!msgbase.save_msg(hdrs, message)) { this.error=msgbase.error; return(false); } return(true);}
msgbase.close();
function GNATS_send_followup(pr,name,from,message){ var hdrs = new Object; var recips = new Array(); var recip = new Object; recip.to='bugs'; recip.to_net_type=NET_INTERNET; recip.to_net_addr=this.email; hdrs.rcpt_list = new Array(); hdrs.rcpt_list.push(recip); var orig=this.get_field(pr,'Reply-To'); recip = new Object; recip.to=mail_get_name(orig); recip.to_net_type=NET_INTERNET; recip.to_net_addr=mail_get_address(orig); hdrs.rcpt_list.push(recip); hdrs.from=name; hdrs.from_net_type=NET_INTERNET; hdrs.from_net_addr=from; hdrs.replyto=name; hdrs.replyto_net_type=NET_INTERNET; hdrs.replyto_net_addr=from; if(!this.set_qfmt('"Re: %s/%d: %s" Category Number Synopsis')); return(false); var subject=this.get_result(pr); if(subject==undefined) return(false); hdrs.subject=subject.replace(/[\r\n]/g,''); var msgbase = new MsgBase('mail'); if(msgbase.open!=undefined && msgbase.open()==false) { this.error='Cannot open message base'; return(false); } if(!msgbase.save_msg(hdrs, message)) { this.error=msgbase.error; return(false); } return(true);}
var recips = new Array();
function GNATS_send_followup(pr,name,from,message){ var hdrs = new Object; var recips = new Array(); var rcpt_list = new Array(); var recip = new Object; recip.to='bugs'; recip.to_net_type=NET_INTERNET; recip.to_net_addr=this.email; var orig=this.get_field(pr,'Reply-To'); var recip = new Object; recip.to=mail_get_name(orig); recip.to_net_type=NET_INTERNET; recip.to_net_addr=mail_get_address(orig); rcpt_list.push(recip); hdrs.from=name; hdrs.from_net_type=NET_INTERNET; hdrs.from_net_addr=from; hdrs.replyto=name; hdrs.replyto_net_type=NET_INTERNET; hdrs.replyto_net_addr=from; if(!this.set_qfmt('"Re: PR %s/%d: %s" Category Number Subject')) return(false); var subject=this.get_result(pr); if(subject==undefined) return(false); hdrs.subject=subject.replace(/[\r\n]/g,''); var msgbase = new MsgBase('mail'); if(msgbase.open!=undefined && msgbase.open()==false) { this.error='Cannot open message base'; return(false); } if(!msgbase.save_msg(hdrs, message, rcpt_list)) { this.error='Error saving message: '+msgbase.error; msgbase.close(); return(false); } msgbase.close(); return(true);}
recip.to='bugs';
recip.to=mail_get_name(this.email);
function GNATS_send_followup(pr,name,from,message){ var hdrs = new Object; var recips = new Array(); var rcpt_list = new Array(); var recip = new Object; recip.to='bugs'; recip.to_net_type=NET_INTERNET; recip.to_net_addr=this.email; var orig=this.get_field(pr,'Reply-To'); var recip = new Object; recip.to=mail_get_name(orig); recip.to_net_type=NET_INTERNET; recip.to_net_addr=mail_get_address(orig); rcpt_list.push(recip); hdrs.from=name; hdrs.from_net_type=NET_INTERNET; hdrs.from_net_addr=from; hdrs.replyto=name; hdrs.replyto_net_type=NET_INTERNET; hdrs.replyto_net_addr=from; if(!this.set_qfmt('"Re: PR %s/%d: %s" Category Number Subject')) return(false); var subject=this.get_result(pr); if(subject==undefined) return(false); hdrs.subject=subject.replace(/[\r\n]/g,''); var msgbase = new MsgBase('mail'); if(msgbase.open!=undefined && msgbase.open()==false) { this.error='Cannot open message base'; return(false); } if(!msgbase.save_msg(hdrs, message, rcpt_list)) { this.error='Error saving message: '+msgbase.error; msgbase.close(); return(false); } msgbase.close(); return(true);}
recip.to_net_addr=this.email;
recip.to_net_addr=mail_get_address(this.email); rcpt_list.push(recip);
function GNATS_send_followup(pr,name,from,message){ var hdrs = new Object; var recips = new Array(); var rcpt_list = new Array(); var recip = new Object; recip.to='bugs'; recip.to_net_type=NET_INTERNET; recip.to_net_addr=this.email; var orig=this.get_field(pr,'Reply-To'); var recip = new Object; recip.to=mail_get_name(orig); recip.to_net_type=NET_INTERNET; recip.to_net_addr=mail_get_address(orig); rcpt_list.push(recip); hdrs.from=name; hdrs.from_net_type=NET_INTERNET; hdrs.from_net_addr=from; hdrs.replyto=name; hdrs.replyto_net_type=NET_INTERNET; hdrs.replyto_net_addr=from; if(!this.set_qfmt('"Re: PR %s/%d: %s" Category Number Subject')) return(false); var subject=this.get_result(pr); if(subject==undefined) return(false); hdrs.subject=subject.replace(/[\r\n]/g,''); var msgbase = new MsgBase('mail'); if(msgbase.open!=undefined && msgbase.open()==false) { this.error='Cannot open message base'; return(false); } if(!msgbase.save_msg(hdrs, message, rcpt_list)) { this.error='Error saving message: '+msgbase.error; msgbase.close(); return(false); } msgbase.close(); return(true);}
if(!this.cmd("EXPR",arguments.join(" "))
if(!this.cmd("EXPR",args.join(" ")))
function GNATS_set_expr(){ if(!this.reset_expr()) return(false); if(!this.cmd("EXPR",arguments.join(" ")) return(false); if(!this.expect("EXPR",210)) return(FALSE); return(true);}
if(!this.cmd("QFMT",format)
if(!this.cmd("QFMT",format))
function GNATS_set_qfmt(format){ if(format==undefined) format="standard"; if(!this.cmd("QFMT",format) return(false); if(!this.expect("QFMT",210)) return(FALSE); return(true);}
if (c > 500) { console.log("avg " + miss_c/c + "ms per frame (" + now_playing + ")");
if (c > 750) { console.log("avg " + Math.round(miss_c/c) + "ms per frame, frame rate needs " + (1000/FRAME_RATE));
function go() { var d = (new Date).getTime(); miss_c+=d-next_frame; next_frame = d+1000/FRAME_RATE; c++; if (now_playing[0][1] <= 0) { now_playing.splice(0,1); } if (c > 500) { console.log("avg " + miss_c/c + "ms per frame (" + now_playing + ")"); if (now_playing.length == 1) { var keys = Object.keys(providers); for (var p=0;p<now_playing.length;++p){ for (var k=0;k<keys.length;++k){ if (p[0] == keys[k]) { keys.splice(k,1); } } } now_playing.push([keys[ keys.length * Math.random() << 0], 0]); } c=0; miss_c=0; } if (now_playing.length > 1) { now_playing[0][1]-=now_playing[0][1]<=0?0:1; now_playing[1][1]+=now_playing[1][1]>=255?0:1; } var s; try { s = spectrum.getSpectrum(); } catch (x){ console.log("f: "); } if (s==undefined){ console.log("x:"); s=[0,0,0,0,0,0]; } var volume = (s[0]+s[1]+s[2]+s[3]+s[4]+s[5]+s[6])/7;// var v = providers['rainbow'].getFrame(s,volume);// var v = providers['text'].getFrame(s,volume);// var v = providers['image'].getFrame(s,volume);// var v = providers['skulls'].getFrame(s,volume);// var v = providers['plasma'].getFrame(s,volume); for (var x = 0; x < 24;++x){ for (var y = 0; y < 6; y++){ for (var b = 0; b < 3; b++){ pixels[x][y][b] = 0; } } } var things = [['mario',255]]; things = now_playing; for (var i = 0; i < things.length; ++i){ var v = providers[things[i][0]].getFrame(s,volume,s[7],s[8] > 0); for (var x = 0; x < 24;++x){ for (var y = 0; y < 6;++y){ for (var b = 0; b < 3; ++b){ pixels[x][y][b] += v[x][y][b]*things[i][1]/255; } } } } for (var x = 0; x < 24;++x){ for (var y = 0; y < 6;++y){ leds.setLed(x,y,pixels[x][y][0],pixels[x][y][1],pixels[x][y][2]); // leds.setLed(x,y,v[x][y][0],v[x][y][1],v[x][y][2]); } } leds.draw(); d = (new Date).getTime() - d; setTimeout(go,(1000/FRAME_RATE)-d); global.gc();}
if (p[0] == keys[k]) {
if (now_playing[p][0] === keys[k]) {
function go() { var d = (new Date).getTime(); miss_c+=d-next_frame; next_frame = d+1000/FRAME_RATE; c++; if (now_playing[0][1] <= 0) { now_playing.splice(0,1); } if (c > 500) { console.log("avg " + miss_c/c + "ms per frame (" + now_playing + ")"); if (now_playing.length == 1) { var keys = Object.keys(providers); for (var p=0;p<now_playing.length;++p){ for (var k=0;k<keys.length;++k){ if (p[0] == keys[k]) { keys.splice(k,1); } } } now_playing.push([keys[ keys.length * Math.random() << 0], 0]); } c=0; miss_c=0; } if (now_playing.length > 1) { now_playing[0][1]-=now_playing[0][1]<=0?0:1; now_playing[1][1]+=now_playing[1][1]>=255?0:1; } var s; try { s = spectrum.getSpectrum(); } catch (x){ console.log("f: "); } if (s==undefined){ console.log("x:"); s=[0,0,0,0,0,0]; } var volume = (s[0]+s[1]+s[2]+s[3]+s[4]+s[5]+s[6])/7;// var v = providers['rainbow'].getFrame(s,volume);// var v = providers['text'].getFrame(s,volume);// var v = providers['image'].getFrame(s,volume);// var v = providers['skulls'].getFrame(s,volume);// var v = providers['plasma'].getFrame(s,volume); for (var x = 0; x < 24;++x){ for (var y = 0; y < 6; y++){ for (var b = 0; b < 3; b++){ pixels[x][y][b] = 0; } } } var things = [['mario',255]]; things = now_playing; for (var i = 0; i < things.length; ++i){ var v = providers[things[i][0]].getFrame(s,volume,s[7],s[8] > 0); for (var x = 0; x < 24;++x){ for (var y = 0; y < 6;++y){ for (var b = 0; b < 3; ++b){ pixels[x][y][b] += v[x][y][b]*things[i][1]/255; } } } } for (var x = 0; x < 24;++x){ for (var y = 0; y < 6;++y){ leds.setLed(x,y,pixels[x][y][0],pixels[x][y][1],pixels[x][y][2]); // leds.setLed(x,y,v[x][y][0],v[x][y][1],v[x][y][2]); } } leds.draw(); d = (new Date).getTime() - d; setTimeout(go,(1000/FRAME_RATE)-d); global.gc();}
global.gc();
function go() { var d = (new Date).getTime(); miss_c+=d-next_frame; next_frame = d+1000/FRAME_RATE; c++; if (now_playing[0][1] <= 0) { now_playing.splice(0,1); } if (c > 500) { console.log("avg " + miss_c/c + "ms per frame (" + now_playing + ")"); if (now_playing.length == 1) { var keys = Object.keys(providers); for (var p=0;p<now_playing.length;++p){ for (var k=0;k<keys.length;++k){ if (p[0] == keys[k]) { keys.splice(k,1); } } } now_playing.push([keys[ keys.length * Math.random() << 0], 0]); } c=0; miss_c=0; } if (now_playing.length > 1) { now_playing[0][1]-=now_playing[0][1]<=0?0:1; now_playing[1][1]+=now_playing[1][1]>=255?0:1; } var s; try { s = spectrum.getSpectrum(); } catch (x){ console.log("f: "); } if (s==undefined){ console.log("x:"); s=[0,0,0,0,0,0]; } var volume = (s[0]+s[1]+s[2]+s[3]+s[4]+s[5]+s[6])/7;// var v = providers['rainbow'].getFrame(s,volume);// var v = providers['text'].getFrame(s,volume);// var v = providers['image'].getFrame(s,volume);// var v = providers['skulls'].getFrame(s,volume);// var v = providers['plasma'].getFrame(s,volume); for (var x = 0; x < 24;++x){ for (var y = 0; y < 6; y++){ for (var b = 0; b < 3; b++){ pixels[x][y][b] = 0; } } } var things = [['mario',255]]; things = now_playing; for (var i = 0; i < things.length; ++i){ var v = providers[things[i][0]].getFrame(s,volume,s[7],s[8] > 0); for (var x = 0; x < 24;++x){ for (var y = 0; y < 6;++y){ for (var b = 0; b < 3; ++b){ pixels[x][y][b] += v[x][y][b]*things[i][1]/255; } } } } for (var x = 0; x < 24;++x){ for (var y = 0; y < 6;++y){ leds.setLed(x,y,pixels[x][y][0],pixels[x][y][1],pixels[x][y][2]); // leds.setLed(x,y,v[x][y][0],v[x][y][1],v[x][y][2]); } } leds.draw(); d = (new Date).getTime() - d; setTimeout(go,(1000/FRAME_RATE)-d); global.gc();}
kinds = parent.frames["navigationFrame"].document.getElementById("kinds") oldLocation = parent.frames["classesFrame"].window.location.href
kinds = parent.navigationFrame.document.getElementById("kinds") oldLocation = parent.classesFrame.window.location.href
function goto() { kinds = parent.frames["navigationFrame"].document.getElementById("kinds") oldLocation = parent.frames["classesFrame"].window.location.href //alert("oldLocation="+oldLocation); pos = oldLocation.lastIndexOf("#") classesURL = (pos > 0) ? oldLocation.substring(0, pos) : oldLocation; newLocation = classesURL + kinds.options[kinds.selectedIndex].value; //alert("newLocation="+newLocation); parent.frames["classesFrame"].window.location = newLocation;}
parent.frames["classesFrame"].window.location = newLocation;
parent.classesFrame.window.location = newLocation;
function goto() { kinds = parent.frames["navigationFrame"].document.getElementById("kinds") oldLocation = parent.frames["classesFrame"].window.location.href //alert("oldLocation="+oldLocation); pos = oldLocation.lastIndexOf("#") classesURL = (pos > 0) ? oldLocation.substring(0, pos) : oldLocation; newLocation = classesURL + kinds.options[kinds.selectedIndex].value; //alert("newLocation="+newLocation); parent.frames["classesFrame"].window.location = newLocation;}
function Graphic(width,height,attribute,char)
function Graphic(w,h,attr,ch)
function Graphic(width,height,attribute,char){ if(char==undefined) this.char=' '; else this.char=char; if(attribute==undefined) this.attribute=7; else this.attribute=attribute; if(height==undefined) this.height=24; else this.height=height; if(width==undefined) this.width=80; else this.width=width; this.data=new Array(width,height); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; this.data[x][y].char=char; this.data[x][y].attr=attribute; } } this.draw=Graphic_draw;}
if(char==undefined) this.char=' ';
if(ch==undefined) this.ch=' ';
function Graphic(width,height,attribute,char){ if(char==undefined) this.char=' '; else this.char=char; if(attribute==undefined) this.attribute=7; else this.attribute=attribute; if(height==undefined) this.height=24; else this.height=height; if(width==undefined) this.width=80; else this.width=width; this.data=new Array(width,height); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; this.data[x][y].char=char; this.data[x][y].attr=attribute; } } this.draw=Graphic_draw;}
this.char=char; if(attribute==undefined)
this.ch=ch; if(attr==undefined)
function Graphic(width,height,attribute,char){ if(char==undefined) this.char=' '; else this.char=char; if(attribute==undefined) this.attribute=7; else this.attribute=attribute; if(height==undefined) this.height=24; else this.height=height; if(width==undefined) this.width=80; else this.width=width; this.data=new Array(width,height); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; this.data[x][y].char=char; this.data[x][y].attr=attribute; } } this.draw=Graphic_draw;}
this.attribute=attribute; if(height==undefined)
this.attribute=attr; if(h==undefined)
function Graphic(width,height,attribute,char){ if(char==undefined) this.char=' '; else this.char=char; if(attribute==undefined) this.attribute=7; else this.attribute=attribute; if(height==undefined) this.height=24; else this.height=height; if(width==undefined) this.width=80; else this.width=width; this.data=new Array(width,height); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; this.data[x][y].char=char; this.data[x][y].attr=attribute; } } this.draw=Graphic_draw;}
this.height=height; if(width==undefined)
this.height=h; if(w==undefined)
function Graphic(width,height,attribute,char){ if(char==undefined) this.char=' '; else this.char=char; if(attribute==undefined) this.attribute=7; else this.attribute=attribute; if(height==undefined) this.height=24; else this.height=height; if(width==undefined) this.width=80; else this.width=width; this.data=new Array(width,height); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; this.data[x][y].char=char; this.data[x][y].attr=attribute; } } this.draw=Graphic_draw;}
this.width=width;
this.width=w;
function Graphic(width,height,attribute,char){ if(char==undefined) this.char=' '; else this.char=char; if(attribute==undefined) this.attribute=7; else this.attribute=attribute; if(height==undefined) this.height=24; else this.height=height; if(width==undefined) this.width=80; else this.width=width; this.data=new Array(width,height); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; this.data[x][y].char=char; this.data[x][y].attr=attribute; } } this.draw=Graphic_draw;}
this.data=new Array(width,height);
this.data=new Array(w);
function Graphic(width,height,attribute,char){ if(char==undefined) this.char=' '; else this.char=char; if(attribute==undefined) this.attribute=7; else this.attribute=attribute; if(height==undefined) this.height=24; else this.height=height; if(width==undefined) this.width=80; else this.width=width; this.data=new Array(width,height); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; this.data[x][y].char=char; this.data[x][y].attr=attribute; } } this.draw=Graphic_draw;}
this.data[x][y].char=char; this.data[x][y].attr=attribute;
this.data[x][y].ch=ch; this.data[x][y].attr=attr;
function Graphic(width,height,attribute,char){ if(char==undefined) this.char=' '; else this.char=char; if(attribute==undefined) this.attribute=7; else this.attribute=attribute; if(height==undefined) this.height=24; else this.height=height; if(width==undefined) this.width=80; else this.width=width; this.data=new Array(width,height); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; this.data[x][y].char=char; this.data[x][y].attr=attribute; } } this.draw=Graphic_draw;}
this.load=Graphic_load;
function Graphic(width,height,attribute,char){ if(char==undefined) this.char=' '; else this.char=char; if(attribute==undefined) this.attribute=7; else this.attribute=attribute; if(height==undefined) this.height=24; else this.height=height; if(width==undefined) this.width=80; else this.width=width; this.data=new Array(width,height); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; this.data[x][y].char=char; this.data[x][y].attr=attribute; } } this.draw=Graphic_draw;}
this.scroll=Graphic_scroll; this.putmsg=Graphic_putmsg;
function Graphic(w,h,attr,ch){ if(ch==undefined) this.ch=' '; else this.ch=ch; if(attr==undefined) this.attribute=7; else this.attribute=attr; if(h==undefined) this.height=24; else this.height=h; if(w==undefined) this.width=80; else this.width=w; this.data=new Array(w); var x; var y; for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { if(y==0) { this.data[x]=new Array(h); } this.data[x][y]=new Object; this.data[x][y].ch=ch; this.data[x][y].attr=attr; } } this.draw=Graphic_draw; this.load=Graphic_load; this.write=Graphic_write;}
if(xpos+width > console.screen_columns || ypos+height > console.screen_rows) {
if(xpos+width-1 > console.screen_columns || ypos+height-1 > console.screen_rows) {
function Graphic_draw(xpos,ypos,width,height,xoff,yoff){ var x; var y; if(xpos==undefined) xpos=1; if(ypos==undefined) ypos=1; if(width==undefined) width=this.width; if(height==undefined) height=this.height; if(xoff==undefined) xoff=0; if(yoff==undefined) yoff=0; if(xoff+width > this.width || yoff+height > this.height) { alert("Attempt to draw from outside of graphic"); return(false) } if(xpos+width > console.screen_columns || ypos+height > console.screen_rows) { alert("Attempt to draw outside of screen"); return(false); } for(y=0;y<height; y++) { gotoxy(xpos,ypos+y); for(x=0; x<width; x++) { // Do not draw to the bottom left corner of the screen-would scroll if(xpos+x != console.screen_columns || ypos+y != console.screen_rows) { console.attributes=this.data[x+xoff][y+yoff].attr; console.write(this.data[x+xoff][y+yoff].char; } } } return(true);}
gotoxy(xpos,ypos+y);
console.gotoxy(xpos,ypos+y);
function Graphic_draw(xpos,ypos,width,height,xoff,yoff){ var x; var y; if(xpos==undefined) xpos=1; if(ypos==undefined) ypos=1; if(width==undefined) width=this.width; if(height==undefined) height=this.height; if(xoff==undefined) xoff=0; if(yoff==undefined) yoff=0; if(xoff+width > this.width || yoff+height > this.height) { alert("Attempt to draw from outside of graphic"); return(false) } if(xpos+width > console.screen_columns || ypos+height > console.screen_rows) { alert("Attempt to draw outside of screen"); return(false); } for(y=0;y<height; y++) { gotoxy(xpos,ypos+y); for(x=0; x<width; x++) { // Do not draw to the bottom left corner of the screen-would scroll if(xpos+x != console.screen_columns || ypos+y != console.screen_rows) { console.attributes=this.data[x+xoff][y+yoff].attr; console.write(this.data[x+xoff][y+yoff].char; } } } return(true);}
console.write(this.data[x+xoff][y+yoff].char;
console.write(this.data[x+xoff][y+yoff].ch);
function Graphic_draw(xpos,ypos,width,height,xoff,yoff){ var x; var y; if(xpos==undefined) xpos=1; if(ypos==undefined) ypos=1; if(width==undefined) width=this.width; if(height==undefined) height=this.height; if(xoff==undefined) xoff=0; if(yoff==undefined) yoff=0; if(xoff+width > this.width || yoff+height > this.height) { alert("Attempt to draw from outside of graphic"); return(false) } if(xpos+width > console.screen_columns || ypos+height > console.screen_rows) { alert("Attempt to draw outside of screen"); return(false); } for(y=0;y<height; y++) { gotoxy(xpos,ypos+y); for(x=0; x<width; x++) { // Do not draw to the bottom left corner of the screen-would scroll if(xpos+x != console.screen_columns || ypos+y != console.screen_rows) { console.attributes=this.data[x+xoff][y+yoff].attr; console.write(this.data[x+xoff][y+yoff].char; } } } return(true);}
alert("Attempt to draw from outside of graphic");
alert("Attempt to draw from outside of graphic: "+xoff+":"+yoff+" "+width+"x"+height+" "+this.width+"x"+this.height);
function Graphic_draw(xpos,ypos,width,height,xoff,yoff){ var x; var y; if(xpos==undefined) xpos=1; if(ypos==undefined) ypos=1; if(width==undefined) width=this.width; if(height==undefined) height=this.height; if(xoff==undefined) xoff=0; if(yoff==undefined) yoff=0; if(xoff+width > this.width || yoff+height > this.height) { alert("Attempt to draw from outside of graphic"); return(false) } if(xpos+width-1 > console.screen_columns || ypos+height-1 > console.screen_rows) { alert("Attempt to draw outside of screen"); return(false); } for(y=0;y<height; y++) { console.gotoxy(xpos,ypos+y); for(x=0; x<width; x++) { // Do not draw to the bottom left corner of the screen-would scroll if(xpos+x != console.screen_columns || ypos+y != console.screen_rows) { console.attributes=this.data[x+xoff][y+yoff].attr; console.write(this.data[x+xoff][y+yoff].ch); } } } return(true);}
if(!(f.open("rb",true))
if(!(f.open("rb",true)))
function Graphic_load(filename){ var x; var y; var f=new File(filename); if(!(f.open("rb",true)) return(false); for(y=0; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y]=new Object; if(f.eof) return(false); this.data[x][y].ch=f.read(1); if(f.eof) return(false); this.data[x][y].attr=f.readBin(1); } } return(true);}
ch=txt.substr(p++,1);
ch=txt.substr(p++,1).toUpperCase();
function Graphic_putmsg(xpos, ypos, txt, attr, scroll){ var curattr=attr; var ch; var x=xpos-1; var y=ypos-1; if(curattr==undefined) curattr=this.attribute; /* Expand @-codes */ txt=txt.replace(/@(.*)@/g, function (str, code, offset, s) { return bbs.atcode(code); } ); /* ToDo: Expand \1D, \1T, \1<, \1Z */ /* ToDo: "Expand" (ie: remove from string when appropriate) per-level/per-flag stuff */ /* ToDo: Strip ANSI (I betcha @-codes can slap it in there) */ while(p<txt.length && x<this.width && y<this.height) { ch=txt.substr(p++,1); switch(ch) { case '\1': /* CTRL-A code */ ch=txt.substr(p++,1); switch(ch) { case '\1': /* A "real" ^A code */ this.data[x][y].ch=ch; this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } break; case 'K': /* Black */ curattr=(curattr)&0x8f; break; case 'R': /* Red */ curattr=((curattr)&0xff)|RED; break; case 'G': /* Green */ curattr=((curattr)&0xf8)|GREEN; break; case 'Y': /* Yellow */ curattr=((curattr)&0xf8)|BROWN; break; case 'B': /* Blue */ curattr=((curattr)&0xf8)|BLUE; break; case 'M': /* Magenta */ curattr=((curattr)&0xf8)|MAGENTA; break; case 'C': /* Cyan */ curattr=((curattr)&0xf8)|CYAN; break; case 'W': /* White */ curattr=((curattr)&0xf8)|LIGHTGRAY; break; case '0': /* Black */ curattr=(curattr)&0x8f; break; case '1': /* Red */ curattr=((curattr)&0x8f)|(RED<<4); break; case '2': /* Green */ curattr=((curattr)&0x8f)|(GREEN<<4); break; case '3': /* Yellow */ curattr=((curattr)&0x8f)|(BROWN<<4); break; case '4': /* Blue */ curattr=((curattr)&0x8f)|(BLUE<<4); break; case '5': /* Magenta */ curattr=((curattr)&0x8f)|(MAGENTA<<4); break; case '6': /* Cyan */ curattr=((curattr)&0x8f)|(CYAN<<4); break; case '7': /* White */ curattr=((curattr)&0x8f)|(LIGHTGRAY<<4); break; case 'H': /* High Intensity */ curattr|=HIGH; break; case 'I': /* Blink */ curattr|=BLINK; break; case 'N': /* Normal (ToDo: Does this do ESC[0?) */ curattr=7; break; case '-': /* Normal if High, Blink, or BG */ if(curattr & 0xf8) curattr=7; break; case '_': /* Normal if blink/background */ if(curattr & 0xf0) curattr=7; break; case '[': /* CR */ x=0; break; case ']': /* LF */ y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: /* Other stuff... specifically, check for right movement */ if(ch.charCodeAt(0)>127) { x+=ch.charCodeAt(0)-127; if(x>=this.width) x=this.width-1; } } break; case '\7': /* Beep */ break; case '\r': x=0; break; case '\n': y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: this.data[x][y].ch=txt.substr(p,1); this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } } }}
if(scroll && y==this.height) {
if(scroll && y>=this.height) {
function Graphic_putmsg(xpos, ypos, txt, attr, scroll){ var curattr=attr; var ch; var x=xpos-1; var y=ypos-1; if(curattr==undefined) curattr=this.attribute; /* Expand @-codes */ txt=txt.replace(/@(.*)@/g, function (str, code, offset, s) { return bbs.atcode(code); } ); /* ToDo: Expand \1D, \1T, \1<, \1Z */ /* ToDo: "Expand" (ie: remove from string when appropriate) per-level/per-flag stuff */ /* ToDo: Strip ANSI (I betcha @-codes can slap it in there) */ while(p<txt.length && x<this.width && y<this.height) { ch=txt.substr(p++,1); switch(ch) { case '\1': /* CTRL-A code */ ch=txt.substr(p++,1); switch(ch) { case '\1': /* A "real" ^A code */ this.data[x][y].ch=ch; this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } break; case 'K': /* Black */ curattr=(curattr)&0x8f; break; case 'R': /* Red */ curattr=((curattr)&0xff)|RED; break; case 'G': /* Green */ curattr=((curattr)&0xf8)|GREEN; break; case 'Y': /* Yellow */ curattr=((curattr)&0xf8)|BROWN; break; case 'B': /* Blue */ curattr=((curattr)&0xf8)|BLUE; break; case 'M': /* Magenta */ curattr=((curattr)&0xf8)|MAGENTA; break; case 'C': /* Cyan */ curattr=((curattr)&0xf8)|CYAN; break; case 'W': /* White */ curattr=((curattr)&0xf8)|LIGHTGRAY; break; case '0': /* Black */ curattr=(curattr)&0x8f; break; case '1': /* Red */ curattr=((curattr)&0x8f)|(RED<<4); break; case '2': /* Green */ curattr=((curattr)&0x8f)|(GREEN<<4); break; case '3': /* Yellow */ curattr=((curattr)&0x8f)|(BROWN<<4); break; case '4': /* Blue */ curattr=((curattr)&0x8f)|(BLUE<<4); break; case '5': /* Magenta */ curattr=((curattr)&0x8f)|(MAGENTA<<4); break; case '6': /* Cyan */ curattr=((curattr)&0x8f)|(CYAN<<4); break; case '7': /* White */ curattr=((curattr)&0x8f)|(LIGHTGRAY<<4); break; case 'H': /* High Intensity */ curattr|=HIGH; break; case 'I': /* Blink */ curattr|=BLINK; break; case 'N': /* Normal (ToDo: Does this do ESC[0?) */ curattr=7; break; case '-': /* Normal if High, Blink, or BG */ if(curattr & 0xf8) curattr=7; break; case '_': /* Normal if blink/background */ if(curattr & 0xf0) curattr=7; break; case '[': /* CR */ x=0; break; case ']': /* LF */ y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: /* Other stuff... specifically, check for right movement */ if(ch.charCodeAt(0)>127) { x+=ch.charCodeAt(0)-127; if(x>=this.width) x=this.width-1; } } break; case '\7': /* Beep */ break; case '\r': x=0; break; case '\n': y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: this.data[x][y].ch=txt.substr(p,1); this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } } }}
curattr=(curattr)&0x8f;
curattr=(curattr)&0xf8;
function Graphic_putmsg(xpos, ypos, txt, attr, scroll){ var curattr=attr; var ch; var x=xpos-1; var y=ypos-1; if(curattr==undefined) curattr=this.attribute; /* Expand @-codes */ txt=txt.replace(/@(.*)@/g, function (str, code, offset, s) { return bbs.atcode(code); } ); /* ToDo: Expand \1D, \1T, \1<, \1Z */ /* ToDo: "Expand" (ie: remove from string when appropriate) per-level/per-flag stuff */ /* ToDo: Strip ANSI (I betcha @-codes can slap it in there) */ while(p<txt.length && x<this.width && y<this.height) { ch=txt.substr(p++,1); switch(ch) { case '\1': /* CTRL-A code */ ch=txt.substr(p++,1); switch(ch) { case '\1': /* A "real" ^A code */ this.data[x][y].ch=ch; this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } break; case 'K': /* Black */ curattr=(curattr)&0x8f; break; case 'R': /* Red */ curattr=((curattr)&0xff)|RED; break; case 'G': /* Green */ curattr=((curattr)&0xf8)|GREEN; break; case 'Y': /* Yellow */ curattr=((curattr)&0xf8)|BROWN; break; case 'B': /* Blue */ curattr=((curattr)&0xf8)|BLUE; break; case 'M': /* Magenta */ curattr=((curattr)&0xf8)|MAGENTA; break; case 'C': /* Cyan */ curattr=((curattr)&0xf8)|CYAN; break; case 'W': /* White */ curattr=((curattr)&0xf8)|LIGHTGRAY; break; case '0': /* Black */ curattr=(curattr)&0x8f; break; case '1': /* Red */ curattr=((curattr)&0x8f)|(RED<<4); break; case '2': /* Green */ curattr=((curattr)&0x8f)|(GREEN<<4); break; case '3': /* Yellow */ curattr=((curattr)&0x8f)|(BROWN<<4); break; case '4': /* Blue */ curattr=((curattr)&0x8f)|(BLUE<<4); break; case '5': /* Magenta */ curattr=((curattr)&0x8f)|(MAGENTA<<4); break; case '6': /* Cyan */ curattr=((curattr)&0x8f)|(CYAN<<4); break; case '7': /* White */ curattr=((curattr)&0x8f)|(LIGHTGRAY<<4); break; case 'H': /* High Intensity */ curattr|=HIGH; break; case 'I': /* Blink */ curattr|=BLINK; break; case 'N': /* Normal (ToDo: Does this do ESC[0?) */ curattr=7; break; case '-': /* Normal if High, Blink, or BG */ if(curattr & 0xf8) curattr=7; break; case '_': /* Normal if blink/background */ if(curattr & 0xf0) curattr=7; break; case '[': /* CR */ x=0; break; case ']': /* LF */ y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: /* Other stuff... specifically, check for right movement */ if(ch.charCodeAt(0)>127) { x+=ch.charCodeAt(0)-127; if(x>=this.width) x=this.width-1; } } break; case '\7': /* Beep */ break; case '\r': x=0; break; case '\n': y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: this.data[x][y].ch=txt.substr(p,1); this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } } }}
curattr=((curattr)&0xff)|RED;
curattr=((curattr)&0xf8)|RED;
function Graphic_putmsg(xpos, ypos, txt, attr, scroll){ var curattr=attr; var ch; var x=xpos-1; var y=ypos-1; if(curattr==undefined) curattr=this.attribute; /* Expand @-codes */ txt=txt.replace(/@(.*)@/g, function (str, code, offset, s) { return bbs.atcode(code); } ); /* ToDo: Expand \1D, \1T, \1<, \1Z */ /* ToDo: "Expand" (ie: remove from string when appropriate) per-level/per-flag stuff */ /* ToDo: Strip ANSI (I betcha @-codes can slap it in there) */ while(p<txt.length && x<this.width && y<this.height) { ch=txt.substr(p++,1); switch(ch) { case '\1': /* CTRL-A code */ ch=txt.substr(p++,1); switch(ch) { case '\1': /* A "real" ^A code */ this.data[x][y].ch=ch; this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } break; case 'K': /* Black */ curattr=(curattr)&0x8f; break; case 'R': /* Red */ curattr=((curattr)&0xff)|RED; break; case 'G': /* Green */ curattr=((curattr)&0xf8)|GREEN; break; case 'Y': /* Yellow */ curattr=((curattr)&0xf8)|BROWN; break; case 'B': /* Blue */ curattr=((curattr)&0xf8)|BLUE; break; case 'M': /* Magenta */ curattr=((curattr)&0xf8)|MAGENTA; break; case 'C': /* Cyan */ curattr=((curattr)&0xf8)|CYAN; break; case 'W': /* White */ curattr=((curattr)&0xf8)|LIGHTGRAY; break; case '0': /* Black */ curattr=(curattr)&0x8f; break; case '1': /* Red */ curattr=((curattr)&0x8f)|(RED<<4); break; case '2': /* Green */ curattr=((curattr)&0x8f)|(GREEN<<4); break; case '3': /* Yellow */ curattr=((curattr)&0x8f)|(BROWN<<4); break; case '4': /* Blue */ curattr=((curattr)&0x8f)|(BLUE<<4); break; case '5': /* Magenta */ curattr=((curattr)&0x8f)|(MAGENTA<<4); break; case '6': /* Cyan */ curattr=((curattr)&0x8f)|(CYAN<<4); break; case '7': /* White */ curattr=((curattr)&0x8f)|(LIGHTGRAY<<4); break; case 'H': /* High Intensity */ curattr|=HIGH; break; case 'I': /* Blink */ curattr|=BLINK; break; case 'N': /* Normal (ToDo: Does this do ESC[0?) */ curattr=7; break; case '-': /* Normal if High, Blink, or BG */ if(curattr & 0xf8) curattr=7; break; case '_': /* Normal if blink/background */ if(curattr & 0xf0) curattr=7; break; case '[': /* CR */ x=0; break; case ']': /* LF */ y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: /* Other stuff... specifically, check for right movement */ if(ch.charCodeAt(0)>127) { x+=ch.charCodeAt(0)-127; if(x>=this.width) x=this.width-1; } } break; case '\7': /* Beep */ break; case '\r': x=0; break; case '\n': y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: this.data[x][y].ch=txt.substr(p,1); this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } } }}
this.data[x][y].ch=txt.substr(p,1);
this.data[x][y].ch=ch;
function Graphic_putmsg(xpos, ypos, txt, attr, scroll){ var curattr=attr; var ch; var x=xpos-1; var y=ypos-1; if(curattr==undefined) curattr=this.attribute; /* Expand @-codes */ txt=txt.replace(/@(.*)@/g, function (str, code, offset, s) { return bbs.atcode(code); } ); /* ToDo: Expand \1D, \1T, \1<, \1Z */ /* ToDo: "Expand" (ie: remove from string when appropriate) per-level/per-flag stuff */ /* ToDo: Strip ANSI (I betcha @-codes can slap it in there) */ while(p<txt.length && x<this.width && y<this.height) { ch=txt.substr(p++,1); switch(ch) { case '\1': /* CTRL-A code */ ch=txt.substr(p++,1); switch(ch) { case '\1': /* A "real" ^A code */ this.data[x][y].ch=ch; this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } break; case 'K': /* Black */ curattr=(curattr)&0x8f; break; case 'R': /* Red */ curattr=((curattr)&0xff)|RED; break; case 'G': /* Green */ curattr=((curattr)&0xf8)|GREEN; break; case 'Y': /* Yellow */ curattr=((curattr)&0xf8)|BROWN; break; case 'B': /* Blue */ curattr=((curattr)&0xf8)|BLUE; break; case 'M': /* Magenta */ curattr=((curattr)&0xf8)|MAGENTA; break; case 'C': /* Cyan */ curattr=((curattr)&0xf8)|CYAN; break; case 'W': /* White */ curattr=((curattr)&0xf8)|LIGHTGRAY; break; case '0': /* Black */ curattr=(curattr)&0x8f; break; case '1': /* Red */ curattr=((curattr)&0x8f)|(RED<<4); break; case '2': /* Green */ curattr=((curattr)&0x8f)|(GREEN<<4); break; case '3': /* Yellow */ curattr=((curattr)&0x8f)|(BROWN<<4); break; case '4': /* Blue */ curattr=((curattr)&0x8f)|(BLUE<<4); break; case '5': /* Magenta */ curattr=((curattr)&0x8f)|(MAGENTA<<4); break; case '6': /* Cyan */ curattr=((curattr)&0x8f)|(CYAN<<4); break; case '7': /* White */ curattr=((curattr)&0x8f)|(LIGHTGRAY<<4); break; case 'H': /* High Intensity */ curattr|=HIGH; break; case 'I': /* Blink */ curattr|=BLINK; break; case 'N': /* Normal (ToDo: Does this do ESC[0?) */ curattr=7; break; case '-': /* Normal if High, Blink, or BG */ if(curattr & 0xf8) curattr=7; break; case '_': /* Normal if blink/background */ if(curattr & 0xf0) curattr=7; break; case '[': /* CR */ x=0; break; case ']': /* LF */ y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: /* Other stuff... specifically, check for right movement */ if(ch.charCodeAt(0)>127) { x+=ch.charCodeAt(0)-127; if(x>=this.width) x=this.width-1; } } break; case '\7': /* Beep */ break; case '\r': x=0; break; case '\n': y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: this.data[x][y].ch=txt.substr(p,1); this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } } }}
var x=xpos-1; var y=ypos-1;
function Graphic_putmsg(xpos, ypos, txt, attr, scroll){ var curattr=attr; var ch; if(curattr==undefined) curattr=this.attribute; /* Expand @-codes */ txt=txt.replace(/@(.*)@/g, function (str, code, offset, s) { return bbs.atcode(code); } ); /* ToDo: Expand \1D, \1T, \1<, \1Z */ /* ToDo: "Expand" (ie: remove from string when appropriate) per-level/per-flag stuff */ /* ToDo: Strip ANSI (I betcha @-codes can slap it in there) */ while(p<txt.length && x<this.width && y<this.height) { ch=txt.substr(p++,1); switch(ch) { case '\1': /* CTRL-A code */ ch=txt.substr(p++,1); switch(ch) { case '\1': /* A "real" ^A code */ this.data[x][y].ch=ch; this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } break; case 'K': /* Black */ curattr=(curattr)&0x8f; break; case 'R': /* Red */ curattr=((curattr)&0xff)|RED; break; case 'G': /* Green */ curattr=((curattr)&0xf8)|GREEN; break; case 'Y': /* Yellow */ curattr=((curattr)&0xf8)|BROWN; break; case 'B': /* Blue */ curattr=((curattr)&0xf8)|BLUE; break; case 'M': /* Magenta */ curattr=((curattr)&0xf8)|MAGENTA; break; case 'C': /* Cyan */ curattr=((curattr)&0xf8)|CYAN; break; case 'W': /* White */ curattr=((curattr)&0xf8)|LIGHTGRAY; break; case '0': /* Black */ curattr=(curattr)&0x8f; break; case '1': /* Red */ curattr=((curattr)&0x8f)|(RED<<4); break; case '2': /* Green */ curattr=((curattr)&0x8f)|(GREEN<<4); break; case '3': /* Yellow */ curattr=((curattr)&0x8f)|(BROWN<<4); break; case '4': /* Blue */ curattr=((curattr)&0x8f)|(BLUE<<4); break; case '5': /* Magenta */ curattr=((curattr)&0x8f)|(MAGENTA<<4); break; case '6': /* Cyan */ curattr=((curattr)&0x8f)|(CYAN<<4); break; case '7': /* White */ curattr=((curattr)&0x8f)|(LIGHTGRAY<<4); break; case 'H': /* High Intensity */ curattr|=HIGH; break; case 'I': /* Blink */ curattr|=BLINK; break; case 'N': /* Normal (ToDo: Does this do ESC[0?) */ curattr=7; break; case '-': /* Normal if High, Blink, or BG */ if(curattr & 0xf8) curattr=7; break; case '_': /* Normal if blink/background */ if(curattr & 0xf0) curattr=7; break; case '[': /* CR */ x=0; break; case ']': /* LF */ y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: /* Other stuff... specifically, check for right movement */ if(ch.charCodeAt(0)>127) { x+=ch.charCodeAt(0)-127; if(x>=this.width) x=this.width-1; } } break; case '\7': /* Beep */ break; case '\r': x=0; break; case '\n': y++; if(scroll && y==this.height) { this.scroll(1); y--; } break; default: this.data[x][y].ch=txt.substr(p,1); this.data[x][y].attr=curattr; x++; if(x>=this.width) { x=0; y++; if(scroll && y==this.height) { this.scroll(1); y--; } } } }}
for(y=height-lines; y<this.height; y++) {
for(y=this.height-lines; y<this.height; y++) {
function Graphic_scroll(lines){ var x; var y; if(lines<1) /* Do not (yet... ToDo) allow negative scroll */ return; for(y=lines; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y-lines].ch=this.data[x][y].ch; this.data[x][y-lines].attr=this.data[x][y].attr; } } for(y=height-lines; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y-lines].ch=this.ch; this.data[x][y-lines].attr=this.attribute; } }}
this.data[x][y-lines].ch=this.ch; this.data[x][y-lines].attr=this.attribute;
this.data[x][y].ch=this.ch; this.data[x][y].attr=this.attribute;
function Graphic_scroll(lines){ var x; var y; if(lines<1) /* Do not (yet... ToDo) allow negative scroll */ return; for(y=lines; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y-lines].ch=this.data[x][y].ch; this.data[x][y-lines].attr=this.data[x][y].attr; } } for(y=height-lines; y<this.height; y++) { for(x=0; x<this.width; x++) { this.data[x][y-lines].ch=this.ch; this.data[x][y-lines].attr=this.attribute; } }}
this.data[x][y].ch=txt.substr(p,1);
this.data[x][y].ch=txt.substr(p++,1);
function Graphic_write(xpos, ypos, txt, attr){ var x=xpos-1; var y=ypos-1; var p=0; while(p<txt.length && x<this.width && y<this.height) { this.data[x][y].ch=txt.substr(p,1); if(attr!=undefined) this.data[x][y].attr=attr; x++; if(x>=this.width) { x=0; y++; } }}
while(p<txt.length && x<=this.width && y<=this.height) {
while(p<txt.length && x<this.width && y<this.height) {
function Graphic_write(xpos, ypos, txt, attr){ var x=xpos-1; var y=ypos-1; var p=0; while(p<txt.length && x<=this.width && y<=this.height) { this.data[x][y].ch=txt.substr(p,1); if(attr!=undefined) this.data[x][y].attr=attr; x++; if(x>=this.width) { x=0; y++; } }}
list[i].checked = false;
list[i].checked = false; }
function GridSphere_CheckBoxList_checkOne(list) { // alert("GridSphere CheckBoxList Check One"); // Uncheck "all" option list[0].checked = false; // Uncheck those that don't match selection for (i = 1; i < list.length; i++) { if (list[i].value != list[0].value) { list[i].checked = false; } } }
}
function GridSphere_CheckBoxList_checkOne(list) { // alert("GridSphere CheckBoxList Check One"); // Uncheck "all" option list[0].checked = false; // Uncheck those that don't match selection for (i = 1; i < list.length; i++) { if (list[i].value != list[0].value) { list[i].checked = false; } } }
alert("GridSphere CheckBoxList Clear");
function GridSphere_CheckBoxList_clear(list) { // alert("GridSphere CheckBoxList Clear"); for (i = 0; i < list.length; i++) { list[i].checked = false; } // Clear selected value list[0].value = ""; }
if (newSelection.checked == true) {
function GridSphere_CheckBoxList_onClick(list, newSelection) { // alert("GridSphere CheckBoxList On Click"); // alert("GridSphere CheckBoxList current selection: " + list[0].value); if (newSelection.checked == true) { // Save selection only if none made yet if (list[0].value == "") { list[0].value = newSelection.value; } } else { // If saved selection was this one if (list[0].value == newSelection.value) { var found = false; // Set selection to first checked item other than this for (i = 1; i < list.length && !found; i++) { if (list[i].checked == true) { if (list[i].value != item.value) { list[0].value = list[i].value; found = true; } } } // If we didn't find a checked value if (!found) { // Set selection to none list[0].value = ""; } } } // alert("GridSphere CheckBoxList new selection: " + selection.value); }
if (newSelection.checked == true) {
if (list[0].value == "") {
function GridSphere_CheckBoxList_onClick(list, newSelection) { // alert("GridSphere CheckBoxList On Click"); // alert("GridSphere CheckBoxList current selection: " + list[0].value); if (newSelection.checked == true) { // Save selection only if none made yet if (list[0].value == "") { list[0].value = newSelection.value; } } else { // If saved selection was this one if (list[0].value == newSelection.value) { var found = false; // Set selection to first checked item other than this for (i = 1; i < list.length && !found; i++) { if (list[i].checked == true) { if (list[i].value != item.value) { list[0].value = list[i].value; found = true; } } } // If we didn't find a checked value if (!found) { // Set selection to none list[0].value = ""; } } } // alert("GridSphere CheckBoxList new selection: " + selection.value); }
if (list[0].value == "") {
list[0].value = newSelection.value; }
function GridSphere_CheckBoxList_onClick(list, newSelection) { // alert("GridSphere CheckBoxList On Click"); // alert("GridSphere CheckBoxList current selection: " + list[0].value); if (newSelection.checked == true) { // Save selection only if none made yet if (list[0].value == "") { list[0].value = newSelection.value; } } else { // If saved selection was this one if (list[0].value == newSelection.value) { var found = false; // Set selection to first checked item other than this for (i = 1; i < list.length && !found; i++) { if (list[i].checked == true) { if (list[i].value != item.value) { list[0].value = list[i].value; found = true; } } } // If we didn't find a checked value if (!found) { // Set selection to none list[0].value = ""; } } } // alert("GridSphere CheckBoxList new selection: " + selection.value); }
list[0].value = newSelection.value;
} else { if (list[0].value == newSelection.value) { var found = false; for (i = 1; i < list.length && !found; i++) { if (list[i].checked == true) { if (list[i].value != item.value) { list[0].value = list[i].value; found = true; } } } if (!found) { list[0].value = ""; } }
function GridSphere_CheckBoxList_onClick(list, newSelection) { // alert("GridSphere CheckBoxList On Click"); // alert("GridSphere CheckBoxList current selection: " + list[0].value); if (newSelection.checked == true) { // Save selection only if none made yet if (list[0].value == "") { list[0].value = newSelection.value; } } else { // If saved selection was this one if (list[0].value == newSelection.value) { var found = false; // Set selection to first checked item other than this for (i = 1; i < list.length && !found; i++) { if (list[i].checked == true) { if (list[i].value != item.value) { list[0].value = list[i].value; found = true; } } } // If we didn't find a checked value if (!found) { // Set selection to none list[0].value = ""; } } } // alert("GridSphere CheckBoxList new selection: " + selection.value); }
} else { if (list[0].value == newSelection.value) { var found = false; for (i = 1; i < list.length && !found; i++) { if (list[i].checked == true) { if (list[i].value != item.value) { list[0].value = list[i].value; found = true; } } } if (!found) { list[0].value = ""; } } }
function GridSphere_CheckBoxList_onClick(list, newSelection) { // alert("GridSphere CheckBoxList On Click"); // alert("GridSphere CheckBoxList current selection: " + list[0].value); if (newSelection.checked == true) { // Save selection only if none made yet if (list[0].value == "") { list[0].value = newSelection.value; } } else { // If saved selection was this one if (list[0].value == newSelection.value) { var found = false; // Set selection to first checked item other than this for (i = 1; i < list.length && !found; i++) { if (list[i].checked == true) { if (list[i].value != item.value) { list[0].value = list[i].value; found = true; } } } // If we didn't find a checked value if (!found) { // Set selection to none list[0].value = ""; } } } // alert("GridSphere CheckBoxList new selection: " + selection.value); }
var grid = document.getElementById (ctx);
var grid = document.getElementById (ctx + "_div");
function GridView_ClientRender (data, ctx){ var gridData = eval (ctx + "_data"); var grid = document.getElementById (ctx); var i = data.indexOf ("|"); var j = data.indexOf ("|", i+1); var k = data.indexOf ("|", j+1); gridData.pageIndex = parseInt (data.substring (0, i)); gridData.sortExp = unescape (data.substring (i+1, j)); gridData.sortDir = parseInt (data.substring (j+1, k)); grid.innerHTML = data.substr (k+1); var page = document.getElementById(ctx + "_Page"); page.value = gridData.pageIndex; var sortExp = document.getElementById(ctx + "_SortExpression"); sortExp.value = gridData.sortExp; var sortDir = document.getElementById(ctx + "_SortDirection"); sortDir.value = gridData.sortDir;}
var groupManager = getGroupManager(); var groupId = ""; var name = ""; var description = ""; var message = ""; while (true) { sendPageAndWait("groups/profile.xml", { "page-title" : "Add Group", "group-id" : groupId, "name" : name, "description" : description, "message" : message, "new-group" : true });
resolve(); try { var groupManager = getAccreditableManager().getGroupManager(); var groupId = ""; var name = ""; var description = ""; var message = "";
function group_add_group() { var groupManager = getGroupManager(); var groupId = ""; var name = ""; var description = ""; var message = ""; while (true) { sendPageAndWait("groups/profile.xml", { "page-title" : "Add Group", "group-id" : groupId, "name" : name, "description" : description, "message" : message, "new-group" : true }); if (cocoon.request.get("cancel")) { break; } message = ""; groupId = cocoon.request.get("group-id"); name = cocoon.request.get("name"); description = cocoon.request.get("description"); var existingGroup = groupManager.getGroup(groupId); if (existingGroup != null) { message = "This group already exists."; } else if (!Packages.org.apache.lenya.cms.ac.AbstractItem.isValidId(groupId)) { message = "This is not a valid group ID."; } else { var configDir = groupManager.getConfigurationDirectory(); var group = new Packages.org.apache.lenya.cms.ac.FileGroup(configDir, groupId); group.setName(name); group.setDescription(description); group.save(); groupManager.add(group); break; } } sendPage("redirect.html", { "url" : "../groups.html" });}
if (cocoon.request.get("cancel")) { break; } message = ""; groupId = cocoon.request.get("group-id"); name = cocoon.request.get("name"); description = cocoon.request.get("description"); var existingGroup = groupManager.getGroup(groupId); if (existingGroup != null) { message = "This group already exists.";
while (true) { cocoon.sendPageAndWait("groups/profile.xml", { "page-title" : "Add Group", "group-id" : groupId, "name" : name, "description" : description, "message" : message, "new-group" : true }); if (cocoon.request.get("cancel")) { break; } message = ""; groupId = cocoon.request.get("group-id"); name = cocoon.request.get("name"); description = cocoon.request.get("description"); var existingGroup = groupManager.getGroup(groupId); if (existingGroup != null) { message = "This group already exists."; } else if (!Packages.org.apache.lenya.cms.ac.AbstractItem.isValidId(groupId)) { message = "This is not a valid group ID."; } else { var configDir = groupManager.getConfigurationDirectory(); var group = new Packages.org.apache.lenya.cms.ac.FileGroup(configDir, groupId); group.setName(name); group.setDescription(description); group.save(); groupManager.add(group); break; }
function group_add_group() { var groupManager = getGroupManager(); var groupId = ""; var name = ""; var description = ""; var message = ""; while (true) { sendPageAndWait("groups/profile.xml", { "page-title" : "Add Group", "group-id" : groupId, "name" : name, "description" : description, "message" : message, "new-group" : true }); if (cocoon.request.get("cancel")) { break; } message = ""; groupId = cocoon.request.get("group-id"); name = cocoon.request.get("name"); description = cocoon.request.get("description"); var existingGroup = groupManager.getGroup(groupId); if (existingGroup != null) { message = "This group already exists."; } else if (!Packages.org.apache.lenya.cms.ac.AbstractItem.isValidId(groupId)) { message = "This is not a valid group ID."; } else { var configDir = groupManager.getConfigurationDirectory(); var group = new Packages.org.apache.lenya.cms.ac.FileGroup(configDir, groupId); group.setName(name); group.setDescription(description); group.save(); groupManager.add(group); break; } } sendPage("redirect.html", { "url" : "../groups.html" });}
else if (!Packages.org.apache.lenya.cms.ac.AbstractItem.isValidId(groupId)) { message = "This is not a valid group ID."; } else { var configDir = groupManager.getConfigurationDirectory(); var group = new Packages.org.apache.lenya.cms.ac.FileGroup(configDir, groupId); group.setName(name); group.setDescription(description); group.save(); groupManager.add(group); break; } } sendPage("redirect.html", { "url" : "../groups.html" });
cocoon.sendPage("redirect.html", { "url" : "../groups.html" }); } finally { release(); }
function group_add_group() { var groupManager = getGroupManager(); var groupId = ""; var name = ""; var description = ""; var message = ""; while (true) { sendPageAndWait("groups/profile.xml", { "page-title" : "Add Group", "group-id" : groupId, "name" : name, "description" : description, "message" : message, "new-group" : true }); if (cocoon.request.get("cancel")) { break; } message = ""; groupId = cocoon.request.get("group-id"); name = cocoon.request.get("name"); description = cocoon.request.get("description"); var existingGroup = groupManager.getGroup(groupId); if (existingGroup != null) { message = "This group already exists."; } else if (!Packages.org.apache.lenya.cms.ac.AbstractItem.isValidId(groupId)) { message = "This is not a valid group ID."; } else { var configDir = groupManager.getConfigurationDirectory(); var group = new Packages.org.apache.lenya.cms.ac.FileGroup(configDir, groupId); group.setName(name); group.setDescription(description); group.save(); groupManager.add(group); break; } } sendPage("redirect.html", { "url" : "../groups.html" });}
if (cocoon.request.get("add_user") && otherUserId != "") {
if (cocoon.request.get("add_user") && otherUserId != null) {
function group_change_members(groupId) { resolve(); try { var userManager = getAccreditableManager().getUserManager(); var groupManager = getAccreditableManager().getGroupManager(); var group = groupManager.getGroup(groupId); var memberArray = group.getMembers(); var groupUsers = new java.util.ArrayList(); var otherUsers = new java.util.ArrayList(); var groupMachines = new java.util.ArrayList(); var otherMachines = new java.util.ArrayList(); for (var i = 0; i < memberArray.length; i++) { var member = memberArray[i]; if (member instanceof Packages.org.apache.lenya.ac.User) { groupUsers.add(member); } if (member instanceof Packages.org.apache.lenya.ac.Machine) { groupMachines.add(machine); } } var users = userManager.getUsers(); for (var i = 0; i < users.length; i++) { if (!groupUsers.contains(users[i])) { otherUsers.add(users[i]); } } while (true) { cocoon.sendPageAndWait("groups/" + groupId + "/members.xml", { "group-id" : groupId, "users" : otherUsers, "group-users" : groupUsers, "machines" : otherMachines, "group-machines" : groupMachines, }); var otherUserId = cocoon.request.get("user"); if (cocoon.request.get("add_user") && otherUserId != "") { var user = userManager.getUser(otherUserId); if (!groupUsers.contains(user)) { groupUsers.add(user); otherUsers.remove(user); } } var groupUserId = cocoon.request.get("group_user"); if (cocoon.request.get("remove_user") && groupUserId != "") { var user = userManager.getUser(groupUserId); if (groupUsers.contains(user)) { groupUsers.remove(user); otherUsers.add(user); } } if (cocoon.request.get("cancel")) { break; } if (cocoon.request.get("submit")) { group.removeAllMembers(); var userIterator = groupUsers.iterator(); while (userIterator.hasNext()) { var user = userIterator.next(); group.add(user); user.save(); } break; } } cocoon.sendPage("redirect.html", { "url" : "index.html" }); } finally { release(); }}