-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
57 lines (48 loc) · 1.81 KB
/
index.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
define(["angular"], function(angular) {
var ngModule = angular.module("cockpit.nightmode", []);
ngModule.config([
"ViewsProvider",
function(ViewsProvider) {
ViewsProvider.registerDefaultView(
"cockpit.processDefinition.runtime.action",
{
id: "cockpit.nightmode",
template:
'<a class="btn btn-default btn-toolbar" ng-click="startNight()" tooltip="Activate Nightmode" tooltip-placement="left">🌙︎</a>',
controller: [
"$scope",
function($scope) {
$scope.startNight = () => {
window.enterNightMode(
$scope.processData.$providers.local.bpmn20Xml.data.value
.bpmn20Xml
);
};
}
]
}
);
}
]);
const nightModeScript = document.createElement("script");
nightModeScript.setAttribute("type", "module");
nightModeScript.setAttribute(
"src",
"/camunda/app/cockpit/scripts/nightmode/nightmode.js"
);
const THREE = document.createElement("script");
THREE.setAttribute("type", "application/javascript");
THREE.setAttribute("src", "/camunda/app/cockpit/scripts/nightmode/three.js");
const TWEEN = document.createElement("script");
TWEEN.setAttribute("type", "application/javascript");
TWEEN.setAttribute("src", "/camunda/app/cockpit/scripts/nightmode/tween.js");
const font = document.createElement("link");
font.setAttribute("href", "https://fonts.googleapis.com/css?family=Iceland");
font.setAttribute("rel", "stylesheet");
document.head.appendChild(THREE);
document.head.appendChild(TWEEN);
document.head.appendChild(font);
window.setTimeout(() => document.head.appendChild(nightModeScript), 2500);
window.speechSynthesis.getVoices();
return ngModule;
});