From be3c0f98de00d2bd47f984924225060852b5196a Mon Sep 17 00:00:00 2001 From: DBCL Date: Mon, 17 Jun 2019 23:11:14 +0200 Subject: [PATCH] Few bug fixes --- header-userscript | 204 +++++++++++++++++++++++++++++++++++++++++++++- package-lock.json | 38 ++++++++- package.json | 5 +- src/foldArrow.ts | 9 +- src/index.ts | 1 + src/menu.ts | 18 +++- src/row.ts | 14 +++- 7 files changed, 275 insertions(+), 14 deletions(-) diff --git a/header-userscript b/header-userscript index 487c3f7..faf9295 100644 --- a/header-userscript +++ b/header-userscript @@ -2,13 +2,213 @@ // @name DBCL Navbar // @namespace DBCL // @version __VERSION__ -// @description A navbar to inject into your personal applications +// @description A very simple HTPC navbar // @author DBCL // @match https://www.example.com/* +// @homepage https://github.com/DB-CL/navbar/ // @downloadURL https://github.com/DB-CL/navbar/releases/latest/download/dbcl-navbar.user.js // @updateURL https://github.com/DB-CL/navbar/releases/latest/download/dbcl-navbar.user.js -// @supportURL https://github.com/DB-CL/navbar/releases/latest/download/dbcl-navbar.user.js +// @supportURL https://github.com/DB-CL/navbar/issues +// @resource fa-arrow-down https://db-cl.github.io/navbar/assets/fa-arrow-down.png +// @resource fa-arrow-up https://db-cl.github.io/navbar/assets/fa-arrow-up.png +// @resource fa-menu https://db-cl.github.io/navbar/assets/fa-menu.png +// @resource AdGuardHome https://db-cl.github.io/navbar/assets/apps/64x/AdGuardHome.png +// @resource adminer https://db-cl.github.io/navbar/assets/apps/64x/adminer.png +// @resource airsonic https://db-cl.github.io/navbar/assets/apps/64x/airsonic.png +// @resource ajenti https://db-cl.github.io/navbar/assets/apps/64x/ajenti.png +// @resource alertmanager https://db-cl.github.io/navbar/assets/apps/64x/alertmanager.png +// @resource archivebox https://db-cl.github.io/navbar/assets/apps/64x/archivebox.png +// @resource arduino https://db-cl.github.io/navbar/assets/apps/64x/arduino.png +// @resource asusrouter https://db-cl.github.io/navbar/assets/apps/64x/asusrouter.png +// @resource bazarr https://db-cl.github.io/navbar/assets/apps/64x/bazarr.png +// @resource bitwarden https://db-cl.github.io/navbar/assets/apps/64x/bitwarden.png +// @resource booksonic https://db-cl.github.io/navbar/assets/apps/64x/booksonic.png +// @resource bookstack https://db-cl.github.io/navbar/assets/apps/64x/bookstack.png +// @resource cabot https://db-cl.github.io/navbar/assets/apps/64x/cabot.png +// @resource calibreweb https://db-cl.github.io/navbar/assets/apps/64x/calibreweb.png +// @resource cardigann https://db-cl.github.io/navbar/assets/apps/64x/cardigann.png +// @resource checkmk https://db-cl.github.io/navbar/assets/apps/64x/checkmk.png +// @resource chronograf https://db-cl.github.io/navbar/assets/apps/64x/chronograf.png +// @resource cloudcmd https://db-cl.github.io/navbar/assets/apps/64x/cloudcmd.png +// @resource cockpitcms https://db-cl.github.io/navbar/assets/apps/64x/cockpitcms.png +// @resource cockpit https://db-cl.github.io/navbar/assets/apps/64x/cockpit.png +// @resource codiad https://db-cl.github.io/navbar/assets/apps/64x/codiad.png +// @resource concourse https://db-cl.github.io/navbar/assets/apps/64x/concourse.png +// @resource cops https://db-cl.github.io/navbar/assets/apps/64x/cops.png +// @resource couchpotato https://db-cl.github.io/navbar/assets/apps/64x/couchpotato.png +// @resource cryptpad https://db-cl.github.io/navbar/assets/apps/64x/cryptpad.png +// @resource deluge https://db-cl.github.io/navbar/assets/apps/64x/deluge.png +// @resource directus https://db-cl.github.io/navbar/assets/apps/64x/directus.png +// @resource dokuwiki https://db-cl.github.io/navbar/assets/apps/64x/dokuwiki.png +// @resource domoticz https://db-cl.github.io/navbar/assets/apps/64x/domoticz.png +// @resource downloader https://db-cl.github.io/navbar/assets/apps/64x/downloader.png +// @resource drone https://db-cl.github.io/navbar/assets/apps/64x/drone.png +// @resource duplicacy https://db-cl.github.io/navbar/assets/apps/64x/duplicacy.png +// @resource duplicati https://db-cl.github.io/navbar/assets/apps/64x/duplicati.png +// @resource emby https://db-cl.github.io/navbar/assets/apps/64x/emby.png +// @resource filebrowser https://db-cl.github.io/navbar/assets/apps/64x/filebrowser.png +// @resource flexget https://db-cl.github.io/navbar/assets/apps/64x/flexget.png +// @resource flood https://db-cl.github.io/navbar/assets/apps/64x/flood.png +// @resource freenas-logo https://db-cl.github.io/navbar/assets/apps/64x/freenas-logo.png +// @resource freenas https://db-cl.github.io/navbar/assets/apps/64x/freenas.png +// @resource freshrss https://db-cl.github.io/navbar/assets/apps/64x/freshrss.png +// @resource ghost https://db-cl.github.io/navbar/assets/apps/64x/ghost.png +// @resource gitea https://db-cl.github.io/navbar/assets/apps/64x/gitea.png +// @resource github https://db-cl.github.io/navbar/assets/apps/64x/github.png +// @resource gitlab https://db-cl.github.io/navbar/assets/apps/64x/gitlab.png +// @resource gitter https://db-cl.github.io/navbar/assets/apps/64x/gitter.png +// @resource glances https://db-cl.github.io/navbar/assets/apps/64x/glances.png +// @resource gotify https://db-cl.github.io/navbar/assets/apps/64x/gotify.png +// @resource grafana https://db-cl.github.io/navbar/assets/apps/64x/grafana.png +// @resource grav https://db-cl.github.io/navbar/assets/apps/64x/grav.png +// @resource graylog https://db-cl.github.io/navbar/assets/apps/64x/graylog.png +// @resource guacamole https://db-cl.github.io/navbar/assets/apps/64x/guacamole.png +// @resource haproxy https://db-cl.github.io/navbar/assets/apps/64x/haproxy.png +// @resource headphones https://db-cl.github.io/navbar/assets/apps/64x/headphones.png +// @resource healthchecks https://db-cl.github.io/navbar/assets/apps/64x/healthchecks.png +// @resource heimdall https://db-cl.github.io/navbar/assets/apps/64x/heimdall.png +// @resource hfs https://db-cl.github.io/navbar/assets/apps/64x/hfs.png +// @resource homeassistant https://db-cl.github.io/navbar/assets/apps/64x/homeassistant.png +// @resource huginn https://db-cl.github.io/navbar/assets/apps/64x/huginn.png +// @resource hydra2 https://db-cl.github.io/navbar/assets/apps/64x/hydra2.png +// @resource hydra https://db-cl.github.io/navbar/assets/apps/64x/hydra.png +// @resource influxdb https://db-cl.github.io/navbar/assets/apps/64x/influxdb.png +// @resource invoiceninja https://db-cl.github.io/navbar/assets/apps/64x/invoiceninja.png +// @resource jackett https://db-cl.github.io/navbar/assets/apps/64x/jackett.png +// @resource jdownloader https://db-cl.github.io/navbar/assets/apps/64x/jdownloader.png +// @resource jellyfin https://db-cl.github.io/navbar/assets/apps/64x/jellyfin.png +// @resource jenkins https://db-cl.github.io/navbar/assets/apps/64x/jenkins.png +// @resource jupyter https://db-cl.github.io/navbar/assets/apps/64x/jupyter.png +// @resource kibana https://db-cl.github.io/navbar/assets/apps/64x/kibana.png +// @resource kimai https://db-cl.github.io/navbar/assets/apps/64x/kimai.png +// @resource krusader https://db-cl.github.io/navbar/assets/apps/64x/krusader.png +// @resource lazylibrarian https://db-cl.github.io/navbar/assets/apps/64x/lazylibrarian.png +// @resource lemonldapng https://db-cl.github.io/navbar/assets/apps/64x/lemonldapng.png +// @resource lidarr https://db-cl.github.io/navbar/assets/apps/64x/lidarr.png +// @resource logarr https://db-cl.github.io/navbar/assets/apps/64x/logarr.png +// @resource madsonic https://db-cl.github.io/navbar/assets/apps/64x/madsonic.png +// @resource mailhog https://db-cl.github.io/navbar/assets/apps/64x/mailhog.png +// @resource mattermost https://db-cl.github.io/navbar/assets/apps/64x/mattermost.png +// @resource mayanedms https://db-cl.github.io/navbar/assets/apps/64x/mayanedms.png +// @resource mcmap https://db-cl.github.io/navbar/assets/apps/64x/mcmap.png +// @resource mcmyadmin https://db-cl.github.io/navbar/assets/apps/64x/mcmyadmin.png +// @resource medusa https://db-cl.github.io/navbar/assets/apps/64x/medusa.png +// @resource meraki https://db-cl.github.io/navbar/assets/apps/64x/meraki.png +// @resource miniflux https://db-cl.github.io/navbar/assets/apps/64x/miniflux.png +// @resource minio https://db-cl.github.io/navbar/assets/apps/64x/minio.png +// @resource monica https://db-cl.github.io/navbar/assets/apps/64x/monica.png +// @resource monitorr https://db-cl.github.io/navbar/assets/apps/64x/monitorr.png +// @resource motherboard https://db-cl.github.io/navbar/assets/apps/64x/motherboard.png +// @resource mumble https://db-cl.github.io/navbar/assets/apps/64x/mumble.png +// @resource mylar https://db-cl.github.io/navbar/assets/apps/64x/mylar.png +// @resource netdata https://db-cl.github.io/navbar/assets/apps/64x/netdata.png +// @resource netgear https://db-cl.github.io/navbar/assets/apps/64x/netgear.png +// @resource nextcloud https://db-cl.github.io/navbar/assets/apps/64x/nextcloud.png +// @resource nginxproxymanager https://db-cl.github.io/navbar/assets/apps/64x/nginxproxymanager.png +// @resource nodered https://db-cl.github.io/navbar/assets/apps/64x/nodered.png +// @resource nowshowing https://db-cl.github.io/navbar/assets/apps/64x/nowshowing.png +// @resource nzbget https://db-cl.github.io/navbar/assets/apps/64x/nzbget.png +// @resource nzbhydra https://db-cl.github.io/navbar/assets/apps/64x/nzbhydra.png +// @resource octoprint https://db-cl.github.io/navbar/assets/apps/64x/octoprint.png +// @resource ombi-emby https://db-cl.github.io/navbar/assets/apps/64x/ombi-emby.png +// @resource ombi-plex https://db-cl.github.io/navbar/assets/apps/64x/ombi-plex.png +// @resource ombi https://db-cl.github.io/navbar/assets/apps/64x/ombi.png +// @resource omnidb https://db-cl.github.io/navbar/assets/apps/64x/omnidb.png +// @resource openhab https://db-cl.github.io/navbar/assets/apps/64x/openhab.png +// @resource openmediavault https://db-cl.github.io/navbar/assets/apps/64x/openmediavault.png +// @resource openvpn https://db-cl.github.io/navbar/assets/apps/64x/openvpn.png +// @resource opnsense https://db-cl.github.io/navbar/assets/apps/64x/opnsense.png +// @resource owncloud https://db-cl.github.io/navbar/assets/apps/64x/owncloud.png +// @resource ownphotos https://db-cl.github.io/navbar/assets/apps/64x/ownphotos.png +// @resource paperless https://db-cl.github.io/navbar/assets/apps/64x/paperless.png +// @resource partkeepr https://db-cl.github.io/navbar/assets/apps/64x/partkeepr.png +// @resource pf-blue https://db-cl.github.io/navbar/assets/apps/64x/pf-blue.png +// @resource pfsense https://db-cl.github.io/navbar/assets/apps/64x/pfsense.png +// @resource pgadmin https://db-cl.github.io/navbar/assets/apps/64x/pgadmin.png +// @resource phpldapadmin https://db-cl.github.io/navbar/assets/apps/64x/phpldapadmin.png +// @resource phpmyadmin https://db-cl.github.io/navbar/assets/apps/64x/phpmyadmin.png +// @resource phpsysinfo https://db-cl.github.io/navbar/assets/apps/64x/phpsysinfo.png +// @resource pihole https://db-cl.github.io/navbar/assets/apps/64x/pihole.png +// @resource pimpmylog https://db-cl.github.io/navbar/assets/apps/64x/pimpmylog.png +// @resource plex https://db-cl.github.io/navbar/assets/apps/64x/plex.png +// @resource plexrequests https://db-cl.github.io/navbar/assets/apps/64x/plexrequests.png +// @resource portainer https://db-cl.github.io/navbar/assets/apps/64x/portainer.png +// @resource privatebin https://db-cl.github.io/navbar/assets/apps/64x/privatebin.png +// @resource projectsend https://db-cl.github.io/navbar/assets/apps/64x/projectsend.png +// @resource prometheus https://db-cl.github.io/navbar/assets/apps/64x/prometheus.png +// @resource proxmox https://db-cl.github.io/navbar/assets/apps/64x/proxmox.png +// @resource pvr https://db-cl.github.io/navbar/assets/apps/64x/pvr.png +// @resource pydio https://db-cl.github.io/navbar/assets/apps/64x/pydio.png +// @resource pyload https://db-cl.github.io/navbar/assets/apps/64x/pyload.png +// @resource qBittorrent https://db-cl.github.io/navbar/assets/apps/64x/qBittorrent.png +// @resource qnap https://db-cl.github.io/navbar/assets/apps/64x/qnap.png +// @resource radarr https://db-cl.github.io/navbar/assets/apps/64x/radarr.png +// @resource rancher https://db-cl.github.io/navbar/assets/apps/64x/rancher.png +// @resource raneto https://db-cl.github.io/navbar/assets/apps/64x/raneto.png +// @resource resilio https://db-cl.github.io/navbar/assets/apps/64x/resilio.png +// @resource resiliosync https://db-cl.github.io/navbar/assets/apps/64x/resiliosync.png +// @resource rocketchat https://db-cl.github.io/navbar/assets/apps/64x/rocketchat.png +// @resource rspamd https://db-cl.github.io/navbar/assets/apps/64x/rspamd.png +// @resource rsscrawler https://db-cl.github.io/navbar/assets/apps/64x/rsscrawler.png +// @resource rTorrent https://db-cl.github.io/navbar/assets/apps/64x/rTorrent.png +// @resource runeaudio https://db-cl.github.io/navbar/assets/apps/64x/runeaudio.png +// @resource rutorrent https://db-cl.github.io/navbar/assets/apps/64x/rutorrent.png +// @resource sabnzbd https://db-cl.github.io/navbar/assets/apps/64x/sabnzbd.png +// @resource seafile https://db-cl.github.io/navbar/assets/apps/64x/seafile.png +// @resource searxmetasearchengine https://db-cl.github.io/navbar/assets/apps/64x/searxmetasearchengine.png +// @resource serviio https://db-cl.github.io/navbar/assets/apps/64x/serviio.png +// @resource shaarli https://db-cl.github.io/navbar/assets/apps/64x/shaarli.png +// @resource shinobi https://db-cl.github.io/navbar/assets/apps/64x/shinobi.png +// @resource sickbeard https://db-cl.github.io/navbar/assets/apps/64x/sickbeard.png +// @resource sickchill https://db-cl.github.io/navbar/assets/apps/64x/sickchill.png +// @resource sickrage https://db-cl.github.io/navbar/assets/apps/64x/sickrage.png +// @resource slack https://db-cl.github.io/navbar/assets/apps/64x/slack.png +// @resource snibox https://db-cl.github.io/navbar/assets/apps/64x/snibox.png +// @resource sonarr https://db-cl.github.io/navbar/assets/apps/64x/sonarr.png +// @resource sourcegraph https://db-cl.github.io/navbar/assets/apps/64x/sourcegraph.png +// @resource speed https://db-cl.github.io/navbar/assets/apps/64x/speed.png +// @resource squidex https://db-cl.github.io/navbar/assets/apps/64x/squidex.png +// @resource statuscake https://db-cl.github.io/navbar/assets/apps/64x/statuscake.png +// @resource strapi https://db-cl.github.io/navbar/assets/apps/64x/strapi.png +// @resource subsonic https://db-cl.github.io/navbar/assets/apps/64x/subsonic.png +// @resource sugarcrm https://db-cl.github.io/navbar/assets/apps/64x/sugarcrm.png +// @resource syncthing https://db-cl.github.io/navbar/assets/apps/64x/syncthing.png +// @resource synology https://db-cl.github.io/navbar/assets/apps/64x/synology.png +// @resource taiga https://db-cl.github.io/navbar/assets/apps/64x/taiga.png +// @resource tautulli https://db-cl.github.io/navbar/assets/apps/64x/tautulli.png +// @resource teamspeak https://db-cl.github.io/navbar/assets/apps/64x/teamspeak.png +// @resource thelounge https://db-cl.github.io/navbar/assets/apps/64x/thelounge.png +// @resource tinytinyrss https://db-cl.github.io/navbar/assets/apps/64x/tinytinyrss.png +// @resource toto https://db-cl.github.io/navbar/assets/apps/64x/toto.png +// @resource traccar https://db-cl.github.io/navbar/assets/apps/64x/traccar.png +// @resource traefik https://db-cl.github.io/navbar/assets/apps/64x/traefik.png +// @resource transmission https://db-cl.github.io/navbar/assets/apps/64x/transmission.png +// @resource trilium https://db-cl.github.io/navbar/assets/apps/64x/trilium.png +// @resource tvheadend https://db-cl.github.io/navbar/assets/apps/64x/tvheadend.png +// @resource ubnt https://db-cl.github.io/navbar/assets/apps/64x/ubnt.png +// @resource ubooquity https://db-cl.github.io/navbar/assets/apps/64x/ubooquity.png +// @resource unifi https://db-cl.github.io/navbar/assets/apps/64x/unifi.png +// @resource unraid https://db-cl.github.io/navbar/assets/apps/64x/unraid.png +// @resource utorrent https://db-cl.github.io/navbar/assets/apps/64x/utorrent.png +// @resource vera https://db-cl.github.io/navbar/assets/apps/64x/vera.png +// @resource videochat https://db-cl.github.io/navbar/assets/apps/64x/videochat.png +// @resource vmware https://db-cl.github.io/navbar/assets/apps/64x/vmware.png +// @resource vmwarevcenter https://db-cl.github.io/navbar/assets/apps/64x/vmwarevcenter.png +// @resource vscode https://db-cl.github.io/navbar/assets/apps/64x/vscode.png +// @resource wallabag https://db-cl.github.io/navbar/assets/apps/64x/wallabag.png +// @resource watcher https://db-cl.github.io/navbar/assets/apps/64x/watcher.png +// @resource webmin https://db-cl.github.io/navbar/assets/apps/64x/webmin.png +// @resource webtools https://db-cl.github.io/navbar/assets/apps/64x/webtools.png +// @resource wekan https://db-cl.github.io/navbar/assets/apps/64x/wekan.png +// @resource wetty https://db-cl.github.io/navbar/assets/apps/64x/wetty.png +// @resource xenorchestra https://db-cl.github.io/navbar/assets/apps/64x/xenorchestra.png +// @resource xigmanas https://db-cl.github.io/navbar/assets/apps/64x/xigmanas.png +// @resource xwiki https://db-cl.github.io/navbar/assets/apps/64x/xwiki.png +// @resource znc https://db-cl.github.io/navbar/assets/apps/64x/znc.png +// @resource zoneminder https://db-cl.github.io/navbar/assets/apps/64x/zoneminder.png +// @resource zulip https://db-cl.github.io/navbar/assets/apps/64x/zulip.png // @grant GM_getValue // @grant GM_setValue // @grant GM_xmlhttpRequest +// @grant GM_getResourceURL // ==/UserScript== diff --git a/package-lock.json b/package-lock.json index c5b9295..5053f3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dbcl-navbar", - "version": "1.0.0", + "version": "1.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -916,6 +916,39 @@ "dev": true, "optional": true }, + "babel-polyfill": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", + "requires": { + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "regenerator-runtime": "^0.10.5" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=" + } + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -1186,8 +1219,7 @@ "core-js": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", - "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==", - "dev": true + "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==" }, "core-js-compat": { "version": "3.1.3", diff --git a/package.json b/package.json index 6b3576f..cc5df2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dbcl-navbar", - "version": "1.0.1", + "version": "1.0.2", "description": "A navbar injected with userscripts", "scripts": { "lint": "tslint --project tslint.json ./src/*.ts", @@ -33,6 +33,7 @@ ] }, "dependencies": { - "@types/greasemonkey": "^4.0.0" + "@types/greasemonkey": "^4.0.0", + "babel-polyfill": "^6.26.0" } } diff --git a/src/foldArrow.ts b/src/foldArrow.ts index d69ac00..2d08cab 100644 --- a/src/foldArrow.ts +++ b/src/foldArrow.ts @@ -15,7 +15,7 @@ export class FoldArrow { this.build(); } - private build() { + private async build() { this._html.style.position = 'fixed'; this._html.style.top = '-3px'; this._html.style.left = '10px'; @@ -26,9 +26,14 @@ export class FoldArrow { this._html.style.justifyContent = 'center'; this._html.style.alignItems = 'center'; this._html.style.borderRadius = '3px'; + this._html.style.zIndex = '99999'; const arrowIcon = document.createElement('img'); - arrowIcon.src = env.getInstance().url + '/assets/fa-arrow-down.png'; + if (env.getInstance().devMode === true) { + arrowIcon.src = env.getInstance().url + '/assets/fa-arrow-down.png'; + } else { + arrowIcon.src = await GM_getResourceURL('fa-arrow-down'); + } arrowIcon.style.height = '10px'; arrowIcon.style.width = '10px'; arrowIcon.style.marginTop = '3px'; diff --git a/src/index.ts b/src/index.ts index 10d0b31..87823d3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ +import 'babel-polyfill'; import { Menu, MenuData } from './menu'; import { Environment } from './environment'; import { Row } from './row'; diff --git a/src/menu.ts b/src/menu.ts index d5cdafe..a7df4a0 100644 --- a/src/menu.ts +++ b/src/menu.ts @@ -66,6 +66,7 @@ export class Menu { this._html.style.display = 'flex'; this._html.style.flexDirection = 'column'; this._html.style.backgroundColor = '#333333'; + this._html.style.zIndex = '99999'; const body = document.querySelector('body'); if (body) { @@ -158,7 +159,14 @@ export class Menu { header.style.alignItems = 'center'; const icon = document.createElement('img'); - icon.src = env.getInstance().url + '/assets/fa-menu.png'; + if (env.getInstance().devMode === true) { + icon.src = env.getInstance().url + '/assets/fa-menu.png'; + } else { + (async () => { + icon.src = await GM_getResourceURL('fa-menu'); + })(); + } + icon.style.height = '20px'; icon.style.width = '20px'; icon.style.margin = '10px ' + (this.iconSize / 2) + 'px'; @@ -178,7 +186,13 @@ export class Menu { header.appendChild(title); const foldIcon = document.createElement('img'); - foldIcon.src = env.getInstance().url + '/assets/fa-arrow-up.png'; + if (env.getInstance().devMode === true) { + foldIcon.src = env.getInstance().url + '/assets/fa-arrow-up.png'; + } else { + (async () => { + foldIcon.src = await GM_getResourceURL('fa-arrow-up'); + })(); + } foldIcon.style.height = '10px'; foldIcon.style.width = '10px'; foldIcon.style.margin = '10px'; diff --git a/src/row.ts b/src/row.ts index fd6d767..b531317 100644 --- a/src/row.ts +++ b/src/row.ts @@ -34,7 +34,7 @@ export class Row { this.build(); } - private build() { + private async build() { this._row.style.width = '100%px'; this._row.style.height = '40px'; this._row.style.display = 'flex'; @@ -63,8 +63,16 @@ export class Row { this._row.style.borderLeft = '3px solid transparent'; } - const url = (Row.validURL(this.icon)) ? this.icon : Environment.getInstance().url + '/assets/apps/' + this.icon + '.png'; - this._icon.style.backgroundImage = 'url(' + url + ')'; + let url: string; + if (Environment.getInstance().devMode === true) { + url = (Row.validURL(this.icon)) ? this.icon : Environment.getInstance().url + '/assets/apps/64x/' + this.icon + '.png'; + this._icon.style.backgroundImage = 'url(' + url + ')'; + } else { + (async () => { + url = (Row.validURL(this.icon)) ? this.icon : await GM_getResourceURL(this.icon); + this._icon.style.backgroundImage = 'url(' + url + ')'; + })(); + } this._icon.style.border = '0'; this._icon.style.backgroundColor = 'transparent'; this._icon.style.backgroundRepeat = 'no-repeat';