rem
stringlengths 0
126k
| add
stringlengths 0
441k
| context
stringlengths 15
136k
|
---|---|---|
updateAddExceptionButton() updateDeleteExceptionButton(); | function addException( dateToAdd ){ if( !dateToAdd ) { //get the date from the date and time box. //returns a date object dateToAdd = document.getElementById( "exceptions-date-picker" ).value; } if( isAlreadyException( dateToAdd ) ) return; var DateLabel = formatDate( dateToAdd ); //add a row to the listbox. var listbox = document.getElementById( "exception-dates-listbox" ); //ensure user can see that add occurred (also, avoid bug 231765, bug 250123) listbox.ensureElementIsVisible( listbox.appendItem( DateLabel, dateToAdd.getTime() )); //sizeToContent();} |
|
document.getElementById( "exception-dates-listbox" ).appendItem( DateLabel, dateToAdd.getTime() ); | var listbox = document.getElementById( "exception-dates-listbox" ); listbox.ensureElementIsVisible( listbox.appendItem( DateLabel, dateToAdd.getTime() )); | function addException( dateToAdd ){ if( !dateToAdd ) { //get the date from the date and time box. //returns a date object dateToAdd = document.getElementById( "exceptions-date-picker" ).value; } if( isAlreadyException( dateToAdd ) ) return; var DateLabel = formatDate( dateToAdd ); //add a row to the listbox document.getElementById( "exception-dates-listbox" ).appendItem( DateLabel, dateToAdd.getTime() ); sizeToContent();} |
addressNode.setAttribute("tooltiptext", emailAddress); addressNode.setAttribute("tooltip", "emailAddressTooltip"); } else addressNode.removeAttribute("tooltiptext"); | function AddExtraAddressProcessing(emailAddress, addressNode){ var displayName = addressNode.getTextAttribute("displayName"); var emailAddress = addressNode.getTextAttribute("emailAddress"); if (gShowCondensedEmailAddresses && displayName && useDisplayNameForAddress(emailAddress)) addressNode.setAttribute('label', displayName); } |
|
useDisplayNameForAddress(emailAddress); addressNode.setAttribute("label", displayName); | if (useDisplayNameForAddress(emailAddress)) addressNode.setAttribute("label", displayName); | function AddExtraAddressProcessing(emailAddress, addressNode){ var displayName = addressNode.getAttribute("displayName"); var mailAddress = addressNode.getAttribute("emailAddress"); // always show the address for the from and reply-to fields var parentElementId = addressNode.parentNode.id; var condenseName = true; if (parentElementId == "expandedfromBox" || parentElementId == "expandedreply-toBox") condenseName = false; if (condenseName && gShowCondensedEmailAddresses && displayName) { useDisplayNameForAddress(emailAddress); addressNode.setAttribute("label", displayName); addressNode.setAttribute("tooltiptext", mailAddress); addressNode.setAttribute("tooltip", "emailAddressTooltip"); } else addressNode.removeAttribute("tooltiptext");} |
feed = new Feed(id); feed.download(false, false); | function addFeed(url, title, quickMode, destFolder) { var ds = getSubscriptionsDS(); var feeds = getSubscriptionsList(); // Give quickMode a default value of "true"; otherwise convert value // to either "true" or "false" string. quickMode = quickMode == null ? "false" : quickMode ? "true" : "false"; // Generate a unique ID for the feed. var id = url; var i = 1; while (feeds.IndexOf(rdf.GetResource(id)) != -1 && ++i < 1000) id = url + i; if (id == 1000) throw("couldn't generate a unique ID for feed " + url); // Add the feed to the list. id = rdf.GetResource(id); feeds.AppendElement(id); ds.Assert(id, RDF_TYPE, FZ_FEED, true); ds.Assert(id, DC_IDENTIFIER, rdf.GetLiteral(url), true); if (title) ds.Assert(id, DC_TITLE, rdf.GetLiteral(title), true); ds.Assert(id, FZ_QUICKMODE, rdf.GetLiteral(quickMode), true); ds.Assert(id, FZ_DESTFOLDER, destFolder, true); ds = ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); ds.Flush(); // Create a new feed object for the feed. feed = new Feed(id); // Downloading the feed synchronously will pick up the title. feed.download(false, false);} |
|
var item = document.createElement('treeitem'); var row = document.createElement('treerow'); var cell = document.createElement('treecell'); cell.setAttribute('value', name); item.setAttribute('field-index', index); row.appendChild(cell); item.appendChild(row); body.appendChild(item); | var item = document.createElement('treeitem'); var row = document.createElement('treerow'); var cell = document.createElement('treecell'); cell.setAttribute('label', name); item.setAttribute('field-index', index); row.appendChild(cell); item.appendChild(row); body.appendChild(item); | function AddFieldToList(body, name, index){ var item = document.createElement('treeitem'); var row = document.createElement('treerow'); var cell = document.createElement('treecell'); cell.setAttribute('value', name); item.setAttribute('field-index', index); row.appendChild(cell); item.appendChild(row); body.appendChild(item);} |
tbody = document.createElementNS ("http: "html:tbody"); source.messages.appendChild (tbody); | if (0) { tbody = document.createElementNS ("http: "html:tbody"); source.messages.appendChild (tbody); } else { tbody = source.messages; } | function addHistory (source, obj){ var tbody; if (!source.messages) { source.messages = document.createElementNS ("http://www.w3.org/1999/xhtml", "html:table"); source.messages.setAttribute ("class", "msg-table"); source.messages.setAttribute ("view-type", source.TYPE); tbody = document.createElementNS ("http://www.w3.org/1999/xhtml", "html:tbody"); source.messages.appendChild (tbody); } else tbody = source.messages.firstChild; var needScroll = false; var w = window.frames[0]; if (client.PRINT_DIRECTION == 1) { if ((w.document.height - (w.innerHeight + w.pageYOffset)) < (w.innerHeight / 3)) needScroll = true; tbody.appendChild (obj); } else tbody.insertBefore (obj, source.messages.firstChild); if (source.MAX_MESSAGES) { if (typeof source.messageCount != "number") source.messageCount = 1; else source.messageCount++; if (source.messageCount > source.MAX_MESSAGES) if (client.PRINT_DIRECTION == 1) tbody.removeChild (tbody.firstChild); else tbody.removeChild (tbody.lastChild); } if (needScroll && client.currentObject == source) w.scrollTo (w.pageXOffset, w.document.height); } |
tbody = source.messages.firstChild; | if (0) { tbody = source.messages.firstChild; } else { tbody = source.messages; } | function addHistory (source, obj){ var tbody; if (!source.messages) { source.messages = document.createElementNS ("http://www.w3.org/1999/xhtml", "html:table"); source.messages.setAttribute ("class", "msg-table"); source.messages.setAttribute ("view-type", source.TYPE); tbody = document.createElementNS ("http://www.w3.org/1999/xhtml", "html:tbody"); source.messages.appendChild (tbody); } else tbody = source.messages.firstChild; var needScroll = false; var w = window.frames[0]; if (client.PRINT_DIRECTION == 1) { if ((w.document.height - (w.innerHeight + w.pageYOffset)) < (w.innerHeight / 3)) needScroll = true; tbody.appendChild (obj); } else tbody.insertBefore (obj, source.messages.firstChild); if (source.MAX_MESSAGES) { if (typeof source.messageCount != "number") source.messageCount = 1; else source.messageCount++; if (source.messageCount > source.MAX_MESSAGES) if (client.PRINT_DIRECTION == 1) tbody.removeChild (tbody.firstChild); else tbody.removeChild (tbody.lastChild); } if (needScroll && client.currentObject == source) w.scrollTo (w.pageXOffset, w.document.height); } |
if (!imageHash[url] || !imageHash[url][type] || imageHash[url][type][alt] === undefined) { | if (!(url in imageHash)) imageHash[url] = {}; if (!(type in imageHash[url])) imageHash[url][type] = {}; if (!(alt in imageHash[url][type])) { imageHash[url][type][alt] = imageView.data.length; | function addImage(url, type, alt, elem, isBg){ if (url == "") return; //|imageHash[url][type][alt] === undefined| avoids matching row index 0. if (!imageHash[url] || !imageHash[url][type] || imageHash[url][type][alt] === undefined) { imageView.addRow([url, type, alt, 1, elem, isBg]); // I wish I could do imageHash[url][type][alt] = imageView.data.length without getting errors. if (!imageHash[url]) imageHash[url] = {}; if (!imageHash[url][type]) imageHash[url][type] = {}; imageHash[url][type][alt] = imageView.data.length - 1; } else { var i = imageHash[url][type][alt]; imageView.data[i][3]++; }} |
if (!imageHash[url]) imageHash[url] = {}; if (!imageHash[url][type]) imageHash[url][type] = {}; imageHash[url][type][alt] = imageView.data.length - 1; | function addImage(url, type, alt, elem, isBg){ if (url == "") return; //|imageHash[url][type][alt] === undefined| avoids matching row index 0. if (!imageHash[url] || !imageHash[url][type] || imageHash[url][type][alt] === undefined) { imageView.addRow([url, type, alt, 1, elem, isBg]); // I wish I could do imageHash[url][type][alt] = imageView.data.length without getting errors. if (!imageHash[url]) imageHash[url] = {}; if (!imageHash[url][type]) imageHash[url][type] = {}; imageHash[url][type][alt] = imageView.data.length - 1; } else { var i = imageHash[url][type][alt]; imageView.data[i][3]++; }} |
|
newItem.parent = this; | newItem.parent = this.calendarToReturn; | addItem: function (aItem, aListener) { if (aItem.id == null && aItem.isMutable) aItem.id = "uuid" + (new Date()).getTime(); if (aItem.id == null) { if (aListener) aListener.onOperationComplete (this.calendarToReturn, Components.results.NS_ERROR_FAILURE, aListener.ADD, aItem.id, "Can't set ID on non-mutable item to addItem"); return; } if (this.mItems[aItem.id] != null) { // is this an error? if (aListener) aListener.onOperationComplete (this.calendarToReturn, Components.results.NS_ERROR_FAILURE, aListener.ADD, aItem.id, "ID already exists for addItem"); return; } var newItem = aItem.clone(); newItem.parent = this; newItem.generation = 1; newItem.makeImmutable(); this.mItems[newItem.id] = newItem; // notify the listener if (aListener) aListener.onOperationComplete (this.calendarToReturn, Components.results.NS_OK, aListener.ADD, newItem.id, newItem); // notify observers this.observeAddItem(newItem); }, |
this.observeAddItem(aItem); | savedthis.observeAddItem(aItem); | addItem: function (aItem, aListener) { if (aItem.id == null) aItem.id = "uuid:" + (new Date()).getTime(); // XXX do we need to check the server to see if this already exists? // XXX how are we REALLY supposed to figure this out? var eventUri = this.mUri.clone(); eventUri.spec = eventUri.spec + "calendar/events/" + aItem.id + ".ics"; var eventResource = new WebDavResource(eventUri); var listener = new WebDavListener(); listener.onOperationComplete = function(aStatusCode, aResource, aOperation, aClosure) { // 201 = HTTP "Created" // if (aStatusCode == 201) { dump("Item added successfully.\n"); var retVal = Components.results.NS_OK; // notify observers // XXX should be called after listener? this.observeAddItem(aItem); } else { dump("Error adding item: " + aStatusCode + "\n"); retVal = Components.results.NS_ERROR_FAILURE; } // XXX ensure immutable version returned // notify the listener if (aListener) aListener.onOperationComplete (this, retVal, aListener.ADD, aItem.id, aItem); } dump("icalString = " + aItem.icalString + "\n"); // do WebDAV put var webSvc = Components.classes['@mozilla.org/webdav/service;1'] .getService(Components.interfaces.nsIWebDAVService); webSvc.putFromString(eventResource, "text/calendar", aItem.icalString, listener, null); return; }, |
aListener.onOperationComplete (this, | aListener.onOperationComplete (savedthis, | addItem: function (aItem, aListener) { if (aItem.id == null) aItem.id = "uuid:" + (new Date()).getTime(); // XXX do we need to check the server to see if this already exists? // XXX how are we REALLY supposed to figure this out? var eventUri = this.mUri.clone(); eventUri.spec = eventUri.spec + "calendar/events/" + aItem.id + ".ics"; var eventResource = new WebDavResource(eventUri); var listener = new WebDavListener(); listener.onOperationComplete = function(aStatusCode, aResource, aOperation, aClosure) { // 201 = HTTP "Created" // if (aStatusCode == 201) { dump("Item added successfully.\n"); var retVal = Components.results.NS_OK; // notify observers // XXX should be called after listener? this.observeAddItem(aItem); } else { dump("Error adding item: " + aStatusCode + "\n"); retVal = Components.results.NS_ERROR_FAILURE; } // XXX ensure immutable version returned // notify the listener if (aListener) aListener.onOperationComplete (this, retVal, aListener.ADD, aItem.id, aItem); } dump("icalString = " + aItem.icalString + "\n"); // do WebDAV put var webSvc = Components.classes['@mozilla.org/webdav/service;1'] .getService(Components.interfaces.nsIWebDAVService); webSvc.putFromString(eventResource, "text/calendar", aItem.icalString, listener, null); return; }, |
newItem = aItem.clone(); | var newItem = aItem.clone(); | addItem: function (aItem, aListener) { if (aItem.id == null) { // is this an error? Or should we generate an IID? aItem.id = "uuid:" + (new Date()).getTime(); } else { var olditem = this.getItemById(aItem.id); if (olditem) { if (aListener) aListener.onOperationComplete (this, Components.results.NS_ERROR_FAILURE, aListener.ADD, aItem.id, "ID already exists for addItem"); return; } } newItem = aItem.clone(); newItem.parent = this; newItem.generation = 1; newItem.makeImmutable(); dump ("about to flushItem\n"); this.flushItem (newItem, null); dump ("after flushItem\n"); // notify the listener if (aListener) aListener.onOperationComplete (this, Components.results.NS_OK, aListener.ADD, newItem.id, newItem); // notify observers this.observeAddItem(newItem); }, |
dump ("newitem.recurrenceInfo: " + newItem.recurrenceInfo + " aItem.recurrenceInfo: " + aItem.recurrenceInfo + "\n"); | addItem: function (aItem, aListener) { if (aItem.id == null) { // is this an error? Or should we generate an IID? aItem.id = "uuid:" + (new Date()).getTime(); } else { var olditem = this.getItemById(aItem.id); if (olditem) { if (aListener) aListener.onOperationComplete (this, Components.results.NS_ERROR_FAILURE, aListener.ADD, aItem.id, "ID already exists for addItem"); return; } } newItem = aItem.clone(); newItem.parent = this; newItem.generation = 1; newItem.makeImmutable(); dump ("about to flushItem\n"); this.flushItem (newItem, null); dump ("after flushItem\n"); // notify the listener if (aListener) aListener.onOperationComplete (this, Components.results.NS_OK, aListener.ADD, newItem.id, newItem); // notify observers this.observeAddItem(newItem); }, |
|
this.flushItem (aItem, null); | newItem = aItem.clone(); newItem.parent = this; newItem.generation = 1; newItem.makeImmutable(); this.flushItem (newItem, null); | addItem: function (aItem, aListener) { if (aItem.id == null) { // is this an error? Or should we generate an IID? aItem.id = "uuid:" + (new Date()).getTime(); } else { var olditem = this.getItemById(aItem.id); if (olditem) { if (aListener) aListener.onOperationComplete (this, Components.results.NS_ERROR_FAILURE, aListener.ADD, aItem.id, "ID already exists for addItem"); return; } } this.flushItem (aItem, null); // notify the listener if (aListener) aListener.onOperationComplete (this, Components.results.NS_OK, aListener.ADD, aItem.id, aItem); // notify observers this.observeAddItem(aItem); }, |
aItem.id, aItem); | newItem.id, newItem); | addItem: function (aItem, aListener) { if (aItem.id == null) { // is this an error? Or should we generate an IID? aItem.id = "uuid:" + (new Date()).getTime(); } else { var olditem = this.getItemById(aItem.id); if (olditem) { if (aListener) aListener.onOperationComplete (this, Components.results.NS_ERROR_FAILURE, aListener.ADD, aItem.id, "ID already exists for addItem"); return; } } this.flushItem (aItem, null); // notify the listener if (aListener) aListener.onOperationComplete (this, Components.results.NS_OK, aListener.ADD, aItem.id, aItem); // notify observers this.observeAddItem(aItem); }, |
this.observeAddItem(aItem); | this.observeAddItem(newItem); | addItem: function (aItem, aListener) { if (aItem.id == null) { // is this an error? Or should we generate an IID? aItem.id = "uuid:" + (new Date()).getTime(); } else { var olditem = this.getItemById(aItem.id); if (olditem) { if (aListener) aListener.onOperationComplete (this, Components.results.NS_ERROR_FAILURE, aListener.ADD, aItem.id, "ID already exists for addItem"); return; } } this.flushItem (aItem, null); // notify the listener if (aListener) aListener.onOperationComplete (this, Components.results.NS_OK, aListener.ADD, aItem.id, aItem); // notify observers this.observeAddItem(aItem); }, |
if (this.readOnly) throw Components.interfaces.calIErrors.CAL_IS_READONLY; | addItem: function (aItem, aListener) { if (this.readOnly) throw Components.interfaces.calIErrors.CAL_IS_READONLY; this.mDefaultCalendar.addItem (aItem, aListener); }, |
|
aItem.id = "uuid:" + (new Date()).getTime(); | aItem.id = "uuid" + (new Date()).getTime(); | addItem: function (aItem, aListener) { if (aItem.id == null && aItem.isMutable) aItem.id = "uuid:" + (new Date()).getTime(); if (aItem.id == null) { if (aListener) aListener.onOperationComplete (this, Components.results.NS_ERROR_FAILURE, aListener.ADD, aItem.id, "Can't set ID on non-mutable item to addItem"); return; } if (this.mItems[aItem.id] != null) { // is this an error? if (aListener) aListener.onOperationComplete (this, Components.results.NS_ERROR_FAILURE, aListener.ADD, aItem.id, "ID already exists for addItem"); return; } var newItem = aItem.clone(); newItem.parent = this; newItem.generation = 1; newItem.makeImmutable(); this.mItems[newItem.id] = newItem; // notify the listener if (aListener) aListener.onOperationComplete (this, Components.results.NS_OK, aListener.ADD, newItem.id, newItem); // notify observers this.observeAddItem(newItem); }, |
cell.setAttribute("value", cells[i]) | cell.setAttribute("label", cells[i]) | function AddItem(children,cells,prefix,idfier){ var kids = document.getElementById(children); var item = document.createElement("treeitem"); var row = document.createElement("treerow"); for(var i = 0; i < cells.length; i++) { var cell = document.createElement("treecell"); cell.setAttribute("class", "propertylist"); cell.setAttribute("value", cells[i]) row.appendChild(cell); } item.appendChild(row); item.setAttribute("id",prefix + idfier); kids.appendChild(item);} |
for (var i = 0; i < node.form.elements.length; ++i) { var e = node.form.elements[i]; | for (i=0; i < node.form.elements.length; ++i) { e = node.form.elements[i]; | function AddKeywordForSearchField(){ var node = document.popupNode; var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = ioService.newURI(node.ownerDocument.URL, node.ownerDocument.characterSet, null); var keywordURL = ioService.newURI(node.form.action, node.ownerDocument.characterSet, uri); var spec = keywordURL.spec; var postData = ""; if (node.form.method.toUpperCase() == "POST" && (node.form.enctype == "application/x-www-form-urlencoded" || node.form.enctype == "")) { for (var i = 0; i < node.form.elements.length; ++i) { var e = node.form.elements[i]; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") postData += escape(e.name + "=" + (e == node ? "%s" : e.value)) + "&"; else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) postData += escape(e.name + "=" + e.options[e.selectedIndex].value) + "&"; else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) postData += escape(e.name + "=" + e.value) + "&"; } } else { spec += "?" + escape(node.name) + "=%s"; for (var i = 0; i < node.form.elements.length; ++i) { var e = node.form.elements[i]; if (e == node) // avoid duplication of the target field value, which was populated above. continue; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") spec += "&" + escape(e.name) + "=" + escape(e.value); else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) spec += "&" + escape(e.name) + "=" + escape(e.options[e.selectedIndex].value); else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) spec += "&" + escape(e.name) + "=" + escape(e.value); } } var dialogArgs = { name: "", url: spec, charset: node.ownerDocument.characterSet, bWebPanel: false, keyword: "", bNeedKeyword: true, postData: postData, description: BookmarksUtils.getDescriptionFromDocument(node.ownerDocument) } openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "", ADD_BM_DIALOG_FEATURES, dialogArgs);} |
e.localName.toLowerCase() == "textarea") | e instanceof HTMLTextAreaElement) | function AddKeywordForSearchField(){ var node = document.popupNode; var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = ioService.newURI(node.ownerDocument.URL, node.ownerDocument.characterSet, null); var keywordURL = ioService.newURI(node.form.getAttribute("action"), node.ownerDocument.characterSet, uri); var spec = keywordURL.spec; var postData = ""; var i, e; if (node.form.method.toUpperCase() == "POST" && (node.form.enctype == "application/x-www-form-urlencoded" || node.form.enctype == "")) { for (i=0; i < node.form.elements.length; ++i) { e = node.form.elements[i]; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") postData += escape(e.name + "=" + (e == node ? "%s" : e.value)) + "&"; else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) postData += escape(e.name + "=" + e.options[e.selectedIndex].value) + "&"; else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) postData += escape(e.name + "=" + e.value) + "&"; } } else { spec += "?" + escape(node.name) + "=%s"; for (i=0; i < node.form.elements.length; ++i) { e = node.form.elements[i]; if (e == node) // avoid duplication of the target field value, which was populated above. continue; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") spec += "&" + escape(e.name) + "=" + escape(e.value); else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) spec += "&" + escape(e.name) + "=" + escape(e.options[e.selectedIndex].value); else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) spec += "&" + escape(e.name) + "=" + escape(e.value); } } var dialogArgs = { name: "", url: spec, charset: node.ownerDocument.characterSet, bWebPanel: false, keyword: "", bNeedKeyword: true, postData: postData, description: BookmarksUtils.getDescriptionFromDocument(node.ownerDocument) } openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "", BROWSER_ADD_BM_FEATURES, dialogArgs);} |
else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) | else if (e instanceof HTMLSelectElement && e.selectedIndex >= 0) | function AddKeywordForSearchField(){ var node = document.popupNode; var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = ioService.newURI(node.ownerDocument.URL, node.ownerDocument.characterSet, null); var keywordURL = ioService.newURI(node.form.getAttribute("action"), node.ownerDocument.characterSet, uri); var spec = keywordURL.spec; var postData = ""; var i, e; if (node.form.method.toUpperCase() == "POST" && (node.form.enctype == "application/x-www-form-urlencoded" || node.form.enctype == "")) { for (i=0; i < node.form.elements.length; ++i) { e = node.form.elements[i]; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") postData += escape(e.name + "=" + (e == node ? "%s" : e.value)) + "&"; else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) postData += escape(e.name + "=" + e.options[e.selectedIndex].value) + "&"; else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) postData += escape(e.name + "=" + e.value) + "&"; } } else { spec += "?" + escape(node.name) + "=%s"; for (i=0; i < node.form.elements.length; ++i) { e = node.form.elements[i]; if (e == node) // avoid duplication of the target field value, which was populated above. continue; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") spec += "&" + escape(e.name) + "=" + escape(e.value); else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) spec += "&" + escape(e.name) + "=" + escape(e.options[e.selectedIndex].value); else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) spec += "&" + escape(e.name) + "=" + escape(e.value); } } var dialogArgs = { name: "", url: spec, charset: node.ownerDocument.characterSet, bWebPanel: false, keyword: "", bNeedKeyword: true, postData: postData, description: BookmarksUtils.getDescriptionFromDocument(node.ownerDocument) } openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "", BROWSER_ADD_BM_FEATURES, dialogArgs);} |
openDialog("chrome: "centerscreen,chrome,dialog,resizable,dependent", "", spec, null, node.ownerDocument.characterSet, null, null, false, "", true, postData); | var dialogArgs = { name: "", url: spec, charset: node.ownerDocument.characterSet, bWebPanel: false, keyword: "", bNeedKeyword: true, postData: postData, description: BookmarksUtils.getDescriptionFromDocument(node.ownerDocument) } openDialog("chrome: | function AddKeywordForSearchField(){ var node = document.popupNode; var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = Components.classes["@mozilla.org/network/standard-url;1"] .getService(Components.interfaces.nsIURI); uri.spec = node.ownerDocument.URL; var keywordURL = ioService.newURI(node.form.action, node.ownerDocument.characterSet, uri); var spec = keywordURL.spec; var postData = ""; if (node.form.method.toUpperCase() == "POST" && (node.form.enctype == "application/x-www-form-urlencoded" || node.form.enctype == "")) { for (var i = 0; i < node.form.elements.length; ++i) { var e = node.form.elements[i]; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") postData += escape(e.name + "=" + (e == node ? "%s" : e.value)) + "&"; else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) postData += escape(e.name + "=" + e.options[e.selectedIndex].value) + "&"; else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) postData += escape(e.name + "=" + e.value) + "&"; } } else { spec += "?" + escape(node.name) + "=%s"; for (var i = 0; i < node.form.elements.length; ++i) { var e = node.form.elements[i]; if (e == node) // avoid duplication of the target field value, which was populated above. continue; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") spec += "&" + escape(e.name) + "=" + escape(e.value); else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) spec += "&" + escape(e.name) + "=" + escape(e.options[e.selectedIndex].value); else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) spec += "&" + escape(e.name) + "=" + escape(e.value); } } openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "", "centerscreen,chrome,dialog,resizable,dependent", "", spec, null, node.ownerDocument.characterSet, null, null, false, "", true, postData);} |
openDialog("chrome: | openDialog("chrome: ADD_BM_DIALOG_FEATURES, dialogArgs); | function AddKeywordForSearchField(){ var node = document.popupNode; var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = Components.classes["@mozilla.org/network/standard-url;1"] .getService(Components.interfaces.nsIURI); uri.spec = node.ownerDocument.URL; var keywordURL = ioService.newURI(node.form.action, node.ownerDocument.characterSet, uri); var spec = keywordURL.spec; var postData = ""; if (node.form.method.toUpperCase() == "POST" && (node.form.enctype == "application/x-www-form-urlencoded" || node.form.enctype == "")) { for (var i = 0; i < node.form.elements.length; ++i) { var e = node.form.elements[i]; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") postData += escape(e.name + "=" + (e == node ? "%s" : e.value)) + "&"; else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) postData += escape(e.name + "=" + e.options[e.selectedIndex].value) + "&"; else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) postData += escape(e.name + "=" + e.value) + "&"; } } else { spec += "?" + escape(node.name) + "=%s"; for (var i = 0; i < node.form.elements.length; ++i) { var e = node.form.elements[i]; if (e == node) // avoid duplication of the target field value, which was populated above. continue; if (e.type.toLowerCase() == "text" || e.type.toLowerCase() == "hidden" || e.localName.toLowerCase() == "textarea") spec += "&" + escape(e.name) + "=" + escape(e.value); else if (e.localName.toLowerCase() == "select" && e.selectedIndex >= 0) spec += "&" + escape(e.name) + "=" + escape(e.options[e.selectedIndex].value); else if ((e.type.toLowerCase() == "checkbox" || e.type.toLowerCase() == "radio") && e.checked) spec += "&" + escape(e.name) + "=" + escape(e.value); } } var dialogArgs = { name: "", url: spec, charset: node.ownerDocument.characterSet, bWebPanel: false, keyword: "", bNeedKeyword: true, postData: postData, description: BookmarksUtils.getDescriptionFromDocument(node.ownerDocument) } openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", dialogArgs);} |
document.getElementById('intlAcceptLanguages').value = pref_string; | document.getElementById('intlAcceptLanguages').label = pref_string; | function AddLanguage() { //cludge: make pref string available from the popup document.getElementById('intlAcceptLanguages').value = pref_string; window.openDialog("chrome://communicator/content/pref/pref-languages-add.xul","","modal=yes,chrome,resizable=yes", "addlangwindow"); UpdateSavePrefString(); SelectLanguage();} |
addLivemark: function (aURL, aFeedURL, aTitle) | addLivemark: function (aURL, aFeedURL, aTitle, aDescription) | addLivemark: function (aURL, aFeedURL, aTitle) { openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "", "centerscreen,chrome,dialog,resizable,dependent", aTitle, aURL, null, null, null, null, false, null, null, null, aFeedURL); }, |
"centerscreen,chrome,dialog,resizable,dependent", aTitle, aURL, null, null, null, null, false, null, null, null, aFeedURL); | "centerscreen,chrome,dialog,resizable,dependent", dArgs); | addLivemark: function (aURL, aFeedURL, aTitle) { openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "", "centerscreen,chrome,dialog,resizable,dependent", aTitle, aURL, null, null, null, null, false, null, null, null, aFeedURL); }, |
"centerscreen,chrome,dialog,resizable,dependent", dArgs); | ADD_BM_DIALOG_FEATURES, dArgs); | addLivemark: function (aURL, aFeedURL, aTitle, aDescription) { var dArgs = { name: aTitle, url: aURL, bWebPanel: false, feedURL: aFeedURL, description: aDescription } openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "", "centerscreen,chrome,dialog,resizable,dependent", dArgs); }, |
var body = document.getElementById("bucketBody"); var item = document.createElement('treeitem'); var row = document.createElement('treerow'); var cell = document.createElement('treecell'); cell.setAttribute('value', moduleName); item.setAttribute('list-index', index); row.appendChild(cell); item.appendChild(row); body.appendChild(item); | var body = document.getElementById("bucketBody"); var item = document.createElement('treeitem'); var row = document.createElement('treerow'); var cell = document.createElement('treecell'); cell.setAttribute('label', moduleName); item.setAttribute('list-index', index); row.appendChild(cell); item.appendChild(row); body.appendChild(item); | function AddModuleToList(moduleName, index){ var body = document.getElementById("bucketBody"); var item = document.createElement('treeitem'); var row = document.createElement('treerow'); var cell = document.createElement('treecell'); cell.setAttribute('value', moduleName); item.setAttribute('list-index', index); row.appendChild(cell); item.appendChild(row); body.appendChild(item);} |
if (!name.value) { message = stringBundle.getFormattedString("enterToolbarBlank", [name.value]); continue; } | function addNewToolbar(){ var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var stringBundle = document.getElementById("stringBundle"); var message = stringBundle.getString("enterToolbarName"); var title = stringBundle.getString("enterToolbarTitle"); var name = {}; while (true) { if (!promptService.prompt(window, title, message, name, null, {})) return; var dupeFound = false; // Check for an existing toolbar with the same display name for (i = 0; i < gToolbox.childNodes.length; ++i) { var toolbar = gToolbox.childNodes[i]; var toolbarName = toolbar.getAttribute("toolbarname"); if (toolbarName == name.value && toolbar.getAttribute("type") != "menubar") { dupeFound = true; break; } } if (!dupeFound) break; message = stringBundle.getFormattedString("enterToolbarDup", [name.value]); } gToolbox.appendCustomToolbar(name.value, ""); repositionDialog(); gToolboxChanged = true;} |
|
if (toolbarName == name.value && toolbar.getAttribute("type") != "menubar") { | if (toolbarName == name.value && toolbar.getAttribute("type") != "menubar" && toolbar.nodeName == 'toolbar') { | function addNewToolbar(){ var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var stringBundle = document.getElementById("stringBundle"); var message = stringBundle.getString("enterToolbarName"); var title = stringBundle.getString("enterToolbarTitle"); var name = {}; while (true) { if (!promptService.prompt(window, title, message, name, null, {})) return; var dupeFound = false; // Check for an existing toolbar with the same display name for (i = 0; i < gToolbox.childNodes.length; ++i) { var toolbar = gToolbox.childNodes[i]; var toolbarName = toolbar.getAttribute("toolbarname"); if (toolbarName == name.value && toolbar.getAttribute("type") != "menubar") { dupeFound = true; break; } } if (!dupeFound) break; message = stringBundle.getFormattedString("enterToolbarDup", [name.value]); } gToolbox.appendCustomToolbar(name.value, ""); repositionDialog(); gToolboxChanged = true;} |
"chrome,titlebar,resizable=no", | "chrome,resizable=no,titlebar,modal,centerscreen", | function AddNodeToAddressBook (emailAddressNode){ if (emailAddressNode) { var primaryEmail = emailAddressNode.getAttribute("emailAddress"); var displayName = emailAddressNode.getAttribute("displayName"); window.openDialog("chrome://messenger/content/addressbook/abNewCardDialog.xul", "", "chrome,titlebar,resizable=no", {primaryEmail:primaryEmail, displayName:displayName }); }} |
select.add(new Option("-Product-", "---", false, false), null); | select.add(new Option("-Product-", "", false, false), null); | function addNullEntry(select) { // add a blank entry to the current select // if possible, try to make the null entry reflect the select's // contents based on it's name: if (select.className == 'select_product') { select.add(new Option("-Product-", "---", false, false), null); } else if (select.className == 'select_testgroup') { select.add(new Option("-Testgroup-", "---", false, false), null); } else if (select.className == 'select_subgroup') { select.add(new Option("-Subgroup-", "---", false, false), null); } else { select.add(new Option("---", "---", false, false), null); }} |
select.add(new Option("-Testgroup-", "---", false, false), null); | select.add(new Option("-Testgroup-", "", false, false), null); | function addNullEntry(select) { // add a blank entry to the current select // if possible, try to make the null entry reflect the select's // contents based on it's name: if (select.className == 'select_product') { select.add(new Option("-Product-", "---", false, false), null); } else if (select.className == 'select_testgroup') { select.add(new Option("-Testgroup-", "---", false, false), null); } else if (select.className == 'select_subgroup') { select.add(new Option("-Subgroup-", "---", false, false), null); } else { select.add(new Option("---", "---", false, false), null); }} |
select.add(new Option("-Subgroup-", "---", false, false), null); | select.add(new Option("-Subgroup-", "", false, false), null); } else if (select.className == 'select_branch') { select.add(new Option("-Branch-", "", false, false), null); | function addNullEntry(select) { // add a blank entry to the current select // if possible, try to make the null entry reflect the select's // contents based on it's name: if (select.className == 'select_product') { select.add(new Option("-Product-", "---", false, false), null); } else if (select.className == 'select_testgroup') { select.add(new Option("-Testgroup-", "---", false, false), null); } else if (select.className == 'select_subgroup') { select.add(new Option("-Subgroup-", "---", false, false), null); } else { select.add(new Option("---", "---", false, false), null); }} |
select.add(new Option("---", "---", false, false), null); | select.add(new Option("---", "", false, false), null); | function addNullEntry(select) { // add a blank entry to the current select // if possible, try to make the null entry reflect the select's // contents based on it's name: if (select.className == 'select_product') { select.add(new Option("-Product-", "---", false, false), null); } else if (select.className == 'select_testgroup') { select.add(new Option("-Testgroup-", "---", false, false), null); } else if (select.className == 'select_subgroup') { select.add(new Option("-Subgroup-", "---", false, false), null); } else { select.add(new Option("---", "---", false, false), null); }} |
this.mPrefs.addObserver(aDomain, aFunction); | var pbi = XPCU.QI(this.mPrefs, "nsIPrefBranchInternal"); if (pbi) pbi.addObserver(aDomain, aFunction, false); | addObserver: function(aDomain, aFunction) { if (!this.mPrefs) this.init(); this.mPrefs.addObserver(aDomain, aFunction); }, |
addObserver: function (aObserver, aItemFilter) { | addObserver: function (aObserver) { | addObserver: function (aObserver, aItemFilter) { const calICompositeObserver = Components.interfaces.calICompositeObserver; if (aObserver instanceof calICompositeObserver) { var compobs = aObserver.QueryInterface (calICompositeObserver); for each (obs in this.mCompositeObservers) { if (obs == aObserver) return; } this.mCompositeObservers.push(compobs); } for each (cal in this.mCalendars) { cal.addObserver(aObserver); } }, |
var compobs = aObserver.QueryInterface (calICompositeObserver); for each (obs in this.mCompositeObservers) { if (obs == aObserver) return; | if (this.mCompositeObservers.indexOf(aObserver) == -1) { var compobs = aObserver.QueryInterface (calICompositeObserver); this.mCompositeObservers.push(compobs); | addObserver: function (aObserver, aItemFilter) { const calICompositeObserver = Components.interfaces.calICompositeObserver; if (aObserver instanceof calICompositeObserver) { var compobs = aObserver.QueryInterface (calICompositeObserver); for each (obs in this.mCompositeObservers) { if (obs == aObserver) return; } this.mCompositeObservers.push(compobs); } for each (cal in this.mCalendars) { cal.addObserver(aObserver); } }, |
this.mCompositeObservers.push(compobs); | addObserver: function (aObserver, aItemFilter) { const calICompositeObserver = Components.interfaces.calICompositeObserver; if (aObserver instanceof calICompositeObserver) { var compobs = aObserver.QueryInterface (calICompositeObserver); for each (obs in this.mCompositeObservers) { if (obs == aObserver) return; } this.mCompositeObservers.push(compobs); } for each (cal in this.mCalendars) { cal.addObserver(aObserver); } }, |
|
for each (cal in this.mCalendars) { cal.addObserver(aObserver); } | if (this.mObservers.indexOf(aObserver) == -1) this.mObservers.push(aObserver); | addObserver: function (aObserver, aItemFilter) { const calICompositeObserver = Components.interfaces.calICompositeObserver; if (aObserver instanceof calICompositeObserver) { var compobs = aObserver.QueryInterface (calICompositeObserver); for each (obs in this.mCompositeObservers) { if (obs == aObserver) return; } this.mCompositeObservers.push(compobs); } for each (cal in this.mCalendars) { cal.addObserver(aObserver); } }, |
for each (obs in this.mObservers) { if (obs == aObserver) | for each (obs in aObserver) { if (obs == aObserver) { | addObserver: function (aObserver, aItemFilter) { for each (obs in this.mObservers) { if (obs == aObserver) return; } this.mObservers.push(aObserver); }, |
} | addObserver: function (aObserver, aItemFilter) { for each (obs in this.mObservers) { if (obs == aObserver) return; } this.mObservers.push(aObserver); }, |
|
var eventQSvc = Components. classes["@mozilla.org/event-queue-service;1"]. getService(Components.interfaces.nsIEventQueueService); var uiQueue = eventQSvc. getSpecialEventQueue(Components.interfaces. nsIEventQueueService.UI_THREAD_EVENT_QUEUE); var proxyMgr = Components. classes["@mozilla.org/xpcomproxy;1"]. getService(Components.interfaces.nsIProxyObjectManager); var observer = proxyMgr.getProxyForObject(uiQueue, Components.interfaces.nsIRDFObserver, aObserver, 5); this.mObserverList.push(observer); | this.mObserverList.push(getProxyOnUIThread(aObserver, Components.interfaces.nsIRDFObserver)); | AddObserver: function(aObserver) { if (DEBUG) { dump("AddObserver() called\n\n"); } var eventQSvc = Components. classes["@mozilla.org/event-queue-service;1"]. getService(Components.interfaces.nsIEventQueueService); var uiQueue = eventQSvc. getSpecialEventQueue(Components.interfaces. nsIEventQueueService.UI_THREAD_EVENT_QUEUE); var proxyMgr = Components. classes["@mozilla.org/xpcomproxy;1"]. getService(Components.interfaces.nsIProxyObjectManager); var observer = proxyMgr.getProxyForObject(uiQueue, Components.interfaces.nsIRDFObserver, aObserver, 5); // 5 == PROXY_ALWAYS | PROXY_SYNC this.mObserverList.push(observer); }, |
var message = stringBundle.getString("invalidURI"); var title = stringBundle.getString("invalidURITitle"); promptservice.alert(window,title,message); | var message = this._bundle.getString("invalidURI"); var title = this._bundle.getString("invalidURITitle"); promptService.alert(window, title, message); return; | addPermission: function (aCapability) { var textbox = document.getElementById("url"); var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme try { var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = ioService.newURI("http://"+host, null, null); host = uri.host; } catch(ex) { var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var message = stringBundle.getString("invalidURI"); var title = stringBundle.getString("invalidURITitle"); promptservice.alert(window,title,message); } var capabilityString = this._getCapabilityString(aCapability); // check whether the permission already exists, if not, add it var exists = false; for (var i = 0; i < this._permissions.length; ++i) { if (this._permissions[i].rawHost == host) { exists = true; this._permissions[i].capability = capabilityString; this._permissions[i].perm = aCapability; break; } } if (!exists) { var p = new Permission(host, (host.charAt(0) == ".") ? host.substring(1,host.length) : host, this._type, capabilityString, aCapability); uri.spec = p.host; this._pm.add(uri, p.type, p.perm); } textbox.value = ""; textbox.focus(); // covers a case where the site exists already, so the buttons don't disable this.onHostInput(textbox); // enable "remove all" button as needed document.getElementById("removeAllPermissions").disabled = this._permissions.length == 0; }, |
var p = new Permission(host, (host.charAt(0) == ".") ? host.substring(1,host.length) : host, this._type, capabilityString, aCapability); uri.spec = p.host; this._pm.add(uri, p.type, p.perm); | host = (host.charAt(0) == ".") ? host.substring(1,host.length) : host; var uri = ioService.newURI("http: this._pm.add(uri, this._type, aCapability); | addPermission: function (aCapability) { var textbox = document.getElementById("url"); var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme try { var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = ioService.newURI("http://"+host, null, null); host = uri.host; } catch(ex) { var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var message = stringBundle.getString("invalidURI"); var title = stringBundle.getString("invalidURITitle"); promptservice.alert(window,title,message); } var capabilityString = this._getCapabilityString(aCapability); // check whether the permission already exists, if not, add it var exists = false; for (var i = 0; i < this._permissions.length; ++i) { if (this._permissions[i].rawHost == host) { exists = true; this._permissions[i].capability = capabilityString; this._permissions[i].perm = aCapability; break; } } if (!exists) { var p = new Permission(host, (host.charAt(0) == ".") ? host.substring(1,host.length) : host, this._type, capabilityString, aCapability); uri.spec = p.host; this._pm.add(uri, p.type, p.perm); } textbox.value = ""; textbox.focus(); // covers a case where the site exists already, so the buttons don't disable this.onHostInput(textbox); // enable "remove all" button as needed document.getElementById("removeAllPermissions").disabled = this._permissions.length == 0; }, |
this.onHostInput(textbox); | addPermission: function (aPermission) { var textbox = document.getElementById("url"); var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme try { var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = ioService.newURI("http://"+host, null, null); host = uri.host; } catch(ex) { var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var message = this._bundle.getString("invalidURI"); var title = this._bundle.getString("invalidURITitle"); promptService.alert(window, title, message); textbox.value = ""; textbox.focus(); return; } // we need this whether the perm exists or not var stringKey = null; switch (aPermission) { case nsIPermissionManager.ALLOW_ACTION: stringKey = "can"; break; case nsIPermissionManager.DENY_ACTION: stringKey = "cannot"; break; case nsICookiePermission.ACCESS_SESSION: stringKey = "canSession"; break; default: break; } // check whether the permission already exists, if not, add it var exists = false; for (var i = 0; i < this._addedPermissions.length; ++i) { if (this._addedPermissions[i].rawHost == host) { exists = true; this._addedPermissions[i].capability = this._bundle.getString(stringKey); this._addedPermissions[i].perm = aPermission; break; } } if (!exists) { var p = new Permission(this._addedPermissions.length, host, (host.charAt(0) == ".") ? host.substring(1,host.length) : host, this._type, this._bundle.getString(stringKey), aPermission); this._addedPermissions.push(p); this._view._rowCount = this._addedPermissions.length; this._tree.treeBoxObject.rowCountChanged(this._addedPermissions.length-1, 1); this._tree.treeBoxObject.ensureRowIsVisible(this._addedPermissions.length-1); } textbox.value = ""; textbox.focus(); // covers a case where the site exists already, so the buttons don't disable this.onHostInput(textbox); // enable "remove all" button as needed document.getElementById("removeAllPermissions").disabled = this._addedPermissions.length == 0; }, |
|
if (this._permissions[i].perm == permission) { exists = true; } | addPermission: function (aIsSave) { var textbox = document.getElementById("url"); var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme try { var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = ioService.newURI("http://"+host, null, null); host = uri.host; } catch(ex) { var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var message = this._bundle.getString("invalidURI"); var title = this._bundle.getString("invalidURITitle"); promptService.alert(window, title, message); return; } var permission = 0; var canLoad = document.getElementById("checkLoad").checked; var canSend = document.getElementById("checkSend").checked; if (!canLoad && !canSend) { // invalid return; } else if (canLoad && canSend) { permission = 3; } else { permission = canSend ? 1 : 2; } // check whether the permission already exists, if not, add it var exists = false; for (var i = 0; i < this._permissions.length; ++i) { // check if the host and the permission matches if (this._permissions[i].rawHost == host) { var capabilityString = this._getCapabilityString(permission); this._permissions[i].capability = capabilityString; this._permissions[i].perm = permission; if (this._permissions[i].perm == permission) { exists = true; } break; } } if (!exists) { if (aIsSave) { // if it doesn't exist, but we were saving, remove the entry we were // editing. var index = this._tree.currentIndex; var oldurl = this._tree.view.getCellText(index, this._tree.columns.getFirstColumn()); if (oldurl != host) { this.onPermissionDeleted(); } } host = (host.charAt(0) == ".") ? host.substring(1,host.length) : host; var uri = ioService.newURI("http://" + host, null, null); this._pm.add(uri, this._type, permission); } // clear the checkboxes document.getElementById("checkLoad").checked = false; document.getElementById("checkSend").checked = false; this.clear(); textbox.focus(); // covers a case where the site exists already, so the buttons don't disable this.onHostInput(textbox); // enable "remove all" button as needed document.getElementById("removeAllPermissions").disabled = this._permissions.length == 0; }, |
|
"/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""), | "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""), | function AddRegExpCases( re, s, g, i, m, l ) { AddTestCase( re + ".test == RegExp.prototype.test", true, re.test == RegExp.prototype.test ); AddTestCase( re + ".toString == RegExp.prototype.toString", true, re.toString == RegExp.prototype.toString ); AddTestCase( re + ".contructor == RegExp.prototype.constructor", true, re.constructor == RegExp.prototype.constructor ); AddTestCase( re + ".compile == RegExp.prototype.compile", true, re.compile == RegExp.prototype.compile ); AddTestCase( re + ".exec == RegExp.prototype.exec", true, re.exec == RegExp.prototype.exec ); // properties AddTestCase( re + ".source", s, re.source ); AddTestCase( re + ".toString()", "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""), re.toString() ); AddTestCase( re + ".global", g, re.global ); AddTestCase( re + ".ignoreCase", i, re.ignoreCase ); AddTestCase( re + ".multiline", m, re.multiline); AddTestCase( re + ".lastIndex", l, re.lastIndex );} |
item.setAttribute('value', "Save All..."); | item.setAttribute('label', "Save All..."); | function AddSaveAllAttachmentsMenu(){ var popup = document.getElementById("attachmentPopup"); if (popup && popup.childNodes.length > 1) { var separator = document.createElement('menuseparator'); var item = document.createElement('menuitem'); if (separator && item) { popup.appendChild(separator); popup.appendChild(item); item.setAttribute('value', "Save All..."); item.setAttribute('oncommand', "SaveAllAttachments()"); } }} |
var fromValue = node.childNodes[0].nodeValue; | var fromValue = node.value; | function AddSenderToAddressBook() { // extract the from field from the current msg header and then call AddToAddressBook with that information var node = document.getElementById("FromValue"); if (node) { var fromValue = node.childNodes[0].nodeValue; if (fromValue) AddToAddressBook(fromValue, ""); }} |
var i; stringsLength++; for (i=stringsLength; i>stringToAdd; i--) { strings[i] = strings[i-1]; } strings[stringToAdd] = text; for (i=0; !(i>valuesLength); i++) { if (values[i] >= stringToAdd) { values[i]++; } } | var i; stringsLength++; for (i=stringsLength; i>stringToAdd; i--) { strings[i] = strings[i-1]; } strings[stringToAdd] = text; for (i=0; i<=entriesLength; i++) { if (entries[i] >= stringToAdd) { entries[i]++; } } | function addString(stringToAdd, text) { var i; stringsLength++; for (i=stringsLength; i>stringToAdd; i--) { strings[i] = strings[i-1]; } strings[stringToAdd] = text; for (i=0; !(i>valuesLength); i++) { if (values[i] >= stringToAdd) { values[i]++; } } } |
(bundle.GetStringFromName("EnterNewSynonym"), "", | (bundle.GetStringFromName("EnterNewSynonym")+" "+entryName, "", | function AddSynonym0() { var text = myPrompt (bundle.GetStringFromName("EnterNewSynonym"), "", bundle.GetStringFromName("AddingTitle")); if (text == "") { return; } var crypt = Encrypt(text); if (crypt == "") { /* user failed to unlock the database */ return; } addString(entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+2, crypt);} |
(bundle.GetStringFromName("EnterNewSynonym")+" "+entryName, "", | (bundle.GetStringFromName("EnterNewSynonym")+" "+entryName+" "+bundle.GetStringFromName("EnterNewSynonym1"), "", | function AddSynonym0() { var schemaId = document.getElementById("schematree").selectedItems[0].getAttribute("id"); var schemanumb =parseInt(schemaId.substring(5, schemaId.length)); var entryId = document.getElementById("entrytree").selectedItems[0].getAttribute("id"); var entrynumb =parseInt(entryId.substring(5, entryId.length)); var entryName = Decrypt(strings[entries[schemas[schemanumb]+entrynumb]+1]); var text = myPrompt (bundle.GetStringFromName("EnterNewSynonym")+" "+entryName, "", bundle.GetStringFromName("AddingTitle")); if (text == "") { return; } var crypt = Encrypt(text); if (crypt == "") { /* user failed to unlock the database */ return; } addString(entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+2, crypt);} |
{ var args = {result: "", okCallback: AddTagCallback}; var dialog = window.openDialog("chrome: "", "chrome,titlebar,modal", args); | { var dupeList = {}; for (var entry = gTagList.firstChild; entry; entry = entry.nextSibling) if (entry.localName == 'listitem') dupeList[entry.firstChild.firstChild.value] = true; var tag = DisambiguateTag(gAddButton.getAttribute('defaulttagname'), dupeList); var tagInfo = {tag: tag, key: '', color: '', ordinal: ''}; var refChild = gTagList.getNextItem(gTagList.selectedItem, 1); var newEntry = AppendTagEntry(tagInfo, refChild); FocusTagEntry(newEntry); | function AddTag(){ var args = {result: "", okCallback: AddTagCallback}; var dialog = window.openDialog("chrome://messenger/content/newTagDialog.xul", "", "chrome,titlebar,modal", args);} |
if (misspelledWord != "") { spellChecker.AddWordToDictionary(misspelledWord); | if (MisspelledWord != "") { spellChecker.AddWordToDictionary(MisspelledWord); | function AddToDictionary(){ dump("SpellCheck: AddToDictionary\n"); if (misspelledWord != "") { spellChecker.AddWordToDictionary(misspelledWord); }} |
var ubHistory = appCore.urlbarHistory; if (ubHistory) { ubHistory.addEntry( gURLBar.value ); ubHistory.printHistory() } | var urlToAdd = gURLBar.value; if (!urlToAdd) return; if (localstore) { var entries = localstore.GetTargets(rdf.GetResource("nc:urlbar-history"), rdf.GetResource("http: true); while (entries.hasMoreElements()) { var entry = entries.getNext(); if (entry) { entry = entry.QueryInterface(Components.interfaces.nsIRDFLiteral); var url = entry.Value; if (url == urlToAdd) { dump("URL already in urlbar history\n"); return; } } } dump("Adding " + urlToAdd + "to urlbar history\n"); localstore.Assert(rdf.GetResource("nc:urlbar-history"), rdf.GetResource("http: rdf.GetLiteral(urlToAdd), true); } | function addToUrlbarHistory() { var ubHistory = appCore.urlbarHistory; if (ubHistory) { ubHistory.addEntry( gURLBar.value ); ubHistory.printHistory() } } |
function addToUrlbarHistory() | function addToUrlbarHistory(aUrlToAdd) | function addToUrlbarHistory(){ var urlToAdd = gURLBar.value; if (!urlToAdd) return; if (urlToAdd.search(/[\x00-\x1F]/) != -1) // don't store bad URLs return; if (!gGlobalHistory) gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;2"] .getService(Components.interfaces.nsIBrowserHistory); if (!gURIFixup) gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"] .getService(Components.interfaces.nsIURIFixup); try { if (urlToAdd.indexOf(" ") == -1) { var fixedUpURI = gURIFixup.createFixupURI(urlToAdd, 0); gGlobalHistory.markPageAsTyped(fixedUpURI); } } catch(ex) { }} |
var urlToAdd = gURLBar.value; if (!urlToAdd) | if (!aUrlToAdd) | function addToUrlbarHistory(){ var urlToAdd = gURLBar.value; if (!urlToAdd) return; if (urlToAdd.search(/[\x00-\x1F]/) != -1) // don't store bad URLs return; if (!gGlobalHistory) gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;2"] .getService(Components.interfaces.nsIBrowserHistory); if (!gURIFixup) gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"] .getService(Components.interfaces.nsIURIFixup); try { if (urlToAdd.indexOf(" ") == -1) { var fixedUpURI = gURIFixup.createFixupURI(urlToAdd, 0); gGlobalHistory.markPageAsTyped(fixedUpURI); } } catch(ex) { }} |
if (urlToAdd.search(/[\x00-\x1F]/) != -1) | if (aUrlToAdd.search(/[\x00-\x1F]/) != -1) | function addToUrlbarHistory(){ var urlToAdd = gURLBar.value; if (!urlToAdd) return; if (urlToAdd.search(/[\x00-\x1F]/) != -1) // don't store bad URLs return; if (!gGlobalHistory) gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;2"] .getService(Components.interfaces.nsIBrowserHistory); if (!gURIFixup) gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"] .getService(Components.interfaces.nsIURIFixup); try { if (urlToAdd.indexOf(" ") == -1) { var fixedUpURI = gURIFixup.createFixupURI(urlToAdd, 0); gGlobalHistory.markPageAsTyped(fixedUpURI); } } catch(ex) { }} |
if (urlToAdd.indexOf(" ") == -1) { var fixedUpURI = gURIFixup.createFixupURI(urlToAdd, 0); | if (aUrlToAdd.indexOf(" ") == -1) { var fixedUpURI = gURIFixup.createFixupURI(aUrlToAdd, 0); | function addToUrlbarHistory(){ var urlToAdd = gURLBar.value; if (!urlToAdd) return; if (urlToAdd.search(/[\x00-\x1F]/) != -1) // don't store bad URLs return; if (!gGlobalHistory) gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;2"] .getService(Components.interfaces.nsIBrowserHistory); if (!gURIFixup) gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"] .getService(Components.interfaces.nsIURIFixup); try { if (urlToAdd.indexOf(" ") == -1) { var fixedUpURI = gURIFixup.createFixupURI(urlToAdd, 0); gGlobalHistory.markPageAsTyped(fixedUpURI); } } catch(ex) { }} |
var uriToAdd = ioService.newURI(urlToAdd, null); | try { var uriToAdd = ioService.newURI(urlToAdd, null); } catch(e) { } | function addToUrlbarHistory(){ var urlToAdd = gURLBar.value; if (!urlToAdd) return; if (localstore) { var entries = rdfc.MakeSeq(localstore, rdf.GetResource("nc:urlbar-history")); if (!entries) return; var elements = entries.GetElements(); if (!elements) return; var index = 0; // create the nsIURI objects for comparing the 2 urls var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); try { var unused = { }; var scheme = ioService.extractScheme(urlToAdd, unused, unused); } catch(e) { urlToAdd = "http://" + urlToAdd; } var uriToAdd = ioService.newURI(urlToAdd, null); while(elements.hasMoreElements()) { entry = elements.getNext(); if (entry) { index ++; entry= entry.QueryInterface(Components.interfaces.nsIRDFLiteral); var rdfValue = entry.Value; try { var unused = { }; var scheme = ioService.extractScheme(rdfValue, unused, unused); } catch(e) { rdfValue = "http://" + rdfValue; } var rdfUri = ioService.newURI(rdfValue, null); if (rdfUri.equals(uriToAdd)) { // URI already present in the database // Remove it from its current position. // It is inserted to the top after the while loop. entries.RemoveElementAt(index, true); break; } } } // while var entry = rdf.GetLiteral(urlToAdd); // Otherwise, we've got a new URL in town. Add it! // Put the value as it was typed by the user in to RDF // Insert it to the beginning of the list. entries.InsertElementAt(entry, 1, true); // Remove any expired history items so that we don't let // this grow without bound. for (index = entries.GetCount(); index > MAX_HISTORY_ITEMS; --index) { entries.RemoveElementAt(index, true); } // for } // localstore} |
if (entry) { index ++; entry= entry.QueryInterface(Components.interfaces.nsIRDFLiteral); var rdfValue = entry.Value; | if (!entry) continue; | function addToUrlbarHistory(){ var urlToAdd = gURLBar.value; if (!urlToAdd) return; if (localstore) { var entries = rdfc.MakeSeq(localstore, rdf.GetResource("nc:urlbar-history")); if (!entries) return; var elements = entries.GetElements(); if (!elements) return; var index = 0; // create the nsIURI objects for comparing the 2 urls var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); try { var unused = { }; var scheme = ioService.extractScheme(urlToAdd, unused, unused); } catch(e) { urlToAdd = "http://" + urlToAdd; } var uriToAdd = ioService.newURI(urlToAdd, null); while(elements.hasMoreElements()) { entry = elements.getNext(); if (entry) { index ++; entry= entry.QueryInterface(Components.interfaces.nsIRDFLiteral); var rdfValue = entry.Value; try { var unused = { }; var scheme = ioService.extractScheme(rdfValue, unused, unused); } catch(e) { rdfValue = "http://" + rdfValue; } var rdfUri = ioService.newURI(rdfValue, null); if (rdfUri.equals(uriToAdd)) { // URI already present in the database // Remove it from its current position. // It is inserted to the top after the while loop. entries.RemoveElementAt(index, true); break; } } } // while var entry = rdf.GetLiteral(urlToAdd); // Otherwise, we've got a new URL in town. Add it! // Put the value as it was typed by the user in to RDF // Insert it to the beginning of the list. entries.InsertElementAt(entry, 1, true); // Remove any expired history items so that we don't let // this grow without bound. for (index = entries.GetCount(); index > MAX_HISTORY_ITEMS; --index) { entries.RemoveElementAt(index, true); } // for } // localstore} |
try { var unused = { }; var scheme = ioService.extractScheme(rdfValue, unused, unused); } catch(e) { rdfValue = "http: | index ++; entry= entry.QueryInterface(Components.interfaces.nsIRDFLiteral); var rdfValue = entry.Value; try { var unused = { }; var scheme = ioService.extractScheme(rdfValue, unused, unused); } catch(e) { rdfValue = "http: } if (uriToAdd) { try { var rdfUri = ioService.newURI(rdfValue, null); if (rdfUri.equals(uriToAdd)) { entries.RemoveElementAt(index, true); break; } | function addToUrlbarHistory(){ var urlToAdd = gURLBar.value; if (!urlToAdd) return; if (localstore) { var entries = rdfc.MakeSeq(localstore, rdf.GetResource("nc:urlbar-history")); if (!entries) return; var elements = entries.GetElements(); if (!elements) return; var index = 0; // create the nsIURI objects for comparing the 2 urls var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); try { var unused = { }; var scheme = ioService.extractScheme(urlToAdd, unused, unused); } catch(e) { urlToAdd = "http://" + urlToAdd; } var uriToAdd = ioService.newURI(urlToAdd, null); while(elements.hasMoreElements()) { entry = elements.getNext(); if (entry) { index ++; entry= entry.QueryInterface(Components.interfaces.nsIRDFLiteral); var rdfValue = entry.Value; try { var unused = { }; var scheme = ioService.extractScheme(rdfValue, unused, unused); } catch(e) { rdfValue = "http://" + rdfValue; } var rdfUri = ioService.newURI(rdfValue, null); if (rdfUri.equals(uriToAdd)) { // URI already present in the database // Remove it from its current position. // It is inserted to the top after the while loop. entries.RemoveElementAt(index, true); break; } } } // while var entry = rdf.GetLiteral(urlToAdd); // Otherwise, we've got a new URL in town. Add it! // Put the value as it was typed by the user in to RDF // Insert it to the beginning of the list. entries.InsertElementAt(entry, 1, true); // Remove any expired history items so that we don't let // this grow without bound. for (index = entries.GetCount(); index > MAX_HISTORY_ITEMS; --index) { entries.RemoveElementAt(index, true); } // for } // localstore} |
var rdfUri = ioService.newURI(rdfValue, null); if (rdfUri.equals(uriToAdd)) { entries.RemoveElementAt(index, true); break; } | if (urlToAdd == rdfValue) { entries.RemoveElementAt(index, true); break; | function addToUrlbarHistory(){ var urlToAdd = gURLBar.value; if (!urlToAdd) return; if (localstore) { var entries = rdfc.MakeSeq(localstore, rdf.GetResource("nc:urlbar-history")); if (!entries) return; var elements = entries.GetElements(); if (!elements) return; var index = 0; // create the nsIURI objects for comparing the 2 urls var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); try { var unused = { }; var scheme = ioService.extractScheme(urlToAdd, unused, unused); } catch(e) { urlToAdd = "http://" + urlToAdd; } var uriToAdd = ioService.newURI(urlToAdd, null); while(elements.hasMoreElements()) { entry = elements.getNext(); if (entry) { index ++; entry= entry.QueryInterface(Components.interfaces.nsIRDFLiteral); var rdfValue = entry.Value; try { var unused = { }; var scheme = ioService.extractScheme(rdfValue, unused, unused); } catch(e) { rdfValue = "http://" + rdfValue; } var rdfUri = ioService.newURI(rdfValue, null); if (rdfUri.equals(uriToAdd)) { // URI already present in the database // Remove it from its current position. // It is inserted to the top after the while loop. entries.RemoveElementAt(index, true); break; } } } // while var entry = rdf.GetLiteral(urlToAdd); // Otherwise, we've got a new URL in town. Add it! // Put the value as it was typed by the user in to RDF // Insert it to the beginning of the list. entries.InsertElementAt(entry, 1, true); // Remove any expired history items so that we don't let // this grow without bound. for (index = entries.GetCount(); index > MAX_HISTORY_ITEMS; --index) { entries.RemoveElementAt(index, true); } // for } // localstore} |
cell.setAttribute('value', UIstring); | cell.setAttribute('label', UIstring); | function AddTreeItem(doc, treeRoot, ID, UIstring){ // Create a treerow for the new item var item = doc.createElement('treeitem'); var row = doc.createElement('treerow'); var cell = doc.createElement('treecell'); // Copy over the attributes cell.setAttribute('value', UIstring); cell.setAttribute('id', ID); // Add it to the tree item.appendChild(row); row.appendChild(cell); treeRoot.appendChild(item);} |
cell.setAttribute('value', domainTitle); | cell.setAttribute('label', domainTitle); | function AddTreeItem(treeRoot, domainTitle){ try { // Create a treerow for the new Domain var item = document.createElement('treeitem'); var row = document.createElement('treerow'); var cell = document.createElement('treecell'); // Copy over the attributes cell.setAttribute('value', domainTitle); // Add it to the active languages tree item.appendChild(row); row.appendChild(cell); treeRoot.appendChild(item); } //try catch (ex) { dump("*** Failed to add item: " + domainTitle + "\n"); } //catch } |
dump("Adding element " + num + " : " + name + "\n"); | dump("Adding Progress element " + num + " : " + name + "\n"); | function addTreeItem(num, modName, url){ dump("Adding element " + num + " : " + name + "\n"); var body = document.getElementById("theTreeBody"); var newitem = document.createElement('treeitem'); var newrow = document.createElement('treerow'); newrow.setAttribute("rowNum", num); newrow.setAttribute("rowName", modName); var elem = document.createElement('treecell'); elem.setAttribute("value", modName); newrow.appendChild(elem); var elem = document.createElement('treecell'); elem.setAttribute("value", url); newrow.appendChild(elem); newitem.appendChild(newrow); body.appendChild(newitem);} |
cell.setAttribute('value', langTitle); cell.setAttribute('id', langID); | cell.setAttribute('label', langTitle); cell.setAttribute('id', langID); | function AddTreeItem(doc, treeRoot, langID, langTitle){ try { //let's beef up our error handling for languages without label / title // Create a treerow for the new Language var item = doc.createElement('treeitem'); var row = doc.createElement('treerow'); var cell = doc.createElement('treecell'); // Copy over the attributes cell.setAttribute('value', langTitle); cell.setAttribute('id', langID); // Add it to the active languages tree item.appendChild(row); row.appendChild(cell); treeRoot.appendChild(item); } //try catch (ex) { } //catch } |
attrcell.setAttribute( "value", name ); | attrcell.setAttribute( "label", name ); | function AddTreeItem ( name, value, treekidsId, attArray, valueCaseFunc ){ attArray[attArray.length] = name; var treekids = document.getElementById ( treekidsId ); var treeitem = document.createElementNS ( XUL_NS, "treeitem" ); var treerow = document.createElementNS ( XUL_NS, "treerow" ); var attrcell = document.createElementNS ( XUL_NS, "treecell" ); attrcell.setAttribute( "class", "propertylist" ); attrcell.setAttribute( "value", name ); // Modify treerow selection to better show focus in textbox treeitem.setAttribute( "class", "ae-selection"); treerow.appendChild ( attrcell ); if ( !valueCaseFunc ) { // no handling function provided, create default cell. var valCell = CreateCellWithField ( name, value ); if (!valCell) return null; treerow.appendChild ( valCell ); } else valueCaseFunc(); // run user specified function for adding content treeitem.appendChild ( treerow ); treekids.appendChild ( treeitem ); return treeitem;} |
function addTreeItemToTreeChild(treeChild, label) | function addTreeItemToTreeChild(treeChild,label,value,addTwistie) | function addTreeItemToTreeChild(treeChild, label){ var treeElem1 = document.createElement("treeitem"); treeElem1.setAttribute("container","true"); treeElem1.setAttribute("open","true"); treeElem1.setAttribute("class","treecell-indent"); var treeRow = document.createElement("treerow"); var treeCell = document.createElement("treecell"); treeCell.setAttribute("class", "treecell-indent"); treeCell.setAttribute("label",label); treeRow.appendChild(treeCell); treeElem1.appendChild(treeRow); treeChild.appendChild(treeElem1); return treeElem1;} |
treeElem1.setAttribute("container","true"); treeElem1.setAttribute("open","true"); treeElem1.setAttribute("class","treecell-indent"); | if (addTwistie) { treeElem1.setAttribute("container","true"); treeElem1.setAttribute("open","true"); } | function addTreeItemToTreeChild(treeChild, label){ var treeElem1 = document.createElement("treeitem"); treeElem1.setAttribute("container","true"); treeElem1.setAttribute("open","true"); treeElem1.setAttribute("class","treecell-indent"); var treeRow = document.createElement("treerow"); var treeCell = document.createElement("treecell"); treeCell.setAttribute("class", "treecell-indent"); treeCell.setAttribute("label",label); treeRow.appendChild(treeCell); treeElem1.appendChild(treeRow); treeChild.appendChild(treeElem1); return treeElem1;} |
if (value) treeCell.setAttribute("display",value); | function addTreeItemToTreeChild(treeChild, label){ var treeElem1 = document.createElement("treeitem"); treeElem1.setAttribute("container","true"); treeElem1.setAttribute("open","true"); treeElem1.setAttribute("class","treecell-indent"); var treeRow = document.createElement("treerow"); var treeCell = document.createElement("treecell"); treeCell.setAttribute("class", "treecell-indent"); treeCell.setAttribute("label",label); treeRow.appendChild(treeCell); treeElem1.appendChild(treeRow); treeChild.appendChild(treeElem1); return treeElem1;} |
|
if (!(mimeInfo.primaryExtension in this._pluginTypeHash)) { var pluginType = new PluginType(aPluginEnabled, mimeInfo); this._pluginTypeHash[mimeInfo.primaryExtension] = pluginType; this._pluginTypes.push(pluginType); } else { var pluginType = this._pluginTypeHash[mimeInfo.primaryExtension]; pluginType.MIMETypes.push(mimeInfo.MIMEType); | try { var primExt = mimeInfo.primaryExtension; } catch (e) { } if (primExt) { if (!(primExt in this._pluginTypeHash)) { var pluginType = new PluginType(aPluginEnabled, mimeInfo); this._pluginTypeHash[primExt] = pluginType; this._pluginTypes.push(pluginType); } else { var pluginType = this._pluginTypeHash[primExt]; pluginType.MIMETypes.push(mimeInfo.MIMEType); } | addType: function (aMIMEType, aPluginEnabled) { var mimeInfo = this.getMIMEInfoForType(aMIMEType); if (mimeInfo) { // We only want to show one entry per extension, even if several MIME // types map to that extension, e.g. audio/wav, audio/x-wav. Hash the // primary extension for the type to prevent duplicates. If we encounter // a duplicate, record the additional MIME type so we know to deactivate // support for it too if the user deactivates support for the extension. if (!(mimeInfo.primaryExtension in this._pluginTypeHash)) { var pluginType = new PluginType(aPluginEnabled, mimeInfo); this._pluginTypeHash[mimeInfo.primaryExtension] = pluginType; this._pluginTypes.push(pluginType); } // We check that the primary extension has already been hashed // by a plugin that is installed in this build before adding a disable // override to the list. Otherwise we might end up showing disabled // plugin entries for plugins that actually aren't installed and configured // in this build, but were for another build that was using this profile. else { // Append this MIME type to the list of MIME types for the extension. var pluginType = this._pluginTypeHash[mimeInfo.primaryExtension]; pluginType.MIMETypes.push(mimeInfo.MIMEType); } } }, |
cell.setAttribute("value", usage); | cell.setAttribute("label", usage); | function AddUsage(usage){ var tree = document.getElementById("usage"); var row = document.createElement("treerow"); var cell = document.createElement("treecell"); cell.setAttribute("class", "propertylist"); cell.setAttribute("value", usage); row.appendChild(cell); tree.appendChild(row);} |
dump("Exception occured in spellChecker.AddWordToDictionary\nWord to add probably already existed"); | dump("Exception occured in spellChecker.AddWordToDictionary\nWord to add probably already existed\n"); | function AddWord(){ if (ValidateWordToAdd()) { try { spellChecker.AddWordToDictionary(WordToAdd); } catch (e) { dump("Exception occured in spellChecker.AddWordToDictionary\nWord to add probably already existed"); } // Rebuild the dialog list FillDictionaryList(); SelectWordToAddInList(); }} |
spellChecker.AddWordToDictionary(WordToAdd); | gSpellChecker.AddWordToDictionary(gWordToAdd); | function AddWord(){ if (ValidateWordToAdd()) { try { spellChecker.AddWordToDictionary(WordToAdd); } catch (e) { dump("Exception occured in spellChecker.AddWordToDictionary\nWord to add probably already existed\n"); } // Rebuild the dialog list FillDictionaryList(); SelectWordToAddInList(); }} |
dump("Exception occured in spellChecker.AddWordToDictionary\nWord to add probably already existed\n"); | dump("Exception occured in gSpellChecker.AddWordToDictionary\nWord to add probably already existed\n"); | function AddWord(){ if (ValidateWordToAdd()) { try { spellChecker.AddWordToDictionary(WordToAdd); } catch (e) { dump("Exception occured in spellChecker.AddWordToDictionary\nWord to add probably already existed\n"); } // Rebuild the dialog list FillDictionaryList(); SelectWordToAddInList(); }} |
dialog.WordInput.value = ""; | function AddWord(){ if (ValidateWordToAdd()) { try { spellChecker.AddWordToDictionary(WordToAdd); } catch (e) { dump("Exception occured in spellChecker.AddWordToDictionary\nWord to add probably already existed\n"); } // Rebuild the dialog list FillDictionaryList(); SelectWordToAddInList(); }} |
|
if (document.getElementById("msgRecipient#1").value == "") | var element = document.getElementById("msgRecipient#1"); if (element.value == "") | function AdjustFocus(){ if (document.getElementById("msgRecipient#1").value == "") { dump("set focus on the recipient\n"); document.getElementById("msgRecipient#1").focus(); } else { dump("set focus on the body\n"); contentWindow.focus(); }} |
document.getElementById("msgRecipient#1").focus(); | element.focus(); | function AdjustFocus(){ if (document.getElementById("msgRecipient#1").value == "") { dump("set focus on the recipient\n"); document.getElementById("msgRecipient#1").focus(); } else { dump("set focus on the body\n"); contentWindow.focus(); }} |
dump("set focus on the body\n"); contentWindow.focus(); } | element = document.getElementById("msgSubject"); if (element.value == "") { dump("set focus on the subject\n"); element.focus(); } else { dump("set focus on the body\n"); contentWindow.focus(); } } | function AdjustFocus(){ if (document.getElementById("msgRecipient#1").value == "") { dump("set focus on the recipient\n"); document.getElementById("msgRecipient#1").focus(); } else { dump("set focus on the body\n"); contentWindow.focus(); }} |
this.assureReadWrite(); | this.assureAccess(Components.interfaces.calIWcapCalendar.AC_COMP_WRITE); | calWcapCalendar.prototype.adoptItem_queued = function( item, listener ){ this.log( "adoptItem() call: " + item.title ); try { this.assureReadWrite(); // xxx todo: workaround really necessary for adding an occurrence? var oldItem = null; if (!isParent(item)) { this.logError( "adoptItem(): unexpected proxy!" ); debugger; item.parentItem.recurrenceInfo.modifyException( item ); oldItem = item; // patch to modify } var this_ = this; this.storeItem( item, oldItem, function( wcapResponse ) { this_.adoptItem_resp( wcapResponse, item, listener ); } ); } catch (exc) { if (listener != null) { listener.onOperationComplete( this.superCalendar, Components.results.NS_ERROR_FAILURE, Components.interfaces.calIOperationListener.ADD, item.id, exc ); } this.notifyError( exc ); } this.log( "adoptItem() returning." );}; |
cardForEmailAddress.editCardToDatabase(""); | addrbook.modifyCard(cardForEmailAddress); | function allowRemoteContentForSender(){ // get the sender of the msg hdr var msgHdr = msgHdrForCurrentMessage(); if (!msgHdr) return; var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"] .getService(Components.interfaces.nsIMsgHeaderParser); var names = {}; var addresses = {}; var fullNames = {}; var numAddresses; numAddresses = headerParser.parseHeadersWithArray(msgHdr.author, addresses, names, fullNames); var authorEmailAddress = addresses.value[0]; if (!authorEmailAddress) return; // search through all of our local address books looking for a match. var parentDir = RDF.GetResource("moz-abdirectory://").QueryInterface(Components.interfaces.nsIAbDirectory); var enumerator = parentDir.childNodes; var cardForEmailAddress; var addrbook; while (!cardForEmailAddress && enumerator.hasMoreElements()) { addrbook = enumerator.getNext(); if (addrbook instanceof Components.interfaces.nsIAbMDBDirectory) cardForEmailAddress = addrbook.cardForEmailAddress(authorEmailAddress); } var allowRemoteContent = false; if (cardForEmailAddress) { // set the property for remote content cardForEmailAddress.allowRemoteContent = true; cardForEmailAddress.editCardToDatabase(""); allowRemoteContent = true; } else { var args = {primaryEmail:authorEmailAddress, displayName:names.value[0], allowRemoteContent:true}; // create a new card and set the property window.openDialog("chrome://messenger/content/addressbook/abNewCardDialog.xul", "", "chrome,resizable=no,titlebar,modal,centerscreen", args); allowRemoteContent = args.allowRemoteContent; } // reload the message if we've updated the remote content policy for the sender if (allowRemoteContent) MsgReload();} |
var spamSettings = aMsgHdr.folder.server.spamSettings; if (spamSettings.useWhiteList && spamSettings.whiteListAbURI) { var whiteListDirectory = RDF.GetResource(spamSettings.whiteListAbURI).QueryInterface(Components.interfaces.nsIAbMDBDirectory); var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser); var authorEmailAddress = new Object; headerParser.extractHeaderAddressMailboxes(null, aMsgHdr.author, authorEmailAddress); if (whiteListDirectory.hasCardForEmailAddress(authorEmailAddress.value)) { listener.onMessageClassified(aMsgHdr.folder.generateMessageURI(aMsgHdr.messageKey), nsIJunkMailPlugin.GOOD); return; } } | function analyze(aMsgHdr, aNextFunction){ var listener = { onMessageClassified: function(aMsgURI, aClassification) { dump(aMsgURI + ' is ' + (aClassification == nsIJunkMailPlugin.JUNK ? 'JUNK' : 'GOOD') + '\n'); // XXX TODO, make the cut off 50, like in nsMsgSearchTerm.cpp var score = aClassification == nsIJunkMailPlugin.JUNK ? "100" : "0"; // set these props via the db (instead of the message header // directly) so that the nsMsgDBView knows to update the UI // var db = aMsgHdr.folder.getMsgDatabase(msgWindow); db.setStringProperty(aMsgHdr.messageKey, "junkscore", score); db.setStringProperty(aMsgHdr.messageKey, "junkscoreorigin", "plugin"); aNextFunction(); } }; var messageURI = aMsgHdr.folder.generateMessageURI(aMsgHdr.messageKey) + "?fetchCompleteMessage=true"; gJunkmailComponent.classifyMessage(messageURI, msgWindow, listener);} |
|
dump(aMsgURL + ' is ' | dump(aMsgURI + ' is ' | function analyze(aMsgHdr, aNextFunction){ var listener = { onMessageClassified: function(aMsgURI, aClassification) { dump(aMsgURL + ' is ' + (aClassification == nsIJunkMailPlugin.JUNK ? 'JUNK' : 'GOOD') + '\n'); // XXX TODO, make the cut off 50, like in nsMsgSearchTerm.cpp var score = aClassification == nsIJunkMailPlugin.JUNK ? "100" : "0"; // set these props via the db (instead of the message header // directly) so that the nsMsgDBView knows to update the UI // var db = aMsgHdr.folder.getMsgDatabase(msgWindow); db.setStringProperty(aMsgHdr.messageKey, "junkscore", score); db.setStringProperty(aMsgHdr.messageKey, "junkscoreorigin", "plugin"); aNextFunction(); } }; var messageURI = aMsgHdr.folder.generateMessageURI(aMsgHdr.messageKey) + "?fetchCompleteMessage=true"; gJunkmailComponent.classifyMessage(messageURI, msgWindow, listener);} |
saveJunkMsgForAction(aMsgHdr.folder.server, aMsgURI, aClassification); | function analyze(aMsgHdr, aNextFunction){ var listener = { onMessageClassified: function(aMsgURI, aClassification) { // XXX todo // update status bar, or a progress dialog // running junk mail controls manually, on a large folder // can take a while, and the user doesn't know when we are done. dump(aMsgURI + ' is ' + (aClassification == nsIJunkMailPlugin.JUNK ? 'JUNK' : 'GOOD') + '\n'); // XXX TODO, make the cut off 50, like in nsMsgSearchTerm.cpp var score = aClassification == nsIJunkMailPlugin.JUNK ? "100" : "0"; // set these props via the db (instead of the message header // directly) so that the nsMsgDBView knows to update the UI // var db = aMsgHdr.folder.getMsgDatabase(msgWindow); db.setStringProperty(aMsgHdr.messageKey, "junkscore", score); db.setStringProperty(aMsgHdr.messageKey, "junkscoreorigin", "plugin"); aNextFunction(); } }; // if we are whitelisting, check if the email address is in the whitelist addressbook. var spamSettings = aMsgHdr.folder.server.spamSettings; if (spamSettings.useWhiteList && spamSettings.whiteListAbURI) { var whiteListDirectory = RDF.GetResource(spamSettings.whiteListAbURI).QueryInterface(Components.interfaces.nsIAbMDBDirectory); var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser); var authorEmailAddress = new Object; headerParser.extractHeaderAddressMailboxes(null, aMsgHdr.author, authorEmailAddress); if (whiteListDirectory.hasCardForEmailAddress(authorEmailAddress.value)) { // skip over this message, like we do on incoming mail // the difference is it could be marked as junk from previous analysis // or from being manually marked by the user. aNextFunction(); return; } } var messageURI = aMsgHdr.folder.generateMessageURI(aMsgHdr.messageKey) + "?fetchCompleteMessage=true"; gJunkmailComponent.classifyMessage(messageURI, msgWindow, listener);} |
|
{ gJunkmailComponent.endBatch(); | function analyzeMessageForJunk(aMsgHdr, aMsgIndex, aJunkMsgIndices, aLastMessage, aWhiteListDirectory){ var listener = { onMessageClassified: function(aClassifiedMsgURI, aClassification) { // XXX TODO // update status bar, or a progress dialog // running junk mail controls manually, on a large folder // can take a while, and the user doesn't know when we are done. // XXX TODO // make the cut off 50, like in nsMsgSearchTerm.cpp var score = aClassification == nsIJunkMailPlugin.JUNK ? "100" : "0"; // set these props via the db (instead of the message header // directly) so that the nsMsgDBView knows to update the UI // var db = aMsgHdr.folder.getMsgDatabase(msgWindow); db.setStringProperty(aMsgHdr.messageKey, "junkscore", score); db.setStringProperty(aMsgHdr.messageKey, "junkscoreorigin", "plugin"); if (aClassification == nsIJunkMailPlugin.JUNK) aJunkMsgIndices.push(aMsgIndex); if (aLastMessage) { gJunkmailComponent.endBatch(); performActionsOnJunkMsgs(aJunkMsgIndices); } } }; // if we are whitelisting, check if the email address is in the whitelist addressbook. if (aWhiteListDirectory) { var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser); var authorEmailAddress = headerParser.extractHeaderAddressMailboxes(null, aMsgHdr.author); if (aWhiteListDirectory.hasCardForEmailAddress(authorEmailAddress)) // skip over this message, like we do on incoming mail // the difference is it could be marked as junk from previous analysis // or from being manually marked by the user. return; } var messageURI = aMsgHdr.folder.generateMessageURI(aMsgHdr.messageKey) + "?fetchCompleteMessage=true"; gJunkmailComponent.classifyMessage(messageURI, msgWindow, listener);} |
|
} | function analyzeMessageForJunk(aMsgHdr, aMsgIndex, aJunkMsgIndices, aLastMessage, aWhiteListDirectory){ var listener = { onMessageClassified: function(aClassifiedMsgURI, aClassification) { // XXX TODO // update status bar, or a progress dialog // running junk mail controls manually, on a large folder // can take a while, and the user doesn't know when we are done. // XXX TODO // make the cut off 50, like in nsMsgSearchTerm.cpp var score = aClassification == nsIJunkMailPlugin.JUNK ? "100" : "0"; // set these props via the db (instead of the message header // directly) so that the nsMsgDBView knows to update the UI // var db = aMsgHdr.folder.getMsgDatabase(msgWindow); db.setStringProperty(aMsgHdr.messageKey, "junkscore", score); db.setStringProperty(aMsgHdr.messageKey, "junkscoreorigin", "plugin"); if (aClassification == nsIJunkMailPlugin.JUNK) aJunkMsgIndices.push(aMsgIndex); if (aLastMessage) { gJunkmailComponent.endBatch(); performActionsOnJunkMsgs(aJunkMsgIndices); } } }; // if we are whitelisting, check if the email address is in the whitelist addressbook. if (aWhiteListDirectory) { var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser); var authorEmailAddress = headerParser.extractHeaderAddressMailboxes(null, aMsgHdr.author); if (aWhiteListDirectory.hasCardForEmailAddress(authorEmailAddress)) // skip over this message, like we do on incoming mail // the difference is it could be marked as junk from previous analysis // or from being manually marked by the user. return; } var messageURI = aMsgHdr.folder.generateMessageURI(aMsgHdr.messageKey) + "?fetchCompleteMessage=true"; gJunkmailComponent.classifyMessage(messageURI, msgWindow, listener);} |
|
performActionOnJunkMsgs(); | function analyzeMessages(messages){ function processNext() { if (counter < messages.length) { var messageUri = messages[counter]; var message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri); ++counter; analyze(message, processNext); } else { dump('[bayesian filter message analysis complete.]\n'); gJunkmailComponent.endBatch(); } } getJunkmailComponent(); var counter = 0; gJunkmailComponent.startBatch(); dump('[bayesian filter message analysis begins.]\n'); processNext();} |
|
function processNext() | function processNext() { if (counter < messages.length) | function analyzeMessages(messages){ function processNext() { if (counter < messages.length) { var messageUri = messages[counter]; var message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri); ++counter; analyze(message, processNext); } else { dump('[bayesian filter message analysis complete.]\n'); gJunkmailComponent.endBatch(); performActionOnJunkMsgs(); } } getJunkmailComponent(); var counter = 0; gJunkmailComponent.startBatch(); dump('[bayesian filter message analysis begins.]\n'); processNext();} |
if (counter < messages.length) { var messageUri = messages[counter]; var message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri); ++counter; analyze(message, processNext); } else { dump('[bayesian filter message analysis complete.]\n'); gJunkmailComponent.endBatch(); performActionOnJunkMsgs(); } } | var messageUri = messages[counter]; var message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri); ++counter; analyze(message, processNext); } else performActionOnJunkMsgs(); } | function analyzeMessages(messages){ function processNext() { if (counter < messages.length) { var messageUri = messages[counter]; var message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri); ++counter; analyze(message, processNext); } else { dump('[bayesian filter message analysis complete.]\n'); gJunkmailComponent.endBatch(); performActionOnJunkMsgs(); } } getJunkmailComponent(); var counter = 0; gJunkmailComponent.startBatch(); dump('[bayesian filter message analysis begins.]\n'); processNext();} |
getJunkmailComponent(); var counter = 0; gJunkmailComponent.startBatch(); dump('[bayesian filter message analysis begins.]\n'); processNext(); | getJunkmailComponent(); var counter = 0; processNext(); | function analyzeMessages(messages){ function processNext() { if (counter < messages.length) { var messageUri = messages[counter]; var message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri); ++counter; analyze(message, processNext); } else { dump('[bayesian filter message analysis complete.]\n'); gJunkmailComponent.endBatch(); performActionOnJunkMsgs(); } } getJunkmailComponent(); var counter = 0; gJunkmailComponent.startBatch(); dump('[bayesian filter message analysis begins.]\n'); processNext();} |
window.outerHeight = gCurrentHeight; window.moveTo((screen.availWidth - gWidth), screen.availHeight - gCurrentHeight); | window.screenY -= gSlideIncrement; window.outerHeight += gSlideIncrement; | function animateAlert(){ if (gCurrentHeight < gFinalHeight) { gCurrentHeight += gSlideIncrement; window.outerHeight = gCurrentHeight; window.moveTo((screen.availWidth - gWidth), screen.availHeight - gCurrentHeight); setTimeout(animateAlert, gSlideTime); } else setTimeout(closeAlert, gOpenTime); } |
thisMenuItem.setAttribute('value',thisMenuList.value); | thisMenuItem.setAttribute('label',thisMenuList.label); | function Append(thisMenuList) { /* Note: we always want a zero-length textbox so the user * can start typing in a new value. So we need to determine * if user has started typing into the zero-length textbox * in which case it's time to create yet another zero-length * one. We also need to determine if user has removed all * text in a textbox in which case that textbox needs to * be removed */ /* transfer value from menu list to the selected menu item */ var thisMenuItem = thisMenuList.selectedItem; if (!thisMenuItem) { return; } thisMenuItem.setAttribute('value',thisMenuList.value); /* determine previous size of textbox */ var len = Number(thisMenuItem.getAttribute("len")); /* update previous size */ var newLen = thisMenuItem.getAttribute("value").length; thisMenuItem.setAttribute("len", newLen); /* obtain parent element */ var thisMenuPopup = thisMenuItem.parentNode; if (!thisMenuPopup) { return; } /* determine if it's time to remove menuItem */ if (newLen == 0) { /* no characters left in text field */ if (len) { /* previously there were some characters, time to remove */ thisMenuPopup.parentNode.selectedItem = thisMenuPopup.lastChild; thisMenuPopup.removeChild(thisMenuItem); } return; } /* currently modified entry is not null so put it at head of list */ if (thisMenuPopup.childNodes.length > 1) { thisMenuPopup.removeChild(thisMenuItem); thisMenuPopup.insertBefore(thisMenuItem, thisMenuPopup.firstChild); } /* determine if it's time to add menuItem */ if (len) { /* previously there were some characters and there still are so it's not time to add */ return; } /* add menu item */ var menuItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem"); if (!menuItem) { return; } menuItem.setAttribute("value", ""); menuItem.setAttribute("len", "0"); thisMenuPopup.appendChild(menuItem); return; } |
var newLen = thisMenuItem.getAttribute("value").length; | var newLen = thisMenuItem.getAttribute("label").length; | function Append(thisMenuList) { /* Note: we always want a zero-length textbox so the user * can start typing in a new value. So we need to determine * if user has started typing into the zero-length textbox * in which case it's time to create yet another zero-length * one. We also need to determine if user has removed all * text in a textbox in which case that textbox needs to * be removed */ /* transfer value from menu list to the selected menu item */ var thisMenuItem = thisMenuList.selectedItem; if (!thisMenuItem) { return; } thisMenuItem.setAttribute('value',thisMenuList.value); /* determine previous size of textbox */ var len = Number(thisMenuItem.getAttribute("len")); /* update previous size */ var newLen = thisMenuItem.getAttribute("value").length; thisMenuItem.setAttribute("len", newLen); /* obtain parent element */ var thisMenuPopup = thisMenuItem.parentNode; if (!thisMenuPopup) { return; } /* determine if it's time to remove menuItem */ if (newLen == 0) { /* no characters left in text field */ if (len) { /* previously there were some characters, time to remove */ thisMenuPopup.parentNode.selectedItem = thisMenuPopup.lastChild; thisMenuPopup.removeChild(thisMenuItem); } return; } /* currently modified entry is not null so put it at head of list */ if (thisMenuPopup.childNodes.length > 1) { thisMenuPopup.removeChild(thisMenuItem); thisMenuPopup.insertBefore(thisMenuItem, thisMenuPopup.firstChild); } /* determine if it's time to add menuItem */ if (len) { /* previously there were some characters and there still are so it's not time to add */ return; } /* add menu item */ var menuItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem"); if (!menuItem) { return; } menuItem.setAttribute("value", ""); menuItem.setAttribute("len", "0"); thisMenuPopup.appendChild(menuItem); return; } |
menuItem.setAttribute("value", ""); | menuItem.setAttribute("label", ""); | function Append(thisMenuList) { /* Note: we always want a zero-length textbox so the user * can start typing in a new value. So we need to determine * if user has started typing into the zero-length textbox * in which case it's time to create yet another zero-length * one. We also need to determine if user has removed all * text in a textbox in which case that textbox needs to * be removed */ /* transfer value from menu list to the selected menu item */ var thisMenuItem = thisMenuList.selectedItem; if (!thisMenuItem) { return; } thisMenuItem.setAttribute('value',thisMenuList.value); /* determine previous size of textbox */ var len = Number(thisMenuItem.getAttribute("len")); /* update previous size */ var newLen = thisMenuItem.getAttribute("value").length; thisMenuItem.setAttribute("len", newLen); /* obtain parent element */ var thisMenuPopup = thisMenuItem.parentNode; if (!thisMenuPopup) { return; } /* determine if it's time to remove menuItem */ if (newLen == 0) { /* no characters left in text field */ if (len) { /* previously there were some characters, time to remove */ thisMenuPopup.parentNode.selectedItem = thisMenuPopup.lastChild; thisMenuPopup.removeChild(thisMenuItem); } return; } /* currently modified entry is not null so put it at head of list */ if (thisMenuPopup.childNodes.length > 1) { thisMenuPopup.removeChild(thisMenuItem); thisMenuPopup.insertBefore(thisMenuItem, thisMenuPopup.firstChild); } /* determine if it's time to add menuItem */ if (len) { /* previously there were some characters and there still are so it's not time to add */ return; } /* add menu item */ var menuItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem"); if (!menuItem) { return; } menuItem.setAttribute("value", ""); menuItem.setAttribute("len", "0"); thisMenuPopup.appendChild(menuItem); return; } |
aFilePicker.appendFilter(bundle.GetStringFromName("TextOnlyFilter"), "*.txt"); | aFilePicker.appendFilters(Components.interfaces.nsIFilePicker.filterText); | function appendFiltersForContentType(aFilePicker, aContentType, aSaveMode){ var bundle = getStringBundle(); switch (aContentType) { case "text/html": if (aSaveMode == MODE_COMPLETE) aFilePicker.appendFilter(bundle.GetStringFromName("WebPageCompleteFilter"), "*.htm; *.html"); aFilePicker.appendFilter(bundle.GetStringFromName("WebPageHTMLOnlyFilter"), "*.htm; *.html"); if (aSaveMode == MODE_COMPLETE) aFilePicker.appendFilter(bundle.GetStringFromName("TextOnlyFilter"), "*.txt"); break; default: var mimeInfo = getMIMEInfoForType(aContentType); if (mimeInfo) { var extCount = { }; var extList = { }; mimeInfo.GetFileExtensions(extCount, extList); var extString = ""; for (var i = 0; i < extCount.value; ++i) { if (i > 0) extString += "; "; // If adding more than one extension, separate by semi-colon extString += "*." + extList.value[i]; } if (extCount.value > 0) { aFilePicker.appendFilter(mimeInfo.Description, extString); } else { aFilePicker.appendFilter(bundle.GetStringFromName("AllFilesFilter"), "*.*"); } } else aFilePicker.appendFilter(bundle.GetStringFromName("AllFilesFilter"), "*.*"); break; }} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.