-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
85 lines (84 loc) · 2.49 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* Audiobookshelf App
* Defined an App to manage audiobookshelf
*/
var AudiobookshelfApp = AudiobookshelfApp || {} //Define audiobookshelf App namespace.
/**
* Constructor UNAS App
*/
AudiobookshelfApp.App = function () {
this.id = 'Audiobookshelf'
this.name = 'Audiobookshelf'
this.version = '6.0.4'
this.active = false
this.menuIcon = '/apps/audiobookshelf/images/logo.png?v=6.0.4&'
this.shortcutIcon = '/apps/audiobookshelf/images/logo.png?v=6.0.4&'
this.entryUrl = '/apps/audiobookshelf/index.html?v=6.0.4&'
var self = this
this.AudiobookshelfAppWindow = function () {
if (UNAS.CheckAppState('Audiobookshelf')) {
return false
}
self.window = new MUI.Window({
id: 'AudiobookshelfAppWindow',
title: UNAS._('Audiobookshelf'),
icon: '/apps/audiobookshelf/images/logo_small.png?v=6.0.4&',
loadMethod: 'xhr',
width: 750,
height: 480,
maximizable: false,
resizable: true,
scrollbars: false,
resizeLimit: { x: [200, 2000], y: [150, 1500] },
contentURL: '/apps/audiobookshelf/index.html?v=6.0.4&',
require: { css: ['/apps/audiobookshelf/css/index.css'] },
onBeforeBuild: function () {
UNAS.SetAppOpenedWindow('Audiobookshelf', 'AudiobookshelfAppWindow')
},
})
}
this.AudiobookshelfUninstall = function () {
UNAS.RemoveDesktopShortcut('Audiobookshelf')
UNAS.RemoveMenu('Audiobookshelf')
UNAS.RemoveAppFromGroups('Audiobookshelf', 'ControlPanel')
UNAS.RemoveAppFromApps('Audiobookshelf')
}
new UNAS.Menu(
'UNAS_App_Internet_Menu',
this.name,
this.menuIcon,
'Audiobookshelf',
'',
this.AudiobookshelfAppWindow
)
new UNAS.RegisterToAppGroup(
this.name,
'ControlPanel',
{
Type: 'Internet',
Location: 1,
Icon: this.shortcutIcon,
Url: this.entryUrl,
},
{}
)
var OnChangeLanguage = function (e) {
UNAS.SetMenuTitle('Audiobookshelf', UNAS._('Audiobookshelf')) //translate menu
//UNAS.SetShortcutTitle('Audiobookshelf', UNAS._('Audiobookshelf'));
if (typeof self.window !== 'undefined') {
UNAS.SetWindowTitle('AudiobookshelfAppWindow', UNAS._('Audiobookshelf'))
}
}
UNAS.LoadTranslation(
'/apps/audiobookshelf/languages/Translation?v=' + this.version,
OnChangeLanguage
)
UNAS.Event.addEvent('ChangeLanguage', OnChangeLanguage)
UNAS.CreateApp(
this.name,
this.shortcutIcon,
this.AudiobookshelfAppWindow,
this.AudiobookshelfUninstall
)
}
new AudiobookshelfApp.App()