interface.js
Summary
No overview generated for 'interface.js'
var mozileTarget;
Mozile.prototype.open = function(url) {
var name = "";
var options = "";
if(arguments.length == 2) name = arguments[2];
if(arguments.length == 3) options = arguments[3];
if(mozile.extension) {
mozileTarget = document.commandDispatcher.focusedWindow;
}
else {
mozileTarget = window;
}
return window.open(url,name,options);
}
Mozile.prototype.createToolbar = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.createToolbar()";
this.debug(f,1,"Creating toolbar");
this.loadLink(this.root + "core/interface.css", "Mozile-Core-interface.css");
if(!this.styleSheet) this.addStyleSheet();
var rule;
if(document.documentElement.tagName.toLowerCase()=="html") {
rule = "body { -moz-binding: url(" + this.root +"core/interface.xml#toolbar); }";
}
else {
rule = "moziletoolbar { -moz-binding: url(" + this.root +"core/interface.xml#toolbar); }";
document.documentElement.insertBefore(document.createElement("moziletoolbar"), document.documentElement.firstChild);
}
this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
this.rootCommandList = mozile.createCommand("MozileCommandList: id=Mozile-RootList, label='Mozile Root List'");
var mozileList = this.rootCommandList.createCommand("MozileCommandList: id=Mozile-firstList, label='Mozile First List', image='"+this.root+"images/Mozile-Smaller.png', buttonPosition=0, menuPosition=0");
var about = mozileList.createCommand("MozileCommand: id=Mozile-About, label='About Mozile'");
about.command = function(event) {
mozile.showAboutInterface();
document.getAnonymousElementByAttribute(mozile.aboutInterface.parentNode, "id", "version").value = mozile.version;
}
var accel = mozileList.createCommand("MozileCommand: id=Mozile-Accelerators, label='Keyboard Shortcuts'");
accel.command = function(event) {
if(mozile.keyboardShortcuts) {
var message = "Mozile defines the following keyboard shortcuts:";
var accels = mozile.acceleratorList;
for(key in accels) {
message = message +"\n"+accels[key].label+" => "+key;
}
alert(message);
}
else {
alert("Mozile keyboard shortcuts have been turned off.");
}
}
var debug = mozileList.createCommand("MozileCommand: id=Mozile-Debug, label=Debug");
debug.command = function(event) {
mozile.showMessageInterface();
mozileDebugInit();
}
var report = mozileList.createCommand("MozileCommand: id=Mozile-ReportBugs, label='Report a Bug'");
report.command = function(event) {
window.open("http://mozile.mozdev.org/bugs.html", "Mozile Bugs", "");
}
var home = mozileList.createCommand("MozileCommand: id=Mozile-Home, label='Mozile Home'");
home.command = function(event) {
window.open("http://mozile.mozdev.org", "Mozile Home", "");
}
var help = mozileList.createCommand("MozileCommand: id=Mozile-Help, label='Help'");
help.command = function(event) {
window.open(mozile.root+"docs/index.html", "Mozile Help", "");
}
var save = this.rootCommandList.createCommand("MozileCommand: id=Mozile-Save, label=Save, tooltip='Save to a dialog', accelerator='Command-S', image='"+this.root+"images/filesave.png'");
save.command = function(event) {
mozile.save();
}
var saveAs = this.rootCommandList.createCommand("MozileCommand: id=Mozile-SaveAs, label='Save As', tooltip='Save as...', accelerator='Command-Shift-S', image='"+this.root+"images/filesaveas.png'");
saveAs.command = function(event) {
mozile.saveAs();
}
return true;
}
Mozile.prototype.initializeToolbar = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.initializeToolbar()";
this.debug(f,1,"Initializing toolbar");
this.rootCommandList.createBox();
this.toolbar.appendChild(this.rootCommandList.box);
return true;
}
Mozile.prototype.hideToolbar = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.hideToolbar()";
this.debug(f,1,"Hiding toolbar");
this.toolbar.collapsed = true;
this.statusbar.collapsed = true;
return true;
}
Mozile.prototype.showToolbar = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.showToolbar()";
this.debug(f,1,"Showing toolbar. First time? " + this.firstToolbarShow);
if(this.firstToolbarShow) {
if(this.toolbarPosition == "absolute") {
this.toolbar.style.position = "absolute";
this.statusbar.style.position = "absolute";
}
if(this.toolbarUpdateFrequency == 2) {
window.setInterval("mozile.moveToolbar()", 100);
}
this.initializeToolbar();
this.storeState("Initial state");
this.firstToolbarShow=false;
}
this.toolbar.collapsed = false;
this.statusbar.collapsed = false;
return true;
}
Mozile.prototype.moveToolbar = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.moveToolbar()";
if(this.toolbar == null) return false;
if(!this.lastWindowSize) {
this.lastWindowSize = new Array();
}
if(this.lastWindowSize["innerWidth"] == window.innerWidth &&
this.lastWindowSize["innerHeight"] == window.innerHeight &&
this.lastWindowSize["pageXOffset"] == window.pageXOffset &&
this.lastWindowSize["pageYOffset"] == window.pageYOffset &&
this.lastWindowSize["toolbarWidth"] == this.toolbar.boxObject.width) {
return true;
}
this.debug(f,1,"Moving toolbar.");
this.toolbar.style.left= "0px";
this.toolbar.style.left = (window.innerWidth - this.toolbar.boxObject.width) / 2 +"px";
this.statusbar.style.left = (window.innerWidth - this.statusbar.boxObject.width) / 2 +"px";
if(this.toolbar.style.position == "absolute") {
this.debug(f,1,"Moving toolbars");
this.toolbar.style.top = window.pageYOffset - 1 +"px";
this.statusbar.style.top = window.pageYOffset + window.innerHeight - this.statusbar.boxObject.height + 1 +"px";
}
this.lastWindowSize["innerWidth"] = window.innerWidth;
this.lastWindowSize["innerHeight"] = window.innerHeight;
this.lastWindowSize["pageXOffset"] = window.pageXOffset;
this.lastWindowSize["pageYOffset"] = window.pageYOffset;
this.lastWindowSize["toolbarWidth"] = this.toolbar.boxObject.width;
return true;
}
Mozile.prototype.updateToolbar = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.updateToolbar()";
this.debug(f,1,"Updating toolbar");
if(this.toolbarUpdateFrequency==0) return true;
var force = false;
if(arguments.length > 0) {
force = arguments[0];
}
var selection = mozile.getSelection();
if(!force) {
if(selection.focusNode == this.lastFocusNode) {
this.debug(f,0,"Toolbar update not required");
return true;
}
}
this.debug(f,1,"Updating toolbar");
this.lastFocusNode = selection.focusNode;
for(var command in this.commandList) {
try {
this.commandList[command].update();
} catch(e) {
}
}
this.moveToolbar();
return true;
}
Mozile.prototype.saveToDialog = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "mozileSaveToDialog";
var mozileDocument = this.getDocument();
this.showSourceInterface();
mozileDocument.getAnonymousElementByAttribute(this.sourceInterface.parentNode,'id','sourceText').value = this.content();
this.status(f,1,"Displaying document contents.");
return true;
}
Mozile.prototype.save = function() {
var mode;
if(this.saveList["custom"] != null) {
mode = "custom";
}
else {
if(this.saveList["default"] != null) {
mode = "default";
}
else {
return this.saveAs();
}
}
if(this.saveFlag == true || !this.saveConfig) {
this.saveFlag = false;
this.saveConfig = new Array();
for(key in this.saveList[mode]) {
this.saveConfig[key] = this.saveList[mode][key];
}
}
eval( this.saveConfig["function"] + "()" );
return true;
}
Mozile.prototype.saveAs = function() {
this.showSaveInterface();
mozileSaveInit();
return true;
}
Mozile.prototype.createCommand = function(configString) {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.createCommand()";
this.debug(f,1,"Creating command "+ configString);
var configArray = this.parseConfig(configString);
var name = configArray['name'];
var command;
var create = "command = new "+name+"(configArray)";
eval(create);
return command;
}
Mozile.prototype.registerCommand = function(command) {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.registerCommand()";
this.debug(f,1,"Registering command "+ command +" with id "+ command.id);
if(typeof(command) != "object") return false;
var id = command.id;
if(id == null || this.commandIsRegistered(id)) return false;
else {
this.commandList[id] = command;
if(command.accelerator) {
var accel = command.accelerator;
if(this.operatingSystem=="Mac") {
accel = accel.replace("Command", "Meta");
}
else {
accel = accel.replace("Command", "Control");
}
this.acceleratorList[accel] = command;
}
return true;
}
}
Mozile.prototype.unregisterCommand = function(id) {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.unregisterCommand()";
this.debug(f,1,"Unregistering command "+ id);
if(!this.commandIsRegistered(id)) return false;
else {
this.commandList[id] = null;
return true;
}
}
Mozile.prototype.commandIsRegistered = function(id) {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.commandIsRegistered()";
this.debug(f,1,"Checking for command "+ id);
if(this.commandList[id]) return true;
else return false;
}
Mozile.prototype.executeCommand = function(id, event) {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "Mozile.executeCommand()";
this.debug(f,1,"Executing command "+ id +" "+ event);
var cleanId = /(.*)(\-Button|\-Menuitem)$/;
var result = cleanId.exec(id);
var commandId;
if(result) commandId = result[1];
else commandId = id;
if(!this.commandIsRegistered(commandId)) return false;
else {
var command = this.commandList[commandId];
if(this.keyCounter != 0) this.storeState(command);
result = command.command(event);
if(result && command.id!="Mozile-Undo" && command.id!="Mozile-Redo") this.storeState(command);
this.updateToolbar(true);
return true;
}
}
function MozileCommand() {
this.type = "MozileCommand";
this.id = null;
this.label = null;
this.tooltip = null;
this.image = null;
this.accesskey = null;
this.accelerator = null;
this.namespace = XULNS;
this.debugLevel = 0;
this.button = null;
this.menuitem = null;
if(arguments.length > 0){
var configArray = arguments[0];
this.init(configArray);
}
else return true;
return "Success";
}
MozileCommand.prototype.init = function(configArray) {
this.type = configArray['name'];
if(configArray['id'] && typeof(configArray['id'])!="null") {
this.id = configArray['id'];
}
else {
return "Error initializing MozileCommandList object -- invalid id provided: "+configArray['id'];
}
if(configArray['label'] && typeof(configArray['label'])!="null") {
this.label = configArray['label'];
}
else {
return "Error initializing MozileCommandList object -- invalid label provided: "+configArray['label'];
}
if(configArray['tooltip']) {
this.tooltip = configArray['tooltip'];
}
if(configArray['image']) {
this.image = configArray['image'];
}
if(configArray['accesskey']) {
this.accesskey = configArray['accesskey'];
}
if(configArray['accelerator']) {
this.accelerator = configArray['accelerator'];
}
if(configArray['debugLevel']) {
if(typeof(configArray['debugLevel'])=="number") {
this.debugLevel = configArray['debugLevel'];
}
else {
this.debugLevel = mozile.debugLevel;
}
}
return true;
}
MozileCommand.prototype.debug = mozileDebug;
MozileCommand.prototype.createButton = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommand.createButton()";
this.debug(f,1,"Creating button");
var button = document.createElementNS(XULNS, "toolbarbutton");
button.setAttribute("id", this.id+"-Button");
button.setAttribute("class", "mozileButton");
button.setAttribute("image", this.image);
button.setAttribute("label", this.label);
if(this.tooltip) button.setAttribute("tooltiptext", this.tooltip);
this.button = button;
return button;
}
MozileCommand.prototype.createMenuitem = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommand.createMenuitem()";
this.debug(f,1,"Creating menuitem");
var menuitem = document.createElementNS(XULNS, "menuitem");
menuitem.setAttribute("id", this.id+"-Menuitem");
menuitem.setAttribute("class", "mozileMenuitem");
menuitem.setAttribute("label", this.label);
if(this.tooltip) menuitem.setAttribute("tooltiptext", this.tooltip);
if(this.accesskey) menuitem.setAttribute("accesskey", this.accesskey);
this.menuitem = menuitem;
return menuitem;
}
MozileCommand.prototype.isActive = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommand.isActive()";
this.debug(f,0,"Checking to see if this command is active");
return false;
}
MozileCommand.prototype.update = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommand.update()";
this.debug(f,0,"Updating button and menuitem");
var button = this.button;
var menuitem = this.menuitem;
if(this.isActive()) {
if(button) {
button.setAttribute("active",true);
}
if(menuitem) {
menuitem.setAttribute("checked",true);
}
return true;
}
else {
if(button) {
button.setAttribute("active",false);
}
if(menuitem) {
menuitem.setAttribute("checked",false);
}
return false;
}
}
MozileCommand.prototype.command = function(event) {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommand.command()";
this.debug(f,1,"Executing command "+event);
alert("Command! "+ this.id +" "+ event);
return true;
}
MozileCommandList.prototype = new MozileCommand();
MozileCommandList.prototype.constructor = MozileCommandList;
MozileCommandList.superclass = MozileCommand.prototype;
function MozileCommandList() {
if(arguments.length > 0){
var configArray = arguments[0];
this.init(configArray);
}
else return true;
this.box = null;
this.menu = null;
this.commandList = new Array();
this.buttonList = new Array();
this.menuList = new Array();
return true;
}
MozileCommandList.prototype.createCommand = function(configString) {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommandList.createCommand()";
this.debug(f,1,"Creating command "+ configString);
var configArray = mozile.parseConfig(configString);
var name = configArray['name'];
var command;
var create = "command = new "+name+"(configArray)";
eval(create);
var buttonPosition = null;
if(configArray['buttonPosition'] != null) buttonPosition = configArray['buttonPosition'];
var menuPosition = null;
if(configArray['menuPosition'] != null) menuPosition = configArray['menuPosition'];
this.registerCommand(command, buttonPosition, menuPosition);
return command;
}
MozileCommandList.prototype.registerCommand = function(command, buttonPosition, menuPosition) {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommandList.registerCommand()";
this.debug(f,1,"Registering command "+ command +" with id "+ command.id +" at "+ buttonPosition +" and "+ menuPosition);
var id = command.id
if(command.type!="MozileCommandList") {
mozile.registerCommand(command);
}
this.commandList[id] = command;
if(buttonPosition == null) {
this.buttonList.push(command);
}
else {
if(this.buttonList[buttonPosition]==null) {
this.buttonList[buttonPosition] = command;
}
else {
this.buttonList.splice(buttonPosition, 0, command);
}
}
if(menuPosition == null) {
this.menuList.push(command);
}
else {
if(this.menuList[menuPosition]==null) {
this.menuList[menuPosition] = command;
}
else {
this.menuList.splice(menuPosition, 0, command);
}
}
return true;
}
MozileCommandList.prototype.unregisterCommand = function(id) {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommandList.unregisterCommand()";
this.debug(f,1,"Unregistering command "+ id);
mozile.unregisterCommand(command);
this.commandList[id]=null;
var i;
for(i=0; i < this.buttonList; i++) {
if(this.buttonList[i].id == id) {
this.buttonList.splice(i,0);
i--;
}
}
for(i=0; i < this.menuList; i++) {
if(this.menuList[i].id == id) {
this.menuList.splice(i,0);
i--;
}
}
return true;
}
MozileCommandList.prototype.createBox = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommandList.createBox()";
this.debug(f,1,"Creating box");
var box = document.createElementNS(XULNS, "box");
box.setAttribute("id", this.id+"-Box");
box.setAttribute("class", "mozileBox");
box.setAttribute("label", this.label);
if(this.tooltip) box.setAttribute("tooltiptext", this.tooltip);
var button;
for(var i=0; i < this.buttonList.length; i++) {
if(this.buttonList[i]) {
button = this.buttonList[i].button;
if(!button || button=="") {
this.buttonList[i].createButton();
button = this.buttonList[i].button;
}
box.appendChild(button);
}
}
this.box = box;
return box;
}
MozileCommandList.prototype.createButton = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommandList.createButton()";
this.debug(f,1,"Creating button");
var button = document.createElementNS(XULNS, "toolbarbutton");
button.setAttribute("id", this.id+"-Button");
button.setAttribute("class", "mozileButton");
button.setAttribute("image", this.image);
button.setAttribute("label", this.label);
if(this.tooltip) button.setAttribute("tooltiptext", this.tooltip);
button.setAttribute("type", "menu");
var menuPopup = document.createElementNS(XULNS, "menupopup");
button.appendChild(menuPopup);
var menuitem,menu;
for(var i=0; i < this.menuList.length; i++) {
if(this.menuList[i]) {
if(this.menuList[i].type!="MozileCommandList") {
menuitem = this.menuList[i].menuitem;
if(!menuitem || menuitem=="") {
this.menuList[i].createMenuitem();
menuitem = this.menuList[i].menuitem;
}
menuPopup.appendChild(menuitem);
}
else {
menu = this.menuList[i].menu;
if(!menu || menu=="") {
this.menuList[i].createMenu();
menu = this.menuList[i].menu;
}
menuPopup.appendChild(menu);
}
}
}
this.button = button;
return button;
}
MozileCommandList.prototype.createMenu = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommandList.createMenu()";
this.debug(f,1,"Creating menu");
var menu = document.createElementNS(XULNS, "menu");
menu.setAttribute("id", this.id+"-Menu");
menu.setAttribute("class", "mozileMenu");
menu.setAttribute("label", this.label);
if(this.tooltip) menu.setAttribute("tooltiptext", this.tooltip);
if(this.accesskey) menu.setAttribute("accesskey", this.accesskey);
var menuPopup = document.createElementNS(XULNS, "menupopup");
menu.appendChild(menuPopup);
var menuitem;
for(var i=0; i < this.menuList.length; i++) {
if(this.menuList[i]) {
menuitem = this.menuList[i].menuitem;
if(!menuitem || menuitem=="") {
this.menuList[i].createMenuitem();
menuitem = this.menuList[i].menuitem;
}
menuPopup.appendChild(menuitem);
}
}
this.menu = menu;
return menu;
}
MozileCommandList.prototype.updateBox = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommandList.updateBox()";
this.debug(f,1,"Updating box");
return true;
}
MozileCommandList.prototype.updateMenu = function() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "MozileCommandList.updateMenu()";
this.debug(f,1,"Updating menu");
return true;
}
Mozile.prototype.showAboutInterface = function() {
this.aboutInterface.collapsed = false;
this.aboutInterface.style.width = "450px";
this.aboutInterface.style.height = "300px";
mozileCenterNode(this.aboutInterface);
}
Mozile.prototype.hideAboutInterface = function() {
this.aboutInterface.collapsed = true;
this.aboutInterface.style.width = "0px";
this.aboutInterface.style.height = "0px";
mozileDisappearNode(this.aboutInterface);
}
Mozile.prototype.showSaveInterface = function() {
this.saveInterface.collapsed = false;
this.saveInterface.style.width = "355px";
this.saveInterface.style.height = "270px";
mozileCenterNode(this.saveInterface);
}
Mozile.prototype.hideSaveInterface = function() {
this.saveInterface.collapsed = true;
this.saveInterface.style.width = "0px";
this.saveInterface.style.height = "0px";
mozileDisappearNode(this.saveInterface);
}
Mozile.prototype.showSourceInterface = function() {
this.sourceInterface.collapsed = false;
var space = "50px";
this.sourceInterface.style.top = space;
this.sourceInterface.style.left = space;
this.sourceInterface.style.right = space;
this.sourceInterface.style.bottom = space;
}
Mozile.prototype.hideSourceInterface = function() {
this.sourceInterface.collapsed = true;
this.sourceInterface.style.top = "-500px";
this.sourceInterface.style.left = "-500px";
this.sourceInterface.style.right = "-500px";
this.sourceInterface.style.bottom = "-500px";
mozileDisappearNode(this.sourceInterface);
}
Mozile.prototype.showMessageInterface = function() {
this.messageInterface.collapsed = false;
this.messageInterface.style.width = window.innerWidth - 50 +"px";
this.messageInterface.style.height = window.innerHeight - 50 +"px";
var bugs = document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "bugs");
bugs.style.width = window.innerWidth - 60 +"px";
bugs.style.height = window.innerHeight - 150 +"px";
mozileCenterNode(this.messageInterface);
}
Mozile.prototype.hideMessageInterface = function() {
this.messageInterface.collapsed = true;
this.messageInterface.style.width = "0px";
this.messageInterface.style.height = "0px";
mozileDisappearNode(this.messageInterface);
}
function mozileCenterNode(node) {
var left = (window.innerWidth - node.boxObject.width) / window.innerWidth * 50 ;
node.style.left = left + "%";
var top = (window.innerHeight - node.boxObject.height) / window.innerHeight * 50;
node.style.top = top + "%";
}
function mozileDisappearNode(node) {
node.style.left = "-500px";
node.style.top = "-500px";
}
var mozileSavePreset;
var mozileCustomPreset;
var mozileSaveContent;
var mozileSaveFormat;
var mozileSaveMethod;
function mozileSaveInit() {
mozileSavePreset = document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSavePresetList");
mozileCustomPreset = document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileCustomPresetItem");
mozileSaveContent = document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveContentList");
mozileSaveFormat = document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveFormatList");
mozileSaveMethod = document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveMethodList");
var child = mozileSaveMethod.firstChild.firstChild;
var nextChild;
while(child) {
nextChild = child.nextSibling;
mozileSaveMethod.firstChild.removeChild(child);
child = nextChild;
}
var menuitem;
for(key in mozile.saveList) {
if(key != "default" && key != "custom") {
menuitem = document.createElementNS(XULNS, "menuitem");
menuitem.setAttribute("value", mozile.saveList[key]["value"]);
menuitem.setAttribute("label", mozile.saveList[key]["label"]);
menuitem.setAttribute("oncommand", "mozileSaveChanged()");
mozileSaveMethod.firstChild.appendChild(menuitem);
}
}
if(mozile.saveList["custom"]) {
mozileSavePreset.selectedItem = mozileCustomPreset;
mozileCustomPreset.setAttribute("disabled","false");
if(mozile.saveList["custom"]["content"]) {
mozileSaveContent.value = mozile.saveList["custom"]["content"];
}
if(mozile.saveList["custom"]["format"]) {
mozileSaveFormat.value = mozile.saveList["custom"]["format"];
}
if(mozile.saveList["custom"]["value"]) {
mozileSaveMethod.value = mozile.saveList["custom"]["value"];
}
if(mozile.saveList["custom"]["url"] != null) {
document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveToURL").value = mozile.saveList["custom"]["url"];
}
}
else {
if(mozile.saveList["default"]) {
mozileSaveMethod.value = mozile.saveList["default"]["value"];
if(mozile.saveList["default"]["url"] != null) {
document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveToURL").value = mozile.saveList["default"]["url"];
}
}
else {
mozileSaveMethod.selectedIndex = 0;
}
}
mozileMethodFields();
}
function mozileMethodFields() {
var f = new Array();
f["File"] = "core/interface.js";
f["Function"] = "mozileMethodFields()";
mozile.debug(f,1,"Setting Method Fields");
var method = mozileSaveMethod.value;
var mozileURLBox = document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveURLBox");
mozileURLBox.collapsed = true;
if(mozile.saveList[method]["showURL"] == true) {
mozileURLBox.collapsed = false;
}
mozile.debug(f,3, method +" "+ mozileURLBox +" "+ mozile.saveList[method]["showURL"]);
}
function mozileRestoreDefault() {
if(mozile.saveList["default"]) {
mozileSaveContent.value = mozile.saveList["default"]["content"];
mozileSaveFormat.value = mozile.saveList["default"]["format"];
mozileSaveMethod.value = mozile.saveList["default"]["value"];
if(mozile.saveList["default"]["url"]) {
document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveToURL").value = mozile.saveList["default"]["url"];
}
}
}
function mozileRestoreCustom() {
if(mozile.saveList["default"]) {
mozileSaveContent.value = mozile.saveList["custom"]["content"];
mozileSaveFormat.value = mozile.saveList["custom"]["format"];
mozileSaveMethod.value = mozile.saveList["custom"]["value"];
if(mozile.saveList["custom"]["url"]) {
document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveToURL").value = mozile.saveList["custom"]["url"];
}
}
}
function mozileSaveChanged() {
mozileMethodFields();
mozileStoreCustom();
mozileCustomPreset.setAttribute("disabled","false");
mozileSavePreset.selectedItem = mozileCustomPreset;
}
function mozileSaveDone() {
if(mozileSavePreset.value == "page") {
mozile.saveList["custom"] = null;
var method = mozileSaveMethod.value
mozile.saveList[method]["content"] = mozileSaveContent.value;
mozile.saveList[method]["format"] = mozileSaveFormat.value;
mozile.saveList[method]["method"] = mozileSaveMethod.value;
}
else {
mozileStoreCustom();
}
mozile.saveFlag = true;
mozile.save();
mozile.hideSaveInterface();
}
function mozileStoreCustom() {
mozile.saveList["custom"] = new Array();
mozile.saveList["custom"]["value"] = mozile.saveList[mozileSaveMethod.value]["value"];
mozile.saveList["custom"]["label"] = mozile.saveList[mozileSaveMethod.value]["label"];
mozile.saveList["custom"]["function"] = mozile.saveList[mozileSaveMethod.value]["function"];
mozile.saveList["custom"]["content"] = mozileSaveContent.value;
mozile.saveList["custom"]["format"] = mozileSaveFormat.value;
mozile.saveList["custom"]["method"] = mozileSaveMethod.value;
if(!document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveURLBox").collapsed) {
mozile.saveList["custom"]["url"] = document.getAnonymousElementByAttribute(mozile.saveInterface.parentNode, "id", "mozileSaveToURL").value;
}
}
function mozileDebugInit() {
mozileDebugReset();
}
function mozileDebugReset() {
document.getAnonymousElementByAttribute(mozile.sourceInterface.parentNode,'id','filterText').value = "";
document.getAnonymousElementByAttribute(mozile.sourceInterface.parentNode,'id','filterLevel').selectedIndex=0;
mozileDebugFilter();
}
function mozileDebugClear() {
mozileDebugList = new Array();
mozileDebugReset();
}
function mozileDebugFilter() {
var selected = document.getAnonymousElementByAttribute(mozile.sourceInterface.parentNode,'id','filterLevel').value; // get the value of the Filter Level menu
var text = document.getAnonymousElementByAttribute(mozile.sourceInterface.parentNode,'id','filterText').value; // get the Filter Text
var vbox = document.getAnonymousElementByAttribute(mozile.sourceInterface.parentNode,'id',"bugs");
var count = 0;
mozileDebugRemoveChildren(vbox);
for(var i=0; i < mozileDebugList.length; i++) {
var bug = mozileDebugList[i];
if(selected == "status" && !bug[1]["Status Message"] ) continue;
if(selected > bug[2]) continue;
var search = bug[0].search(text) + bug[1]["File"].search(text) + bug[1]["Function"].search(text) + bug[3].search(text);
if( search == -4 ) continue;
count++;
vbox.appendChild(mozileDebugEntry(mozileDebugList[i]));
}
document.getAnonymousElementByAttribute(mozile.sourceInterface.parentNode,'id','messageCount').value="Showing "+count+" of "+mozileDebugList.length+" Messages";
}
function mozileDebugEntry(bug) {
var hbox = document.createElementNS(XULNS, "hbox");
hbox.setAttribute("class", "level"+bug[2]);
hbox.setAttribute("align", "center");
var datestamp = document.createElementNS(XULNS, "description");
datestamp.setAttribute("class","datestamp");
datestamp.setAttribute("value", bug[0]);
hbox.appendChild(datestamp);
var button = document.createElementNS(XULNS, "button");
button.setAttribute("class","functionButton");
button.setAttribute("type", "menu");
button.setAttribute("image", mozile.root+"images/info.png");
var menupopup = document.createElementNS(XULNS, "menupopup");
var functions;
for(key in bug[1]) {
functions = document.createElementNS(XULNS, "description");
functions.setAttribute("class","functions");
functions.appendChild(document.createTextNode(key +" = "+ bug[1][key]));
menupopup.appendChild(functions);
}
functions = document.createElementNS(XULNS, "description");
functions.setAttribute("class","functions");
functions.appendChild(document.createTextNode("Level = "+ bug[2]));
menupopup.appendChild(functions);
button.appendChild(menupopup);
hbox.appendChild(button);
var message = document.createElementNS(XULNS, "description");
message.setAttribute("class","message");
message.appendChild(document.createTextNode(bug[3]));
hbox.appendChild(message);
return hbox;
}
function mozileArrayString(arr) {
var result = new Array();
for(key in arr) {
result.push(key +"="+ arr[key]);
}
return result.join("\n");
}
function mozileDebugRemoveChildren(node) {
while(node.childNodes.length) {
node.removeChild(node.firstChild);
}
return node;
}
try {
mozileConfiguration();
}
catch(e) {
alert("Error in MozileCore.js when calling mozileConfiguration: "+e);
}
Documentation generated by
JSDoc on Fri Feb 3 19:22:12 2006