Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions JS/tabThumbnailTooltip.uc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// ==UserScript==
// @name Tab Thumbnail Tooltip
// @version 1.0.7
// @version 1.0.8
// @author aminomancer
// @homepage https://github.com/aminomancer/uc.css.js
// @description Show a large thumbnail image to preview tab content when hovering a tab.
// @downloadURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/tabThumbnailTooltip.uc.js
// @updateURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/tabThumbnailTooltip.uc.js
// @license This Source Code Form is subject to the terms of the Creative Commons Attribution-NonCommercial-ShareAlike International License, v. 4.0. If a copy of the CC BY-NC-SA 4.0 was not distributed with this file, You can obtain one at http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
// ==/UserScript==

class TabThumbnail {
// user preferences. add these in about:config if you want them to persist
// between script updates without having to reapply them.
Expand Down Expand Up @@ -80,8 +79,6 @@ class TabThumbnail {
id="tabThumbTooltip"
noautohide="true"
orient="vertical"
onpopupshowing="ucTabThumbnail.onPopupShowing();"
onpopuphiding="ucTabThumbnail.onPopupHiding();"
hide-thumbnail="true"
style="visibility: collapse">
<vbox id="tabThumbBox">
Expand All @@ -92,13 +89,17 @@ class TabThumbnail {
<html:div id="tabThumbCanvas"></html:div>
</vbox>
</tooltip>`;
this.registerSheet();
document
.getElementById("mainPopupSet")
.appendChild(MozXULElement.parseXULToFragment(markup));
this.registerSheet();
const mainPopupSet = document.getElementById("mainPopupSet");
if (mainPopupSet) {
const tooltipElement = MozXULElement.parseXULToFragment(markup).firstChild;
tooltipElement.addEventListener('popupshowing', () => this.onPopupShowing());
tooltipElement.addEventListener('popuphiding', () => this.onPopupHiding());
mainPopupSet.appendChild(tooltipElement);
gBrowser.tabContainer.tooltip = "tabThumbTooltip";
addEventListener("unload", () => this.cancelTimer(), false);
}
}
async onPopupShowing() {
let ready = await this.showPreview();
if (ready) {
Expand Down