(function () {
if (window.jQuery === undefined) {
var script_tag = document.createElement('script');
script_tag.setAttribute("type", "text/javascript");
script_tag.setAttribute("src", "http://code.jquery.com/jquery-1.10.2.js");
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
}
})();
var WidgetDigital = function () {
var _this = {};
_this.item = {};
_this.item.wtDateTimeType = 0;
_this.digitalTimer;
_this.init = function () {
console.log("init");
if (_this.options) {
_this.options.isFirstTime = false;
}
else {
_this.options = _this.getParams();
_this.options.isFirstTime = true;
}
console.log("get params");
_this.injectStyleSheets();
console.log("inject style");
//Check if script called not from SD(by url).
if (_this.options.isRenderByURL == "true") {
try {
var widgetSelector = (_this.item.containerID) ? "#" + _this.item.containerID : "#" + _this.options.containerID;
var el = $(widgetSelector).find("[id*=wt_digital]");
var scriptObj = $('script[id*="widget_digital"]'); //find all script tag for this type of widget
for (var i = 0; i < scriptObj.length; i++) {
if (scriptObj[i].dataset && scriptObj[i].dataset.containerID == el[0].id) {
//var widget = JSON.parse(scriptObj[i].dataset.sourceItem);
//_this.item = widget.item;
//_this.options = widget.options;
var dto = JSON.parse(scriptObj[i].dataset.sourceItem);
if (isEmpty(dto.otherSettings)) {//We will get otherSettings only if we save jsongString(New logic).
_this.item = dto.item;
_this.options = dto.options;
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.