diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-02 05:06:10 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-02 05:06:10 -0500 |
commit | 6d614170cbfa958564eb5f824234ad5a9e484344 (patch) | |
tree | 3e1eb384382f30987cb2e64bd654afa8b74fd06b /application/basilisk/base/content/abouthome/aboutHome.js | |
parent | 2a6b605d64b19411a300efdbbd7f78c349f90206 (diff) | |
download | UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar.gz UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar.lz UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar.xz UXP-6d614170cbfa958564eb5f824234ad5a9e484344.zip |
Revert "Add Basilisk"
This reverts commit e72ef92b5bdc43cd2584198e2e54e951b70299e8.
Diffstat (limited to 'application/basilisk/base/content/abouthome/aboutHome.js')
-rw-r--r-- | application/basilisk/base/content/abouthome/aboutHome.js | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/application/basilisk/base/content/abouthome/aboutHome.js b/application/basilisk/base/content/abouthome/aboutHome.js deleted file mode 100644 index f7fdaee81..000000000 --- a/application/basilisk/base/content/abouthome/aboutHome.js +++ /dev/null @@ -1,113 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -/* import-globals-from ../contentSearchUI.js */ - -var searchText; - -// This global tracks if the page has been set up before, to prevent double inits -var gInitialized = false; -var gObserver = new MutationObserver(function(mutations) { - for (let mutation of mutations) { - // The addition of the restore session button changes our width: - if (mutation.attributeName == "session") { - fitToWidth(); - } - } -}); - -window.addEventListener("pageshow", function() { - // Delay search engine setup, cause browser.js::BrowserOnAboutPageLoad runs - // later and may use asynchronous getters. - window.gObserver.observe(document.documentElement, { attributes: true }); - window.gObserver.observe(document.getElementById("launcher"), { attributes: true }); - fitToWidth(); - setupSearch(); - window.addEventListener("resize", fitToWidth); - - // Ask chrome to update snippets. - var event = new CustomEvent("AboutHomeLoad", {bubbles:true}); - document.dispatchEvent(event); -}); - -window.addEventListener("pagehide", function() { - window.gObserver.disconnect(); - window.removeEventListener("resize", fitToWidth); -}); - -window.addEventListener("keypress", ev => { - if (ev.defaultPrevented) { - return; - } - - // don't focus the search-box on keypress if something other than the - // body or document element has focus - don't want to steal input from other elements - // Make an exception for <a> and <button> elements (and input[type=button|submit]) - // which don't usefully take keypresses anyway. - // (except space, which is handled below) - if (document.activeElement && document.activeElement != document.body && - document.activeElement != document.documentElement && - !["a", "button"].includes(document.activeElement.localName) && - !document.activeElement.matches("input:-moz-any([type=button],[type=submit])")) { - return; - } - - let modifiers = ev.ctrlKey + ev.altKey + ev.metaKey; - // ignore Ctrl/Cmd/Alt, but not Shift - // also ignore Tab, Insert, PageUp, etc., and Space - if (modifiers != 0 || ev.charCode == 0 || ev.charCode == 32) - return; - - searchText.focus(); - // need to send the first keypress outside the search-box manually to it - searchText.value += ev.key; -}); - -function onSearchSubmit(aEvent) { - gContentSearchController.search(aEvent); -} - - -var gContentSearchController; - -function setupSearch() { - // Set submit button label for when CSS background are disabled (e.g. - // high contrast mode). - document.getElementById("searchSubmit").value = - document.body.getAttribute("dir") == "ltr" ? "\u25B6" : "\u25C0"; - - // The "autofocus" attribute doesn't focus the form element - // immediately when the element is first drawn, so the - // attribute is also used for styling when the page first loads. - searchText = document.getElementById("searchText"); - searchText.addEventListener("blur", function searchText_onBlur() { - searchText.removeEventListener("blur", searchText_onBlur); - searchText.removeAttribute("autofocus"); - }); - - if (!gContentSearchController) { - gContentSearchController = - new ContentSearchUIController(searchText, searchText.parentNode, - "abouthome", "homepage"); - } -} - -/** - * Inform the test harness that we're done loading the page. - */ -function loadCompleted() { - var event = new CustomEvent("AboutHomeLoadSnippetsCompleted", {bubbles:true}); - document.dispatchEvent(event); -} - -function fitToWidth() { - if (document.documentElement.scrollWidth > window.innerWidth) { - document.body.setAttribute("narrow", "true"); - } else if (document.body.hasAttribute("narrow")) { - document.body.removeAttribute("narrow"); - fitToWidth(); - } -} |