')
.addClass('hot-price-block')
.append(
$jq('
')
.addClass('hot-otp-price')
.append(
$jq('').click(function () {
if($jq('.new_t-menu-back').length) {
$jq('html, body').animate({
scrollTop: $jq('.new_t-menu-back').offset().top - 20
}, 1000);
}
})
)
).append(
$jq('
')
.addClass('hot-otp-price-count')
)
)
).appendTo($block);
break;
}
};
// Run application
this.checkScripts(startFunction);
/**
* local && session storage #11195
*/
this.storage = new function(){
/**
* Is supported local storage
* @returns {boolean}
*/
this.is_support = function(){
try {
localStorage.setItem('test', 'test');
localStorage.removeItem('test');
return true;
} catch(e) {
return false;
}
};
/**
* Get object from storage
* @param key
* @param type (dict || list)
* @param ts
* @param cached_days
* @param cached_hours
* @param cached_minutes
* @returns {*}
*
* @example o.storage.get('key', '{}', 'session', 7)
*/
this.get = function(key, type, ts, cached_days, cached_hours, cached_minutes) {
type = type || []; // list type default
if(this.is_support() && key) {
if(ts === 'session') {
return JSON.parse(sessionStorage.getItem(key) || type);
} else {
// cached
var now = new Date();
if(+localStorage.getItem(key +'-date') < now.getTime()) {
var days = +cached_days? cached_days: (+cached_hours? 0: 2); // 2 day default
var hours = +cached_hours? cached_hours: 0;
var minutes = +cached_minutes? cached_minutes: 0;
if(days) { // cached days
this.set(key +'-date', now.getTime()+(+days*24*60*60*1000));
} else if(hours) { // cached hours
this.set(key +'-date', now.getTime()+(+hours*60*60*1000));
} else {
this.set(key +'-date', now.getTime()+(+minutes*60*1000));
}
// remove cache
localStorage.removeItem(key);
}
return JSON.parse(localStorage.getItem(key) || type);
}
}
};
/**
* Set object to storage
* @param key
* @param value
* @param ts
*
* @example o.storage.set('key', 123)
*/
this.set = function(key, value, ts){
if(this.is_support() && key && value) {
if(ts === 'session') {
sessionStorage.setItem(key, JSON.stringify(value));
} else {
localStorage.setItem(key, JSON.stringify(value));
}
}
};
};
};
new osHotTourWidgetClass(OShotTourVars, apiKey);