-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic2.js
148 lines (126 loc) · 5.31 KB
/
basic2.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// ----- b a s i c 2 ------------------------------------------------------------
// ------Ergänzung von Bernd Gewehr--------------------------------------------
// ----- basic.pager ----------------------------------------------------------
$(document).delegate('div[data-widget="basic.pager"]', {
'update': function (event, response) {
var prog = response[0].match(/prog[123]/g);
$('#' + $(this).attr('data-val')).css("visibility", "hidden");
$(this).attr('data-val', prog);
$('#' + $(this).attr('data-val')).css("visibility", "visible");
}
});
// ----- basic.httpcmd ----------------------------------------------------------
$(document).delegate('a[data-widget="basic.httpcmd"]', {
'click': function (event) {
$.ajax($(this).attr('data-val'));
}
});
// ----- basic.textrpl ----------------------------------------------------------
$(document).delegate('span[data-widget="basic.textrpl"]', {
'update': function (event, response) {
var UTF8response=response[0].replace(/ü/g, "ü");
UTF8response=UTF8response.replace(/ä/g, "ä");
UTF8response=UTF8response.replace(/ö/g, "ö");
UTF8response=UTF8response.replace(/â¬/g, "€");
$('#' + this.id).html(UTF8response);
}
});
// ----- basic.timecounter-----------------------------------------------------
$(document).delegate('span[data-widget="basic.timecounter"]', {
'init': function (event) {
},
'update': function (event, response) {
$(this).html(ZeitAnzeigen($(this).attr('id'), $(this).attr('data'), response));
}
});
// ----- basic.textinput ------------------------------------------------------
$(document).delegate('input[data-widget="basic.textinput"]', {
'update': function (event, response) {
// DEBUG: console.log("[basic.textinput] update '" + this.id + "':", response);
$(this).val(response);
},
'change': function (event) {
// DEBUG: console.log("[basic.textinput] change '" + this.id + "':", $(this).val());
io.write($(this).attr('data-item'), $(this).val());
}
});
// ----- basic.select_single -------------------------------------------------------
$(document).delegate('select[data-widget="basic.selectmenu"]', {
'update': function (event, response) {
var prog = response[0].match(/prog[123]/g);
$(this).val(prog).selectmenu().selectmenu('refresh');
// DEBUG: console.log("[basic.selectmenu] update '" + this.id + "': aktuell: " + $(this).attr('selected'), response);
},
'change': function (event) {
io.write($(this).attr('data-item'), $(this).val());
// DEBUG: console.log("[basic.selectmenu] change '" + this.id + "':", $(this).prop('selected'));
}
});
// ----- basic.img ----------------------------------------------------------
$(document).delegate('img[data-widget="basic.img"]', {
'update': function (event, response) {
if ($('#' + this.id).attr('alt') == '') {
$('#' + this.id).attr('src',response);
}
else {
$('#' + this.id).attr('src',$('#' + this.id).attr('src') + response[0].match(new RegExp($('#' + this.id).attr('alt'),'gi')));
}
$('#' + this.id).attr('style',"visibility:'display'; width: 100px");
// DEBUG: console.log("[basic.img] '" + this.id + "'", response);console.log("[basic.img] '" + this.id + "'", response[0].match(/\d+\-\d\.jpg/gi));
}
});
// ----- visu.lbutton ----------------------------------------------------------
$(document).delegate('[data-widget="basic.lbutton"]', {
'vmousedown': function(event) { // Short/Long Button
event.preventDefault();
var items = widget.explode($(this).attr('data-item'));
var obj = this;
$(obj).attr('data-timer',
setTimeout(function() {
$(obj).attr('data-long', true);
io.write(items[1], $(obj).attr('data-val'));
}, 400)
);
},
'vmouseup': function() { // Short/Long Button
clearTimeout($(this).attr('data-timer'))
var items = widget.explode($(this).attr('data-item'));
if ($(this).attr('data-long') == 'true') {
$(this).attr('data-long', false);
} else {
io.write(items[0], $(this).attr('data-val'));
}
},
'click': function(event) {
}
});
// ----- basic.lbutton ---------------------------------------------------------
$(document).delegate('a[data-widget="basic.lbutton"]', {
'click': function (event) {
if ($(this).attr('data-val') != '') {
io.write($(this).attr('data-item'), $(this).attr('data-val'));
}
}
});
// ----- basic.hider-----------------------------------------------------
$(document).delegate('div[data-widget="basic.hider"]', {
'init': function (event) {
},
'update': function (event, response) {
if (response == '') {
$(this).html("");
//css("visibility", "hidden");
}
}
});
// ----- basic.auth_switch ---------------------------------------------------------
// ---------------------------------------------------------------------------------
$(document).delegate('span[data-widget="basic.auth_switch"]', {
'update': function (event, response) {
$('#' + this.id + ' img').attr('src', (response == $(this).attr('data-val-on') ? $(this).attr('data-pic-on') : $(this).attr('data-pic-off')));
},
'click': function (event) {
// öffnen des popups bei clicken des icons und ausführung der eingabefunktion
$('#' + this.id + '-popup').popup( "open" );
}
});