/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if (AppConstants.platform === "macosx") { // 1. Map Edit->Find command to OrganizerCommand_find:all. Need to map // both the menuitem and the Find key.
let findMenuItem = document.getElementById("menu_find");
findMenuItem.setAttribute("command", "OrganizerCommand_find:all");
let findKey = document.getElementById("key_find");
findKey.setAttribute("command", "OrganizerCommand_find:all");
// 2. Disable some keybindings from browser.xhtml
let elements = ["cmd_handleBackspace", "cmd_handleShiftBackspace"]; for (let i = 0; i < elements.length; i++) {
document.getElementById(elements[i]).setAttribute("disabled", "true");
}
// 3. MacOS uses a <toolbarbutton> instead of a <menu>
document
.getElementById("organizeButton")
.addEventListener("popupshowing", () => {
document.getElementById("placeContent").focus();
});
}
// remove the "Edit" and "Edit Bookmark" context-menu item, we're in our own details pane
let contextMenu = document.getElementById("placesContext");
contextMenu.removeChild(document.getElementById("placesContext_show:info"));
contextMenu.removeChild(
document.getElementById("placesContext_show_bookmark:info")
);
contextMenu.removeChild(
document.getElementById("placesContext_show_folder:info")
);
let columnsContextPopup = document.getElementById("placesColumnsContext");
columnsContextPopup.addEventListener("command", event => {
ViewMenu.showHideColumn(event.target);
event.stopPropagation();
});
columnsContextPopup.addEventListener("popupshowing", event =>
ViewMenu.fillWithColumns(event, null, null, "checkbox", false)
);
if (!this._places.hasSelection) { // If no node was found for the given place: uri, just load it directly
ContentArea.currentPlace = aLocation;
} this.updateDetailsPane();
back: function PO_back() { this._forwardHistory.unshift(this.location); var historyEntry = this._backHistory.shift(); this._location = null; this.location = historyEntry;
},
forward: function PO_forward() { this._backHistory.unshift(this.location); var historyEntry = this._forwardHistory.shift(); this._location = null; this.location = historyEntry;
},
/** *Calledwhenaplacefolderisselectedintheleftpane. * *@paramresetSearchBox *trueifthesearchboxshouldalsobereset,falseotherwise. *Thesearchboxshouldberesetwhenanewfolderintheleft *paneisselected;thesearchscopeandtextneedtobeclearedin *preparationforthenewfolder.Notethatiftheusermanually *resetsthesearchbox,eitherbyclickingitsresetbuttonorby *deletingitstext,thiswillbefalse.
*/
_cachedLeftPaneSelectedURI: null,
onPlaceSelected: function PO_onPlaceSelected(resetSearchBox) { // Don't change the right-hand pane contents when there's no selection. if (!this._places.hasSelection) { return;
}
let node = this._places.selectedNode;
let placeURI = node.uri;
// If either the place of the content tree in the right pane has changed or // the user cleared the search box, update the place, hide the search UI, // and update the back/forward buttons by setting location. if (ContentArea.currentPlace != placeURI || !resetSearchBox) {
ContentArea.currentPlace = placeURI; this.location = placeURI;
}
// When we invalidate a container we use suppressSelectionEvent, when it is // unset a select event is fired, in many cases the selection did not really // change, so we should check for it, and return early in such a case. Note // that we cannot return any earlier than this point, because when // !resetSearchBox, we need to update location and hide the UI as above, // even though the selection has not changed. if (placeURI == this._cachedLeftPaneSelectedURI) { return;
} this._cachedLeftPaneSelectedURI = placeURI;
// At this point, resetSearchBox is true, because the left pane selection // has changed; otherwise we would have returned earlier.
let input = PlacesSearchBox.searchFilter;
input.clear();
input.editor?.clearUndoRedo(); this._setSearchScopeForNode(node); this.updateDetailsPane();
},
/** *SetsthesearchscopebasedonaNode'sproperties. * *@param{object}aNode *thenodetosetupscopefrom
*/
_setSearchScopeForNode: function PO__setScopeForNode(aNode) {
let itemGuid = aNode.bookmarkGuid;
if (
PlacesUtils.nodeIsHistoryContainer(aNode) ||
itemGuid == PlacesUtils.virtualHistoryGuid
) {
PlacesQueryBuilder.setScope("history");
} elseif (itemGuid == PlacesUtils.virtualDownloadsGuid) {
PlacesQueryBuilder.setScope("downloads");
} else { // Default to All Bookmarks for all other nodes, per bug 469437.
PlacesQueryBuilder.setScope("bookmarks");
}
},
/** *Handleclicksontheplaceslist. *SingleLeftclick,rightclickormodifiedclickdonotresultinany *specialaction,sincethey'rerelatedtoselection. * *@param{object}aEvent *Themouseevent.
*/
onPlacesListClick: function PO_onPlacesListClick(aEvent) { // Only handle clicks on tree children. if (aEvent.target.localName != "treechildren") { return;
}
let node = this._places.selectedNode; if (node) {
let middleClick = aEvent.button == 1 && aEvent.detail == 1; if (middleClick && PlacesUtils.nodeIsContainer(node)) { // The command execution function will take care of seeing if the // selection is a folder or a different container type, and will // load its contents in tabs.
PlacesUIUtils.openMultipleLinksInTabs(node, aEvent, this._places);
}
}
},
/** *Handlefocuschangesontheplaceslistandthecurrentcontentview.
*/
updateDetailsPane: function PO_updateDetailsPane() { if (!ContentArea.currentViewOptions.showDetailsPane) { return;
} // _fillDetailsPane is only invoked when the activeElement is a tree, // there's no other case where we need to update the details pane. This // means it's not possible that while some input field in the panel is // focused we try to update the panel contents causing potential dataloss // of the user's input.
let view = PlacesUIUtils.getViewForNode(document.activeElement); if (view) {
let selectedNodes = view.selectedNode
? [view.selectedNode]
: view.selectedNodes; this._fillDetailsPane(selectedNodes);
}
},
/** *Showthemigrationwizardforimportingpasswords, *cookies,history,preferences,andbookmarks.
*/
importFromBrowser: function PO_importFromBrowser() { // We pass in the type of source we're using for use in telemetry:
MigrationUtils.showMigrationWizard(window, {
entrypoint: MigrationUtils.MIGRATION_ENTRYPOINTS.PLACES,
});
},
/** *Openafile-pickerandimporttheselectedfileintothebookmarksstore
*/
importFromFile: function PO_importFromFile() {
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) { if (aResult != Ci.nsIFilePicker.returnCancel && fp.fileURL) { var { BookmarkHTMLUtils } = ChromeUtils.importESModule( "resource://gre/modules/BookmarkHTMLUtils.sys.mjs"
);
BookmarkHTMLUtils.importFromURL(fp.fileURL.spec).catch(console.error);
}
};
/** *Populatestherestoremenuwiththedatesofthebackupsavailable.
*/
populateRestoreMenu: function PO_populateRestoreMenu() {
let restorePopup = document.getElementById("fileRestorePopup");
const dtOptions = {
dateStyle: "long",
};
let dateFormatter = new Services.intl.DateTimeFormat(undefined, dtOptions);
// Remove existing menu items. Last item is the restoreFromFile item. while (restorePopup.childNodes.length > 1) {
restorePopup.firstChild.remove();
}
(async () => {
let backupFiles = await PlacesBackups.getBackupFiles(); if (!backupFiles.length) { return;
}
// Populate menu with backups. for (let file of backupFiles) {
let fileSize = (await IOUtils.stat(file)).size;
let [size, unit] = DownloadUtils.convertByteUnits(fileSize);
let sizeString = PlacesUtils.getFormattedString("backupFileSizeText", [
size,
unit,
]);
/** *Backupbookmarkstodesktop,auto-generateafilenamewithadate. *ThefileisaJSONserializationofbookmarks,tagsandanyannotations *ofthoseitems.
*/
backupBookmarks: function PO_backupBookmarks() {
let backupsDir = Services.dirsvc.get("Desk", Ci.nsIFile);
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) { if (aResult != Ci.nsIFilePicker.returnCancel) { // There is no OS.File version of the filepicker yet (Bug 937812).
PlacesBackups.saveBookmarksToJSONFile(fp.file.path).catch(
console.error
);
}
};
_fillDetailsPane: function PO__fillDetailsPane(aNodeList) { var infoBox = document.getElementById("infoBox"); var itemsCountBox = document.getElementById("itemsCountBox");
// Make sure the infoBox UI is visible if we need to use it, we hide it // below when we don't.
infoBox.hidden = false;
itemsCountBox.hidden = true;
let selectedNode = aNodeList.length == 1 ? aNodeList[0] : null;
// Don't update the panel if it's already editing this node, unless we're // in multi-edit mode. if (
selectedNode &&
!gEditItemOverlay.multiEdit &&
((gEditItemOverlay.concreteGuid &&
gEditItemOverlay.concreteGuid ==
PlacesUtils.getConcreteItemGuid(selectedNode)) ||
(!selectedNode.bookmarkGuid &&
gEditItemOverlay.uri &&
gEditItemOverlay.uri == selectedNode.uri))
) { return;
}
// Clean up the panel before initing it again.
gEditItemOverlay.uninitPanel(false);
/** *Folderstoincludewhensearching.
*/
_folders: [],
get folders() { if (!this._folders.length) { this._folders = PlacesUtils.bookmarks.userContentRoots;
} returnthis._folders;
},
set folders(aFolders) { this._folders = aFolders;
},
/** *Runasearchforthespecifiedtext,overthecollectionspecifiedby *thedropdownarrow.Thedefaultisallbookmarks,butcanbe *localizedtotheactivecollection. * *@param{string}filterString *Thetexttosearchfor.
*/
search(filterString) { var PO = PlacesOrganizer; // If the user empties the search box manually, reset it and load all // contents of the current scope. // XXX this might be to jumpy, maybe should search for "", so results // are ungrouped, and search box not reset if (filterString == "") {
PO.onPlaceSelected(false); return;
}
let currentView = ContentArea.currentView;
// Search according to the current scope, which was set by // PQB_setScope() switch (PlacesSearchBox.filterCollection) { case"bookmarks":
currentView.applyFilter(filterString, this.folders);
Glean.library.search.bookmarks.add(1); this.cumulativeBookmarkSearches++; break; case"history": {
let currentOptions = PO.getCurrentOptions(); if (
currentOptions.queryType !=
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY
) {
let query = PlacesUtils.history.getNewQuery();
query.searchTerms = filterString;
let options = currentOptions.clone(); // Make sure we're getting uri results.
options.resultType = currentOptions.RESULTS_AS_URI;
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY;
options.includeHidden = true;
currentView.load([query], options);
} else {
let timerId = Glean.library.historySearchTime.start();
currentView.applyFilter(filterString, null, true);
Glean.library.historySearchTime.stopAndAccumulate(timerId);
Glean.library.search.history.add(1); this.cumulativeHistorySearches++;
} break;
} case"downloads": { // The new downloads view doesn't use places for searching downloads.
currentView.searchTerm = filterString; break;
} default: thrownew Error("Invalid filterCollection on search");
}
// Update the details panel
PlacesOrganizer.updateDetailsPane();
},
/** *GetsorsetsthetextshowninthePlacesSearchBox * *@returns{string}
*/
get value() { returnthis.searchFilter.value;
},
set value(value) { this.searchFilter.value = value;
},
};
function updateTelemetry(urlsOpened) {
let historyLinks = urlsOpened.filter(
link => !link.isBookmark && !PlacesUtils.nodeIsBookmark(link)
); if (!historyLinks.length) {
Glean.library.cumulativeBookmarkSearches.accumulateSingleSample(
PlacesSearchBox.cumulativeBookmarkSearches
);
// Record cumulative search count before selecting History link from Library
Glean.library.cumulativeHistorySearches.accumulateSingleSample(
PlacesSearchBox.cumulativeHistorySearches
);
// Update the search box. Re-search if there's an active search.
PlacesSearchBox.filterCollection = filterCollection;
PlacesSearchBox.folders = folders; var searchStr = PlacesSearchBox.searchFilter.value; if (searchStr) {
PlacesSearchBox.search(searchStr);
}
},
};
/** *Removescontentgeneratedpreviouslyfromamenupopup. * *@param{object}popup *Thepopupthatcontainsthepreviouslygeneratedcontent. *@param{string}startID *Theidattributeofanelementthatisthestartofthe *dynamicallygeneratedregion-removeelementsafterthis *itemonly. *Mustbecontainedbypopup.Canbenull(inwhichcasethe *contentsofpopupareremoved). *@param{string}endID *Theidattributeofanelementthatistheendofthe *dynamicallygeneratedregion-removeelementsuptothis *itemonly. *Mustbecontainedbypopup.Canbenull(inwhichcaseall *itemsuntiltheendofthepopupwillberemoved).Ignored *ifstartIDisnull. *@returns{object|null}Theelementforthecallertoinsertnewitemsbefore, *nullifthecallershouldjustappendtothepopup.
*/
_clean: function VM__clean(popup, startID, endID) { if (endID && !startID) { thrownew Error("meaningless to have valid endID and null startID");
} if (startID) { var startElement = document.getElementById(startID); if (startElement.parentNode != popup) { thrownew Error("startElement is not in popup");
} if (!startElement) { thrownew Error("startID does not correspond to an existing element");
} var endElement = null; if (endID) {
endElement = document.getElementById(endID); if (endElement.parentNode != popup) { thrownew Error("endElement is not in popup");
} if (!endElement) { thrownew Error("endID does not correspond to an existing element");
}
} while (startElement.nextSibling != endElement) {
popup.removeChild(startElement.nextSibling);
} return endElement;
} while (popup.hasChildNodes()) {
popup.firstChild.remove();
} returnnull;
},
var sortColumn = this._getSortColumn(); var viewSortAscending = document.getElementById("viewSortAscending"); var viewSortDescending = document.getElementById("viewSortDescending"); // We need to remove an existing checked attribute because the unsorted // menu item is not rebuilt every time we open the menu like the others. var viewUnsorted = document.getElementById("viewUnsorted"); if (!sortColumn) {
viewSortAscending.removeAttribute("checked");
viewSortDescending.removeAttribute("checked");
viewUnsorted.setAttribute("checked", "true");
} elseif (sortColumn.getAttribute("sortDirection") == "ascending") {
viewSortAscending.setAttribute("checked", "true");
viewSortDescending.removeAttribute("checked");
viewUnsorted.removeAttribute("checked");
} elseif (sortColumn.getAttribute("sortDirection") == "descending") {
viewSortDescending.setAttribute("checked", "true");
viewSortAscending.removeAttribute("checked");
viewUnsorted.removeAttribute("checked");
}
},
/** *Shows/Hidesatreecolumn. * *@param{object}element *Themenuitemelementforthecolumn
*/
showHideColumn: function VM_showHideColumn(element) { var column = element.column;
var splitter = column.nextSibling; if (splitter && splitter.localName != "splitter") {
splitter = null;
}
/** *Getsthelastcolumnthatwassorted. * *@returns{object|null}thecurrentlysortedcolumn,nullifthereisnosortedcolumn.
*/
_getSortColumn: function VM__getSortColumn() { var content = document.getElementById("placeContent"); var cols = content.columns; for (var i = 0; i < cols.count; ++i) { var column = cols.getColumnAt(i).element; var sortDirection = column.getAttribute("sortDirection"); if (sortDirection == "ascending" || sortDirection == "descending") { return column;
}
} returnnull;
},
/** *Sortstheviewbythespecifiedcolumn. * *@param{object}aColumn *Thecolumthatisthesortkey.Canbenull-the *currentsortcolumnorthetitlecolumnwillbeused. *@param{string}aDirection *Thedirectiontosort-"ascending"or"descending". *Canbenull-thelastdirectionordescendingwillbeused. * *IfbothaColumnIDandaDirectionarenull,theviewwillbeunsorted.
*/
setSortColumn: function VM_setSortColumn(aColumn, aDirection) { var result = document.getElementById("placeContent").result; if (!aColumn && !aDirection) {
result.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE; return;
}
var columnId; if (aColumn) {
columnId = aColumn.getAttribute("anonid"); if (!aDirection) {
let sortColumn = this._getSortColumn(); if (sortColumn) {
aDirection = sortColumn.getAttribute("sortDirection");
}
}
} else {
let sortColumn = this._getSortColumn();
columnId = sortColumn ? sortColumn.getAttribute("anonid") : "title";
}
// This maps the possible values of columnId (i.e., anonid's of treecols in // placeContent) to the default sortingMode for each column. // key: Sort key in the name of one of the // nsINavHistoryQueryOptions.SORT_BY_* constants // dir: Default sort direction to use if none has been specified const colLookupTable = {
title: { key: "TITLE", dir: "ascending" },
tags: { key: "TAGS", dir: "ascending" },
url: { key: "URI", dir: "ascending" },
date: { key: "DATE", dir: "descending" },
visitCount: { key: "VISITCOUNT", dir: "descending" },
dateAdded: { key: "DATEADDED", dir: "descending" },
lastModified: { key: "LASTMODIFIED", dir: "descending" },
};
// Make sure we have a valid column. if (!colLookupTable.hasOwnProperty(columnId)) { thrownew Error("Invalid column");
}
// Use a default sort direction if none has been specified. If aDirection // is invalid, result.sortingMode will be undefined, which has the effect // of unsorting the tree.
aDirection = (aDirection || colLookupTable[columnId].dir).toUpperCase();
get currentView() {
let selectedPane = [...this._box.children].filter(
child => !child.hidden
)[0]; return PlacesUIUtils.getViewForNode(selectedPane);
},
set currentView(aNewView) {
let oldView = this.currentView; if (oldView != aNewView) {
oldView.associatedElement.hidden = true;
aNewView.associatedElement.hidden = false;
// If the content area inactivated view was focused, move focus // to the new view. if (document.activeElement == oldView.associatedElement) {
aNewView.associatedElement.focus();
}
}
},
get currentPlace() { returnthis.currentView.place;
},
set currentPlace(aQueryString) {
let oldView = this.currentView;
let newView = this.getContentViewForQueryString(aQueryString);
newView.place = aQueryString; if (oldView != newView) {
oldView.active = false; this.currentView = newView; this._setupView();
newView.active = true;
}
},
/** *Appliesviewoptions.
*/
_setupView: function CA__setupView() {
let options = this.currentViewOptions;
// showDetailsPane.
let detailsPane = document.getElementById("detailsPane");
detailsPane.hidden = !options.showDetailsPane;
// toolbarSet. for (let elt of this._toolbar.childNodes) { // On Windows and Linux the menu buttons are menus wrapped in a menubar. if (elt.id == "placesMenu") { for (let menuElt of elt.childNodes) {
menuElt.hidden = !options.toolbarSet.includes(menuElt.id);
}
} else {
elt.hidden = !options.toolbarSet.includes(elt.id);
}
}
},
/** *Optionsforthecurrentview. * *@see{@linkContentTree.viewOptions}forsupportedoptionsanddefaultvalues. *@returns{{showDetailsPane:boolean;toolbarSet:string;}}
*/
get currentViewOptions() { // Use ContentTree options as default.
let viewOptions = ContentTree.viewOptions; if (this._specialViews.has(this.currentPlace)) {
let { options } = this._specialViews.get(this.currentPlace); for (let option in options) {
viewOptions[option] = options[option];
}
} return viewOptions;
},
onClick: function CT_onClick(aEvent) {
let node = this.view.selectedNode; if (node) {
let doubleClick = aEvent.button == 0 && aEvent.detail == 2;
let middleClick = aEvent.button == 1 && aEvent.detail == 1; if (PlacesUtils.nodeIsURI(node) && (doubleClick || middleClick)) { // Open associated uri in the browser. this.openSelectedNode(aEvent);
} elseif (middleClick && PlacesUtils.nodeIsContainer(node)) { // The command execution function will take care of seeing if the // selection is a folder or a different container type, and will // load its contents in tabs.
PlacesUIUtils.openMultipleLinksInTabs(node, aEvent, this.view);
}
}
},
onKeyPress: function CT_onKeyPress(aEvent) { if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) { this.openSelectedNode(aEvent);
}
},
};
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.23Angebot
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.