-
Notifications
You must be signed in to change notification settings - Fork 8
/
getBins.js
37 lines (35 loc) · 904 Bytes
/
getBins.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
// return a parameter value from the current URL
function getParam ( sname )
{
var params = location.search.substr(location.search.indexOf("?")+1);
var sval = "";
params = params.split("&");
// split param and value into individual pieces
for (var i=0; i<params.length; i++)
{
temp = params[i].split("=");
if ( [temp[0]] == sname ) { sval = temp[1]; }
}
return sval;
}
var binsBinding = new Shiny.InputBinding();
$.extend(binsBinding, {
find: function(scope) {
return $(scope).find(".n_breaks");
},
getValue: function(el) {
return $(el).val();
},
setValue: function(el, value) {
$(el).val(value);
},
subscribe: function(el, callback) {
$(el).val(getParam("bins"));
$(el).trigger("change");
callback();
},
unsubscribe: function(el) {
$(el).off(".binsBinding");
}
});
Shiny.inputBindings.register(binsBinding);