This repository was archived by the owner on Apr 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcubicle.js
81 lines (78 loc) · 2.04 KB
/
cubicle.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
(function(){
var _ = function(m)
{
if("babelfish" in window)
return window.babelfish.translate(m);
return m;
};
var cubicle = {
load: function()
{
var defaults = { extension: 'p3' };
window.freshy.waitFor('settings', function() { window.settings.setDefaults('cubicle', defaults); });
window.freshy.systemLoaded('cubicle');
},
configure: function(config)
{
if(window.cubicle.config.values.extension != config.extension
|| window.cubicle.config.values.extension == 'rcs')
{
window.cubicle.config.values = config;
window.cubicle.activate();
}
},
save: function()
{
window.settings.configuration.cubicle = window.cubicle.config.values;
window.settings.saveConfiguration();
},
config:
{
values: { extension: '' },
get: function()
{
return [
{
title: _('Load extension'),
type: 'right',
options: [
{ type: 'select', name: 'extension', value: window.cubicle.config.values.extension, options: [{value:'', label:_('No')},{value:'p3', label:_('Plug³')}] },
]
}
];
},
set: function(config, value)
{
console.log(config.name, value);
if(window.cubicle.config.values[config.name] != value)
{
window.cubicle.config.values[config.name] = value;
window.cubicle.activate();
window.cubicle.save();
}
return value;
}
},
activate: function()
{
if("rs" in window)
setTimeout(function(){ window.rs.__close(); window.rs = { __close: function(){} }; }, 1);
if(window.cubicle.config.values.extension != 'p3' && ("plugCubed" in window))
{
console.log('Deactive P3');
setTimeout(function(){ window.plugCubed.close(); window.plugCubed = { close: function(){} }; }, 1);
}
if(window.cubicle.config.values.extension == 'p3')
{
console.log('Activate p3');
$.getScript('https://plugcubed.net/scripts/release/plugCubed.js');
}
}
};
if("cubicle" in window)
{
cubicle.config.values.extension = window.cubicle.config.values.extension;
}
window.cubicle = cubicle;
window.cubicle.load();
})();