/* Copyright 2022 0xf8 This file is part of Galerie Galerie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Galerie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Galerie. If not, see . */ import App from "./app"; import React from "react"; import jQuery from "jquery"; const $ = jQuery; import Settings, { apiUrl } from "./settings"; const settings = new Settings(); let global_ActiveContextMenu: ContextMenu = null; let global_ActivePopout: Popout = null; // =================== // === ContextMenu === // =================== class ContextMenu { public menu: JQuery; private overlay: JQuery; constructor(label: string, buttons: JQuery[], position: [any, any]) { this.overlay = $("
"); this.menu = $("
"); let labelElement = $(""); labelElement.text(label); this.menu.append(labelElement); for (let _b in buttons) this.menu.append(buttons[_b]); this.menu.css("top", position[1]); this.menu.css("left", position[0]); this.overlay.append(this.menu); } public static async createButton(text: string) { return $("