|
|
@ -7,7 +7,7 @@ function bindData(){
|
|
|
|
let mods = $('model');
|
|
|
|
let mods = $('model');
|
|
|
|
mods.each(function(){
|
|
|
|
mods.each(function(){
|
|
|
|
let model = $(this);
|
|
|
|
let model = $(this);
|
|
|
|
if (model.attr('refresh-interval') != undefined) {
|
|
|
|
if (model.attr('refresh-interval') !== undefined) {
|
|
|
|
bindModelData(model);
|
|
|
|
bindModelData(model);
|
|
|
|
setInterval(()=> { bindModelData(model) }, model.attr('refresh-interval'));
|
|
|
|
setInterval(()=> { bindModelData(model) }, model.attr('refresh-interval'));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -16,11 +16,11 @@ function bindData(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function bindModelData(model) {
|
|
|
|
function bindModelData(model) {
|
|
|
|
$.get(model.attr('src'), function(data){
|
|
|
|
$.get(model.attr('src'), function(data) {
|
|
|
|
$('*[model='+model.attr('name')+']').each(function() {
|
|
|
|
$('*[model='+model.attr('name')+']').each(function() {
|
|
|
|
let elem = $(this);
|
|
|
|
let elem = $(this);
|
|
|
|
let data = getDataByPath(JSON.parse(data), elem.attr('datapath'));
|
|
|
|
let dat = getDataByPath(JSON.parse(data), elem.attr('datapath'));
|
|
|
|
this.setAttribute(":data", data);
|
|
|
|
this.setAttribute(":data", dat);
|
|
|
|
//elem.html();
|
|
|
|
//elem.html();
|
|
|
|
})
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -28,7 +28,7 @@ function bindModelData(model) {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns the data of an array by accessing the given path-string
|
|
|
|
* Returns the data of an array by accessing the given path-string
|
|
|
|
* @param {JSON-Object} array Contains the data.
|
|
|
|
* @param {Object} array Contains the data.
|
|
|
|
* @param {String} path The path to the wanted data.
|
|
|
|
* @param {String} path The path to the wanted data.
|
|
|
|
* @return {Object} Returns anything that the path points to.
|
|
|
|
* @return {Object} Returns anything that the path points to.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|