Advertisement
clickio

budu5.com Mobile sticky 2 times in 6 hours

Nov 20th, 2020 (edited)
1,056
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.95 KB | None | 0 0
  1. <script>
  2. (function(w){
  3.     var showTime = 2;
  4.     var showHours = 3;
  5.  
  6.     function getCookie(name) {
  7.         let matches = document.cookie.match(new RegExp(
  8.             "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
  9.         ));
  10.         return matches ? decodeURIComponent(matches[1]) : undefined;
  11.     }
  12.     function setCookie(name, value, options = {}) {
  13.         if (options.expires instanceof Date) {
  14.             options.expires = options.expires.toUTCString();
  15.         }
  16.         let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
  17.         for (let optionKey in options) {
  18.             updatedCookie += "; " + optionKey;
  19.             let optionValue = options[optionKey];
  20.             if (optionValue !== true) {
  21.                 updatedCookie += "=" + optionValue;
  22.             }
  23.         }
  24.         document.cookie = updatedCookie;
  25.     }
  26.     function showCode(p, c) {
  27.         var div = document.createElement('div');
  28.         div.innerHTML = c;
  29.         p.appendChild(div);
  30.         while (div.firstChild) p.insertBefore(div.firstChild, div);
  31.         p.removeChild(div);
  32.         var scripts = p.getElementsByTagName("script");
  33.         Array.from(scripts).forEach(function(script, index, array) {
  34.             var newScript = document.createElement('script');
  35.             if(typeof script.src !== "undefined" && script.src && script.sr !== "")
  36.           {
  37.               newScript.src = script.src;
  38.                 newScript.className = script.className;
  39.                 p.appendChild(newScript);
  40.             }
  41.             else
  42.             {
  43.                 var data = (script.text || script.textContent || script.innerHTML || "");
  44.                 newScript.className = script.className;
  45.                 newScript.type = script.type;
  46.                 newScript.appendChild(document.createTextNode(data));
  47.                 p.appendChild(newScript);
  48.             }
  49.             p.removeChild(script);
  50.         });
  51.     }
  52.     var c = getCookie("lx_sticky_shown")
  53.     if(!c || ( c && Number.parseInt(c, 10) < showTime ) )
  54.    {
  55.        var div = document.createElement("DIV");
  56.         div.id = "lx_sticky_wrapper";
  57.         var b = document.querySelector("body");
  58.         b.appendChild(div);
  59.         var code = "<scr" + "ipt async type='text/javascript' src='//s.luxupcdnc.com/t/220567/360_light.js'><\/scr" + "ipt>" +
  60.             "<script class='__lxGc__' type='text/javascript'>" +
  61.             "((__lxGc__=window.__lxGc__||{'s':{},'b':0})['s']['_220567']=__lxGc__['s']['_220567']||{'b':{}})['b']['_665493']={'i':__lxGc__.b++};" +
  62.             "<\/scr" + "ipt>";
  63.  
  64.         var parent = document.querySelector("#lx_sticky_wrapper");
  65.         showCode(parent, code);
  66.         var date = new Date();
  67.         date.setHours(date.getHours() + showHours);
  68.         var cv = (c?Number.parseInt(c, 10):0) + 1;
  69.         setCookie("lx_sticky_shown", cv, {secure: true, expires: date.toString()});
  70.     }
  71. })(window);
  72. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement