rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
else if( event.type == "keypress" && event.which != 13 )
} var target = event.target.parentNode.parentNode; if (target.getAttribute('container') == 'true') { if (target.getAttribute('open') == 'true') { target.removeAttribute('open'); } else { target.setAttribute('open','true'); } return true; } if (event.detail != 1) {
function openURL(event, root){ if( event.type == "click" && ( event.button != 1 || event.detail != 2 ) ) return false; else if( event.type == "keypress" && event.which != 13 ) return false; var treeitem = document.getElementById(root).selectedItems[0]; if (treeitem.getAttribute('container') == 'true' || treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator") return(false); var id = treeitem.getAttribute('id'); if (!id) return(false); // rjc: add support for anonymous resources; if the node has // a "#URL" property, use it, otherwise default to using the id try { var rootNode = document.getElementById(root); var ds = null; if (rootNode) { ds = rootNode.database; } var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService(); if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService); if (rdf) { if (ds) { var src = rdf.GetResource(id, true); var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true); var target = ds.GetTarget(src, prop, true); if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral); if (target) target = target.Value; if (target) id = target; } } } catch(ex) { } if(appCore) { // support session history (if appCore is available) appCore.loadUrl(id); } else { // fallback case (if appCore isn't available) ContentWindow.location = id; }}
if (treeitem.getAttribute('container') == 'true' || treeitem.getAttribute("type") == "http:
if (treeitem.getAttribute("type") == "http:
function openURL(event, root){ if( event.type == "click" && ( event.button != 1 || event.detail != 2 ) ) return false; else if( event.type == "keypress" && event.which != 13 ) return false; var treeitem = document.getElementById(root).selectedItems[0]; if (treeitem.getAttribute('container') == 'true' || treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator") return(false); var id = treeitem.getAttribute('id'); if (!id) return(false); // rjc: add support for anonymous resources; if the node has // a "#URL" property, use it, otherwise default to using the id try { var rootNode = document.getElementById(root); var ds = null; if (rootNode) { ds = rootNode.database; } var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService(); if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService); if (rdf) { if (ds) { var src = rdf.GetResource(id, true); var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true); var target = ds.GetTarget(src, prop, true); if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral); if (target) target = target.Value; if (target) id = target; } } } catch(ex) { } if(appCore) { // support session history (if appCore is available) appCore.loadUrl(id); } else { // fallback case (if appCore isn't available) ContentWindow.location = id; }}
}
function openURL(event, root){ if( event.type == "click" && ( event.button != 1 || event.detail != 2 ) ) return false; else if( event.type == "keypress" && event.which != 13 ) return false; var treeitem = document.getElementById(root).selectedItems[0]; if (treeitem.getAttribute('container') == 'true' || treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator") return(false); var id = treeitem.getAttribute('id'); if (!id) return(false); // rjc: add support for anonymous resources; if the node has // a "#URL" property, use it, otherwise default to using the id try { var rootNode = document.getElementById(root); var ds = null; if (rootNode) { ds = rootNode.database; } var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService(); if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService); if (rdf) { if (ds) { var src = rdf.GetResource(id, true); var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true); var target = ds.GetTarget(src, prop, true); if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral); if (target) target = target.Value; if (target) id = target; } } } catch(ex) { } if(appCore) { // support session history (if appCore is available) appCore.loadUrl(id); } else { // fallback case (if appCore isn't available) ContentWindow.location = id; }}
ContentWindow.location = id;
if(appCore) { appCore.loadUrl(id); } else { ContentWindow.location = id; }
function openURL(event, root){ if( event.type == "click" && ( event.button != 1 || event.detail != 2 ) ) return false; else if( event.type == "keypress" && event.which != 13 ) return false; var treeitem = document.getElementById(root).selectedItems[0]; if (treeitem.getAttribute('container') == 'true' || treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator") return(false); var id = treeitem.getAttribute('id'); if (!id) return(false); // rjc: add support for anonymous resources; if the node has // a "#URL" property, use it, otherwise default to using the id try { var rootNode = document.getElementById(root); var ds = null; if (rootNode) { ds = rootNode.database; } var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService(); if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService); if (rdf) { if (ds) { var src = rdf.GetResource(id, true); var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true); var target = ds.GetTarget(src, prop, true); if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral); if (target) target = target.Value; if (target) id = target; } } } catch(ex) { } ContentWindow.location = id;}
OpenURLArrayInTabs(URLArray);
OpenURLArrayInTabs(URLArray, aTarget == "tab_background");
function OpenURL(aTarget){ var currentIndex = gHistoryTree.currentIndex; var builder = gHistoryTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder); var url = builder.getResourceAtIndex(currentIndex).ValueUTF8; var uri = Components.classes["@mozilla.org/network/standard-url;1"]. createInstance(Components.interfaces.nsIURI); uri.spec = url; if (uri.schemeIs("javascript") || uri.schemeIs("data")) { var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService); var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var historyBundle = strBundleService.createBundle("chrome://communicator/locale/history/history.properties"); var brandBundle = strBundleService.createBundle("chrome://branding/locale/brand.properties"); var brandStr = brandBundle.GetStringFromName("brandShortName"); var errorStr = historyBundle.GetStringFromName("load-js-data-url-error"); promptService.alert(window, brandStr, errorStr); return false; } if (aTarget != "current") { var count = gHistoryTree.view.selection.count; var URLArray = []; if (count == 1) { if (isContainer(gHistoryTree, currentIndex)) openDialog("chrome://communicator/content/history/history.xul", "", "chrome,all,dialog=no", url, "newWindow"); else URLArray.push(url); } else { var col = gHistoryTree.columns["URL"]; var min = new Object(); var max = new Object(); var rangeCount = gHistoryTree.view.selection.getRangeCount(); for (var i = 0; i < rangeCount; ++i) { gHistoryTree.view.selection.getRangeAt(i, min, max); for (var k = max.value; k >= min.value; --k) { url = gHistoryTree.view.getCellText(k, col); URLArray.push(url); } } } if (aTarget == "window") { for (i = 0; i < URLArray.length; i++) { openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", URLArray[i]); } } else { if (URLArray.length > 0) OpenURLArrayInTabs(URLArray); } } else if (!isContainer(gHistoryTree, currentIndex)) openTopWin(url); return true;}
function OpenURL(aTarget)
function OpenURL(aTarget, aEvent)
function OpenURL(aTarget){ var currentIndex = gHistoryTree.currentIndex; var builder = gHistoryTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder); var url = builder.getResourceAtIndex(currentIndex).ValueUTF8; var uri = Components.classes["@mozilla.org/network/standard-url;1"]. createInstance(Components.interfaces.nsIURI); uri.spec = url; if (uri.schemeIs("javascript") || uri.schemeIs("data")) { var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService); var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var historyBundle = strBundleService.createBundle("chrome://communicator/locale/history/history.properties"); var brandBundle = strBundleService.createBundle("chrome://branding/locale/brand.properties"); var brandStr = brandBundle.GetStringFromName("brandShortName"); var errorStr = historyBundle.GetStringFromName("load-js-data-url-error"); promptService.alert(window, brandStr, errorStr); return false; } if (aTarget != "current") { var count = gHistoryTree.view.selection.count; var URLArray = []; if (count == 1) { if (isContainer(gHistoryTree, currentIndex)) openDialog("chrome://communicator/content/history/history.xul", "", "chrome,all,dialog=no", url, "newWindow"); else URLArray.push(url); } else { var col = gHistoryTree.columns["URL"]; var min = new Object(); var max = new Object(); var rangeCount = gHistoryTree.view.selection.getRangeCount(); for (var i = 0; i < rangeCount; ++i) { gHistoryTree.view.selection.getRangeAt(i, min, max); for (var k = max.value; k >= min.value; --k) { url = gHistoryTree.view.getCellText(k, col); URLArray.push(url); } } } if (aTarget == "window") { for (i = 0; i < URLArray.length; i++) { openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", URLArray[i]); } } else { if (URLArray.length > 0) OpenURLArrayInTabs(URLArray, aTarget == "tab_background"); } } else if (!isContainer(gHistoryTree, currentIndex)) openTopWin(url); return true;}
var uri = Components.classes["@mozilla.org/network/standard-url;1"]. createInstance(Components.interfaces.nsIURI); uri.spec = url; if (uri.schemeIs("javascript") || uri.schemeIs("data")) { var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService); var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var historyBundle = strBundleService.createBundle("chrome: var brandBundle = strBundleService.createBundle("chrome: var brandStr = brandBundle.GetStringFromName("brandShortName"); var errorStr = historyBundle.GetStringFromName("load-js-data-url-error"); promptService.alert(window, brandStr, errorStr);
if (!gIOService) gIOService = Components.classes['@mozilla.org/network/io-service;1'] .getService(Components.interfaces.nsIIOService); try { var scheme = gIOService.extractScheme(url); if (scheme == "javascript" || scheme == "data") { var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService); var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var historyBundle = strBundleService.createBundle("chrome: var brandBundle = strBundleService.createBundle("chrome: var brandStr = brandBundle.GetStringFromName("brandShortName"); var errorStr = historyBundle.GetStringFromName("load-js-data-url-error"); promptService.alert(window, brandStr, errorStr); return false; } } catch (e) {
function OpenURL(aTarget){ var currentIndex = gHistoryTree.currentIndex; var builder = gHistoryTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder); var url = builder.getResourceAtIndex(currentIndex).ValueUTF8; var uri = Components.classes["@mozilla.org/network/standard-url;1"]. createInstance(Components.interfaces.nsIURI); uri.spec = url; if (uri.schemeIs("javascript") || uri.schemeIs("data")) { var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService); var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var historyBundle = strBundleService.createBundle("chrome://communicator/locale/history/history.properties"); var brandBundle = strBundleService.createBundle("chrome://branding/locale/brand.properties"); var brandStr = brandBundle.GetStringFromName("brandShortName"); var errorStr = historyBundle.GetStringFromName("load-js-data-url-error"); promptService.alert(window, brandStr, errorStr); return false; } if (aTarget != "current") { var count = gHistoryTree.view.selection.count; var URLArray = []; if (count == 1) { if (isContainer(gHistoryTree, currentIndex)) openDialog("chrome://communicator/content/history/history.xul", "", "chrome,all,dialog=no", url, "newWindow"); else URLArray.push(url); } else { var col = gHistoryTree.columns["URL"]; var min = new Object(); var max = new Object(); var rangeCount = gHistoryTree.view.selection.getRangeCount(); for (var i = 0; i < rangeCount; ++i) { gHistoryTree.view.selection.getRangeAt(i, min, max); for (var k = max.value; k >= min.value; --k) { url = gHistoryTree.view.getCellText(k, col); URLArray.push(url); } } } if (aTarget == "window") { for (i = 0; i < URLArray.length; i++) { openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", URLArray[i]); } } else { if (URLArray.length > 0) OpenURLArrayInTabs(URLArray, aTarget == "tab_background"); } } else if (!isContainer(gHistoryTree, currentIndex)) openTopWin(url); return true;}
OpenURLArrayInTabs(URLArray, aTarget == "tab_background");
OpenURLArrayInTabs(URLArray, BookmarksUtils.shouldLoadTabInBackground(aEvent));
function OpenURL(aTarget){ var currentIndex = gHistoryTree.currentIndex; var builder = gHistoryTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder); var url = builder.getResourceAtIndex(currentIndex).ValueUTF8; var uri = Components.classes["@mozilla.org/network/standard-url;1"]. createInstance(Components.interfaces.nsIURI); uri.spec = url; if (uri.schemeIs("javascript") || uri.schemeIs("data")) { var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService); var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var historyBundle = strBundleService.createBundle("chrome://communicator/locale/history/history.properties"); var brandBundle = strBundleService.createBundle("chrome://branding/locale/brand.properties"); var brandStr = brandBundle.GetStringFromName("brandShortName"); var errorStr = historyBundle.GetStringFromName("load-js-data-url-error"); promptService.alert(window, brandStr, errorStr); return false; } if (aTarget != "current") { var count = gHistoryTree.view.selection.count; var URLArray = []; if (count == 1) { if (isContainer(gHistoryTree, currentIndex)) openDialog("chrome://communicator/content/history/history.xul", "", "chrome,all,dialog=no", url, "newWindow"); else URLArray.push(url); } else { var col = gHistoryTree.columns["URL"]; var min = new Object(); var max = new Object(); var rangeCount = gHistoryTree.view.selection.getRangeCount(); for (var i = 0; i < rangeCount; ++i) { gHistoryTree.view.selection.getRangeAt(i, min, max); for (var k = max.value; k >= min.value; --k) { url = gHistoryTree.view.getCellText(k, col); URLArray.push(url); } } } if (aTarget == "window") { for (i = 0; i < URLArray.length; i++) { openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", URLArray[i]); } } else { if (URLArray.length > 0) OpenURLArrayInTabs(URLArray, aTarget == "tab_background"); } } else if (!isContainer(gHistoryTree, currentIndex)) openTopWin(url); return true;}
function OpenURLArrayInTabs(aURLArray)
function OpenURLArrayInTabs(aURLArray, aBackground)
function OpenURLArrayInTabs(aURLArray){ var browserWin = getTopWin(); if (browserWin) { var browser = browserWin.getBrowser(); browser.selectedTab = browser.addTab(aURLArray[0]); for (var i = 1; i < aURLArray.length; ++i) tab = browser.addTab(aURLArray[i]); } else { openTopWin(aURLArray.join("\n")); // Pretend that we're a home page group }}
browser.selectedTab = browser.addTab(aURLArray[0]);
var tab = browser.addTab(aURLArray[0]); if (!aBackground) browser.selectedTab = tab;
function OpenURLArrayInTabs(aURLArray){ var browserWin = getTopWin(); if (browserWin) { var browser = browserWin.getBrowser(); browser.selectedTab = browser.addTab(aURLArray[0]); for (var i = 1; i < aURLArray.length; ++i) tab = browser.addTab(aURLArray[i]); } else { openTopWin(aURLArray.join("\n")); // Pretend that we're a home page group }}
tab = browser.addTab(aURLArray[i]);
browser.addTab(aURLArray[i]);
function OpenURLArrayInTabs(aURLArray){ var browserWin = getTopWin(); if (browserWin) { var browser = browserWin.getBrowser(); browser.selectedTab = browser.addTab(aURLArray[0]); for (var i = 1; i < aURLArray.length; ++i) tab = browser.addTab(aURLArray[i]); } else { openTopWin(aURLArray.join("\n")); // Pretend that we're a home page group }}
if (sidebar.contentDocument && sidebar.contentDocument.getElementById('web-panels-browser')) {
if (sidebar.docShell && sidebar.contentDocument && sidebar.contentDocument.getElementById('web-panels-browser')) {
function openWebPanel(aTitle, aURI){ // Ensure that the web panels sidebar is open. toggleSidebar('viewWebPanelsSidebar', true); // Set the title of the panel. document.getElementById("sidebar-title").value = aTitle; // Tell the Web Panels sidebar to load the bookmark. var sidebar = document.getElementById("sidebar"); if (sidebar.contentDocument && sidebar.contentDocument.getElementById('web-panels-browser')) { sidebar.contentWindow.loadWebPanel(aURI); if (gWebPanelURI) { gWebPanelURI = ""; sidebar.removeEventListener("load", asyncOpenWebPanel, true); } } else { // The panel is still being constructed. Attach an onload handler. if (!gWebPanelURI) sidebar.addEventListener("load", asyncOpenWebPanel, true); gWebPanelURI = aURI; }}
windowList[currentIndex] = window.open(KID_URL, currentIndex);
var path = window.location.pathname.substring( 0, window.location.pathname.lastIndexOf('/') ); var url = window.location.protocol + " window.location.hostname + path + "/" + KID_URL; windowList[currentIndex] = window.open(url, currentIndex);
function openWindow() { startingTimes[currentIndex] = (new Date()).getTime(); windowList[currentIndex] = window.open(KID_URL, currentIndex);}
wwatch.openWindow(parent, url, target, features, argstring);
return wwatch.openWindow(parent, url, target, features, argstring);
function openWindow(parent, url, target, features, args){ var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getService(nsIWindowWatcher); var argstring; if (args) { argstring = Components.classes["@mozilla.org/supports-string;1"] .createInstance(nsISupportsString); argstring.data = args; } wwatch.openWindow(parent, url, target, features, argstring);}
function otherPanelSelected()
function otherPanelSelected(event, target)
function otherPanelSelected(){ var add_button = document.getElementById('add_button'); var preview_button = document.getElementById('preview_button'); var other_panels = document.getElementById('other-panels'); if (other_panels.selectedItems.length > 0) { add_button.setAttribute('disabled',''); preview_button.setAttribute('disabled',''); } else { add_button.setAttribute('disabled','true'); preview_button.setAttribute('disabled','true'); }}
var add_button = document.getElementById('add_button'); var preview_button = document.getElementById('preview_button'); var other_panels = document.getElementById('other-panels');
if (target.getAttribute('container') == 'true') { if (target.getAttribute('open') == 'true') { target.removeAttribute('open'); } else { target.setAttribute('open','true'); } return; }
function otherPanelSelected(){ var add_button = document.getElementById('add_button'); var preview_button = document.getElementById('preview_button'); var other_panels = document.getElementById('other-panels'); if (other_panels.selectedItems.length > 0) { add_button.setAttribute('disabled',''); preview_button.setAttribute('disabled',''); } else { add_button.setAttribute('disabled','true'); preview_button.setAttribute('disabled','true'); }}
if (other_panels.selectedItems.length > 0) { add_button.setAttribute('disabled',''); preview_button.setAttribute('disabled',''); } else { add_button.setAttribute('disabled','true'); preview_button.setAttribute('disabled','true'); }
var add_button = document.getElementById('add_button'); var preview_button = document.getElementById('preview_button'); var other_panels = document.getElementById('other-panels'); var num_selected = 0; for (var ii=0; ii<other_panels.selectedItems.length; ii++) { var node = other_panels.selectedItems[ii]; if (node.getAttribute('container') != 'true') { num_selected++; } } if (num_selected > 0) { add_button.setAttribute('disabled',''); preview_button.setAttribute('disabled',''); } else { add_button.setAttribute('disabled','true'); preview_button.setAttribute('disabled','true'); }
function otherPanelSelected(){ var add_button = document.getElementById('add_button'); var preview_button = document.getElementById('preview_button'); var other_panels = document.getElementById('other-panels'); if (other_panels.selectedItems.length > 0) { add_button.setAttribute('disabled',''); preview_button.setAttribute('disabled',''); } else { add_button.setAttribute('disabled','true'); preview_button.setAttribute('disabled','true'); }}
$.fn.outerHeight = function() {
jQuery.fn.outerHeight = function() {
$.fn.outerHeight = function() { return this.get(0) == window || this.get(0) == document ? this.height() : this.get(0).offsetHeight; };
$.fn.outerWidth = function() {
jQuery.fn.outerWidth = function() {
$.fn.outerWidth = function() { return this.get(0) == window || this.get(0) == document ? this.width() : this.get(0).offsetWidth; };
{ var address = {}; address.emailAddress = addresses.value[index]; address.fullAddress = fullNames.value[index]; address.displayName = names.value[index];
function OutputEmailAddresses(headerEntry, emailAddresses){ if ( !emailAddresses ) return; if (msgHeaderParser) { var addresses = {}; var fullNames = {}; var names = {}; var numAddresses = 0; numAddresses = msgHeaderParser.parseHeadersWithArray(emailAddresses, addresses, names, fullNames); var index = 0; while (index < numAddresses) { // if we want to include short/long toggle views and we have a long view, always add it. // if we aren't including a short/long view OR if we are and we haven't parsed enough // addresses to reach the cutoff valve yet then add it to the default (short) div. if (headerEntry.useToggle) { var address = {}; address.emailAddress = addresses.value[index]; address.fullAddress = fullNames.value[index]; address.displayName = names.value[index]; headerEntry.enclosingBox.addAddressView(address); } else { updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, addresses.value[index], fullNames.value[index], names.value[index], headerEntry.useShortView); } if (headerEntry.enclosingBox.getAttribute("id") == "expandedfromBox") { setFromBuddyIcon(addresses.value[index]); } index++; } if (headerEntry.useToggle) headerEntry.enclosingBox.buildViews(gNumAddressesToShow); } // if msgheader parser}
}
function OutputEmailAddresses(headerEntry, emailAddresses){ if ( !emailAddresses ) return; if (msgHeaderParser) { var addresses = {}; var fullNames = {}; var names = {}; var numAddresses = 0; numAddresses = msgHeaderParser.parseHeadersWithArray(emailAddresses, addresses, names, fullNames); var index = 0; while (index < numAddresses) { // if we want to include short/long toggle views and we have a long view, always add it. // if we aren't including a short/long view OR if we are and we haven't parsed enough // addresses to reach the cutoff valve yet then add it to the default (short) div. if (headerEntry.useToggle) { var address = {}; address.emailAddress = addresses.value[index]; address.fullAddress = fullNames.value[index]; address.displayName = names.value[index]; headerEntry.enclosingBox.addAddressView(address); } else { updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, addresses.value[index], fullNames.value[index], names.value[index], headerEntry.useShortView); } if (headerEntry.enclosingBox.getAttribute("id") == "expandedfromBox") { setFromBuddyIcon(addresses.value[index]); } index++; } if (headerEntry.useToggle) headerEntry.enclosingBox.buildViews(gNumAddressesToShow); } // if msgheader parser}
{ updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, addresses.value[index], fullNames.value[index], names.value[index], headerEntry.useShortView); }
updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, address);
function OutputEmailAddresses(headerEntry, emailAddresses){ if ( !emailAddresses ) return; if (msgHeaderParser) { var addresses = {}; var fullNames = {}; var names = {}; var numAddresses = 0; numAddresses = msgHeaderParser.parseHeadersWithArray(emailAddresses, addresses, names, fullNames); var index = 0; while (index < numAddresses) { // if we want to include short/long toggle views and we have a long view, always add it. // if we aren't including a short/long view OR if we are and we haven't parsed enough // addresses to reach the cutoff valve yet then add it to the default (short) div. if (headerEntry.useToggle) { var address = {}; address.emailAddress = addresses.value[index]; address.fullAddress = fullNames.value[index]; address.displayName = names.value[index]; headerEntry.enclosingBox.addAddressView(address); } else { updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, addresses.value[index], fullNames.value[index], names.value[index], headerEntry.useShortView); } if (headerEntry.enclosingBox.getAttribute("id") == "expandedfromBox") { setFromBuddyIcon(addresses.value[index]); } index++; } if (headerEntry.useToggle) headerEntry.enclosingBox.buildViews(gNumAddressesToShow); } // if msgheader parser}
var myEnum = msgHeaderParser.ParseHeadersWithEnumerator(emailAddresses); myEnum = myEnum.QueryInterface(Components.interfaces.nsISimpleEnumerator); numOfEmailsInEnumerator = 0; while (myEnum.hasMoreElements()) { myEnum.getNext(); numOfEmailsInEnumerator++; }
function OutputEmailAddresses(headerEntry, emailAddresses){ if ( !emailAddresses ) return; if (msgHeaderParser) { // Count the number of email addresses being inserted into each header // The headers could be "to", "cc", "from" var myEnum = msgHeaderParser.ParseHeadersWithEnumerator(emailAddresses); myEnum = myEnum.QueryInterface(Components.interfaces.nsISimpleEnumerator); numOfEmailsInEnumerator = 0; while (myEnum.hasMoreElements()) { myEnum.getNext(); numOfEmailsInEnumerator++; } var enumerator = msgHeaderParser.ParseHeadersWithEnumerator(emailAddresses); enumerator = enumerator.QueryInterface(Components.interfaces.nsISimpleEnumerator); var numAddressesParsed = 0; if (enumerator) { var emailAddress = {}; var name = {}; while (enumerator.hasMoreElements()) { var headerResult = enumerator.getNext(); headerResult = enumerator.QueryInterface(Components.interfaces.nsIMsgHeaderParserResult); // get the email and name fields var addrValue = {}; var nameValue = {}; var fullAddress = headerResult.getAddressAndName(addrValue, nameValue); emailAddress = addrValue.value; name = nameValue.value; // if we want to include short/long toggle views and we have a long view, always add it. // if we aren't including a short/long view OR if we are and we haven't parsed enough // addresses to reach the cutoff valve yet then add it to the default (short) div. if (headerEntry.useToggle && headerEntry.longTextNode) { InsertEmailAddressUnderEnclosingBox(headerEntry, headerEntry.longTextNode, emailAddress, fullAddress, name); } if (!headerEntry.useToggle && !headerEntry.useShortView) { updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, emailAddress, fullAddress, name, headerEntry.useShortView); } else if (!headerEntry.useToggle || (numAddressesParsed < gNumAddressesToShow)) { InsertEmailAddressUnderEnclosingBox(headerEntry, headerEntry.textNode, emailAddress, fullAddress, name); } numAddressesParsed++; } } // if enumerator if (headerEntry.useToggle && headerEntry.toggleIcon) { if (numAddressesParsed > gNumAddressesToShow) // make sure the icon is always visible if we have more than the # of addresses to show headerEntry.toggleIcon.removeAttribute('collapsed'); else headerEntry.toggleIcon.setAttribute('collapsed', true); } } // if msgheader parser}
optionalToggleButton.removeAttribute('hideNonBox');
optionalToggleButton.removeAttribute('collapsed');
function OutputEmailAddresses(parentBox, defaultParentDiv, emailAddresses, includeShortLongToggle, optionalLongDiv, optionalToggleButton){ // if we don't have any addresses for this field, hide the parent box! if ( !emailAddresses ) { hdrViewSetVisible(parentBox, false); return; } if (msgHeaderParser) { var enumerator = msgHeaderParser.ParseHeadersWithEnumerator(emailAddresses); enumerator = enumerator.QueryInterface(Components.interfaces.nsISimpleEnumerator); var numAddressesParsed = 0; if (enumerator) { var emailAddress = {}; var name = {}; while (enumerator.HasMoreElements()) { var headerResult = enumerator.GetNext(); headerResult = enumerator.QueryInterface(Components.interfaces.nsIMsgHeaderParserResult); // get the email and name fields var addrValue = {}; var nameValue = {}; fullAddress = headerResult.getAddressAndName(addrValue, nameValue); emailAddress = addrValue.value; name = nameValue.value; // turn the strings back into a full address // var fullAddress = msgHeaderParser.MakeFullAddress(name, emailAddress); // if we want to include short/long toggle views and we have a long view, always add it. // if we aren't including a short/long view OR if we are and we haven't parsed enough // addresses to reach the cutoff valve yet then add it to the default (short) div. if (includeShortLongToggle && optionalLongDiv) { InsertEmailAddressUnderEnclosingBox(parentBox, optionalLongDiv, emailAddress, fullAddress); } if (!includeShortLongToggle || (numAddressesParsed < gNumAddressesToShow)) { InsertEmailAddressUnderEnclosingBox(parentBox, defaultParentDiv, emailAddress, fullAddress); } numAddressesParsed++; } } // if enumerator if (includeShortLongToggle && (numAddressesParsed > gNumAddressesToShow) && optionalToggleButton) { optionalToggleButton.removeAttribute('hideNonBox'); } } // if msgheader parser}
persistObj.persistFlags = persistObj.persistFlags | webPersist.PERSIST_FLAGS_SERIALIZE_OUTPUT; }
function OutputFileWithPersistAPI(editorDoc, aDestinationLocation, aRelatedFilesParentDir, aMimeType){ gPersistObj = null; try { var imeEditor = window.editorShell.editor.QueryInterface(Components.interfaces.nsIEditorIMESupport); if (imeEditor) imeEditor.ForceCompositionEnd(); } catch (e) {} var isLocalFile = false; try { var tmp1 = aDestinationLocation.QueryInterface(Components.interfaces.nsIFile); isLocalFile = true; } catch (e) { try { var tmp = aDestinationLocation.QueryInterface(Components.interfaces.nsIURI); isLocalFile = tmp.schemeIs("file"); } catch (e) {} } try { // we should supply a parent directory if/when we turn on functionality to save related documents var persistObj = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(webPersist); persistObj.progressListener = gEditorOutputProgressListener; var wrapColumn = GetWrapColumn(); var outputFlags = GetOutputFlags(aMimeType, wrapColumn); // for 4.x parity as well as improving readability of file locally on server // this will always send crlf for upload (http/ftp) if (!isLocalFile) // if we aren't saving locally then send both cr and lf outputFlags |= webPersist.ENCODE_FLAGS_CR_LINEBREAKS | webPersist.ENCODE_FLAGS_LF_LINEBREAKS; // note: we always want to set the replace existing files flag since we have // already given user the chance to not replace an existing file (file picker) // or the user picked an option where the file is implicitly being replaced (save) persistObj.persistFlags = persistObj.persistFlags | webPersist.PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS | webPersist.PERSIST_FLAGS_REPLACE_EXISTING_FILES | webPersist.PERSIST_FLAGS_DONT_FIXUP_LINKS | webPersist.PERSIST_FLAGS_FIXUP_ORIGINAL_DOM; persistObj.saveDocument(editorDoc, aDestinationLocation, aRelatedFilesParentDir, aMimeType, outputFlags, wrapColumn); gPersistObj = persistObj; } catch(e) { dump("caught an error, bail\n"); return false; } return true;}
var hideMenus = (gSendFormat == nsIMsgCompSendFormat.PlainText); format_menubar.hidden = hideMenus; insert_menubar.hidden = hideMenus; show_menuitem.hidden = hideMenus; toolbar.hidden = hideMenus ||
gHideMenus = (gSendFormat == nsIMsgCompSendFormat.PlainText); format_menubar.hidden = gHideMenus; insert_menubar.hidden = gHideMenus; show_menuitem.hidden = gHideMenus; toolbar.hidden = gHideMenus ||
function OutputFormatMenuSelect(target){ if (gMsgCompose) { var msgCompFields = gMsgCompose.compFields; var toolbar = document.getElementById("FormatToolbar"); var format_menubar = document.getElementById("formatMenu"); var insert_menubar = document.getElementById("insertMenu"); var show_menuitem = document.getElementById("menu_showFormatToolbar"); if (msgCompFields) switch (target.getAttribute('id')) { case "format_auto": gSendFormat = nsIMsgCompSendFormat.AskUser; break; case "format_plain": gSendFormat = nsIMsgCompSendFormat.PlainText; break; case "format_html": gSendFormat = nsIMsgCompSendFormat.HTML; break; case "format_both": gSendFormat = nsIMsgCompSendFormat.Both; break; } var hideMenus = (gSendFormat == nsIMsgCompSendFormat.PlainText); format_menubar.hidden = hideMenus; insert_menubar.hidden = hideMenus; show_menuitem.hidden = hideMenus; toolbar.hidden = hideMenus || (show_menuitem.getAttribute("checked") == "false"); }}
if (list.cancelled) { if (list.done) { network.display(getMsg(MSG_LIST_END, [list.displayed, list.count])); delete network._list; } else { setTimeout(outputList, 1000, network); } return; }
function outputList (network) { const CHUNK_SIZE = 5; var list = network._list; if (list.length > list.displayed) { var start = list.displayed; var end = list.length; if (end - start > CHUNK_SIZE) end = start + CHUNK_SIZE; for (var i = start; i < end; ++i) network.displayHere (getMsg(MSG_FMT_CHANLIST, list[i]), "322"); list.displayed = end; } if (list.done && (list.displayed == list.length)) { if (list.event323) { var length = list.event323.params.length; network.displayHere (list.event323.params[length - 1], "323"); } network.displayHere(getMsg(MSG_LIST_END, [list.displayed, list.count])); delete network._list; } else { setTimeout(outputList, 250, network); } }
dump("Editorshell="+editorShell+"\n"); dump("DocumentIsEmpty="+editorShell.documentIsEmpty+"\n"); dump("docWasModified="+docWasModified+"\n");
function PageIsEmptyAndUntouched(){dump("Editorshell="+editorShell+"\n");dump("DocumentIsEmpty="+editorShell.documentIsEmpty+"\n");dump("docWasModified="+docWasModified+"\n"); return (editorShell != null) && (editorShell.documentIsEmpty == true) && (docWasModified == false);}
*/
function PageProxySetIcon (aURL){#ifdef MOZ_PLACES // Save this favicon in the favicon service if (aURL) { var faviconService = Components.classes["@mozilla.org/browser/favicon-service;1"]. getService(Components.interfaces.nsIFaviconService); var uri = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService).newURI(aURL, null, null); faviconService.setAndLoadFaviconForPage(gBrowser.currentURI, uri, false); }#endif if (!gProxyFavIcon) return; if (!aURL) PageProxyClearIcon(); else if (gProxyFavIcon.getAttribute("src") != aURL) gProxyFavIcon.setAttribute("src", aURL); else if (gProxyDeck.selectedIndex != 1) gProxyDeck.selectedIndex = 1;}
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
function pageShowEventHandlers(event){ // Filter out events that are not about the document load we are interested in if (event.originalTarget == content.document) { checkForDirectoryListing(); charsetLoadListener(event); XULBrowserWindow.asyncUpdateUI(); } // some event handlers want to be told what the original browser/listener is var targetBrowser = null; if (gBrowser.mTabbedMode) { var targetBrowserIndex = gBrowser.getBrowserIndexForDocument(event.originalTarget); if (targetBrowserIndex == -1) return; targetBrowser = gBrowser.getBrowserAtIndex(targetBrowserIndex); } else { targetBrowser = gBrowser.mCurrentBrowser; }#ifndef MOZ_PLACES // update the last visited date if (targetBrowser.currentURI.spec) BMSVC.updateLastVisitedDate(targetBrowser.currentURI.spec, targetBrowser.contentDocument.characterSet);#endif}
dump_tree(this);
function panel_loader() { debug("---------- panel_loader"); dump_tree(this); this.removeEventListener("load", panel_loader, true); this.removeAttribute('collapsed'); this.parentNode.firstChild.setAttribute('hidden','true');}
sidebar.loading_iframe = null;
function panel_loader() { debug("---------- panel_loader"); dump_tree(this); this.removeEventListener("load", panel_loader, true); this.removeAttribute('collapsed'); this.parentNode.firstChild.setAttribute('hidden','true');}
dump("Exception caught in 'panelOnCancel': " + ex + "\n");
panelOnCancel: function () { for (var i=0; i < parent.backupPrefList.length; i++) { if (parent.backupPrefList[i].color == "##NEW") { try { categoryPrefBranch.clearUserPref(parent.backupPrefList[i].name); } catch (ex) { } } else { categoryPrefBranch.setCharPref(parent.backupPrefList[i].name, parent.backupPrefList[i].color); } } }
jQuery.param = function(a) { var s = []; if ( a.constructor == Array ) for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) );
param: function(a) { var s = [];
jQuery.param = function(a) { var s = []; // If an array was passed in, assume that it is an array // of form elements if ( a.constructor == Array ) // Serialize the form elements for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); // Otherwise, assume that it's an object of key/value pairs else // Serialize the key/values for ( var j in a ) s.push( j + "=" + encodeURIComponent( a[j] ) ); // Return the resulting serialization return s.join("&");};
else for ( var j in a ) s.push( j + "=" + encodeURIComponent( a[j] ) ); return s.join("&"); };
if ( a.constructor == Array ) for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); else for ( var j in a ) s.push( j + "=" + encodeURIComponent( a[j] ) ); return s.join("&"); }
jQuery.param = function(a) { var s = []; // If an array was passed in, assume that it is an array // of form elements if ( a.constructor == Array ) // Serialize the form elements for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); // Otherwise, assume that it's an object of key/value pairs else // Serialize the key/values for ( var j in a ) s.push( j + "=" + encodeURIComponent( a[j] ) ); // Return the resulting serialization return s.join("&");};
if (a && typeof a == 'object' && a.constructor == Array) { for ( var i=0; i < a.length; i++ ) { s[s.length] = a[i].name + "=" + encodeURIComponent( a[i].value ); } } else { for ( var j in a ) { s[s.length] = j + "=" + encodeURIComponent( a[j] ); } }
if ( a.constructor == Array ) for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); else for ( var j in a ) s.push( j + "=" + encodeURIComponent( a[j] ) );
$.param = function(a) { var s = []; if (a && typeof a == 'object' && a.constructor == Array) { for ( var i=0; i < a.length; i++ ) { s[s.length] = a[i].name + "=" + encodeURIComponent( a[i].value ); } } else { for ( var j in a ) { s[s.length] = j + "=" + encodeURIComponent( a[j] ); } } return s.join("&");};
for ( var i in a ) s[s.length] = i + "=" + encodeURIComponent( a[i] );
if (a && typeof a == 'object' && a.constructor == Array) { for ( var i=0; i < a.length; i++ ) s[s.length] = a[i]['name'] + "=" + encodeURIComponent( a[i]['value'] ); } else { for ( var i in a ) s[s.length] = i + "=" + encodeURIComponent( a[i] ); }
$.param = function(a) { var s = []; for ( var i in a ) s[s.length] = i + "=" + encodeURIComponent( a[i] ); return s.join("&");};
if ( a.constructor == Array )
if ( a.constructor == Array ) {
param: function(a) { var s = []; // If an array was passed in, assume that it is an array // of form elements if ( a.constructor == Array ) // Serialize the form elements for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); // Otherwise, assume that it's an object of key/value pairs else // Serialize the key/values for ( var j in a ) s.push( j + "=" + encodeURIComponent( a[j] ) ); // Return the resulting serialization return s.join("&"); }
else
} else {
param: function(a) { var s = []; // If an array was passed in, assume that it is an array // of form elements if ( a.constructor == Array ) // Serialize the form elements for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); // Otherwise, assume that it's an object of key/value pairs else // Serialize the key/values for ( var j in a ) s.push( j + "=" + encodeURIComponent( a[j] ) ); // Return the resulting serialization return s.join("&"); }
}
param: function(a) { var s = []; // If an array was passed in, assume that it is an array // of form elements if ( a.constructor == Array ) // Serialize the form elements for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); // Otherwise, assume that it's an object of key/value pairs else // Serialize the key/values for ( var j in a ) s.push( j + "=" + encodeURIComponent( a[j] ) ); // Return the resulting serialization return s.join("&"); }
}
},
param: function(a) { var s = []; // If an array was passed in, assume that it is an array // of form elements if ( a.constructor == Array || a.jquery ) { // Serialize the form elements for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); // Otherwise, assume that it's an object of key/value pairs } else { // Serialize the key/values for ( var j in a ) { //if one value is array then treat each array value in part if (typeof a[j] == 'object') { for (var k = 0; k < a[j].length; k++) { s.push( j + "[]=" + encodeURIComponent( a[j][k] ) ); } } else { s.push( j + "=" + encodeURIComponent( a[j] ) ); } } } // Return the resulting serialization return s.join("&"); }
if (typeof a[j] == 'object') {
if( a[j].constructor == Array ) {
param: function(a) { var s = []; // If an array was passed in, assume that it is an array // of form elements if ( a.constructor == Array || a.jquery ) { // Serialize the form elements for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); // Otherwise, assume that it's an object of key/value pairs } else { // Serialize the key/values for ( var j in a ) { //if one value is array then treat each array value in part if (typeof a[j] == 'object') { for (var k = 0; k < a[j].length; k++) { s.push( j + "[]=" + encodeURIComponent( a[j][k] ) ); } } else { s.push( j + "=" + encodeURIComponent( a[j] ) ); } } } // Return the resulting serialization return s.join("&"); },
s.push( j + "[]=" + encodeURIComponent( a[j][k] ) );
s.push( j + "=" + encodeURIComponent( a[j][k] ) );
param: function(a) { var s = []; // If an array was passed in, assume that it is an array // of form elements if ( a.constructor == Array || a.jquery ) { // Serialize the form elements for ( var i = 0; i < a.length; i++ ) s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) ); // Otherwise, assume that it's an object of key/value pairs } else { // Serialize the key/values for ( var j in a ) { //if one value is array then treat each array value in part if (typeof a[j] == 'object') { for (var k = 0; k < a[j].length; k++) { s.push( j + "[]=" + encodeURIComponent( a[j][k] ) ); } } else { s.push( j + "=" + encodeURIComponent( a[j] ) ); } } } // Return the resulting serialization return s.join("&"); },
var ret = jQuery.map(this.cur,"d.parentNode");
var ret = jQuery.map(this.cur,"a.parentNode");
parent: function(a) { var ret = jQuery.map(this.cur,"d.parentNode"); if ( a ) ret = jQuery.filter(a,ret).r; return this.pushStack(ret); },
this.cur = $.map(this.cur,function(d){ return d.parentNode; }); if ( a ) this.cur = $.filter(a,this.cur).r; return this; },
this.cur = $.map(this.cur,"d.parentNode"); if ( a ) this.cur = $.filter(a,this.cur).r; return this; },
parent: function(a) { this.cur = $.map(this.cur,function(d){ return d.parentNode; }); if ( a ) this.cur = $.filter(a,this.cur).r; return this; },
parents: function(a){ var b = []; var c = a.parentNode; while ( c && c != document ) { b.push( c ); c = c.parentNode;
parents: function( elem ){ var matched = []; var cur = elem.parentNode; while ( cur && cur != document ) { matched.push( cur ); cur = cur.parentNode;
parents: function(a){ var b = []; var c = a.parentNode; while ( c && c != document ) { b.push( c ); c = c.parentNode; } return b; },
return b;
return matched;
parents: function(a){ var b = []; var c = a.parentNode; while ( c && c != document ) { b.push( c ); c = c.parentNode; } return b; },
while ( c !== null && c != document ) {
while ( c && c != document ) {
$.parents = function(a){ var b = []; var c = a.parentNode; while ( c !== null && c != document ) { b[b.length] = c; c = c.parentNode; } return b;};
return this.onParseError(this);
{ this.onParseError(this); return; }
parse: function() { // Figures out what description language (RSS, Atom) and version this feed // is using and calls a language/version-specific feed parser. debug("parsing feed " + this.url); if (!this.request.responseText) return this.onParseError(this); // create a feed parser which will parse the feed for us var parser = new FeedParser(); this.itemsToStore = parser.parseFeed(this, this.request.responseText, this.request.responseXML, this.request.channel.URI); // storeNextItem will iterate through the parsed items, storing each one. this.itemsToStoreIndex = 0; this.storeNextItem(); },
e.unparsedData = (2 in ary) ? ary[2] : "";
e.unparsedData = arrayHasElementAt(ary, 2) ? ary[2] : "";
function parse_int (e, name){ var ary = e.unparsedData.match (/(\d+)(?:\s+(.*))?$/); if (!ary) return false; e[name] = Number(ary[1]); e.unparsedData = (2 in ary) ? ary[2] : ""; return true;}
e.unparsedData = (2 in ary) ? ary[2] : "";
e.unparsedData = arrayHasElementAt(ary, 2) ? ary[2] : "";
function parse_state (e, name){ var ary = e.unparsedData.match (/(true|on|yes|1|false|off|no|0)(?:\s+(.*))?$/i); if (!ary) return false; if (ary[1].search(/true|on|yes|1/i) != -1) e[name] = true; else e[name] = false; e.unparsedData = (2 in ary) ? ary[2] : ""; return true;}
e.unparsedData = (2 in ary) ? ary[2] : "";
e.unparsedData = arrayHasElementAt(ary, 2) ? ary[2] : "";
function parse_toggle (e, name){ var ary = e.unparsedData.match (/(toggle|true|on|yes|1|false|off|no|0)(?:\s+(.*))?$/i); if (!ary) return false; if (ary[1].search(/toggle/i) != -1) e[name] = "toggle"; else if (ary[1].search(/true|on|yes|1/i) != -1) e[name] = true; else e[name] = false; e.unparsedData = (2 in ary) ? ary[2] : ""; return true;}
e.unparsedData = (2 in ary) ? ary[2] : "";
e.unparsedData = arrayHasElementAt(ary, 2) ? ary[2] : "";
function parse_word (e, name){ var ary = e.unparsedData.match (/(\S+)(?:\s+(.*))?$/); if (!ary) return false; e[name] = ary[1]; e.unparsedData = (2 in ary) ? ary[2] : ""; return true;}
var fullNames;
var strippedAddresses = addressText.replace(/.* >> /, "");
function parseAndAddAddresses(addressText, recipientType){ var fullNames; fullNames = addressText.split(','); numAddresses = fullNames.length; for (index in fullNames) { // we want to eat leading and trailing white space... fullNames[index] = fullNames[index].replace(/^\s+|\s+$/g, ""); } if (numAddresses > 0) { // we need to set up our own autocomplete session and search for results setupAutocomplete(); // be safe, make sure we are setup if (!gAutomatedAutoCompleteListener) gAutomatedAutoCompleteListener = new AutomatedAutoCompleteHandler(); gAutomatedAutoCompleteListener.init(fullNames, numAddresses, recipientType); }}
fullNames = addressText.split(','); numAddresses = fullNames.length; for (index in fullNames) { fullNames[index] = fullNames[index].replace(/^\s+|\s+$/g, ""); }
var hdrParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser); var addresses = {}; var names = {}; var fullNames = {}; var numAddresses = hdrParser.parseHeadersWithArray(strippedAddresses, addresses, names, fullNames);
function parseAndAddAddresses(addressText, recipientType){ var fullNames; fullNames = addressText.split(','); numAddresses = fullNames.length; for (index in fullNames) { // we want to eat leading and trailing white space... fullNames[index] = fullNames[index].replace(/^\s+|\s+$/g, ""); } if (numAddresses > 0) { // we need to set up our own autocomplete session and search for results setupAutocomplete(); // be safe, make sure we are setup if (!gAutomatedAutoCompleteListener) gAutomatedAutoCompleteListener = new AutomatedAutoCompleteHandler(); gAutomatedAutoCompleteListener.init(fullNames, numAddresses, recipientType); }}
gAutomatedAutoCompleteListener.init(fullNames, numAddresses, recipientType);
gAutomatedAutoCompleteListener.init(fullNames.value, numAddresses, recipientType);
function parseAndAddAddresses(addressText, recipientType){ var fullNames; fullNames = addressText.split(','); numAddresses = fullNames.length; for (index in fullNames) { // we want to eat leading and trailing white space... fullNames[index] = fullNames[index].replace(/^\s+|\s+$/g, ""); } if (numAddresses > 0) { // we need to set up our own autocomplete session and search for results setupAutocomplete(); // be safe, make sure we are setup if (!gAutomatedAutoCompleteListener) gAutomatedAutoCompleteListener = new AutomatedAutoCompleteHandler(); gAutomatedAutoCompleteListener.init(fullNames, numAddresses, recipientType); }}
aFeed.title = aFeed.title || getRDFTargetValue(ds, channel, RSS_TITLE); aFeed.description = getRDFTargetValue(ds, channel, RSS_DESCRIPTION); aFeed.link = getRDFTargetValue(ds, channel, RSS_LINK);
aFeed.title = aFeed.title || getRDFTargetValue(ds, channel, RSS_TITLE) || aFeed.url; aFeed.description = getRDFTargetValue(ds, channel, RSS_DESCRIPTION) || ""; aFeed.link = getRDFTargetValue(ds, channel, RSS_LINK) || aFeed.url;
parseAsRSS1 : function(aFeed, aSource, aBaseURI) { var parsedItems = new Array(); // RSS 1.0 is valid RDF, so use the RDF parser/service to extract data. // Create a new RDF data source and parse the feed into it. var ds = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"] .createInstance(Components.interfaces.nsIRDFDataSource); rdfparser.parseString(ds, aBaseURI, aSource); // Get information about the feed as a whole. var channel = ds.GetSource(RDF_TYPE, RSS_CHANNEL, true); aFeed.title = aFeed.title || getRDFTargetValue(ds, channel, RSS_TITLE); aFeed.description = getRDFTargetValue(ds, channel, RSS_DESCRIPTION); aFeed.link = getRDFTargetValue(ds, channel, RSS_LINK); if (!aFeed.parseItems) return parsedItems; aFeed.invalidateItems(); var items = ds.GetTarget(channel, RSS_ITEMS, true); if (items) items = rdfcontainer.MakeSeq(ds, items).GetElements(); // If the channel doesn't list any items, look for resources of type "item" // (a hacky workaround for some buggy feeds). if (!items || !items.hasMoreElements()) items = ds.GetSources(RDF_TYPE, RSS_ITEM, true); var index = 0; while (items.hasMoreElements()) { var itemResource = items.getNext().QueryInterface(Components.interfaces.nsIRDFResource); var item = new FeedItem(); item.feed = aFeed; item.characterSet = "UTF-8"; // Prefer the value of the link tag to the item URI since the URI could be // a relative URN. var uri = itemResource.Value; var link = getRDFTargetValue(ds, itemResource, RSS_LINK); item.url = link || uri; item.id = item.url; item.description = getRDFTargetValue(ds, itemResource, RSS_DESCRIPTION); item.title = getRDFTargetValue(ds, itemResource, RSS_TITLE) || getRDFTargetValue(ds, itemResource, DC_SUBJECT) || (item.description ? (this.stripTags(item.description).substr(0, 150)) : null) || item.title; item.author = getRDFTargetValue(ds, itemResource, DC_CREATOR) || getRDFTargetValue(ds, channel, DC_CREATOR) || aFeed.title || item.author; item.date = getRDFTargetValue(ds, itemResource, DC_DATE) || item.date; item.content = getRDFTargetValue(ds, itemResource, RSS_CONTENT_ENCODED); parsedItems[index++] = item; } return parsedItems; },
var enclosureNode = itemNode.getElementsByTagName("enclosure")[0]; if (enclosureNode) item.enclosure = new FeedEnclosure(enclosureNode.getAttribute("url"), enclosureNode.getAttribute("type"), enclosureNode.getAttribute("length"));
parseAsRSS2: function (aFeed, aDOM) { // Get the first channel (assuming there is only one per RSS File). var parsedItems = new Array(); var channel = aDOM.getElementsByTagName("channel")[0]; if (!channel) return aFeed.onParseError(aFeed); aFeed.title = aFeed.title || getNodeValue(channel.getElementsByTagName("title")[0]); aFeed.description = getNodeValue(channel.getElementsByTagName("description")[0]); aFeed.link = getNodeValue(channel.getElementsByTagName("link")[0]); if (!aFeed.parseItems) return parsedItems; aFeed.invalidateItems(); var itemNodes = aDOM.getElementsByTagName("item"); var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. createInstance(Components.interfaces.nsIScriptableUnicodeConverter); converter.charset = 'UTF-8'; for (var i=0; i<itemNodes.length; i++) { var itemNode = itemNodes[i]; var item = new FeedItem(); item.feed = aFeed; item.characterSet = "UTF-8"; var link = getNodeValue(itemNode.getElementsByTagName("link")[0]); var guidNode = itemNode.getElementsByTagName("guid")[0]; var guid; var isPermaLink; if (guidNode) { guid = getNodeValue(guidNode); isPermaLink = guidNode.getAttribute('isPermaLink') == 'false' ? false : true; } // getNodeValue returns unicode strings... // we need to do the proper conversion on these before we call into // item.Store(); item.url = link ? link : (guid && isPermaLink) ? guid : null; item.id = guid; item.description = getNodeValue(itemNode.getElementsByTagName("description")[0]); item.title = converter.ConvertFromUnicode(getNodeValue(itemNode.getElementsByTagName("title")[0]) || (item.description ? item.description.substr(0, 150) : null) || item.title); // do this after we potentially assign item.description into item.title // because that potential assignment assumes the value is in unicode still item.description = converter.ConvertFromUnicode(item.description); item.author = getNodeValue(itemNode.getElementsByTagName("author")[0] || itemNode.getElementsByTagName("creator")[0]) || aFeed.title || item.author; item.date = getNodeValue(itemNode.getElementsByTagName("pubDate")[0] || itemNode.getElementsByTagName("date")[0]) || item.date; // If the date is invalid, users will see the beginning of the epoch // unless we reset it here, so they'll see the current time instead. // This is typical aggregator behavior. if(item.date) { item.date = trimString(item.date); if(!isValidRFC822Date(item.date)) { // XXX Use this on the other formats as well item.date = dateRescue(item.date); } } var content = getNodeValue(itemNode.getElementsByTagNameNS(RSS_CONTENT_NS, "encoded")[0]); if (content) item.content = converter.ConvertFromUnicode(content); parsedItems[i] = item; } return parsedItems; },
function parseIcalData( icalStr )
function parseIcalData( icalendarString )
function parseIcalData( icalStr ){ var calendarEventArray = new Array(); var i,j; while( icalStr.indexOf("BEGIN:VEVENT") != -1 ) { // try to find the begin and end of an event. ParseIcalString does not support VCALENDAR i = icalStr.indexOf("BEGIN:VEVENT"); j = icalStr.indexOf("END:VEVENT") + 10; eventData = icalStr.substring(i, j); calendarEvent = createEvent(); // if parsing import iCalendar failed, add date as description if ( !calendarEvent.parseIcalString(eventData) ) { // initialize start and end dates. initCalendarEvent( calendarEvent ); // Save the parsed text as description. calendarEvent.description = icalStr; } calendarEventArray[ calendarEventArray.length ] = calendarEvent; // remove the parsed VEVENT from the calendar data to parse icalStr = icalStr.substring(j+1); } return calendarEventArray;}
eventData = icalStr.substring(i, j);
var eventData = icalStr.substring(i, j);
function parseIcalData( icalStr ){ var calendarEventArray = new Array(); var i,j; while( icalStr.indexOf("BEGIN:VEVENT") != -1 ) { // try to find the begin and end of an event. ParseIcalString does not support VCALENDAR i = icalStr.indexOf("BEGIN:VEVENT"); j = icalStr.indexOf("END:VEVENT") + 10; eventData = icalStr.substring(i, j); calendarEvent = createEvent(); // if parsing import iCalendar failed, add date as description if ( !calendarEvent.parseIcalString(eventData) ) { // initialize start and end dates. initCalendarEvent( calendarEvent ); // Save the parsed text as description. calendarEvent.description = icalStr; } calendarEventArray[ calendarEventArray.length ] = calendarEvent; // remove the parsed VEVENT from the calendar data to parse icalStr = icalStr.substring(j+1); } return calendarEventArray;}
calendarEvent = createEvent();
var calendarEvent = createEvent();
function parseIcalData( icalStr ){ var calendarEventArray = new Array(); var i,j; while( icalStr.indexOf("BEGIN:VEVENT") != -1 ) { // try to find the begin and end of an event. ParseIcalString does not support VCALENDAR i = icalStr.indexOf("BEGIN:VEVENT"); j = icalStr.indexOf("END:VEVENT") + 10; eventData = icalStr.substring(i, j); calendarEvent = createEvent(); // if parsing import iCalendar failed, add date as description if ( !calendarEvent.parseIcalString(eventData) ) { // initialize start and end dates. initCalendarEvent( calendarEvent ); // Save the parsed text as description. calendarEvent.description = icalStr; } calendarEventArray[ calendarEventArray.length ] = calendarEvent; // remove the parsed VEVENT from the calendar data to parse icalStr = icalStr.substring(j+1); } return calendarEventArray;}
icalStr = icalendarString; while( icalStr.indexOf("BEGIN:VTODO") != -1 ) { i = icalStr.indexOf("BEGIN:VTODO"); j = icalStr.indexOf("END:VTODO") + 9; var todoData = icalStr.substring(i, j); var calendarTodo = createToDo(); if ( !calendarTodo.parseTodoIcalString(todoData) ) { calendarTodo.description = icalStr; } calendarEventArray[ calendarEventArray.length ] = calendarTodo; icalStr = icalStr.substring(j+1); }
function parseIcalData( icalStr ){ var calendarEventArray = new Array(); var i,j; while( icalStr.indexOf("BEGIN:VEVENT") != -1 ) { // try to find the begin and end of an event. ParseIcalString does not support VCALENDAR i = icalStr.indexOf("BEGIN:VEVENT"); j = icalStr.indexOf("END:VEVENT") + 10; eventData = icalStr.substring(i, j); calendarEvent = createEvent(); // if parsing import iCalendar failed, add date as description if ( !calendarEvent.parseIcalString(eventData) ) { // initialize start and end dates. initCalendarEvent( calendarEvent ); // Save the parsed text as description. calendarEvent.description = icalStr; } calendarEventArray[ calendarEventArray.length ] = calendarEvent; // remove the parsed VEVENT from the calendar data to parse icalStr = icalStr.substring(j+1); } return calendarEventArray;}
if (2 in ary && !(name in parseResult))
if (arrayHasElementAt(ary, 2) && !(name in parseResult))
function parseJSDURL (url){ var ary; if (url.search(JSD_URL_PREFIX) != 0) return null; ary = url.substr(JSD_SCHEME_LEN).match(/([^?#]+)(?:\?(.*))?/); if (!ary) return null; var parseResult = new Object(); parseResult.spec = url; parseResult.service = ary[1].toLowerCase(); var rest = ary[2]; if (rest) { ary = rest.match(/([^&#]+)/); while (ary) { rest = RegExp.rightContext.substr(1); var assignment = ary[1]; ary = assignment.match(/(.+)=(.*)/); if (ASSERT(ary, "error parsing ``" + assignment + "'' from " + url)) { var name = decodeURIComponent(ary[1]); /* only set the property the first time we see it */ if (2 in ary && !(name in parseResult)) parseResult[name] = decodeURIComponent(ary[2]); } ary = rest.match(/([^&#]+)/); } } //dd (dumpObjectTree(parseResult)); return parseResult;}
var name = unescape(ary[1]);
var name = decodeURIComponent(ary[1]);
function parseJSDURL (url){ var ary; if (url.search(JSD_URL_PREFIX) != 0) return null; ary = url.substr(JSD_SCHEME_LEN).match(/([^?#]+)(?:\?(.*))?/); if (!ary) return null; var parseResult = new Object(); parseResult.spec = url; parseResult.service = ary[1].toLowerCase(); var rest = ary[2]; if (rest) { ary = rest.match(/([^&#]+)/); while (ary) { rest = RegExp.rightContext.substr(1); var assignment = ary[1]; ary = assignment.match(/(.+)=(.*)/); if (ASSERT(ary, "error parsing ``" + assignment + "'' from " + url)) { var name = unescape(ary[1]); /* only set the property the first time we see it */ if (2 in ary && !(name in parseResult)) parseResult[name] = unescape(ary[2]); } ary = rest.match(/([^&#]+)/); } } //dd (dumpObjectTree(parseResult)); return parseResult;}
parseResult[name] = unescape(ary[2]);
parseResult[name] = decodeURIComponent(ary[2]);
function parseJSDURL (url){ var ary; if (url.search(JSD_URL_PREFIX) != 0) return null; ary = url.substr(JSD_SCHEME_LEN).match(/([^?#]+)(?:\?(.*))?/); if (!ary) return null; var parseResult = new Object(); parseResult.spec = url; parseResult.service = ary[1].toLowerCase(); var rest = ary[2]; if (rest) { ary = rest.match(/([^&#]+)/); while (ary) { rest = RegExp.rightContext.substr(1); var assignment = ary[1]; ary = assignment.match(/(.+)=(.*)/); if (ASSERT(ary, "error parsing ``" + assignment + "'' from " + url)) { var name = unescape(ary[1]); /* only set the property the first time we see it */ if (2 in ary && !(name in parseResult)) parseResult[name] = unescape(ary[2]); } ary = rest.match(/([^&#]+)/); } } //dd (dumpObjectTree(parseResult)); return parseResult;}
e.unparsedData = (4 in ary) ? ary[4] : "";
e.unparsedData = arrayHasElementAt(ary, 4) ? ary[4] : "";
function parsePlugin(e, name){ var ary = e.unparsedData.match (/(?:(\d+)|(\S+))(?:\s+(.*))?$/); if (!ary) return false; var plugin; if (ary[1]) { var i = parseInt(ary[1]); if (!(i in client.plugins)) return false; plugin = client.plugins[i]; } else { plugin = getPluginById(ary[2]); if (!plugin) return false; } e.unparsedData = (4 in ary) ? ary[4] : ""; e[name] = plugin; return true;}
var ix = data.value.indexOf("\n");
var ix = data.indexOf("\n");
paste: function (aSelection) { const kXferableContractID = "@mozilla.org/widget/transferable;1"; const kXferableIID = Components.interfaces.nsITransferable; var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID); xferable.addDataFlavor("moz/bookmarkclipboarditem"); xferable.addDataFlavor("text/x-moz-url"); xferable.addDataFlavor("text/unicode"); const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; const kClipboardIID = Components.interfaces.nsIClipboard; var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID); clipboard.getData(xferable, kClipboardIID.kGlobalClipboard); var flavour = { }; var data = { }; var length = { }; xferable.getAnyTransferData(flavour, data, length); var nodes = []; var names = []; data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; switch (flavour.value) { case "moz/bookmarkclipboarditem": nodes = data.split("\n"); break; case "text/x-moz-url": var ix = data.value.indexOf("\n"); nodes.push(data.substring(0, ix != -1 ? ix : data.length)); names.push(data.substring(ix)); break; default: return; } const lastSelected = aSelection[aSelection.length-1]; const kParentNode = this.resolvePasteFolder(aSelection); const krParent = this.RDF.GetResource(NODE_ID(kParentNode)); const krSource = this.RDF.GetResource(NODE_ID(lastSelected)); const kRDFCContractID = "@mozilla.org/rdf/container;1"; const kRDFCIID = Components.interfaces.nsIRDFContainer; const ksRDFC = Components.classes[kRDFCContractID].getService(kRDFCIID); const kBMDS = this.RDF.GetDataSource("rdf:bookmarks"); if ("beginBatch" in this && nodes.length > 1) this.beginBatch(); var additiveFlag = false; for (var i = 0; i < nodes.length; ++i) { if (!nodes[i]) continue; var rCurrent = this.RDF.GetResource(nodes[i]); const krTypeProperty = this.RDF.GetResource(RDF_NS + "type"); var rType = this.db.GetTarget(rCurrent, krTypeProperty, true); try { rType = rType.QueryInterface(Components.interfaces.nsIRDFResource); } catch (e) { rType = rType.QueryInterface(Components.interfaces.nsIRDFLiteral); } // If the node is a folder, then we need to create a new anonymous // resource and copy all the arcs over. if (rType.Value == NC_NS + "Folder") rCurrent = BookmarksUtils.cloneFolder(rCurrent, krParent, krSource); // If we are given names, this implies that the nodes do not already // exist in the graph, and we need to create some additional information // for them. if (names.length) { const krName = this.RDF.GetResource(names[i]); const krNameProperty = this.RDF.GetResource(NC_NS + "Name"); const krBookmark = this.RDF.GetResource(NC_NS + "Bookmark"); this.db.Assert(rCurrent, krNameProperty, krName, true); this.db.Assert(rCurrent, krTypeProperty, krBookmark, true); } ksRDFC.Init(kBMDS, krParent); ix = ksRDFC.IndexOf(krSource); if (ix != -1) ksRDFC.InsertElementAt(rCurrent, ix+1, true); else ksRDFC.AppendElement(rCurrent); this.selectFolderItem(krSource.Value, rCurrent.Value, additiveFlag); if (!additiveFlag) additiveFlag = true; } if ("endBatch" in this && nodes.length > 1) this.endBatch(); },
if ("beginBatch" in this && nodes.length > 1) this.beginBatch();
paste: function (aSelection) { const kXferableContractID = "@mozilla.org/widget/transferable;1"; const kXferableIID = Components.interfaces.nsITransferable; var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID); xferable.addDataFlavor("moz/bookmarkclipboarditem"); xferable.addDataFlavor("text/x-moz-url"); xferable.addDataFlavor("text/unicode"); const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; const kClipboardIID = Components.interfaces.nsIClipboard; var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID); clipboard.getData(xferable, kClipboardIID.kGlobalClipboard); var flavour = { }; var data = { }; var length = { }; xferable.getAnyTransferData(flavour, data, length); var nodes = []; var names = []; data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; switch (flavour.value) { case "moz/bookmarkclipboarditem": nodes = data.split("\n"); break; case "text/x-moz-url": var ix = data.value.indexOf("\n"); nodes.push(data.substring(0, ix != -1 ? ix : data.length)); names.push(data.substring(ix)); break; default: return; } const lastSelected = aSelection[aSelection.length-1]; const kParentNode = this.resolvePasteFolder(aSelection); const krParent = this.RDF.GetResource(NODE_ID(kParentNode)); const krSource = this.RDF.GetResource(NODE_ID(lastSelected)); const kRDFCContractID = "@mozilla.org/rdf/container;1"; const kRDFCIID = Components.interfaces.nsIRDFContainer; const ksRDFC = Components.classes[kRDFCContractID].getService(kRDFCIID); const kBMDS = this.RDF.GetDataSource("rdf:bookmarks"); if ("beginBatch" in this && nodes.length > 1) this.beginBatch(); var additiveFlag = false; for (var i = 0; i < nodes.length; ++i) { if (!nodes[i]) continue; var rCurrent = this.RDF.GetResource(nodes[i]); const krTypeProperty = this.RDF.GetResource(RDF_NS + "type"); var rType = this.db.GetTarget(rCurrent, krTypeProperty, true); try { rType = rType.QueryInterface(Components.interfaces.nsIRDFResource); } catch (e) { rType = rType.QueryInterface(Components.interfaces.nsIRDFLiteral); } // If the node is a folder, then we need to create a new anonymous // resource and copy all the arcs over. if (rType.Value == NC_NS + "Folder") rCurrent = BookmarksUtils.cloneFolder(rCurrent, krParent, krSource); // If we are given names, this implies that the nodes do not already // exist in the graph, and we need to create some additional information // for them. if (names.length) { const krName = this.RDF.GetResource(names[i]); const krNameProperty = this.RDF.GetResource(NC_NS + "Name"); const krBookmark = this.RDF.GetResource(NC_NS + "Bookmark"); this.db.Assert(rCurrent, krNameProperty, krName, true); this.db.Assert(rCurrent, krTypeProperty, krBookmark, true); } ksRDFC.Init(kBMDS, krParent); ix = ksRDFC.IndexOf(krSource); if (ix != -1) ksRDFC.InsertElementAt(rCurrent, ix+1, true); else ksRDFC.AppendElement(rCurrent); this.selectFolderItem(krSource.Value, rCurrent.Value, additiveFlag); if (!additiveFlag) additiveFlag = true; } if ("endBatch" in this && nodes.length > 1) this.endBatch(); },
rType = rType.QueryInterface(Components.interfaces.nsIRDFLiteral);
try { rType = rType.QueryInterface(Components.interfaces.nsIRDFLiteral); } catch (e) { const krName = this.RDF.GetResource(names[i]); const krNameProperty = this.RDF.GetResource(NC_NS + "Name"); const krBookmark = this.RDF.GetResource(NC_NS + "Bookmark"); kBMDS.Assert(rCurrent, krNameProperty, krName, true); kBMDS.Assert(rCurrent, krTypeProperty, krBookmark, true); }
paste: function (aSelection) { const kXferableContractID = "@mozilla.org/widget/transferable;1"; const kXferableIID = Components.interfaces.nsITransferable; var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID); xferable.addDataFlavor("moz/bookmarkclipboarditem"); xferable.addDataFlavor("text/x-moz-url"); xferable.addDataFlavor("text/unicode"); const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; const kClipboardIID = Components.interfaces.nsIClipboard; var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID); clipboard.getData(xferable, kClipboardIID.kGlobalClipboard); var flavour = { }; var data = { }; var length = { }; xferable.getAnyTransferData(flavour, data, length); var nodes = []; var names = []; data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; switch (flavour.value) { case "moz/bookmarkclipboarditem": nodes = data.split("\n"); break; case "text/x-moz-url": var ix = data.value.indexOf("\n"); nodes.push(data.substring(0, ix != -1 ? ix : data.length)); names.push(data.substring(ix)); break; default: return; } const lastSelected = aSelection[aSelection.length-1]; const kParentNode = this.resolvePasteFolder(aSelection); const krParent = this.RDF.GetResource(NODE_ID(kParentNode)); const krSource = this.RDF.GetResource(NODE_ID(lastSelected)); const kRDFCContractID = "@mozilla.org/rdf/container;1"; const kRDFCIID = Components.interfaces.nsIRDFContainer; const ksRDFC = Components.classes[kRDFCContractID].getService(kRDFCIID); const kBMDS = this.RDF.GetDataSource("rdf:bookmarks"); if ("beginBatch" in this && nodes.length > 1) this.beginBatch(); var additiveFlag = false; for (var i = 0; i < nodes.length; ++i) { if (!nodes[i]) continue; var rCurrent = this.RDF.GetResource(nodes[i]); const krTypeProperty = this.RDF.GetResource(RDF_NS + "type"); var rType = this.db.GetTarget(rCurrent, krTypeProperty, true); try { rType = rType.QueryInterface(Components.interfaces.nsIRDFResource); } catch (e) { rType = rType.QueryInterface(Components.interfaces.nsIRDFLiteral); } // If the node is a folder, then we need to create a new anonymous // resource and copy all the arcs over. if (rType.Value == NC_NS + "Folder") rCurrent = BookmarksUtils.cloneFolder(rCurrent, krParent, krSource); // If we are given names, this implies that the nodes do not already // exist in the graph, and we need to create some additional information // for them. if (names.length) { const krName = this.RDF.GetResource(names[i]); const krNameProperty = this.RDF.GetResource(NC_NS + "Name"); const krBookmark = this.RDF.GetResource(NC_NS + "Bookmark"); this.db.Assert(rCurrent, krNameProperty, krName, true); this.db.Assert(rCurrent, krTypeProperty, krBookmark, true); } ksRDFC.Init(kBMDS, krParent); ix = ksRDFC.IndexOf(krSource); if (ix != -1) ksRDFC.InsertElementAt(rCurrent, ix+1, true); else ksRDFC.AppendElement(rCurrent); this.selectFolderItem(krSource.Value, rCurrent.Value, additiveFlag); if (!additiveFlag) additiveFlag = true; } if ("endBatch" in this && nodes.length > 1) this.endBatch(); },
if (rType.Value == NC_NS + "Folder")
if (rType && rType.Value == NC_NS + "Folder")
paste: function (aSelection) { const kXferableContractID = "@mozilla.org/widget/transferable;1"; const kXferableIID = Components.interfaces.nsITransferable; var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID); xferable.addDataFlavor("moz/bookmarkclipboarditem"); xferable.addDataFlavor("text/x-moz-url"); xferable.addDataFlavor("text/unicode"); const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; const kClipboardIID = Components.interfaces.nsIClipboard; var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID); clipboard.getData(xferable, kClipboardIID.kGlobalClipboard); var flavour = { }; var data = { }; var length = { }; xferable.getAnyTransferData(flavour, data, length); var nodes = []; var names = []; data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; switch (flavour.value) { case "moz/bookmarkclipboarditem": nodes = data.split("\n"); break; case "text/x-moz-url": var ix = data.value.indexOf("\n"); nodes.push(data.substring(0, ix != -1 ? ix : data.length)); names.push(data.substring(ix)); break; default: return; } const lastSelected = aSelection[aSelection.length-1]; const kParentNode = this.resolvePasteFolder(aSelection); const krParent = this.RDF.GetResource(NODE_ID(kParentNode)); const krSource = this.RDF.GetResource(NODE_ID(lastSelected)); const kRDFCContractID = "@mozilla.org/rdf/container;1"; const kRDFCIID = Components.interfaces.nsIRDFContainer; const ksRDFC = Components.classes[kRDFCContractID].getService(kRDFCIID); const kBMDS = this.RDF.GetDataSource("rdf:bookmarks"); if ("beginBatch" in this && nodes.length > 1) this.beginBatch(); var additiveFlag = false; for (var i = 0; i < nodes.length; ++i) { if (!nodes[i]) continue; var rCurrent = this.RDF.GetResource(nodes[i]); const krTypeProperty = this.RDF.GetResource(RDF_NS + "type"); var rType = this.db.GetTarget(rCurrent, krTypeProperty, true); try { rType = rType.QueryInterface(Components.interfaces.nsIRDFResource); } catch (e) { rType = rType.QueryInterface(Components.interfaces.nsIRDFLiteral); } // If the node is a folder, then we need to create a new anonymous // resource and copy all the arcs over. if (rType.Value == NC_NS + "Folder") rCurrent = BookmarksUtils.cloneFolder(rCurrent, krParent, krSource); // If we are given names, this implies that the nodes do not already // exist in the graph, and we need to create some additional information // for them. if (names.length) { const krName = this.RDF.GetResource(names[i]); const krNameProperty = this.RDF.GetResource(NC_NS + "Name"); const krBookmark = this.RDF.GetResource(NC_NS + "Bookmark"); this.db.Assert(rCurrent, krNameProperty, krName, true); this.db.Assert(rCurrent, krTypeProperty, krBookmark, true); } ksRDFC.Init(kBMDS, krParent); ix = ksRDFC.IndexOf(krSource); if (ix != -1) ksRDFC.InsertElementAt(rCurrent, ix+1, true); else ksRDFC.AppendElement(rCurrent); this.selectFolderItem(krSource.Value, rCurrent.Value, additiveFlag); if (!additiveFlag) additiveFlag = true; } if ("endBatch" in this && nodes.length > 1) this.endBatch(); },
if (names.length) { const krName = this.RDF.GetResource(names[i]); const krNameProperty = this.RDF.GetResource(NC_NS + "Name"); const krBookmark = this.RDF.GetResource(NC_NS + "Bookmark"); this.db.Assert(rCurrent, krNameProperty, krName, true); this.db.Assert(rCurrent, krTypeProperty, krBookmark, true); }
paste: function (aSelection) { const kXferableContractID = "@mozilla.org/widget/transferable;1"; const kXferableIID = Components.interfaces.nsITransferable; var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID); xferable.addDataFlavor("moz/bookmarkclipboarditem"); xferable.addDataFlavor("text/x-moz-url"); xferable.addDataFlavor("text/unicode"); const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; const kClipboardIID = Components.interfaces.nsIClipboard; var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID); clipboard.getData(xferable, kClipboardIID.kGlobalClipboard); var flavour = { }; var data = { }; var length = { }; xferable.getAnyTransferData(flavour, data, length); var nodes = []; var names = []; data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; switch (flavour.value) { case "moz/bookmarkclipboarditem": nodes = data.split("\n"); break; case "text/x-moz-url": var ix = data.value.indexOf("\n"); nodes.push(data.substring(0, ix != -1 ? ix : data.length)); names.push(data.substring(ix)); break; default: return; } const lastSelected = aSelection[aSelection.length-1]; const kParentNode = this.resolvePasteFolder(aSelection); const krParent = this.RDF.GetResource(NODE_ID(kParentNode)); const krSource = this.RDF.GetResource(NODE_ID(lastSelected)); const kRDFCContractID = "@mozilla.org/rdf/container;1"; const kRDFCIID = Components.interfaces.nsIRDFContainer; const ksRDFC = Components.classes[kRDFCContractID].getService(kRDFCIID); const kBMDS = this.RDF.GetDataSource("rdf:bookmarks"); if ("beginBatch" in this && nodes.length > 1) this.beginBatch(); var additiveFlag = false; for (var i = 0; i < nodes.length; ++i) { if (!nodes[i]) continue; var rCurrent = this.RDF.GetResource(nodes[i]); const krTypeProperty = this.RDF.GetResource(RDF_NS + "type"); var rType = this.db.GetTarget(rCurrent, krTypeProperty, true); try { rType = rType.QueryInterface(Components.interfaces.nsIRDFResource); } catch (e) { rType = rType.QueryInterface(Components.interfaces.nsIRDFLiteral); } // If the node is a folder, then we need to create a new anonymous // resource and copy all the arcs over. if (rType.Value == NC_NS + "Folder") rCurrent = BookmarksUtils.cloneFolder(rCurrent, krParent, krSource); // If we are given names, this implies that the nodes do not already // exist in the graph, and we need to create some additional information // for them. if (names.length) { const krName = this.RDF.GetResource(names[i]); const krNameProperty = this.RDF.GetResource(NC_NS + "Name"); const krBookmark = this.RDF.GetResource(NC_NS + "Bookmark"); this.db.Assert(rCurrent, krNameProperty, krName, true); this.db.Assert(rCurrent, krTypeProperty, krBookmark, true); } ksRDFC.Init(kBMDS, krParent); ix = ksRDFC.IndexOf(krSource); if (ix != -1) ksRDFC.InsertElementAt(rCurrent, ix+1, true); else ksRDFC.AppendElement(rCurrent); this.selectFolderItem(krSource.Value, rCurrent.Value, additiveFlag); if (!additiveFlag) additiveFlag = true; } if ("endBatch" in this && nodes.length > 1) this.endBatch(); },
if ("endBatch" in this && nodes.length > 1) this.endBatch();
paste: function (aSelection) { const kXferableContractID = "@mozilla.org/widget/transferable;1"; const kXferableIID = Components.interfaces.nsITransferable; var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID); xferable.addDataFlavor("moz/bookmarkclipboarditem"); xferable.addDataFlavor("text/x-moz-url"); xferable.addDataFlavor("text/unicode"); const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; const kClipboardIID = Components.interfaces.nsIClipboard; var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID); clipboard.getData(xferable, kClipboardIID.kGlobalClipboard); var flavour = { }; var data = { }; var length = { }; xferable.getAnyTransferData(flavour, data, length); var nodes = []; var names = []; data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; switch (flavour.value) { case "moz/bookmarkclipboarditem": nodes = data.split("\n"); break; case "text/x-moz-url": var ix = data.value.indexOf("\n"); nodes.push(data.substring(0, ix != -1 ? ix : data.length)); names.push(data.substring(ix)); break; default: return; } const lastSelected = aSelection[aSelection.length-1]; const kParentNode = this.resolvePasteFolder(aSelection); const krParent = this.RDF.GetResource(NODE_ID(kParentNode)); const krSource = this.RDF.GetResource(NODE_ID(lastSelected)); const kRDFCContractID = "@mozilla.org/rdf/container;1"; const kRDFCIID = Components.interfaces.nsIRDFContainer; const ksRDFC = Components.classes[kRDFCContractID].getService(kRDFCIID); const kBMDS = this.RDF.GetDataSource("rdf:bookmarks"); if ("beginBatch" in this && nodes.length > 1) this.beginBatch(); var additiveFlag = false; for (var i = 0; i < nodes.length; ++i) { if (!nodes[i]) continue; var rCurrent = this.RDF.GetResource(nodes[i]); const krTypeProperty = this.RDF.GetResource(RDF_NS + "type"); var rType = this.db.GetTarget(rCurrent, krTypeProperty, true); try { rType = rType.QueryInterface(Components.interfaces.nsIRDFResource); } catch (e) { rType = rType.QueryInterface(Components.interfaces.nsIRDFLiteral); } // If the node is a folder, then we need to create a new anonymous // resource and copy all the arcs over. if (rType.Value == NC_NS + "Folder") rCurrent = BookmarksUtils.cloneFolder(rCurrent, krParent, krSource); // If we are given names, this implies that the nodes do not already // exist in the graph, and we need to create some additional information // for them. if (names.length) { const krName = this.RDF.GetResource(names[i]); const krNameProperty = this.RDF.GetResource(NC_NS + "Name"); const krBookmark = this.RDF.GetResource(NC_NS + "Bookmark"); this.db.Assert(rCurrent, krNameProperty, krName, true); this.db.Assert(rCurrent, krTypeProperty, krBookmark, true); } ksRDFC.Init(kBMDS, krParent); ix = ksRDFC.IndexOf(krSource); if (ix != -1) ksRDFC.InsertElementAt(rCurrent, ix+1, true); else ksRDFC.AppendElement(rCurrent); this.selectFolderItem(krSource.Value, rCurrent.Value, additiveFlag); if (!additiveFlag) additiveFlag = true; } if ("endBatch" in this && nodes.length > 1) this.endBatch(); },
var resource = RDF.GetResource(items[i]); name = BookmarksUtils.getProperty(resource, NC_NS+"Name"); url = BookmarksUtils.getProperty(resource, NC_NS+"URL" ); items[i] = BookmarksUtils.createBookmark(name, url, null, null);
items[i] = RDF.GetResource(items[i]);
pasteBookmark: function (aTarget) { const kXferableContractID = "@mozilla.org/widget/transferable;1"; const kXferableIID = Components.interfaces.nsITransferable; var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID); xferable.addDataFlavor("moz/bookmarkclipboarditem"); xferable.addDataFlavor("text/x-moz-url"); xferable.addDataFlavor("text/unicode"); const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; const kClipboardIID = Components.interfaces.nsIClipboard; var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID); clipboard.getData(xferable, kClipboardIID.kGlobalClipboard); var flavour = { }; var data = { }; var length = { }; xferable.getAnyTransferData(flavour, data, length); var items, name, url; data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data; switch (flavour.value) { case "moz/bookmarkclipboarditem": items = data.split("\n"); // since data are ended by \n, remove the last empty node items.pop(); for (var i=0; i<items.length; ++i) { var resource = RDF.GetResource(items[i]); name = BookmarksUtils.getProperty(resource, NC_NS+"Name"); url = BookmarksUtils.getProperty(resource, NC_NS+"URL" ); items[i] = BookmarksUtils.createBookmark(name, url, null, null); } break; case "text/x-moz-url": // there should be only one item in this case var ix = data.indexOf("\n"); items = data.substring(0, ix != -1 ? ix : data.length); name = data.substring(ix); // XXX: we should infer the best charset BookmarksUtils.createBookmark(null, items, null, name); items = [items]; break; default: return; } var selection = {item: items, parent:Array(items.length), length: items.length}; BookmarksUtils.checkSelection(selection); BookmarksUtils.insertSelection("paste", selection, aTarget, true); },
BookmarksUtils.insertSelection("paste", selection, aTarget, true);
BookmarksUtils.insertSelection("paste", selection, aTarget);
pasteBookmark: function (aTarget) { const kXferableContractID = "@mozilla.org/widget/transferable;1"; const kXferableIID = Components.interfaces.nsITransferable; var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID); xferable.addDataFlavor("moz/bookmarkclipboarditem"); xferable.addDataFlavor("text/x-moz-url"); xferable.addDataFlavor("text/unicode"); const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; const kClipboardIID = Components.interfaces.nsIClipboard; var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID); clipboard.getData(xferable, kClipboardIID.kGlobalClipboard); var flavour = { }; var data = { }; var length = { }; xferable.getAnyTransferData(flavour, data, length); var items, name, url; data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data; switch (flavour.value) { case "moz/bookmarkclipboarditem": items = data.split("\n"); // since data are ended by \n, remove the last empty node items.pop(); for (var i=0; i<items.length; ++i) { var resource = RDF.GetResource(items[i]); name = BookmarksUtils.getProperty(resource, NC_NS+"Name"); url = BookmarksUtils.getProperty(resource, NC_NS+"URL" ); items[i] = BookmarksUtils.createBookmark(name, url, null, null); } break; case "text/x-moz-url": // there should be only one item in this case var ix = data.indexOf("\n"); items = data.substring(0, ix != -1 ? ix : data.length); name = data.substring(ix); // XXX: we should infer the best charset BookmarksUtils.createBookmark(null, items, null, name); items = [items]; break; default: return; } var selection = {item: items, parent:Array(items.length), length: items.length}; BookmarksUtils.checkSelection(selection); BookmarksUtils.insertSelection("paste", selection, aTarget, true); },
BookmarksUtils.insertSelection("paste", selection, aTarget);
BookmarksUtils.insertAndCheckSelection("paste", selection, aTarget);
pasteBookmark: function (aTarget) { const kXferableContractID = "@mozilla.org/widget/transferable;1"; const kXferableIID = Components.interfaces.nsITransferable; var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID); xferable.addDataFlavor("moz/bookmarkclipboarditem"); xferable.addDataFlavor("text/x-moz-url"); xferable.addDataFlavor("text/unicode"); const kClipboardContractID = "@mozilla.org/widget/clipboard;1"; const kClipboardIID = Components.interfaces.nsIClipboard; var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID); clipboard.getData(xferable, kClipboardIID.kGlobalClipboard); var flavour = { }; var data = { }; var length = { }; xferable.getAnyTransferData(flavour, data, length); var items, name, url; data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data; switch (flavour.value) { case "moz/bookmarkclipboarditem": items = data.split("\n"); // since data are ended by \n, remove the last empty node items.pop(); for (var i=0; i<items.length; ++i) { items[i] = RDF.GetResource(items[i]); } break; case "text/x-moz-url": // there should be only one item in this case var ix = data.indexOf("\n"); items = data.substring(0, ix != -1 ? ix : data.length); name = data.substring(ix); // XXX: we should infer the best charset BookmarksUtils.createBookmark(null, items, null, name); items = [items]; break; default: return; } var selection = {item: items, parent:Array(items.length), length: items.length}; BookmarksUtils.checkSelection(selection); BookmarksUtils.insertSelection("paste", selection, aTarget); },
var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 );
MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 );
function pasteFromClipboard(){ const kClipboardIID = Components.interfaces.nsIClipboard; if( canPaste() ) { // 1. get the clipboard service var clipboard = getClipboard(); // 2. create the transferable var trans = createTransferable(); if ( trans && clipboard) { // 3. register the data flavors you want, highest fidelity first! trans.addDataFlavor("text/calendar"); trans.addDataFlavor("text/unicode"); // 4. get transferable from clipboard clipboard.getData ( trans, kClipboardIID.kGlobalClipboard); // 5. ask transferable for the best flavor. Need to create new JS // objects for the out params. var flavour = { }; var data = { }; var length = { }; trans.getAnyTransferData(flavour, data, length); data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data; //DEBUG alert("clipboard type: " + flavour.value); var calendarEventArray; var startDate; switch (flavour.value) { case "text/calendar": calendarEventArray = parseIcalData( data ); //change the date of all the events to now startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); break; case "text/unicode": if ( data.indexOf("BEGIN:VEVENT") == -1 ) { // no iCalendar data, paste clipboard text into description of new event calendarEvent = createEvent(); initCalendarEvent( calendarEvent ); calendarEvent.description = data; editNewEvent( calendarEvent ); } else { calendarEventArray = parseIcalData( data ); //change the date of all the events to now startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); } break; default: alert("Unknown clipboard type: " + flavour.value); } } } else alert( "No iCalendar or text on the clipboard." );}
var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn );
endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn );
function pasteFromClipboard(){ const kClipboardIID = Components.interfaces.nsIClipboard; if( canPaste() ) { // 1. get the clipboard service var clipboard = getClipboard(); // 2. create the transferable var trans = createTransferable(); if ( trans && clipboard) { // 3. register the data flavors you want, highest fidelity first! trans.addDataFlavor("text/calendar"); trans.addDataFlavor("text/unicode"); // 4. get transferable from clipboard clipboard.getData ( trans, kClipboardIID.kGlobalClipboard); // 5. ask transferable for the best flavor. Need to create new JS // objects for the out params. var flavour = { }; var data = { }; var length = { }; trans.getAnyTransferData(flavour, data, length); data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data; //DEBUG alert("clipboard type: " + flavour.value); var calendarEventArray; var startDate; switch (flavour.value) { case "text/calendar": calendarEventArray = parseIcalData( data ); //change the date of all the events to now startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); break; case "text/unicode": if ( data.indexOf("BEGIN:VEVENT") == -1 ) { // no iCalendar data, paste clipboard text into description of new event calendarEvent = createEvent(); initCalendarEvent( calendarEvent ); calendarEvent.description = data; editNewEvent( calendarEvent ); } else { calendarEventArray = parseIcalData( data ); //change the date of all the events to now startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); } break; default: alert("Unknown clipboard type: " + flavour.value); } } } else alert( "No iCalendar or text on the clipboard." );}
for( var i = 0; i < calendarEventArray.length; i++ )
for( i = 0; i < calendarEventArray.length; i++ )
function pasteFromClipboard(){ const kClipboardIID = Components.interfaces.nsIClipboard; if( canPaste() ) { // 1. get the clipboard service var clipboard = getClipboard(); // 2. create the transferable var trans = createTransferable(); if ( trans && clipboard) { // 3. register the data flavors you want, highest fidelity first! trans.addDataFlavor("text/calendar"); trans.addDataFlavor("text/unicode"); // 4. get transferable from clipboard clipboard.getData ( trans, kClipboardIID.kGlobalClipboard); // 5. ask transferable for the best flavor. Need to create new JS // objects for the out params. var flavour = { }; var data = { }; var length = { }; trans.getAnyTransferData(flavour, data, length); data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data; //DEBUG alert("clipboard type: " + flavour.value); var calendarEventArray; var startDate; switch (flavour.value) { case "text/calendar": calendarEventArray = parseIcalData( data ); //change the date of all the events to now startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); break; case "text/unicode": if ( data.indexOf("BEGIN:VEVENT") == -1 ) { // no iCalendar data, paste clipboard text into description of new event calendarEvent = createEvent(); initCalendarEvent( calendarEvent ); calendarEvent.description = data; editNewEvent( calendarEvent ); } else { calendarEventArray = parseIcalData( data ); //change the date of all the events to now startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); } break; default: alert("Unknown clipboard type: " + flavour.value); } } } else alert( "No iCalendar or text on the clipboard." );}
var calendarEventArray;
function pasteFromClipboard(){ const kClipboardIID = Components.interfaces.nsIClipboard; if( canPaste() ) { // 1. get the clipboard service var clipboard = getClipboard(); // 2. create the transferable var trans = createTransferable(); if ( trans && clipboard) { // 3. register the data flavors you want, highest fidelity first! trans.addDataFlavor("text/calendar"); trans.addDataFlavor("text/unicode"); // 4. get transferable from clipboard clipboard.getData ( trans, kClipboardIID.kGlobalClipboard); // 5. ask transferable for the best flavor. Need to create new JS // objects for the out params. var flavour = { }; var data = { }; var length = { }; trans.getAnyTransferData(flavour, data, length); data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; //DEBUG alert("clipboard type: " + flavour.value); var calendarEventArray; switch (flavour.value) { case "text/calendar": calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); break; case "text/unicode": if ( data.indexOf("BEGIN:VCALENDAR") == -1 ) { // no iCalendar data, paste clipboard text into description of new event calendarEvent = createEvent(); initCalendarEvent( calendarEvent ); calendarEvent.description = data; editNewEvent( calendarEvent ); } else { calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); } break; default: alert("Unknown clipboard type: " + flavour.value); } } } else alert( "No iCalendar or text on the clipboard." );}
if ( data.indexOf("BEGIN:VCALENDAR") == -1 )
if ( data.indexOf("BEGIN:VEVENT") == -1 )
function pasteFromClipboard(){ const kClipboardIID = Components.interfaces.nsIClipboard; if( canPaste() ) { // 1. get the clipboard service var clipboard = getClipboard(); // 2. create the transferable var trans = createTransferable(); if ( trans && clipboard) { // 3. register the data flavors you want, highest fidelity first! trans.addDataFlavor("text/calendar"); trans.addDataFlavor("text/unicode"); // 4. get transferable from clipboard clipboard.getData ( trans, kClipboardIID.kGlobalClipboard); // 5. ask transferable for the best flavor. Need to create new JS // objects for the out params. var flavour = { }; var data = { }; var length = { }; trans.getAnyTransferData(flavour, data, length); data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; //DEBUG alert("clipboard type: " + flavour.value); var calendarEventArray; switch (flavour.value) { case "text/calendar": calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); break; case "text/unicode": if ( data.indexOf("BEGIN:VCALENDAR") == -1 ) { // no iCalendar data, paste clipboard text into description of new event calendarEvent = createEvent(); initCalendarEvent( calendarEvent ); calendarEvent.description = data; editNewEvent( calendarEvent ); } else { calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); } break; default: alert("Unknown clipboard type: " + flavour.value); } } } else alert( "No iCalendar or text on the clipboard." );}
var calendarEventArray;
function pasteFromClipboard(){ const kClipboardIID = Components.interfaces.nsIClipboard; if( canPaste() ) { // 1. get the clipboard service var clipboard = getClipboard(); // 2. create the transferable var trans = createTransferable(); if ( trans && clipboard) { // 3. register the data flavors you want, highest fidelity first! trans.addDataFlavor("text/calendar"); trans.addDataFlavor("text/unicode"); // 4. get transferable from clipboard clipboard.getData ( trans, kClipboardIID.kGlobalClipboard); // 5. ask transferable for the best flavor. Need to create new JS // objects for the out params. var flavour = { }; var data = { }; var length = { }; trans.getAnyTransferData(flavour, data, length); data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; //DEBUG alert("clipboard type: " + flavour.value); var calendarEventArray; switch (flavour.value) { case "text/calendar": calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); break; case "text/unicode": if ( data.indexOf("BEGIN:VCALENDAR") == -1 ) { // no iCalendar data, paste clipboard text into description of new event calendarEvent = createEvent(); initCalendarEvent( calendarEvent ); calendarEvent.description = data; editNewEvent( calendarEvent ); } else { calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); } break; default: alert("Unknown clipboard type: " + flavour.value); } } } else alert( "No iCalendar or text on the clipboard." );}
var calendarEventArray;
function pasteFromClipboard(){ const kClipboardIID = Components.interfaces.nsIClipboard; if( canPaste() ) { // 1. get the clipboard service var clipboard = getClipboard(); // 2. create the transferable var trans = createTransferable(); if ( trans && clipboard) { // 3. register the data flavors you want, highest fidelity first! trans.addDataFlavor("text/calendar"); trans.addDataFlavor("text/unicode"); // 4. get transferable from clipboard clipboard.getData ( trans, kClipboardIID.kGlobalClipboard); // 5. ask transferable for the best flavor. Need to create new JS // objects for the out params. var flavour = { }; var data = { }; var length = { }; trans.getAnyTransferData(flavour, data, length); data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; //DEBUG alert("clipboard type: " + flavour.value); switch (flavour.value) { case "text/calendar": var calendarEventArray; calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); break; case "text/unicode": if ( data.indexOf("BEGIN:VEVENT") == -1 ) { // no iCalendar data, paste clipboard text into description of new event calendarEvent = createEvent(); initCalendarEvent( calendarEvent ); calendarEvent.description = data; editNewEvent( calendarEvent ); } else { var calendarEventArray; calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); } break; default: alert("Unknown clipboard type: " + flavour.value); } } } else alert( "No iCalendar or text on the clipboard." );}
if ( data.indexOf("BEGIN:VEVENT") == -1 )
if ( data.indexOf("BEGIN:VCALENDAR") == -1 )
function pasteFromClipboard(){ const kClipboardIID = Components.interfaces.nsIClipboard; if( canPaste() ) { // 1. get the clipboard service var clipboard = getClipboard(); // 2. create the transferable var trans = createTransferable(); if ( trans && clipboard) { // 3. register the data flavors you want, highest fidelity first! trans.addDataFlavor("text/calendar"); trans.addDataFlavor("text/unicode"); // 4. get transferable from clipboard clipboard.getData ( trans, kClipboardIID.kGlobalClipboard); // 5. ask transferable for the best flavor. Need to create new JS // objects for the out params. var flavour = { }; var data = { }; var length = { }; trans.getAnyTransferData(flavour, data, length); data = data.value.QueryInterface(Components.interfaces.nsISupportsWString).data; //DEBUG alert("clipboard type: " + flavour.value); switch (flavour.value) { case "text/calendar": var calendarEventArray; calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); break; case "text/unicode": if ( data.indexOf("BEGIN:VEVENT") == -1 ) { // no iCalendar data, paste clipboard text into description of new event calendarEvent = createEvent(); initCalendarEvent( calendarEvent ); calendarEvent.description = data; editNewEvent( calendarEvent ); } else { var calendarEventArray; calendarEventArray = parseIcalData( data ); //change the date of all the events to now var startDate = gCalendarWindow.currentView.getNewEventDate(); var MinutesToAddOn = gCalendarWindow.calendarPreferences.getPref( "defaulteventlength" ); var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn ); for( var i = 0; i < calendarEventArray.length; i++ ) { calendarEventArray[i].start.setTime( startDate ); calendarEventArray[i].end.setTime( endDateTime ); } addEventsToCalendar( calendarEventArray ); } break; default: alert("Unknown clipboard type: " + flavour.value); } } } else alert( "No iCalendar or text on the clipboard." );}
if (treechild.tagName == 'treechildren') {
if (treechild.localName == 'treechildren') {
function PerformExpandForAllOpenServers(tree){ //dump("PerformExpandForAllOpenServers()\n"); var uri = null; var open = null; var treechild = null; var server = null; if ( tree && tree.childNodes ) { for ( var i = tree.childNodes.length - 1; i >= 0; i-- ) { treechild = tree.childNodes[i]; if (treechild.tagName == 'treechildren') { var treeitems = treechild.childNodes; for ( var j = treeitems.length - 1; j >= 0; j--) { open = treeitems[j].getAttribute('open'); //dump("open="+open+"\n"); if (open == "true") { var isServer = (treeitems[j].getAttribute('IsServer') == "true"); //dump("isServer="+isServer+"\n"); if (isServer) { uri = treeitems[j].getAttribute('id'); //dump("uri="+uri+"\n"); server = GetServer(uri); if (server) { //dump("PerformExpand on " + uri + "\n"); server.PerformExpand(msgWindow); } } } } } } }}
UpdateStandAloneMessageCounts();
function performNavigation(type){ var resultId = new Object; var resultIndex = new Object; var threadIndex = new Object; gDBView.viewNavigate(type, resultId, resultIndex, threadIndex, true /* wrap */); // if we found something....display it. if ((resultId.value != nsMsgKey_None) && (resultIndex.value != nsMsgKey_None)) { // load the message key gDBView.loadMessageByMsgKey(resultId.value); return; } // we need to span another folder CrossFolderNavigation(type, false);}
if ((resultId.value != -1) && (resultIndex.value != -1))
if ((resultId.value != nsMsgViewIndex_None) && (resultIndex.value != nsMsgViewIndex_None))
function performNavigation(type){ var resultId = new Object; var resultIndex = new Object; var threadIndex = new Object; gDBView.viewNavigate(type, resultId, resultIndex, threadIndex, true /* wrap */); // if we found something....display it. if ((resultId.value != -1) && (resultIndex.value != -1)) { // load the message key gDBView.loadMessageByMsgKey(resultId.value); return; } // we need to span another folder CrossFolderNavigation(type, false);}
var sidebar = document.getElementById('sidebar-box');
var sidebarBox = document.getElementById('sidebar-box');
function persist_width() { // XXX Partial workaround for bug #19488. var sidebar = document.getElementById('sidebar-box'); var sidebar_splitter = document.getElementById('sidebar-splitter'); var state = sidebar_splitter.getAttribute('state'); var width = sidebar.getAttribute('width'); if (!state || state == '' || state == 'open') { sidebar.removeAttribute('hackforbug20546'); sidebar.setAttribute('hackforbug20546-applied','true'); } if (width && (width > 410 || width < 15)) { sidebar.setAttribute('width',168); } document.persist('sidebar-box', 'width');}
var width = sidebar.getAttribute('width');
var width = sidebarBox.getAttribute('width');
function persist_width() { // XXX Partial workaround for bug #19488. var sidebar = document.getElementById('sidebar-box'); var sidebar_splitter = document.getElementById('sidebar-splitter'); var state = sidebar_splitter.getAttribute('state'); var width = sidebar.getAttribute('width'); if (!state || state == '' || state == 'open') { sidebar.removeAttribute('hackforbug20546'); sidebar.setAttribute('hackforbug20546-applied','true'); } if (width && (width > 410 || width < 15)) { sidebar.setAttribute('width',168); } document.persist('sidebar-box', 'width');}
sidebar.removeAttribute('hackforbug20546'); sidebar.setAttribute('hackforbug20546-applied','true');
sidebarBox.removeAttribute('hackforbug20546'); sidebarBox.setAttribute('hackforbug20546-applied','true');
function persist_width() { // XXX Partial workaround for bug #19488. var sidebar = document.getElementById('sidebar-box'); var sidebar_splitter = document.getElementById('sidebar-splitter'); var state = sidebar_splitter.getAttribute('state'); var width = sidebar.getAttribute('width'); if (!state || state == '' || state == 'open') { sidebar.removeAttribute('hackforbug20546'); sidebar.setAttribute('hackforbug20546-applied','true'); } if (width && (width > 410 || width < 15)) { sidebar.setAttribute('width',168); } document.persist('sidebar-box', 'width');}
sidebar.setAttribute('width',168);
sidebarBox.setAttribute('width',168);
function persist_width() { // XXX Partial workaround for bug #19488. var sidebar = document.getElementById('sidebar-box'); var sidebar_splitter = document.getElementById('sidebar-splitter'); var state = sidebar_splitter.getAttribute('state'); var width = sidebar.getAttribute('width'); if (!state || state == '' || state == 'open') { sidebar.removeAttribute('hackforbug20546'); sidebar.setAttribute('hackforbug20546-applied','true'); } if (width && (width > 410 || width < 15)) { sidebar.setAttribute('width',168); } document.persist('sidebar-box', 'width');}
var is_collapsed = document.getElementById('sidebar-box'). getAttribute('collapsed') == 'true'; SidebarSetButtonOpen(!is_collapsed);
function persist_width() { // XXX Mini hack. Persist isn't working too well. Force the persist, // but wait until the width change has commited. setTimeout("document.persist('sidebar-box', 'width');",100);}
var undoItems = ss.getClosedTabData(window); var keys = undoItems.getKeys({}); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var tabData = undoItems.getValue(key).wrappedJSObject;
var undoItems = eval("(" + ss.getClosedTabData(window) + ")"); for (var i = 0; i < undoItems.length; i++) {
HistoryMenu.populateUndoSubmenu = function PHM_populateUndoSubmenu() { var undoPopup = document.getElementById("historyUndoPopup"); // remove existing menu items while (undoPopup.hasChildNodes()) undoPopup.removeChild(undoPopup.firstChild); // get closed-tabs from nsSessionStore var ss = Cc["@mozilla.org/browser/sessionstore;1"]. getService(Ci.nsISessionStore); // no restorable tabs, so make sure menu is disabled, and return if (ss.getClosedTabCount(window) == 0) { undoPopup.parentNode.setAttribute("disabled", true); return; } // enable menu undoPopup.parentNode.removeAttribute("disabled"); // populate menu var undoItems = ss.getClosedTabData(window); var keys = undoItems.getKeys({}); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var tabData = undoItems.getValue(key).wrappedJSObject; var m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", tabData.title); m.setAttribute("value", key); m.addEventListener("command", function(aEvent) { undoCloseTab(aEvent.originalTarget.getAttribute("value")); }, false); } // "open in tabs" var strings = document.getElementById("placeBundle"); undoPopup.appendChild(document.createElement("menuseparator")); m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", strings.getString("menuOpenInTabs.label")); m.setAttribute("accesskey", strings.getString("menuOpenInTabs.accesskey")); m.addEventListener("command", function() { for (var i = 0; i < keys.length; i++) undoCloseTab(); }, false);}
m.setAttribute("label", tabData.title); m.setAttribute("value", key); m.addEventListener("command", function(aEvent) { undoCloseTab(aEvent.originalTarget.getAttribute("value")); }, false);
m.setAttribute("label", undoItems[i].title); m.setAttribute("value", i); m.setAttribute("oncommand", "undoCloseTab(" + i + ");");
HistoryMenu.populateUndoSubmenu = function PHM_populateUndoSubmenu() { var undoPopup = document.getElementById("historyUndoPopup"); // remove existing menu items while (undoPopup.hasChildNodes()) undoPopup.removeChild(undoPopup.firstChild); // get closed-tabs from nsSessionStore var ss = Cc["@mozilla.org/browser/sessionstore;1"]. getService(Ci.nsISessionStore); // no restorable tabs, so make sure menu is disabled, and return if (ss.getClosedTabCount(window) == 0) { undoPopup.parentNode.setAttribute("disabled", true); return; } // enable menu undoPopup.parentNode.removeAttribute("disabled"); // populate menu var undoItems = ss.getClosedTabData(window); var keys = undoItems.getKeys({}); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var tabData = undoItems.getValue(key).wrappedJSObject; var m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", tabData.title); m.setAttribute("value", key); m.addEventListener("command", function(aEvent) { undoCloseTab(aEvent.originalTarget.getAttribute("value")); }, false); } // "open in tabs" var strings = document.getElementById("placeBundle"); undoPopup.appendChild(document.createElement("menuseparator")); m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", strings.getString("menuOpenInTabs.label")); m.setAttribute("accesskey", strings.getString("menuOpenInTabs.accesskey")); m.addEventListener("command", function() { for (var i = 0; i < keys.length; i++) undoCloseTab(); }, false);}
for (var i = 0; i < keys.length; i++)
for (var i = 0; i < undoItems.length; i++)
HistoryMenu.populateUndoSubmenu = function PHM_populateUndoSubmenu() { var undoPopup = document.getElementById("historyUndoPopup"); // remove existing menu items while (undoPopup.hasChildNodes()) undoPopup.removeChild(undoPopup.firstChild); // get closed-tabs from nsSessionStore var ss = Cc["@mozilla.org/browser/sessionstore;1"]. getService(Ci.nsISessionStore); // no restorable tabs, so make sure menu is disabled, and return if (ss.getClosedTabCount(window) == 0) { undoPopup.parentNode.setAttribute("disabled", true); return; } // enable menu undoPopup.parentNode.removeAttribute("disabled"); // populate menu var undoItems = ss.getClosedTabData(window); var keys = undoItems.getKeys({}); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var tabData = undoItems.getValue(key).wrappedJSObject; var m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", tabData.title); m.setAttribute("value", key); m.addEventListener("command", function(aEvent) { undoCloseTab(aEvent.originalTarget.getAttribute("value")); }, false); } // "open in tabs" var strings = document.getElementById("placeBundle"); undoPopup.appendChild(document.createElement("menuseparator")); m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", strings.getString("menuOpenInTabs.label")); m.setAttribute("accesskey", strings.getString("menuOpenInTabs.accesskey")); m.addEventListener("command", function() { for (var i = 0; i < keys.length; i++) undoCloseTab(); }, false);}
var urls = [];
HistoryMenu.populateUndoSubmenu = function PHM_populateUndoSubmenu() { var undoPopup = document.getElementById("historyUndoPopup"); // remove existing menu items while (undoPopup.hasChildNodes()) undoPopup.removeChild(undoPopup.firstChild); // get closed-tabs from nsSessionStore var ss = Cc["@mozilla.org/browser/sessionstore;1"]. getService(Ci.nsISessionStore); // no restorable tabs, so make sure menu is disabled, and return if (ss.getClosedTabCount(window) == 0) { undoPopup.parentNode.setAttribute("disabled", true); return; } // enable menu undoPopup.parentNode.removeAttribute("disabled"); // populate menu var urls = []; var undoItems = ss.getClosedTabData(window); var keys = undoItems.getKeys({}); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var tabData = undoItems.getValue(key).wrappedJSObject; var m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", tabData.title); m.setAttribute("value", key); m.addEventListener("command", function(aEvent) { undoCloseTab(aEvent.originalTarget.getAttribute("value")); }, false); urls.push(tabData.state.entries[0].url); } // "open in tabs" var strings = document.getElementById("placeBundle"); undoPopup.appendChild(document.createElement("menuseparator")); m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", strings.getString("menuOpenInTabs.label")); m.setAttribute("accesskey", strings.getString("menuOpenInTabs.accesskey")); m.addEventListener("command", function() { loadOneOrMoreURIs(urls.join("|")); }, false);}
urls.push(tabData.state.entries[0].url);
HistoryMenu.populateUndoSubmenu = function PHM_populateUndoSubmenu() { var undoPopup = document.getElementById("historyUndoPopup"); // remove existing menu items while (undoPopup.hasChildNodes()) undoPopup.removeChild(undoPopup.firstChild); // get closed-tabs from nsSessionStore var ss = Cc["@mozilla.org/browser/sessionstore;1"]. getService(Ci.nsISessionStore); // no restorable tabs, so make sure menu is disabled, and return if (ss.getClosedTabCount(window) == 0) { undoPopup.parentNode.setAttribute("disabled", true); return; } // enable menu undoPopup.parentNode.removeAttribute("disabled"); // populate menu var urls = []; var undoItems = ss.getClosedTabData(window); var keys = undoItems.getKeys({}); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var tabData = undoItems.getValue(key).wrappedJSObject; var m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", tabData.title); m.setAttribute("value", key); m.addEventListener("command", function(aEvent) { undoCloseTab(aEvent.originalTarget.getAttribute("value")); }, false); urls.push(tabData.state.entries[0].url); } // "open in tabs" var strings = document.getElementById("placeBundle"); undoPopup.appendChild(document.createElement("menuseparator")); m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", strings.getString("menuOpenInTabs.label")); m.setAttribute("accesskey", strings.getString("menuOpenInTabs.accesskey")); m.addEventListener("command", function() { loadOneOrMoreURIs(urls.join("|")); }, false);}
m.addEventListener("command", function() { loadOneOrMoreURIs(urls.join("|")); }, false);
m.addEventListener("command", function() { for (var i = 0; i < keys.length; i++) undoCloseTab(); }, false);
HistoryMenu.populateUndoSubmenu = function PHM_populateUndoSubmenu() { var undoPopup = document.getElementById("historyUndoPopup"); // remove existing menu items while (undoPopup.hasChildNodes()) undoPopup.removeChild(undoPopup.firstChild); // get closed-tabs from nsSessionStore var ss = Cc["@mozilla.org/browser/sessionstore;1"]. getService(Ci.nsISessionStore); // no restorable tabs, so make sure menu is disabled, and return if (ss.getClosedTabCount(window) == 0) { undoPopup.parentNode.setAttribute("disabled", true); return; } // enable menu undoPopup.parentNode.removeAttribute("disabled"); // populate menu var urls = []; var undoItems = ss.getClosedTabData(window); var keys = undoItems.getKeys({}); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var tabData = undoItems.getValue(key).wrappedJSObject; var m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", tabData.title); m.setAttribute("value", key); m.addEventListener("command", function(aEvent) { undoCloseTab(aEvent.originalTarget.getAttribute("value")); }, false); urls.push(tabData.state.entries[0].url); } // "open in tabs" var strings = document.getElementById("placeBundle"); undoPopup.appendChild(document.createElement("menuseparator")); m = undoPopup.appendChild(document.createElement("menuitem")); m.setAttribute("label", strings.getString("menuOpenInTabs.label")); m.setAttribute("accesskey", strings.getString("menuOpenInTabs.accesskey")); m.addEventListener("command", function() { loadOneOrMoreURIs(urls.join("|")); }, false);}
for (var ii=1; ii < panels.childNodes.length; ii += 2) {
for (var ii=2; ii < panels.childNodes.length; ii += 2) {
function pick_last_panel(panels) { last_non_excluded_index = null; debug("pick_default_panel: length="+panels.childNodes.length); for (var ii=1; ii < panels.childNodes.length; ii += 2) { if (!is_excluded(panels.childNodes.item(ii))) { last_non_excluded_index = ii; } } return last_non_excluded_index;}
var rv = picker.show(); if (rv != PICK_CANCEL)
var rv = getPickerChoice(picker); if (rv.ok)
function pickGetFolder(title, defaultDir){ if (!defaultDir && "lastOpenDir" in futils) defaultDir = futils.lastOpenDir; var picker = futils.getPicker(defaultDir); picker.init(window, title ? title : futils.MSG_OPEN, Components.interfaces.nsIFilePicker.modeGetFolder); var rv = picker.show(); if (rv != PICK_CANCEL) futils.lastOpenDir = picker.file; return {reason: rv, file: picker.file, picker: picker};}
return {reason: rv, file: picker.file, picker: picker};
return rv;
function pickGetFolder(title, defaultDir){ if (!defaultDir && "lastOpenDir" in futils) defaultDir = futils.lastOpenDir; var picker = futils.getPicker(defaultDir); picker.init(window, title ? title : futils.MSG_OPEN, Components.interfaces.nsIFilePicker.modeGetFolder); var rv = picker.show(); if (rv != PICK_CANCEL) futils.lastOpenDir = picker.file; return {reason: rv, file: picker.file, picker: picker};}