Skip to content

Commit be3c0f9

Browse files
committed
Few bug fixes
1 parent 989f7d3 commit be3c0f9

File tree

7 files changed

+275
-14
lines changed

7 files changed

+275
-14
lines changed

header-userscript

Lines changed: 202 additions & 2 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 35 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dbcl-navbar",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "A navbar injected with userscripts",
55
"scripts": {
66
"lint": "tslint --project tslint.json ./src/*.ts",
@@ -33,6 +33,7 @@
3333
]
3434
},
3535
"dependencies": {
36-
"@types/greasemonkey": "^4.0.0"
36+
"@types/greasemonkey": "^4.0.0",
37+
"babel-polyfill": "^6.26.0"
3738
}
3839
}

src/foldArrow.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class FoldArrow {
1515
this.build();
1616
}
1717

18-
private build() {
18+
private async build() {
1919
this._html.style.position = 'fixed';
2020
this._html.style.top = '-3px';
2121
this._html.style.left = '10px';
@@ -26,9 +26,14 @@ export class FoldArrow {
2626
this._html.style.justifyContent = 'center';
2727
this._html.style.alignItems = 'center';
2828
this._html.style.borderRadius = '3px';
29+
this._html.style.zIndex = '99999';
2930

3031
const arrowIcon = document.createElement('img');
31-
arrowIcon.src = env.getInstance().url + '/assets/fa-arrow-down.png';
32+
if (env.getInstance().devMode === true) {
33+
arrowIcon.src = env.getInstance().url + '/assets/fa-arrow-down.png';
34+
} else {
35+
arrowIcon.src = await GM_getResourceURL('fa-arrow-down');
36+
}
3237
arrowIcon.style.height = '10px';
3338
arrowIcon.style.width = '10px';
3439
arrowIcon.style.marginTop = '3px';

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'babel-polyfill';
12
import { Menu, MenuData } from './menu';
23
import { Environment } from './environment';
34
import { Row } from './row';

src/menu.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export class Menu {
6666
this._html.style.display = 'flex';
6767
this._html.style.flexDirection = 'column';
6868
this._html.style.backgroundColor = '#333333';
69+
this._html.style.zIndex = '99999';
6970

7071
const body = document.querySelector('body');
7172
if (body) {
@@ -158,7 +159,14 @@ export class Menu {
158159
header.style.alignItems = 'center';
159160

160161
const icon = document.createElement('img');
161-
icon.src = env.getInstance().url + '/assets/fa-menu.png';
162+
if (env.getInstance().devMode === true) {
163+
icon.src = env.getInstance().url + '/assets/fa-menu.png';
164+
} else {
165+
(async () => {
166+
icon.src = await GM_getResourceURL('fa-menu');
167+
})();
168+
}
169+
162170
icon.style.height = '20px';
163171
icon.style.width = '20px';
164172
icon.style.margin = '10px ' + (this.iconSize / 2) + 'px';
@@ -178,7 +186,13 @@ export class Menu {
178186
header.appendChild(title);
179187

180188
const foldIcon = document.createElement('img');
181-
foldIcon.src = env.getInstance().url + '/assets/fa-arrow-up.png';
189+
if (env.getInstance().devMode === true) {
190+
foldIcon.src = env.getInstance().url + '/assets/fa-arrow-up.png';
191+
} else {
192+
(async () => {
193+
foldIcon.src = await GM_getResourceURL('fa-arrow-up');
194+
})();
195+
}
182196
foldIcon.style.height = '10px';
183197
foldIcon.style.width = '10px';
184198
foldIcon.style.margin = '10px';

src/row.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class Row {
3434
this.build();
3535
}
3636

37-
private build() {
37+
private async build() {
3838
this._row.style.width = '100%px';
3939
this._row.style.height = '40px';
4040
this._row.style.display = 'flex';
@@ -63,8 +63,16 @@ export class Row {
6363
this._row.style.borderLeft = '3px solid transparent';
6464
}
6565

66-
const url = (Row.validURL(this.icon)) ? this.icon : Environment.getInstance().url + '/assets/apps/' + this.icon + '.png';
67-
this._icon.style.backgroundImage = 'url(' + url + ')';
66+
let url: string;
67+
if (Environment.getInstance().devMode === true) {
68+
url = (Row.validURL(this.icon)) ? this.icon : Environment.getInstance().url + '/assets/apps/64x/' + this.icon + '.png';
69+
this._icon.style.backgroundImage = 'url(' + url + ')';
70+
} else {
71+
(async () => {
72+
url = (Row.validURL(this.icon)) ? this.icon : await GM_getResourceURL(this.icon);
73+
this._icon.style.backgroundImage = 'url(' + url + ')';
74+
})();
75+
}
6876
this._icon.style.border = '0';
6977
this._icon.style.backgroundColor = 'transparent';
7078
this._icon.style.backgroundRepeat = 'no-repeat';

0 commit comments

Comments
 (0)