From 4dcdf4e6597aafeebe3e98cae59cbcc297273a95 Mon Sep 17 00:00:00 2001 From: toady Date: Thu, 30 Mar 2017 09:00:47 +1000 Subject: [PATCH] Fixed: Alternate Appearance (Classic) with autocomplete popup --- .../content/css/alt_autocomplete.css | 48 +- .../content/css/autocompl_no_title2.css | 23 +- .../content/urlbarBindings.xml | 395 +++--- .../content/urlbarBindings50.xml | 1202 ---------------- .../content/urlbarBindings51.xml | 1239 ----------------- 5 files changed, 227 insertions(+), 2680 deletions(-) delete mode 100644 CTR@8pecxstudios.com/content/urlbarBindings50.xml delete mode 100644 CTR@8pecxstudios.com/content/urlbarBindings51.xml diff --git a/CTR@8pecxstudios.com/content/css/alt_autocomplete.css b/CTR@8pecxstudios.com/content/css/alt_autocomplete.css index 748ac69f..ffc9d487 100644 --- a/CTR@8pecxstudios.com/content/css/alt_autocomplete.css +++ b/CTR@8pecxstudios.com/content/css/alt_autocomplete.css @@ -2,54 +2,16 @@ @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); @-moz-document url(chrome://browser/content/browser.xul) { - - /* Firefox 48/49 popup code */ - panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), - #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { + + #main-window panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), + #main-window #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings.xml#urlbar-rich-result-popup") !important; } - /* Firefox 48/49 richlist item code */ - panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete) .autocomplete-richlistitem, - #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] .autocomplete-richlistitem { + #main-window panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete) .autocomplete-richlistitem, + #main-window #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] .autocomplete-richlistitem { -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings.xml#autocomplete-richlistitem") !important; } - - /* Firefox 50 popup code (50b1 not supported anymore) */ - #main-window[fx50plus="true"] panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), - #main-window[fx50plus="true"] #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { - -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings50.xml#urlbar-rich-result-popup") !important; - } - - /* Firefox 50 richlist item code (50b1 not supported anymore) */ - #main-window[fx50plus="true"] panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete) .autocomplete-richlistitem, - #main-window[fx50plus="true"] #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] .autocomplete-richlistitem { - -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings50.xml#autocomplete-richlistitem") !important; - } - - /* Firefox 51 popup code */ - #main-window[fx51plus="true"] panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), - #main-window[fx51plus="true"] #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { - -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings51.xml#urlbar-rich-result-popup") !important; - } - - /* Firefox 51 richlist item code */ - #main-window[fx51plus="true"] panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete) .autocomplete-richlistitem, - #main-window[fx51plus="true"] #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] .autocomplete-richlistitem { - -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings51.xml#autocomplete-richlistitem") !important; - } - - /* Firefox 54 popup code */ - #main-window[fx54plus="true"] panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), - #main-window[fx54plus="true"] #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { - -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings54.xml#urlbar-rich-result-popup") !important; - } - - /* Firefox 54 richlist item code */ - #main-window[fx54plus="true"] panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete) .autocomplete-richlistitem, - #main-window[fx54plus="true"] #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] .autocomplete-richlistitem { - -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings54.xml#autocomplete-richlistitem") !important; - } /* restyle popup items */ panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete) .autocomplete-richlistitem, diff --git a/CTR@8pecxstudios.com/content/css/autocompl_no_title2.css b/CTR@8pecxstudios.com/content/css/autocompl_no_title2.css index 7a72fe58..8446378e 100644 --- a/CTR@8pecxstudios.com/content/css/autocompl_no_title2.css +++ b/CTR@8pecxstudios.com/content/css/autocompl_no_title2.css @@ -3,30 +3,11 @@ @-moz-document url(chrome://browser/content/browser.xul) { - /* Firefox 48/49 popup code */ - panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), - #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { + #main-window panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), + #main-window #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings.xml#urlbar-rich-result-popup") !important; } - /* Firefox 50 popup code (50b1 not supported anymore) */ - #main-window[fx50plus="true"] panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), - #main-window[fx50plus="true"] #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { - -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings50.xml#urlbar-rich-result-popup") !important; - } - - /* Firefox 51 */ - #main-window[fx51plus="true"] panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), - #main-window[fx51plus="true"] #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { - -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings51.xml#urlbar-rich-result-popup") !important; - } - - /* Firefox 54 */ - #main-window[fx54plus="true"] panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete), - #main-window[fx54plus="true"] #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] { - -moz-binding: url("chrome://classic_theme_restorer/content/urlbarBindings54.xml#urlbar-rich-result-popup") !important; - } - panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete) .autocomplete-richlistitem:not(:-moz-any([collapse="true"],[actiontype="searchengine"],[actiontype="visiturl"],[actiontype="switchtab"])) .ac-title, #PopupAutoCompleteRichResult[autocompleteinput="urlbar"] .autocomplete-richlistitem:not(:-moz-any([collapse="true"],[actiontype="searchengine"],[actiontype="visiturl"],[actiontype="switchtab"])) .ac-title, panel[type="autocomplete-richlistbox"]:not(#PopupAutoComplete) .autocomplete-richlistitem:not([collapse="true"]) .ac-separator, diff --git a/CTR@8pecxstudios.com/content/urlbarBindings.xml b/CTR@8pecxstudios.com/content/urlbarBindings.xml index 2ee26503..e2b16403 100644 --- a/CTR@8pecxstudios.com/content/urlbarBindings.xml +++ b/CTR@8pecxstudios.com/content/urlbarBindings.xml @@ -6,7 +6,8 @@ and chrome://browser/content/urlbarBindings.xml#urlbar-rich-result-popup to simulate pre-Fx48 look of location bars autocomplete popup. - Removed all default comments to reduce file size. + Removed all default comments to reduce file size. + Many "empty" methods to provide compatibility with future Fx builds. --> - + + + + + + + @@ -76,6 +88,36 @@ document.getAnonymousElementByAttribute(this, "anonid", "footer"); + + document.getAnonymousElementByAttribute(this, "anonid", + "one-off-search-buttons"); + + + false + + null + + + + + + + @@ -116,13 +154,6 @@ let newIndex = index + (reverse ? -1 : 1) * amount; - // We only want to wrap if navigation is in any direction by one item, - // otherwise we clamp to one end of the list. - // ie, hitting page-down will only cause is to wrap if we're already - // at one end of the list. - - // Allow the selection to be removed if the first result is not a - // heuristic result. if (!this._isFirstResultHeuristic) { if (reverse && index == -1 || newIndex > maxRow && index != maxRow) newIndex = maxRow; @@ -135,7 +166,6 @@ return newIndex; } - // Otherwise do not allow the selection to be removed. if (newIndex < 0) { newIndex = index > 0 ? 0 : maxRow; } else if (newIndex > maxRow) { @@ -148,9 +178,6 @@ 0 && this.input.mController .getStyleAt(0) @@ -178,12 +205,28 @@ - - { if (enableSuggestions && this.input.textValue) { - this.input.controller.startSearch(this.input.textValue); } }); @@ -306,6 +348,7 @@ this.richlistbox.flex = 1; this.removeAttribute("dontanimate"); if (this._matchCount) { + // Update popup height. this._invalidate(); } else { this.closePopup(); @@ -341,54 +384,50 @@ - - - - + + - if (gURLBar && this.mInput == gURLBar) { - var url = controller.getValueAt(this.selectedIndex); - var options = {}; + + + + - this.closePopup(); - controller.handleEscape(); + + + + + + + - let action = this.mInput._parseActionUrl(url); - if (action) { - switch (action.type) { - case "switchtab": // Fall through. - case "keyword": // Fall through. - case "visiturl": { - url = action.params.url; - break; - } - case "searchengine": { - [url, options.postData] = - this.input._parseAndRecordSearchEngineAction(action); - break; - } - default: { - return; - } - } - } - openUILink(url, aEvent, options); - } - ]]> - - + + + @@ -419,7 +458,6 @@ let types = item.getAttribute("type").split(/\s+/); let type = types.find(type => type != "action" && type != "heuristic"); try { - parts.push(this._bundle.GetStringFromName(type + "ResultLabel")); } catch (e) {} @@ -431,36 +469,45 @@ { + let { event, searchString } = instance; + if (this.input.mController.searchString == searchString) { + this.input.maybeCanonizeURL(event, searchString); + this.input.mController.handleEnter(false, event); + } + }, 0); } ]]> + + + + + + @@ -473,65 +520,64 @@ - - - - - - - - - - - - - - - - - - - - - - + + + - - - + xbl:inherits="selected"> - - - - - + + - + + - + + + + + + + + + + + + + + + + + + + + + @@ -568,7 +614,6 @@ end) { - boundaries.push(start); boundaries.push(end); @@ -699,7 +742,6 @@ = 0 && index < aReplacements.length) { @@ -849,7 +884,6 @@ + + = 0) { pairs = [ @@ -980,19 +1027,22 @@ } if (!displayUrl) { - let input = this.parentNode.parentNode.input; + let input = popup.input; let url = typeof(input.trimValue) == "function" ? input.trimValue(originalUrl) : originalUrl; displayUrl = this._unescapeUrl(url); } + + if (popup.textRunsMaxLen) { + displayUrl = displayUrl.substr(0, popup.textRunsMaxLen); + } this.setAttribute("displayurl", displayUrl); if (!title) { title = displayUrl; try { let uri = Services.io.newURI(originalUrl, null, null); - // Not all valid URLs have a domain. if (uri.host) title = uri.host; } catch (e) {} @@ -1001,7 +1051,6 @@ this._tags.setAttribute("empty", "true"); if (type == "tag" || type == "bookmark-tag") { - let tags; [, title, tags] = title.match(/^(.+) \u2013 (.+)$/); @@ -1017,11 +1066,9 @@ type = "bookmark"; } } else if (type == "keyword") { - emphasiseUrl = false; let keywordArg = this.getAttribute("text").replace(/^[^\s]+\s*/, ""); if (!keywordArg) { - type = "visiturl"; this.setAttribute("actiontype", "visiturl"); let visitStr = this._stringBundle.GetStringFromName("visit"); @@ -1031,17 +1078,22 @@ let interpStr = this._stringBundle.GetStringFromName("bookmarkKeywordSearch"); title = this._generateEmphasisPairs(interpStr, pairs); - this._setUpDescription(this._actionText, "", false); } } - this._typeIcon.setAttribute("type", type); - this._siteIcon.setAttribute("type", type); + this.setAttribute("type", type); if (Array.isArray(title)) { + if (popup.textRunsMaxLen) { + title = title.map(t => t.substr(0, popup.textRunsMaxLen)); + } this._setUpEmphasisedSections(this._titleText, title); } else { + + if (popup.textRunsMaxLen) { + title = title.substr(0, popup.textRunsMaxLen); + } this._setUpDescription(this._titleText, title, false); } this._setUpDescription(this._urlText, displayUrl, !emphasiseUrl); @@ -1063,33 +1115,31 @@ ]]> - + 0; ]]> - itemWidth) { - // The percentage of the item width allocated to the title and tags. let titleTagsPct = 0.66; let titleTagsAvailable = itemWidth - separatorURLActionWidth; @@ -1190,5 +1235,5 @@ ]]> - - + + \ No newline at end of file diff --git a/CTR@8pecxstudios.com/content/urlbarBindings50.xml b/CTR@8pecxstudios.com/content/urlbarBindings50.xml deleted file mode 100644 index 680c48f9..00000000 --- a/CTR@8pecxstudios.com/content/urlbarBindings50.xml +++ /dev/null @@ -1,1202 +0,0 @@ - - - - - -%notificationDTD; - -%browserDTD; - -%brandDTD; -]> - - - - - - - - - - - - - - &urlbar.searchSuggestionsNotification.question; - - - - - - - - - - - - - - 0 - - - Cc["@mozilla.org/intl/stringbundle;1"]. - getService(Ci.nsIStringBundleService). - createBundle("chrome://browser/locale/places/places.properties"); - - - - document.getAnonymousElementByAttribute( - this, "anonid", "search-suggestions-notification" - ); - - - - document.getAnonymousElementByAttribute(this, "anonid", "footer"); - - - - document.getAnonymousElementByAttribute(this, "anonid", - "one-off-search-buttons"); - - - false - - - - - - - - - - - - - - - - - - - - - maxRow && index != maxRow) - newIndex = maxRow; - else if (!reverse && index == -1 || newIndex < 0 && index != 0) - newIndex = 0; - - if (newIndex < 0 && index == 0 || newIndex > maxRow && index == maxRow) - newIndex = -1; - - return newIndex; - } - - if (newIndex < 0) { - newIndex = index > 0 ? 0 : maxRow; - } else if (newIndex > maxRow) { - newIndex = index < maxRow ? maxRow : 0; - } - return newIndex; - ]]> - - - - - 0 && - this.input.mController - .getStyleAt(0) - .split(/\s+/).indexOf("heuristic") > 0; - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { - if (enableSuggestions && this.input.textValue) { - this.input.controller.startSearch(this.input.textValue); - } - }); - ]]> - - - - - - - - - - - - { - let notificationHeight = this.searchSuggestionsNotification - .getBoundingClientRect() - .height; - this.searchSuggestionsNotification.style.marginTop = - "-" + notificationHeight + "px"; - - let popupHeightPx = - (this.getBoundingClientRect().height - notificationHeight) + "px"; - this.style.height = popupHeightPx; - - let onTransitionEnd = () => { - this.removeEventListener("transitionend", onTransitionEnd, true); - this.searchSuggestionsNotification.style.marginTop = "0px"; - this.style.removeProperty("height"); - this._hideSearchSuggestionsNotification(); - resolve(); - }; - this.addEventListener("transitionend", onTransitionEnd, true); - }); - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - type != "action" && type != "heuristic"); - try { - parts.push(this._bundle.GetStringFromName(type + "ResultLabel")); - } catch (e) {} - - return parts.filter(str => str).join(" "); - ]]> - - - - - - { - if (this.input.mController.searchString == instance.searchString) { - this.input.mController.handleEnter(false, instance.event); - } - }, 0); - } - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - str).join(" ") - - let panel = this.parentNode.parentNode; - if (panel.createResultLabel) { - return panel.createResultLabel(this, label); - } - - return label; - ]]> - - - - - - - - null - - - - - - - - false - - - - - - - - - - - - - - - - - - = 0) { - regions.push([matchIndex, matchIndex + searchLen]); - } - } - - regions = regions.sort((a, b) => { - let start = a[0] - b[0]; - return (start == 0) ? a[1] - b[1] : start; - }); - - let start = 0; - let end = 0; - let boundaries = []; - let len = regions.length; - for (let i = 0; i < len; i++) { - let region = regions[i]; - if (region[0] > end) { - boundaries.push(start); - boundaries.push(end); - - start = region[0]; - } - - end = Math.max(end, region[1]); - } - - boundaries.push(start); - boundaries.push(end); - - if (end < aText.length) - boundaries.push(aText.length); - - 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 (!action.params.alias && !initialTypes.has("favicon")) { - this.removeAttribute("image"); - } - } else if (action.type == "visiturl") { - emphasiseUrl = false; - displayUrl = this._unescapeUrl(action.params.url); - title = displayUrl; - let visitStr = this._stringBundle.GetStringFromName("visit"); - this._setUpDescription(this._actionText, visitStr, true); - } - } - - if (!displayUrl) { - let input = popup.input; - let url = typeof(input.trimValue) == "function" ? - input.trimValue(originalUrl) : - originalUrl; - displayUrl = this._unescapeUrl(url); - } - - if (popup.textRunsMaxLen) { - displayUrl = displayUrl.substr(0, popup.textRunsMaxLen); - } - this.setAttribute("displayurl", displayUrl); - - if (!title) { - title = displayUrl; - 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") { - let tags; - [, title, tags] = title.match(/^(.+) \u2013 (.+)$/); - - 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") { - emphasiseUrl = false; - let keywordArg = this.getAttribute("text").replace(/^[^\s]+\s*/, ""); - if (!keywordArg) { - 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); - this._setUpDescription(this._actionText, "", false); - } - } - - this.setAttribute("type", type); - - if (Array.isArray(title)) { - if (popup.textRunsMaxLen) { - title = title.map(t => t.substr(0, popup.textRunsMaxLen)); - } - this._setUpEmphasisedSections(this._titleText, title); - } else { - - 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) { - - // 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) { - 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 = (-62 + itemRect.width) + "px"; - this._tagsText.style.maxWidth = tagsMaxWidth + "px"; - } - - let titleMaxWidth = Math.max( - (titleTagsMaxWidth - tagsRect.width), - titleTagsMaxWidth * 0.33 - ); - - this._urlText.style.maxWidth = (-62 + itemRect.width) + "px"; - this._actionText.style.maxWidth = (-62 + itemRect.width) + "px"; - } - ]]> - - - - - - - - - - - - - - - - diff --git a/CTR@8pecxstudios.com/content/urlbarBindings51.xml b/CTR@8pecxstudios.com/content/urlbarBindings51.xml deleted file mode 100644 index e2b16403..00000000 --- a/CTR@8pecxstudios.com/content/urlbarBindings51.xml +++ /dev/null @@ -1,1239 +0,0 @@ - - - - - -%notificationDTD; - -%browserDTD; - -%brandDTD; -]> - - - - - - - - - - - - - - &urlbar.searchSuggestionsNotification.question; - - - - - - - - - - - - - - 0 - - - Cc["@mozilla.org/intl/stringbundle;1"]. - getService(Ci.nsIStringBundleService). - createBundle("chrome://browser/locale/places/places.properties"); - - - - document.getAnonymousElementByAttribute( - this, "anonid", "search-suggestions-notification" - ); - - - - document.getAnonymousElementByAttribute(this, "anonid", "footer"); - - - - document.getAnonymousElementByAttribute(this, "anonid", - "one-off-search-buttons"); - - - false - - null - - - - - - - - - - - - - - - - - - - - - - maxRow && index != maxRow) - newIndex = maxRow; - else if (!reverse && index == -1 || newIndex < 0 && index != 0) - newIndex = 0; - - if (newIndex < 0 && index == 0 || newIndex > maxRow && index == maxRow) - newIndex = -1; - - return newIndex; - } - - if (newIndex < 0) { - newIndex = index > 0 ? 0 : maxRow; - } else if (newIndex > maxRow) { - newIndex = index < maxRow ? maxRow : 0; - } - return newIndex; - ]]> - - - - - 0 && - this.input.mController - .getStyleAt(0) - .split(/\s+/).indexOf("heuristic") > 0; - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { - if (enableSuggestions && this.input.textValue) { - this.input.controller.startSearch(this.input.textValue); - } - }); - ]]> - - - - - - - - - - - - { - let notificationHeight = this.searchSuggestionsNotification - .getBoundingClientRect() - .height; - this.searchSuggestionsNotification.style.marginTop = - "-" + notificationHeight + "px"; - - let popupHeightPx = - (this.getBoundingClientRect().height - notificationHeight) + "px"; - this.style.height = popupHeightPx; - - let onTransitionEnd = () => { - this.removeEventListener("transitionend", onTransitionEnd, true); - this.searchSuggestionsNotification.style.marginTop = "0px"; - this.style.removeProperty("height"); - this._hideSearchSuggestionsNotification(); - resolve(); - }; - this.addEventListener("transitionend", onTransitionEnd, true); - }); - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - type != "action" && type != "heuristic"); - try { - parts.push(this._bundle.GetStringFromName(type + "ResultLabel")); - } catch (e) {} - - return parts.filter(str => str).join(" "); - ]]> - - - - - - { - let { event, searchString } = instance; - if (this.input.mController.searchString == searchString) { - this.input.maybeCanonizeURL(event, searchString); - this.input.mController.handleEnter(false, event); - } - }, 0); - } - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - str).join(" ") - - let panel = this.parentNode.parentNode; - if (panel.createResultLabel) { - return panel.createResultLabel(this, label); - } - - return label; - ]]> - - - - - - - - null - - - - - - - - false - - - - - - - - - - - - - - - - - - = 0) { - regions.push([matchIndex, matchIndex + searchLen]); - } - } - - regions = regions.sort((a, b) => { - let start = a[0] - b[0]; - return (start == 0) ? a[1] - b[1] : start; - }); - - let start = 0; - let end = 0; - let boundaries = []; - let len = regions.length; - for (let i = 0; i < len; i++) { - let region = regions[i]; - if (region[0] > end) { - boundaries.push(start); - boundaries.push(end); - - start = region[0]; - } - - end = Math.max(end, region[1]); - } - - boundaries.push(start); - boundaries.push(end); - - if (end < aText.length) - boundaries.push(aText.length); - - 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 (!action.params.alias && !initialTypes.has("favicon")) { - this.removeAttribute("image"); - } - } else if (action.type == "visiturl") { - emphasiseUrl = false; - displayUrl = this._unescapeUrl(action.params.url); - title = displayUrl; - let visitStr = this._stringBundle.GetStringFromName("visit"); - this._setUpDescription(this._actionText, visitStr, true); - } - } - - if (!displayUrl) { - let input = popup.input; - let url = typeof(input.trimValue) == "function" ? - input.trimValue(originalUrl) : - originalUrl; - displayUrl = this._unescapeUrl(url); - } - - if (popup.textRunsMaxLen) { - displayUrl = displayUrl.substr(0, popup.textRunsMaxLen); - } - this.setAttribute("displayurl", displayUrl); - - if (!title) { - title = displayUrl; - try { - let uri = Services.io.newURI(originalUrl, null, null); - if (uri.host) - title = uri.host; - } catch (e) {} - } - - this._tags.setAttribute("empty", "true"); - - if (type == "tag" || type == "bookmark-tag") { - let tags; - [, title, tags] = title.match(/^(.+) \u2013 (.+)$/); - - 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") { - emphasiseUrl = false; - let keywordArg = this.getAttribute("text").replace(/^[^\s]+\s*/, ""); - if (!keywordArg) { - 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); - this._setUpDescription(this._actionText, "", false); - } - } - - this.setAttribute("type", type); - - if (Array.isArray(title)) { - if (popup.textRunsMaxLen) { - title = title.map(t => t.substr(0, popup.textRunsMaxLen)); - } - this._setUpEmphasisedSections(this._titleText, title); - } else { - - 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) { - - let titleTagsPct = 0.66; - - let titleTagsAvailable = itemWidth - separatorURLActionWidth; - let titleTagsMaxWidth = Math.max( - titleTagsAvailable, - itemWidth * titleTagsPct - ); - if (titleTagsWidth > titleTagsMaxWidth) { - 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 = (-62 + itemRect.width) + "px"; - this._tagsText.style.maxWidth = tagsMaxWidth + "px"; - } - - let titleMaxWidth = Math.max( - (titleTagsMaxWidth - tagsRect.width), - titleTagsMaxWidth * 0.33 - ); - - this._urlText.style.maxWidth = (-62 + itemRect.width) + "px"; - this._actionText.style.maxWidth = (-62 + itemRect.width) + "px"; - } - ]]> - - - - - - - - - - - - - - - \ No newline at end of file