k911a
8/12/2017 - 8:09 PM

Скрипт для виджета ReClick 3.0 3. На элемент при зарузке страницы 4. На элемент при уходе со страницы

Скрипт для виджета ReClick 3.0

  1. На элемент при зарузке страницы
  2. На элемент при уходе со страницы
function rc302(t){function e(t,e,o){if(t.split("|").length==e.split("|").length&&""!=$.trim(t)&&""!=$.trim(e)){var l=t.split("|"),s=e.split("|");for(i=0;i<l.length;i++)$($.trim(s[i])).text($($.trim(l[i])).text())}t.split("|").length!=e.split("|").length&&"section_1"==o&&console.log("ReClick 3.0: Ошибка! В параметрах реклика (1) обнаружено разное количество селекторов в параметрах ''Текст из'' и ''Текст в''."),t.split("|").length!=e.split("|").length&&"section_2"==o&&console.log("ReClick 3.0: Ошибка! В параметрах реклика (2) обнаружено разное количество селекторов в параметрах ''Текст из'' и ''Текст в''.")}function o(t,e,o){if(t.split("|").length==e.split("|").length&&""!=$.trim(t)&&""!=$.trim(e)){var l=t.split("|"),s=e.split("|");for(i=0;i<l.length;i++)$($.trim(s[i])).css("background-image",$($.trim(l[i])).css("background-image")),$($.trim(s[i])).css("background-repeat",$($.trim(l[i])).css("background-repeat")),$($.trim(s[i])).css("background-position",$($.trim(l[i])).css("background-position")),$($.trim(s[i])).css("background-size",$($.trim(l[i])).css("background-size")),$($.trim(s[i])).css("background-color",$($.trim(l[i])).css("background-color"))}t.split("|").length!=e.split("|").length&&"section_1"==o&&console.log("ReClick 3.0: Ошибка! В параметрах реклика (1) обнаружено разное количество селекторов в параметрах ''Фон из'' и ''Фон в''."),t.split("|").length!=e.split("|").length&&"section_2"==o&&console.log("ReClick 3.0: Ошибка! В параметрах реклика (2) обнаружено разное количество селекторов в параметрах ''Фон из'' и ''Фон в''.")}$=t.S;var l=0,s=0,_=1,n=1,c="section_1",a="section_2";$(document).ready(function(){"toElementOnLoad"==t.type_s1&&(null==localStorage.getItem("ReClick_section_1_toElementOnLoad_"+t.itemUID)&&0!=t.count_s1&&localStorage.setItem("ReClick_section_1_toElementOnLoad_"+t.itemUID,JSON.stringify({val:0,max:t.count_s1})),0==t.count_s1&&localStorage.removeItem("ReClick_section_1_toElementOnLoad_"+t.itemUID),0==t.count_s1&&t.if_s1&&("before"==t.callTime_s1&&t.сallFunc_s1(),setTimeout(function(){e(t.textFrom_s1,t.textTo_s1,c),o(t.bgiFrom_s1,t.bgiTo_s1,c),$(t.target_s1).click().mousedown().mouseup(),"after"==t.callTime_s1&&t.сallFunc_s1()},t.delay_s1)),0!=t.count_s1&&JSON.parse(localStorage.getItem("ReClick_section_1_toElementOnLoad_"+t.itemUID)).val<t.count_s1&&t.if_s1&&("before"==t.callTime_s1&&t.сallFunc_s1(),setTimeout(function(){e(t.textFrom_s1,t.textTo_s1,c),o(t.bgiFrom_s1,t.bgiTo_s1,c),$(t.target_s1).click().mousedown().mouseup(),"after"==t.callTime_s1&&t.сallFunc_s1();var l=JSON.parse(localStorage.getItem("ReClick_section_1_toElementOnLoad_"+t.itemUID));l.val=l.val+1,localStorage.setItem("ReClick_section_1_toElementOnLoad_"+t.itemUID,JSON.stringify(l))},t.delay_s1))),"toElementOnLoad"==t.type_s2&&(null==localStorage.getItem("ReClick_section_2_toElementOnLoad_"+t.itemUID)&&0!=t.count_s2&&localStorage.setItem("ReClick_section_2_toElementOnLoad_"+t.itemUID,JSON.stringify({val:0,max:t.count_s2})),0==t.count_s2&&localStorage.removeItem("ReClick_section_2_toElementOnLoad_"+t.itemUID),0==t.count_s2&&t.if_s2&&("before"==t.callTime_s2&&t.сallFunc_s2(),setTimeout(function(){e(t.textFrom_s2,t.textTo_s2,a),o(t.bgiFrom_s2,t.bgiTo_s2,a),$(t.target_s2).click().mousedown().mouseup(),"after"==t.callTime_s2&&t.сallFunc_s2()},t.delay_s2)),0!=t.count_s2&&JSON.parse(localStorage.getItem("ReClick_section_2_toElementOnLoad_"+t.itemUID)).val<t.count_s2&&t.if_s2&&("before"==t.callTime_s2&&t.сallFunc_s2(),setTimeout(function(){e(t.textFrom_s2,t.textTo_s2,a),o(t.bgiFrom_s2,t.bgiTo_s2,a),$(t.target_s2).click().mousedown().mouseup(),"after"==t.callTime_s2&&t.сallFunc_s2();var l=JSON.parse(localStorage.getItem("ReClick_section_2_toElementOnLoad_"+t.itemUID));l.val=l.val+1,localStorage.setItem("ReClick_section_2_toElementOnLoad_"+t.itemUID,JSON.stringify(l))},t.delay_s2))),"toElementOnExit"==t.type_s1&&(null==localStorage.getItem("ReClick_section_1_toElementOnExit_"+t.itemUID)&&0!=t.count_s1&&localStorage.setItem("ReClick_section_1_toElementOnExit_"+t.itemUID,JSON.stringify({val:0,max:t.count_s1})),0==t.count_s1&&localStorage.removeItem("ReClick_section_1_toElementOnExit_"+t.itemUID),$(document).on("mouseleave",function(){0==t.count_s1&&t.if_s1&&l<_&&("before"==t.callTime_s1&&t.сallFunc_s1(),setTimeout(function(){e(t.textFrom_s1,t.textTo_s1,c),o(t.bgiFrom_s1,t.bgiTo_s1,c),$(t.target_s1).click().mousedown().mouseup(),"after"==t.callTime_s1&&t.сallFunc_s1(),l++},t.delay_s1)),0!=t.count_s1&&JSON.parse(localStorage.getItem("ReClick_section_1_toElementOnExit_"+t.itemUID)).val<t.count_s1&&t.if_s1&&l<_&&("before"==t.callTime_s1&&t.сallFunc_s1(),setTimeout(function(){e(t.textFrom_s1,t.textTo_s1,c),o(t.bgiFrom_s1,t.bgiTo_s1,c),$(t.target_s1).click().mousedown().mouseup(),"after"==t.callTime_s1&&t.сallFunc_s1(),l++;var i=JSON.parse(localStorage.getItem("ReClick_section_1_toElementOnExit_"+t.itemUID));i.val=i.val+1,localStorage.setItem("ReClick_section_1_toElementOnExit_"+t.itemUID,JSON.stringify(i))},t.delay_s1))})),"toElementOnExit"==t.type_s2&&(null==localStorage.getItem("ReClick_section_2_toElementOnExit_"+t.itemUID)&&0!=t.count_s1&&localStorage.setItem("ReClick_section_2_toElementOnExit_"+t.itemUID,JSON.stringify({val:0,max:t.count_s2})),0==t.count_s2&&localStorage.removeItem("ReClick_section_2_toElementOnExit_"+t.itemUID),$(document).on("mouseleave",function(){0==t.count_s2&&t.if_s2&&s<n&&("before"==t.callTime_s2&&t.сallFunc_s2(),setTimeout(function(){e(t.textFrom_s2,t.textTo_s2,a),o(t.bgiFrom_s2,t.bgiTo_s2,a),$(t.target_s2).click().mousedown().mouseup(),"after"==t.callTime_s2&&t.сallFunc_s2(),s++},t.delay_s2)),0!=t.count_s2&&JSON.parse(localStorage.getItem("ReClick_section_2_toElementOnExit_"+t.itemUID)).val<t.count_s2&&t.if_s2&&s<n&&("before"==t.callTime_s2&&t.сallFunc_s2(),setTimeout(function(){e(t.textFrom_s2,t.textTo_s2,a),o(t.bgiFrom_s2,t.bgiTo_s2,a),$(t.target_s2).click().mousedown().mouseup(),"after"==t.callTime_s2&&t.сallFunc_s2(),s++;var l=JSON.parse(localStorage.getItem("ReClick_section_2_toElementOnExit_"+t.itemUID));l.val=l.val+1,localStorage.setItem("ReClick_section_2_toElementOnExit_"+t.itemUID,JSON.stringify(l))},t.delay_s2))}))})}