tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sidebar.js (1305B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const { SyncedTabs } = ChromeUtils.importESModule(
      8  "resource://services-sync/SyncedTabs.sys.mjs"
      9 );
     10 const { SyncedTabsDeckComponent } = ChromeUtils.importESModule(
     11  "resource:///modules/syncedtabs/SyncedTabsDeckComponent.sys.mjs"
     12 );
     13 
     14 var syncedTabsDeckComponent = new SyncedTabsDeckComponent({
     15  window,
     16  SyncedTabs,
     17 });
     18 
     19 let onLoaded = () => {
     20  window.top.MozXULElement.insertFTLIfNeeded("browser/syncedTabs.ftl");
     21  window.top.document
     22    .getElementById("SyncedTabsSidebarContext")
     23    .querySelectorAll("[data-lazy-l10n-id]")
     24    .forEach(el => {
     25      el.setAttribute("data-l10n-id", el.getAttribute("data-lazy-l10n-id"));
     26      el.removeAttribute("data-lazy-l10n-id");
     27    });
     28  syncedTabsDeckComponent.init();
     29  document
     30    .getElementById("template-container")
     31    .appendChild(syncedTabsDeckComponent.container);
     32 };
     33 
     34 let onUnloaded = () => {
     35  removeEventListener("DOMContentLoaded", onLoaded);
     36  removeEventListener("unload", onUnloaded);
     37  syncedTabsDeckComponent.uninit();
     38 };
     39 
     40 addEventListener("DOMContentLoaded", onLoaded);
     41 addEventListener("unload", onUnloaded);