1 /** 2 * @file Data helper methods 3 * 4 * @author Dominik Kocuj 5 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 or later 6 * @copyright Copyright (c) 2016-2018 kocuj.pl 7 */ 8 9 (function() {})(); // empty function for correct minify with comments 10 //'use strict'; // for jshint uncomment this and comment line above 11 12 /* jshint strict: true */ 13 /* jshint -W034 */ 14 15 /* global jQuery */ 16 17 /* global kocujILV12aHelper */ 18 19 /** 20 * Data helper prototype constructor 21 * 22 * @constructs 23 * @namespace kocujILV12aCDataHelper 24 * @public 25 * @return {void} 26 */ 27 function kocujILV12aCDataHelper() { 28 'use strict'; 29 /* jshint validthis: true */ 30 // get this object 31 var self = this; 32 // initialize objects 33 self._objHelper = kocujILV12aHelper; 34 } 35 36 /** 37 * Data helper prototype 38 * 39 * @namespace kocujILV12aCDataHelper 40 * @public 41 */ 42 kocujILV12aCDataHelper.prototype = { 43 /** 44 * Object kocujILV12aHelper 45 * 46 * @private 47 * @type {Object} 48 */ 49 _objHelper : null, 50 51 /** 52 * Set HTML data in DOM 53 * 54 * @public 55 * @param {Object} element HTML element in jQuery format 56 * @param {string} dataId Data identifier 57 * @param {string} value Data value 58 * @return {void} 59 */ 60 setDataInDom : function(element, dataId, value) { 61 'use strict'; 62 // get this object 63 var self = this; 64 (function($) { 65 // parse arguments 66 element = self._objHelper.initObject(element); 67 dataId = self._objHelper.initString(dataId); 68 value = self._objHelper.initString(value); 69 // set HTML data 70 element.attr('data-' + dataId, value); 71 element.data(dataId, value); 72 }(jQuery)); 73 } 74 }; 75 76 // initialize 77 var kocujILV12aDataHelper = new kocujILV12aCDataHelper(); 78