')
.addClass('g-map-header')
.html($.iGuider.opt.tourTitle)
.appendTo($(':contains([map-header])',mapTemplate).last().empty());
}
$.iGuider.v.gMapContent = $('
')
.addClass('g-map-content')
.appendTo($(':contains([map-content])',mapTemplate).last().empty());
/**/
/*Step can be skipped if you set parameter "skip" to true.*/
/**/
var actualStepsCombine = [];
var actualIndex = 0;
var uid = 0;
var stepReplace = function(hStepItem){
if(!hStepItem.loc){
if($.iGuider.opt.baseurl){
hStepItem.loc = $.iGuider.opt.loc || location.href.split($.iGuider.opt.baseurl)[1];
}else{
hStepItem.loc = $.iGuider.opt.loc || location.href;
}
}
if(typeof hStepItem.keyboardEvent == "undefined"){
hStepItem.keyboardEvent = $.iGuider.opt.keyboardEvent;
}
/*Set Step Timer*/
if(!parseFloat(hStepItem.timer)){
if(hStepItem.timer === false || hStepItem.timer === 0 || hStepItem.timer === '0'){
hStepItem.timer = false;
}else{
if(parseFloat($.iGuider.opt.timer) > 0){
hStepItem.timer = $.iGuider.opt.timer;
}else{
hStepItem.timer = false;
}
}
}
actualStepsCombine.push(hStepItem);
/**/
/*Creating step links*/
/**/
var hStepItemTitle = hStepItem.title ? hStepItem.title : '№'+(actualIndex+1);
var hindexStep = $('
'+hStepItemTitle+'
').appendTo($.iGuider.v.gMapContent);
if(hStepItem.ready){
addSuccess(hindexStep);
}
actualIndex++;
};
var escapeRe = function (value) {
return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
};
if($.iGuider.opt.steps && $.iGuider.opt.steps.length){
for(var i = 0; i < $.iGuider.opt.steps.length; i++){
var skip = $.iGuider.opt.steps[i].skip;
if(!skip){
var hStepItem = $.iGuider.opt.steps[i];
if($.iGuider.opt.registerMissingElements || hStepItem.position == 'center'){
stepReplace(hStepItem);
}else{
var targetElement;
if($(hStepItem.target).length){
targetElement = $(hStepItem.target);
}else{
targetElement = $('[data-target ="'+hStepItem.target+'"]');
}
if(targetElement.length){
stepReplace(hStepItem);
}
}
}
$.iGuider.v.tourid = $.iGuider.v.tourid + $.iGuider.opt.steps[i].target;
}
$.iGuider.opt.steps = actualStepsCombine;
}
/**/
/*Save Desktop Events $ Save Touch Events*/
/**/
var iOs = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
$.iGuider.v.clickEvent = iOs ? 'touchend' : 'click';
var touchMoving = false;
if (iOs){
document.ontouchmove = function(e){
touchMoving = true;
};
document.ontouchend = function(e){
setTimeout(function(){
touchMoving = false;
},100);
};
}
var mousemoveEvent = 'mousemove.'+$.iGuider.hName;
var mousedownEvent = 'mousedown.'+$.iGuider.hName;
var mouseupEvent = 'mouseup.'+$.iGuider.hName;
if('ontouchstart' in window){
mousemoveEvent = 'touchmove.'+$.iGuider.hName;
mousedownEvent = 'touchstart.'+$.iGuider.hName;
mouseupEvent = 'touchend.'+$.iGuider.hName;
}
$.iGuider.v.mousemoveEvent = mousemoveEvent;
$.iGuider.v.mouseupEvent = mouseupEvent;
$.iGuider.v.mousedownEvent = mousedownEvent;
/**/
/*Detect Privacy Mode in Safari (iOS)*/
/**/
var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
if(iOS){
try { localStorage.test = 2; } catch (e) {
alert('You are in Privacy Mode\nPlease deactivate Privacy Mode and then reload the page to view the Tour.');
$.fn.iGuider('destroy');
return false;
}
}
/**/
/*This function converts the parameters of the object to a string*/
/**/
var toStringObjIndex = 0;
var typeDetect = function(per){
if(typeof per == 'function'){
//function
return typeof per;
}
if(typeof per == 'boolean'){
//boolean
return typeof per;
}
if(typeof per == 'string'){
//string
return typeof per;
}
if(typeof per == 'number'){
//number
return typeof per;
}
if(typeof per == 'object'){
if(Array.isArray(per)){
//Array
return 'array';
}else{
//Object
return 'object';
}
}
};
$.iGuider.v.toStringObj = function(obj){
var newIndex = toStringObjIndex++;
var objEnter = obj;
var tempObj = {};
tempObj[newIndex] = {};
for (var i in objEnter) {
if(objEnter.hasOwnProperty(i)){
var key1 = i;
var val = objEnter[key1];
//function
if(typeDetect(val) == 'function'){
tempObj[newIndex][key1] = val.toString();
}
//array
if(typeDetect(val) == 'array'){
var valEach = val;
for(var f = 0; f < valEach.length; f++){
if(typeDetect(valEach[f]) == 'object'){
var objMass = valEach[f];
var val3 = $.iGuider.v.toStringObj(objMass);
valEach[f] = val3;
}
}
tempObj[newIndex][key1] = valEach;
}
//object
if(typeDetect(val) == 'object'){
var val2 = $.iGuider.v.toStringObj(val);
tempObj[newIndex][key1] = val2;
}
//string, number, boolean
if(typeDetect(val) == 'string' || typeDetect(val) == 'number' || typeDetect(val) == 'boolean'){
tempObj[newIndex][key1] = objEnter[key1];
}
}
}
return tempObj[newIndex];
};
$.iGuider.v.coneHide = function(){
$.iGuider.v.modalPos.addClass('cone-hide');
};
$.iGuider.v.coneShow = function(){
$.iGuider.v.modalPos.removeClass('cone-hide');
};
$.iGuider.v.selectCallback = function(){
if($.iGuider.opt.steps[$.iGuider.v.startIndex].autofocus !== false){
$(':focus').blur();
$.iGuider.v.targetEl.focus();
}
$.iGuider.v.messHide();
$.iGuider.v.messEvHide();
};
$.iGuider.v.posCorrect = function(pos_0, pos_1, pos_2){
if(!pos_0){
pos_0 = $.iGuider.v.modalPos.attr('data-pos');
}
if(!pos_1){
pos_1 = $.iGuider.v.modalPos.attr('data-cone');
}
if(!pos_2){
pos_2 = $.iGuider.v.modalPos.attr('data-cont');
}
var ww = $(window).width();
var sizeW = $.iGuider.v.modalSize.outerWidth();
if(sizeW > (ww - 20)){
$.iGuider.v.modalSize.css({minWidth:(ww - 20)});
}
var corrected = false;
$.iGuider.v.modalSize.css({marginTop:'', marginLeft:''});
$.iGuider.v.modalPos.css({marginLeft:''});
var sumW = ($.iGuider.v.modalSize.offset().left + $.iGuider.v.modalSize.width());
var wh = $(window).height();
var elOffsetTop = ($.iGuider.v.modalSize.offset().top - $(window).scrollTop());
var sumH = elOffsetTop + $.iGuider.v.modalSize.height();
$.iGuider.v.coneShow();
var corVal;
$.iGuider.v.coneCheckHor = function(corVal){
if(pos_0 == 'l' || pos_0 == 'r'){
//hide cone
$.iGuider.v.coneHide();
}
if(pos_0 == 't' || pos_0 == 'b'){
if(pos_2 == 'r' && corVal > 0){
//hide cone
$.iGuider.v.coneHide();
}
if(pos_2 == 'l' && corVal < 0){
//hide cone
$.iGuider.v.coneHide();
}
if(pos_1 == 'c'){
if(pos_2 == 'c'){
if(corVal < 0){
if((corVal-15) < -$.iGuider.v.modalSize.outerWidth()/2){
//hide cone
$.iGuider.v.coneHide();
}
}
if(corVal > 0){
if((corVal+15) > $.iGuider.v.modalSize.outerWidth()/2){
//hide cone
$.iGuider.v.coneHide();
}
}
}
if(pos_2 == 'r'){
if(corVal < 0){
if((corVal-15) < -$.iGuider.v.modalSize.outerWidth()){
//hide cone
$.iGuider.v.coneHide();
}
}
}
if(pos_2 == 'l'){
if(corVal > 0){
if((corVal+15) > $.iGuider.v.modalSize.outerWidth()){
//hide cone
$.iGuider.v.coneHide();
}
}
}
}
if(pos_1 == 'r' || pos_1 == 'l'){
if(pos_2 == 'r'){
if(corVal < 0){
if((corVal-15) < -$.iGuider.v.modalSize.outerWidth()){
//hide cone
$.iGuider.v.coneHide();
}
}
}
if(pos_2 == 'l'){
if(corVal > 0){
if((corVal+15) > $.iGuider.v.modalSize.outerWidth()){
//hide cone
$.iGuider.v.coneHide();
}
}
}
if(pos_2 == 'c'){
if(corVal < 0){
if((corVal-15) < -$.iGuider.v.modalSize.outerWidth()/2){
//hide cone
$.iGuider.v.coneHide();
}
}
if(corVal > 0){
if((corVal+15) > $.iGuider.v.modalSize.outerWidth()/2){
//hide cone
$.iGuider.v.coneHide();
}
}
}
}
}
};
$.iGuider.v.coneCheckVert = function(corVal){
if(pos_0 == 't' || pos_0 == 'b'){
//hide cone
$.iGuider.v.coneHide();
}
if(pos_0 == 'l' || pos_0 == 'r'){
if(pos_2 == 'b' && corVal > 0){
//hide cone
$.iGuider.v.coneHide();
}
if(pos_2 == 't' && corVal < 0){
//hide cone
$.iGuider.v.coneHide();
}
if(pos_1 == 'c'){
if(pos_2 == 'c'){
if(corVal < 0){
if((corVal-15) < -$.iGuider.v.modalSize.outerHeight()/2){
//hide cone
$.iGuider.v.coneHide();
}
}
if(corVal > 0){
if((corVal+15) > $.iGuider.v.modalSize.outerHeight()/2){
//hide cone
$.iGuider.v.coneHide();
}
}
}
if(pos_2 == 'b'){
if(corVal < 0){
if((corVal-15) < -$.iGuider.v.modalSize.outerHeight()){
//hide cone
$.iGuider.v.coneHide();
}
}
}
if(pos_2 == 't'){
if(corVal > 0){
if((corVal+15) > $.iGuider.v.modalSize.outerHeight()){
//hide cone
$.iGuider.v.coneHide();
}
}
}
}
if(pos_1 == 'b' || pos_1 == 't'){
if(pos_2 == 'b'){
if(corVal < 0){
if((corVal-15) < -$.iGuider.v.modalSize.outerHeight()){
//hide cone
$.iGuider.v.coneHide();
}
}
}
if(pos_2 == 't'){
if(corVal > 0){
if((corVal+15) > $.iGuider.v.modalSize.outerHeight()){
//hide cone
$.iGuider.v.coneHide();
}
}
}
if(pos_2 == 'c'){
if(corVal < 0){
if((corVal-15) < -$.iGuider.v.modalSize.outerHeight()/2){
//hide cone
$.iGuider.v.coneHide();
}
}
if(corVal > 0){
if((corVal+15) > $.iGuider.v.modalSize.outerHeight()/2){
//hide cone
$.iGuider.v.coneHide();
}
}
}
}
}
};
/*start correct*/
/*for horizontal correct*/
if(sumW > (ww - 10)){
corrected = true;
corVal = -((sumW - ww)+10);
$.iGuider.v.modalSize.css({marginLeft:corVal});
$.iGuider.v.coneCheckHor(corVal);
}
if($.iGuider.v.modalSize.offset().left < 10){
corrected = true;
corVal = -$.iGuider.v.modalSize.offset().left+10;
$.iGuider.v.modalSize.css({marginLeft:corVal});
$.iGuider.v.coneCheckHor(corVal);
}
/*for vertical correct*/
if(sumH > (wh - 10)){
corrected = true;
corVal = -((sumH - wh)+10);
$.iGuider.v.modalSize.css({marginTop:corVal});
$.iGuider.v.coneCheckVert(corVal);
}
if(elOffsetTop < 10){
corrected = true;
corVal = (elOffsetTop*-1+10);
$.iGuider.v.modalSize.css({marginTop:corVal});
$.iGuider.v.coneCheckVert(corVal);
}
/*end correct*/
if(pos_0 == 'c' && pos_1 == 'c' && pos_2 == 'c'){
$.iGuider.v.modalSize.css({marginLeft:''});
}
if(pos_2 !== 'c' && corrected){
//hide cone
//$.iGuider.v.coneHide();
}
if($.iGuider.v.modalSize.height() > wh - 20){
//hide cone
$.iGuider.v.coneHide();
}
if(corrected){
$.iGuider.v.modalPos.addClass('g-pos-correct');
}else{
$.iGuider.v.modalPos.removeClass('g-pos-correct');
}
};
$.iGuider.v.play = function(){
if ($.iGuider.opt.play !== undefined) {
try{
var play_Func = new Function('return ' + $.iGuider.opt.play)();
play_Func();
}catch(e) {
$.iGuider.v.debug(new Error().lineNumber+ ' The callback function specified is not correct.');
}
}
};
$.iGuider.v.pause = function(){
if ($.iGuider.opt.pause !== undefined) {
try{
var pause_Func = new Function('return ' + $.iGuider.opt.pause)();
pause_Func();
}catch(e) {
$.iGuider.v.debug(new Error().lineNumber+ ' The callback function specified is not correct.');
}
}
};
/*Callback functions*/
$.iGuider.v.start = function(){
localStorage.setItem('iGuider_event','start');
if ($.iGuider.opt.start !== undefined) {
try{
var start_Func = new Function('return ' + $.iGuider.opt.start)();
start_Func();
}catch(e) {
$.iGuider.v.debug(new Error().lineNumber+ ' The callback function specified is not correct.');
}
}
};
$.iGuider.v.end = function(){
localStorage.setItem('iGuider_event','end');
//$.iGuider.v.progressFunc(0);
if ($.iGuider.opt.end !== undefined) {
try{
var end_Func = new Function('return ' + $.iGuider.opt.end)();
end_Func();
}catch(e) {
$.iGuider.v.debug(new Error().lineNumber+ ' The callback function specified is not correct.');
}
}
};
$.iGuider.v.abort = function(){
localStorage.setItem('iGuider_event','abort');
localStorage.setItem('iGuider_restored','0');
localStorage.removeItem('iGuider_opt');
localStorage.removeItem('iGuider_step');
if ($.iGuider.opt.abort !== undefined) {
try{
var abort_Func = new Function('return ' + $.iGuider.opt.abort)();
abort_Func();
}catch(e) {
$.iGuider.v.debug(new Error().lineNumber+ ' The callback function specified is not correct.');
}
}
};
$.iGuider.v.finish = function(){
localStorage.setItem('iGuider_event','finish');
if ($.iGuider.opt.finish !== undefined) {
try{
var finish_Func = new Function('return ' + $.iGuider.opt.finish)();
finish_Func();
}catch(e) {
$.iGuider.v.debug(new Error().lineNumber+ ' The callback function specified is not correct.');
}
}
localStorage.removeItem('iGuider_step');
localStorage.removeItem('iGuider_opt');
localStorage.removeItem('iGuider_data-'+$.iGuider.opt.tourID);
localStorage.removeItem('itour_options');
};
$.iGuider.v.create = function(){
localStorage.setItem('iGuider_event','create');
if ($.iGuider.opt.create !== undefined) {
try{
var create_Func = new Function('return ' + $.iGuider.opt.create)();
create_Func();
}catch(e) {
$.iGuider.v.debug(new Error().lineNumber+ ' The callback function specified is not correct.');
}
}
if(!$.iGuider.opt.steps){
localStorage.setItem('iGuider_event','no_steps');
}
};
$(document).on('keydown.iGuider',function(e){
if($.iGuider){
if(!$.iGuider.v.design){
if($.iGuider.opt.keyboard){
if(parseFloat(e.keyCode) == 27){
$.iGuider.v.debug(new Error().lineNumber+ ' Click Esc and Destroy');
$.iGuider.v.end();
$.iGuider.v.abort();
$.fn.iGuider('destroy');
}
if(parseFloat(e.keyCode) == 39){
$.iGuider.v.debug(new Error().lineNumber+ ' Click Keyboard Next');
iGuider('next');
}
if(parseFloat(e.keyCode) == 37){
$.iGuider.v.debug(new Error().lineNumber+ ' Click Keyboard Prev');
iGuider('prev');
}
if(parseFloat(e.keyCode) == 13){
$.iGuider.v.debug(new Error().lineNumber+ ' Click Keyboard Enter');
if($('html').is('.g-modal-intro-show')){
$.iGuider.v.debug(new Error().lineNumber+ ' Click Keyboard Start');
$.iGuider.v.modalStart.addClass('active');
$.iGuider.v.modalStart.trigger('click');
}
if($('html').is('.g-modal-continue-show')){
$.iGuider.v.debug(new Error().lineNumber+ ' Click Keyboard Continue');
$.iGuider.v.modalBeginContinue.addClass('active');
$.iGuider.v.modalBeginContinue.trigger('click');
}
}
}
}
}
});
/**/
/*Overlay Elements Positioning*/
/**/
$.iGuider.v.overlayPos = function(targetEl){
$.iGuider.v.debug(new Error().lineNumber+ ' Start overlayPos func');
if(targetEl && targetEl.length){
$.iGuider.v.modalData = [];
var vw = $(window).width();
var vh = $(window).height();
var wst = $(window).scrollTop();
var wsl = $(window).scrollLeft();
var indent = 10;
targetEl.each(function(i){
var targetElItem = $(this);
var targetElWidth = Math.round(targetElItem.outerWidth());
var targetElHeight = Math.round(targetElItem.outerHeight());
var targetElTop = Math.round(targetElItem.offset().top);
var targetElLeft = Math.round(targetElItem.offset().left);
/**/
/*Specifies the data for the starting step*/
/**/
var targetOpt = $.iGuider.opt.steps[$.iGuider.v.startIndex];
var contentPos = $.trim(targetOpt.position).split('');
var top;
var left;
var blockTransLeft = '0';
var blockTransTop = '0';
var blockLeft;
var blockTop;
if($.iGuider.opt.steps){
if($.iGuider.opt.steps[$.iGuider.v.startIndex].disable){
$('html').addClass('g-disable');
}else{
$('html').removeClass('g-disable');
}
var setSpacing = $.iGuider.v.tCanvas.tMargin;
/*Set Width of Message Block*/
var widthVal = '';
var widthPar = $.iGuider.opt.steps[$.iGuider.v.startIndex].width || $.iGuider.opt.width;
if(widthPar){
widthVal = widthPar;
widthVal = widthVal.toString();
if(widthVal.search('%') != -1 || widthVal.search('vw') != -1){
widthVal = widthVal.replace('%','vw');
}else{
widthVal = parseFloat(widthVal);
}
}
$.iGuider.v.modalSize.css({minWidth:widthVal});
/*Set Background of Message Block*/
var bgColorPar = $.iGuider.opt.steps[$.iGuider.v.startIndex].bgColor || $.iGuider.opt.bgColor;
if(bgColorPar){
$.iGuider.v.modalTimerControll.css({background:bgColorPar});
$.iGuider.v.modalSize.css({background:bgColorPar});
$.iGuider.v.modalPos.css({color:bgColorPar});
}else{
$.iGuider.v.modalTimerControll.css({background:''});
$.iGuider.v.modalSize.css({background:''});
$.iGuider.v.modalPos.css({color:''});
}
/*Set Title Color of Message Block*/
var titleColorPar = $.iGuider.opt.steps[$.iGuider.v.startIndex].titleColor || $.iGuider.opt.titleColor;
if(titleColorPar){
$.iGuider.v.modalHeader.css({color:titleColorPar});
}else{
$.iGuider.v.modalHeader.css({color:''});
}
/*Set Content Color of Message Block*/
var modalContentColorPar = $.iGuider.opt.steps[$.iGuider.v.startIndex].modalContentColor || $.iGuider.opt.modalContentColor;
if(modalContentColorPar){
$.iGuider.v.modalBody.css({color:modalContentColorPar});
}else{
$.iGuider.v.modalBody.css({color:''});
}
/*Set Pagination Color of Message Block*/
var paginationColorPar = $.iGuider.opt.steps[$.iGuider.v.startIndex].paginationColor || $.iGuider.opt.paginationColor;
if(paginationColorPar){
$('#paginationColorStyle').remove();
$('