-
Notifications
You must be signed in to change notification settings - Fork 108
/
angular.js
56 lines (46 loc) 路 1.74 KB
/
angular.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
const {shell} = require('electron');
require('angular/angular');
require('angular-aria');
require('angular-animate');
require('angular-messages');
require('angular-material');
global.p3x.onenote.ng = angular.module('p3x-onenote', [
'ngMaterial', 'ngMessages'
]);
require('./angular/prompt');
require('./angular/toast');
global.p3x.onenote.ng.config(($mdAriaProvider, $mdThemingProvider) => {
$mdAriaProvider.disableWarnings();
$mdThemingProvider.theme('default').primaryPalette('purple').accentPalette('blue')//.warnPalette('amber');
})
global.p3x.onenote.ng.run((p3xOnenotePrompt, p3xOnenoteToast, $rootScope, $animate, $mdMedia) => {
$animate.enabled(false)
global.p3x.onenote.prompt = p3xOnenotePrompt;
global.p3x.onenote.toast = p3xOnenoteToast;
global.p3x.onenote.root = $rootScope
$rootScope.$mdMedia = $mdMedia
p3x.onenote.toast.action(p3x.onenote.lang.slow)
$rootScope.p3x = {
onenote: {
go: (action) => {
global.p3x.onenote.webview[action === 'back' ? 'goBack' : 'goForward']()
},
canGo: (action) => {
if (action === 'back') {
return global.p3x.onenote.webview.canGoBack()
}
return global.p3x.onenote.webview.canGoForward()
},
lang: global.p3x.onenote.lang,
location: undefined,
copyLocation: require('./action/multi-action/get-location'),
donate: () => {
shell.openExternal('https://paypal.me/patrikx3')
}
}
}
})
angular.element(document).ready(() => {
const bootstrapElement = document.getElementById('p3x-onenote-bootstrap');
angular.bootstrap(bootstrapElement, ['p3x-onenote']);
})