null
null
false
null
null
null
null
null
parseInt(this.getAttribute("shrinkdelay")) || 0
14
false
false
null
= 1)
this.mController.handleTab();
break;
case KeyEvent.DOM_VK_UP:
case KeyEvent.DOM_VK_DOWN:
case KeyEvent.DOM_VK_PAGE_UP:
case KeyEvent.DOM_VK_PAGE_DOWN:
cancel = this.mController.handleKeyNavigation(aEvent.keyCode);
break;
}
}
// Handle keys we know aren't part of a shortcut, even with Alt or
// Ctrl.
switch (aEvent.keyCode) {
case KeyEvent.DOM_VK_ESCAPE:
cancel = this.mController.handleEscape();
break;
case KeyEvent.DOM_VK_RETURN:
if (/Mac/.test(navigator.platform)) {
// Prevent the default action, since it will beep on Mac
if (aEvent.metaKey)
aEvent.preventDefault();
}
if (this.mController.selection) {
this._selectionDetails = {
index: this.mController.selection.currentIndex,
kind: "key"
};
}
cancel = this.handleEnter(aEvent);
break;
case KeyEvent.DOM_VK_DELETE:
if (/Mac/.test(navigator.platform) && !aEvent.shiftKey) {
break;
}
cancel = this.handleDelete();
break;
case KeyEvent.DOM_VK_BACK_SPACE:
if (/Mac/.test(navigator.platform) && aEvent.shiftKey) {
cancel = this.handleDelete();
}
break;
case KeyEvent.DOM_VK_DOWN:
case KeyEvent.DOM_VK_UP:
if (aEvent.altKey)
this.toggleHistoryPopup();
break;
case KeyEvent.DOM_VK_F4:
if (!/Mac/.test(navigator.platform)) {
this.toggleHistoryPopup();
}
break;
}
if (cancel) {
aEvent.stopPropagation();
aEvent.preventDefault();
}
return true;
]]>
false
aCommand == "cmd_paste",
doCommand: function(aCommand) {
this._autocomplete._valueIsPasted = true;
this._autocomplete.editor.paste(this._kGlobalClipboard);
this._autocomplete._valueIsPasted = false;
},
isCommandEnabled: function(aCommand) {
return this._autocomplete.editor.isSelectionEditable &&
this._autocomplete.editor.canPaste(this._kGlobalClipboard);
},
onEvent: function() {}
})
]]>
= 1) {
// mousemove sets selected index. Don't blindly use that selected
// index in this blur handler since if the popup is open you can
// easily "select" another match just by moving the mouse over it.
let filledVal = this.value.replace(/.+ >> /, "").toLowerCase();
let selectedVal = null;
if (this.popup.selectedIndex >= 0) {
selectedVal = this.mController.getFinalCompleteValueAt(
this.popup.selectedIndex);
}
if (selectedVal && filledVal != selectedVal.toLowerCase()) {
for (let i = 0; i < this.mController.matchCount; i++) {
let matchVal = this.mController.getFinalCompleteValueAt(i);
if (matchVal.toLowerCase() == filledVal) {
this.popup.selectedIndex = i;
break;
}
}
}
this.mController.handleEnter(false);
}
if (!this.ignoreBlurWhileSearching)
this.detachController();
}
]]>
—
—
str).join(" ")
// allow consumers that have extended popups to override
// the label values for the richlistitems
let panel = this.parentNode.parentNode;
if (panel.createResultLabel) {
return panel.createResultLabel(this, label);
}
return label;
]]>
null
false
= 0) {
regions.push([matchIndex, matchIndex + searchLen]);
}
}
// Sort the regions by start position then end position
regions = regions.sort((a, b) => {
let start = a[0] - b[0];
return (start == 0) ? a[1] - b[1] : start;
});
// Generate the boundary indices from each region
let start = 0;
let end = 0;
let boundaries = [];
let len = regions.length;
for (let i = 0; i < len; i++) {
// We have a new boundary if the start of the next is past the end
let region = regions[i];
if (region[0] > end) {
// First index is the beginning of match
boundaries.push(start);
// Second index is the beginning of non-match
boundaries.push(end);
// Track the new region now that we've stored the previous one
start = region[0];
}
// Push back the end index for the current or new region
end = Math.max(end, region[1]);
}
// Add the last region
boundaries.push(start);
boundaries.push(end);
// Put on the end boundary if necessary
if (end < aText.length)
boundaries.push(aText.length);
// Skip the first item because it's always 0
return boundaries.slice(1);
]]>
= 0 && index < aReplacements.length) {
pairs.push([...aReplacements[index]]);
}
} else {
pairs.push([part]);
}
}
return pairs;
]]>
null
= 0) {
pairs = [
[searchSuggestion.substring(0, idx), ""],
[searchQuery, "match"],
[searchSuggestion.substring(idx + searchQuery.length), ""],
];
} else {
pairs = [
[searchSuggestion, ""],
];
}
} else {
pairs = [
[searchQuery, ""],
];
}
let interpStr = pairs.map((pair, i) => `%${i + 1}$S`).join("");
title = this._generateEmphasisPairs(interpStr, pairs);
// If this is a default search match, we remove the image so we
// can style it ourselves with a generic search icon.
// We don't do this when matching an aliased search engine,
// because the icon helps with recognising which engine will be
// used (when using the default engine, we don't need that
// recognition).
if (!action.params.alias && !initialTypes.has("favicon")) {
this.removeAttribute("image");
}
} else if (action.type == "visiturl") {
emphasiseUrl = false;
displayUrl = this._unescapeUrl(action.params.url);
title = displayUrl;
titleLooksLikeUrl = true;
let visitStr = this._stringBundle.GetStringFromName("visit");
this._setUpDescription(this._actionText, visitStr, true);
} else if (action.type == "extension") {
let content = action.params.content;
displayUrl = content;
this._setUpDescription(this._actionText, content, true);
}
}
if (!displayUrl) {
let input = popup.input;
let url = typeof(input.trimValue) == "function" ?
input.trimValue(originalUrl) :
originalUrl;
displayUrl = this._unescapeUrl(url);
}
// For performance reasons we may want to limit the displayUrl size.
if (popup.textRunsMaxLen) {
displayUrl = displayUrl.substr(0, popup.textRunsMaxLen);
}
this.setAttribute("displayurl", displayUrl);
// Show the domain as the title if we don't have a title.
if (!title) {
title = displayUrl;
titleLooksLikeUrl = true;
try {
let uri = Services.io.newURI(originalUrl, null, null);
// Not all valid URLs have a domain.
if (uri.host)
title = uri.host;
} catch (e) {}
}
this._tags.setAttribute("empty", "true");
if (type == "tag" || type == "bookmark-tag") {
// The title is separated from the tags by an endash
let tags;
[, title, tags] = title.match(/^(.+) \u2013 (.+)$/);
// Each tag is split by a comma in an undefined order, so sort it
let sortedTags = tags.split(/\s*,\s*/).sort((a, b) => {
return a.localeCompare(a);
});
let anyTagsMatch = this._setUpTags(sortedTags);
if (anyTagsMatch) {
this._tags.removeAttribute("empty");
}
if (type == "bookmark-tag") {
type = "bookmark";
}
} else if (type == "keyword") {
// Note that this is a moz-action with action.type == keyword.
emphasiseUrl = false;
let keywordArg = this.getAttribute("text").replace(/^[^\s]+\s*/, "");
if (!keywordArg) {
// Treat keyword searches without arguments as visiturl actions.
type = "visiturl";
this.setAttribute("actiontype", "visiturl");
let visitStr = this._stringBundle.GetStringFromName("visit");
this._setUpDescription(this._actionText, visitStr, true);
} else {
let pairs = [[title, ""], [keywordArg, "match"]];
let interpStr =
this._stringBundle.GetStringFromName("bookmarkKeywordSearch");
title = this._generateEmphasisPairs(interpStr, pairs);
// The action box will be visible since this is a moz-action, but
// we want it to appear as if it were not visible, so set its text
// to the empty string.
this._setUpDescription(this._actionText, "", false);
}
}
this.setAttribute("type", type);
if (titleLooksLikeUrl) {
this._titleText.setAttribute("lookslikeurl", "true");
} else {
this._titleText.removeAttribute("lookslikeurl");
}
if (Array.isArray(title)) {
// For performance reasons we may want to limit the title size.
if (popup.textRunsMaxLen) {
title = title.map(t => t.substr(0, popup.textRunsMaxLen));
}
this._setUpEmphasisedSections(this._titleText, title);
} else {
// For performance reasons we may want to limit the title size.
if (popup.textRunsMaxLen) {
title = title.substr(0, popup.textRunsMaxLen);
}
this._setUpDescription(this._titleText, title, false);
}
this._setUpDescription(this._urlText, displayUrl, !emphasiseUrl);
if (this._inOverflow) {
this._handleOverflow();
}
]]>
0;
]]>
itemWidth) {
// Title + tags + URL/action overflows the item width.
// The percentage of the item width allocated to the title and tags.
let titleTagsPct = 0.66;
let titleTagsAvailable = itemWidth - separatorURLActionWidth;
let titleTagsMaxWidth = Math.max(
titleTagsAvailable,
itemWidth * titleTagsPct
);
if (titleTagsWidth > titleTagsMaxWidth) {
// Title + tags overflows the max title + tags width.
// The percentage of the title + tags width allocated to the
// title.
let titlePct = 0.33;
let titleAvailable = titleTagsMaxWidth - tagsRect.width;
let titleMaxWidth = Math.max(
titleAvailable,
titleTagsMaxWidth * titlePct
);
let tagsAvailable = titleTagsMaxWidth - titleRect.width;
let tagsMaxWidth = Math.max(
tagsAvailable,
titleTagsMaxWidth * (1 - titlePct)
);
this._titleText.style.maxWidth = titleMaxWidth + "px";
this._tagsText.style.maxWidth = tagsMaxWidth + "px";
}
let urlActionMaxWidth = Math.max(
itemWidth - titleTagsWidth,
itemWidth * (1 - titleTagsPct)
);
urlActionMaxWidth -= separatorRect.width;
this._urlText.style.maxWidth = urlActionMaxWidth + "px";
this._actionText.style.maxWidth = urlActionMaxWidth + "px";
}
]]>
Date.now()
-1
30) {
let item = event.target;
while (item && item.localName != "richlistitem") {
item = item.parentNode;
}
if (!item)
return;
let index = this.getIndexOfItem(item);
if (index != this.selectedIndex) {
this.mouseSelectedIndex = this.selectedIndex = index;
}
this.mLastMoveTime = Date.now();
}
]]>
Date.now()
30) {
var rc = this.parentNode.treeBoxObject.getRowAt(event.clientX, event.clientY);
if (rc != this.parentNode.currentIndex)
this.parentNode.view.selection.select(rc);
this.mLastMoveTime = Date.now();
}
]]>