/* This file is part of Jeedom. * * Jeedom is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Jeedom is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jeedom. If not, see . */ //initEnergyPanel(); /*var touchEvent = 'ontouchstart' in window ? 'touchstart' : 'click'; if($('.link[data-plugin=energy_frixo][data-value=electricity]')){ initEnergyPanel(_options); }*/ function initEnergyPanel(_options) { // alert(_options); var _options = init(_options, ''); var options = _options.split("::"); var object_id = options; if (isset(object_id)) { var energyType = 'electricity'; } else { var energyType = object_id[1]; alert(energyType); } if (object_id == 'day') { var groupBy = 'day'; } if (object_id == 'month') { var groupBy = 'month'; } $('.link[data-plugin=energy_frixo][data-value=electricity]').attr('data-option', object_id + 'electricity' + groupBy); $('.link[data-plugin=energy_frixo][data-value=water]').attr('data-option', object_id + '::water::'+groupBy); $('.link[data-plugin=energy_frixo][data-value=gas]').attr('data-option', object_id + '::gas::'+groupBy); $('.link[data-plugin=energy_frixo][data-value=day]').attr('data-option', object_id + '::'+energyType+'::day'); $('.link[data-plugin=energy_frixo][data-value=month]').attr('data-option', object_id + '::'+energyType+'::month'); $('.link[data-plugin=energy_frixo][data-value=' + energyType + ']').addClass('ui-btn-raised clr-primary'); $('.link[data-plugin=energy_frixo][data-value=' + groupBy + ']').addClass('ui-btn-raised clr-primary'); jeedom.object.all({ error: function (error) { $('#div_alert').showAlert({message: error.message, level: 'danger'}); }, success: function (objects) { var li = '