-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcontent_message.js
97 lines (95 loc) · 2.57 KB
/
content_message.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
86
87
88
89
90
91
92
93
94
95
96
97
function cek_extension() {
if(typeof Image2 == 'undefined'){
window.Image2 = Image;
}
window.Image = function(){ return {} };
setTimeout(function(){
window.Image = Image2;
console.log('set Image');
}, 15000);
}
// dirun pertama sebelum yg lain
cek_extension();
window.addEventListener('message', function(event) {
var command = event.data.command;
var opsi = event.data.data;
console.log('run_script', event.data);
switch(command) {
case 'run':
eval(opsi);
break;
case 'cek_extension':
if(opsi == 'image'){
cek_extension();
}
break;
case 'show_modal':
if(!opsi){
window.options_datatable = {
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] },
{ "bSearchable": false, "aTargets": [ 0 ] }
],
"order": [[2, 'asc'], [3, 'asc']],
lengthMenu: [[5, 20, 100, -1], [5, 20, 100, "All"]]
};
jQuery('#modal-extension').modal('show');
}else{
window.options_datatable = {
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] },
{ "bSearchable": false, "aTargets": [ 0 ] }
],
lengthMenu: [[5, 20, 100, -1], [5, 20, 100, "All"]]
};
jQuery('#'+opsi.id).modal('show');
}
break;
case 'hide_modal':
if(!opsi){
jQuery('#modal-extension').modal('hide');
}else{
jQuery('#'+opsi.id).modal('hide');
}
break;
case 'config':
// merubah settingan config
for(var i in config){
if(opsi[i]){
config[i] = opsi[i];
}
}
break;
case 'show_modal_sm':
window.options_datatable = {
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] },
{ "bSearchable": false, "aTargets": [ 0 ] }
],
lengthMenu: [[5, 20, 100, -1], [5, 20, 100, "All"]]
};
if(opsi){
if(opsi.order){
options_datatable.order = opsi.order;
}
}
jQuery('#modal-extension').modal('show');
break;
case 'show_modal_usulan_ssh':
window.options_datatable = {
'columnDefs': [
{ 'width': '300px', 'targets': 6 },
{ orderable: false, targets: 1 }],
lengthMenu: [ [10, 250, 500, -1], [10, 250, 500, 'All']
]
};
jQuery("#usulan-ssh").modal("show");
console.log('tampilkan popup usulan ssh');
break;
case 'show_modal_sumber_dana':
window.options_datatable = { lengthMenu: [[20, 50, 100, -1], [20, 50, 100, "All"]] };
jQuery("#modal-extension-rekap-sumber-dana-sub-keg").modal("show");
console.log('tampilkan popup rekap sumber dana');
break;
}
});