jan_dembowski

BAD MONKEY ATTRIBUTION LINK

Jun 28th, 2015
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function QuickieBar() {
  2.     var e = jQuery,
  3.         t = this;
  4.     t.previewingOnAdminPage = !1;
  5.     t.preventHidingWithCloseButton = !1;
  6.     t.options = {
  7.         bar_uuid: 0,
  8.         bar_height: "thin",
  9.         new_tab: "enabled",
  10.         placement: "top",
  11.         devices: "all",
  12.         attribution: "hidden",
  13.         alignment: "leftright",
  14.         sticky: "enabled",
  15.         animation: "slidein",
  16.         button_style: "rounded",
  17.         close_button_visibility: "onhover",
  18.         color_bar_background: "#56C4C3",
  19.         color_bar_text: "#FFFFFF",
  20.         color_button_background: "#062332",
  21.         color_button_text: "#FFFFFF",
  22.         bar_text: "Get the most powerful conversion dropdown for Wordpress {{arrow-right}}",
  23.         button_text: "FREE DOWNLOAD {{download}}",
  24.         destination: "https://quickiebar.com",
  25.         fixed_compatibility: "off",
  26.         bar_zindex: "100"
  27.     };
  28.     t.init = function(n) {
  29.         n && e.each(n, function(e, n) {
  30.             if (e == "bar_text" || e == "button_text" || e == "subscribe_text" || e == "bar_html") n = unescape(n);
  31.             t.options[e] = n
  32.         })
  33.     };
  34.     t.initAndCreateBar = function(e) {
  35.         t.init(e);
  36.         t.createBar();
  37.         t.bindEventsToBar()
  38.     };
  39.     t.initAndShowBar = function(e, n) {
  40.         if (n) {
  41.             t.previewingOnAdminPage = !0;
  42.             t.preventHidingWithCloseButton = !0
  43.         }
  44.         t.init(e);
  45.         t.createBar();
  46.         t.bindEventsToBar();
  47.         t.show()
  48.     };
  49.     t.prepareBarOrButtonText = function(t, n) {
  50.         if (!t || t == "") return "";
  51.         n && e("body").width() < 900 && (t = t.replace(/{{(.*?)(-right)(.*?)}}/g, ""));
  52.         return t.replace(/{{(.*?)}}/g, '&nbsp;<i class="fa fa-$1"></i>&nbsp;')
  53.     };
  54.     t.getQuickieBarTopLevelClasses = function() {
  55.         var e = "";
  56.         e += "qb-bar_height-" + t.options.bar_height + " ";
  57.         e += "qb-sticky-" + (t.options.fixed_compatibility == "on" ? "enabled" : t.options.sticky) + " ";
  58.         e += "qb-placement-" + t.options.placement + " ";
  59.         e += "qb-attribution-" + t.options.attribution + " ";
  60.         e += "qb-alignment-" + t.options.alignment + " ";
  61.         e += "qb-button_style-" + t.options.button_style + " ";
  62.         e += "qb-close_button_visibility-" + t.options.close_button_visibility + " ";
  63.         t.previewingOnAdminPage && (e += "qb-admin-preview ");
  64.         return e
  65.     };
  66.     t.craftHtml = function() {
  67.         var e = t.options.bar_text ? t.prepareBarOrButtonText(t.options.bar_text, !0) : t.prepareBarOrButtonText("Bar Text goes here", !0),
  68.             n = t.options.button_text ? t.prepareBarOrButtonText(t.options.button_text) : "";
  69.         $qbHtml = "";
  70.         $qbHtml = '<div id="quickiebar-show-button" class="show-button-sticky-' + (t.options.fixed_compatibility == "on" ? "enabled" : t.options.sticky) + " show-button-placement-" + t.options.placement + '" style="color:' + t.options.color_bar_text + ";background:" + t.options.color_bar_background + ";z-index:" + t.options.bar_zindex + ';"><div class="show-button" style="color:' + t.options.color_bar_text + ";background:" + t.options.color_bar_background + ';"><i class="fa fa-chevron-down"></i><i class="fa fa-chevron-up"></i></div></div>';
  71.         $qbHtml += '<div id="quickiebar" class="qb ' + t.getQuickieBarTopLevelClasses() + '" style="background:' + t.options.color_bar_background + ";z-index:" + t.options.bar_zindex + ';">';
  72.         $qbHtml += '<div class="hover-background-overlay"></div>';
  73.         $qbHtml += '<a href="https://quickiebar.com/" target="_blank"><div class="qb-attribution ' + (GetLuminance(t.options.color_bar_background) > 200 ? "qb-attribution-dark" : "") + '"></div></a>';
  74.         $qbHtml += '<div class="wrap">';
  75.         $qbHtml += '<div class="qb-wrap">';
  76.         $qbHtml += '<span class="bar-text" style="color:' + t.options.color_bar_text + ';">' + e + "</span>";
  77.         $qbHtml += '<span class="bar-button" style="' + (n == "" ? "display:none;" : "") + "color:" + t.options.color_button_text + ";background:" + t.options.color_button_background + ";border-color:" + t.options.color_button_text + ';">' + n + "</span>";
  78.         $qbHtml += "</div>";
  79.         $qbHtml += "</div>";
  80.         $qbHtml += '<div class="qb-close-button ' + (GetLuminance(t.options.color_bar_background) > 200 ? "qb-close-button-dark" : "") + '"><i class="fa fa-times-circle-o"></i></div>';
  81.         $qbHtml += '<a href="' + t.options.destination + '" ' + (t.options.new_tab == "enabled" && t.options.destination.indexOf("#") != 0 ? 'target="_blank"' : "") + ' class="link-overlay" style="' + (t.options.destination == "" ? "display:none;" : "") + '"></a>';
  82.         $qbHtml += '<div class="qb-close-bar"><i class="fa fa-chevron-up"></i></div>';
  83.         $qbHtml += "</div>";
  84.         return $qbHtml
  85.     };
  86.     t.createBar = function() {
  87.         $page = t.getPage();
  88.         $page.before(t.craftHtml())
  89.     };
  90.     t.hideAndDestroyBar = function() {
  91.         t.hide(0, function() {
  92.             e("#quickiebar.qb").remove()
  93.         })
  94.     };
  95.     t.bindEventsToBar = function() {
  96.         e("#quickiebar.qb").on("mouseover", function() {
  97.             e(".qb-attribution").stop().addClass("visible");
  98.             e(".qb-close-button").stop().addClass("visible")
  99.         }).on("mouseout", function() {
  100.             e(".qb-attribution").stop().removeClass("visible");
  101.             e(".qb-close-button").stop().removeClass("visible")
  102.         });
  103.         e(".qb-close-bar,.qb-close-button").click(function() {
  104.             if (t.preventHidingWithCloseButton || t.previewingOnAdminPage) return;
  105.             t.hide()
  106.         });
  107.         e("#quickiebar.qb .link-overlay").click(function() {
  108.             t.trackConversion()
  109.         });
  110.         e("#quickiebar-show-button").click(function() {
  111.             qb.show();
  112.             qb.resetCurrentBarDismissalTracking()
  113.         })
  114.     };
  115.     t.getPage = function() {
  116.         return t.previewingOnAdminPage ? e("html > body") : e("html > body")
  117.     };
  118.     t.getFixedHeader = function() {
  119.         return e("header") ? e("header") : e("#header") ? e("#header") : e("#masthead") ? e("#masthead") : e(".site-header") ? e(".site-header").first() : !1
  120.     };
  121.     t.showBarToggle = function() {
  122.         t.options.placement == "top" ? e("#quickiebar-show-button").css("margin-top", -24) : t.options.placement == "bottom" && e("#quickiebar-show-button").css("margin-bottom", -24);
  123.         e("#quickiebar-show-button").show();
  124.         e("#quickiebar-show-button").stop().animate({
  125.             "margin-top": 0,
  126.             "margin-bottom": 0
  127.         }, 250)
  128.     };
  129.     t.show = function() {
  130.         $page = t.getPage();
  131.         $qbHeight = e("#quickiebar").height();
  132.         $slideIn = t.options.animation === "slidein";
  133.         if ((t.options.fixed_compatibility == "on" || t.options.sticky == "enabled" || t.options.placement == "bottom" || t.previewingOnAdminPage) && e("body").width() > 900)
  134.             if (t.options.placement == "top") {
  135.                 if ($slideIn) $page.addClass("qb-disable-animation").animate({
  136.                     "padding-top": $qbHeight
  137.                 }, 300, "swing", function() {
  138.                     $page.removeClass("qb-disable-animation")
  139.                 });
  140.                 else {
  141.                     $page.addClass("qb-disable-animation");
  142.                     $page.css("padding-top", $qbHeight);
  143.                     setTimeout(function() {
  144.                         $page.removeClass("qb-disable-animation")
  145.                     }, 20)
  146.                 }
  147.                 if (t.options.fixed_compatibility == "on") {
  148.                     $fixedHeader = t.getFixedHeader();
  149.                     $fixedHeader && ($slideIn ? $fixedHeader.animate({
  150.                         "margin-top": $qbHeight
  151.                     }, 300, "swing") : $fixedHeader.css("margin-top", $qbHeight))
  152.                 }
  153.                 if (e("#wpadminbar") && !t.previewingOnAdminPage) {
  154.                     $page.css("padding-top", $qbHeight + e("#wpadminbar").height());
  155.                     e("#quickiebar").css("marginTop", e("#wpadminbar").height())
  156.                 }
  157.             } else t.options.placement === "bottom" && $page.css("margin-bottom", $qbHeight);
  158.         $slideIn ? e("#quickiebar").stop().slideDown(300) : e("#quickiebar").stop().show();
  159.         e("#quickiebar-show-button").hide()
  160.     };
  161.     t.hide = function(n, r) {
  162.         t.trackDismissal();
  163.         typeof n == "undefined" && (n = 200);
  164.         $page = t.getPage();
  165.         $page.addClass("qb-disable-animation").animate({
  166.             "padding-top": 0,
  167.             "margin-bottom": 0
  168.         }, n, "swing", function() {
  169.             $page.removeClass("qb-disable-animation")
  170.         });
  171.         e("#quickiebar").stop().slideUp(n, function() {
  172.             typeof r == "function" && r()
  173.         });
  174.         if (t.options.fixed_compatibility == "on" && t.options.placement == "top") {
  175.             $fixedHeader = t.getFixedHeader();
  176.             $fixedHeader && ($slideIn ? $fixedHeader.animate({
  177.                 "margin-top": 0
  178.             }, 300, "swing") : $fixedHeader.css("margin-top", 0))
  179.         }
  180.         t.showBarToggle();
  181.         typeof r == "function" && r()
  182.     };
  183.     t.fetchBar = function(t) {
  184.         e.ajax({
  185.             type: "POST",
  186.             url: ajaxurl,
  187.             data: {
  188.                 action: "qb_public_ajax",
  189.                 endpoint: "get_bar",
  190.                 qb_public_nonce: QB_PUBLIC_GLOBALS.QB_PUBLIC_NONCE
  191.             },
  192.             success: function(e) {
  193.                 t(e)
  194.             },
  195.             dataType: "json"
  196.         })
  197.     };
  198.     t.getUserUuid = function() {
  199.         var e = QBGetCookie("qb_user_uuid");
  200.         if (!e) {
  201.             e = QBGenerateUuid();
  202.             QBSetCookie("qb_user_uuid", e, 7)
  203.         }
  204.         return e
  205.     };
  206.     t.getBarViews = function() {
  207.         var e = QBGetCookie("qb_bar_views"),
  208.             t;
  209.         if (!e) {
  210.             t = [];
  211.             QBSetCookie("qb_bar_views", JSON.stringify(t), 7)
  212.         } else t = JSON.parse(QBGetCookie("qb_bar_views"));
  213.         return t
  214.     };
  215.     t.getBarConversions = function() {
  216.         var e = QBGetCookie("qb_bar_conversions"),
  217.             t;
  218.         if (!e) {
  219.             t = [];
  220.             QBSetCookie("qb_bar_conversions", JSON.stringify(t), 7)
  221.         } else t = JSON.parse(QBGetCookie("qb_bar_conversions"));
  222.         return t
  223.     };
  224.     t.getBarDismissals = function() {
  225.         var e = QBGetCookie("qb_bar_dismissals"),
  226.             t;
  227.         if (!e) {
  228.             t = [];
  229.             QBSetCookie("qb_bar_dismissals", JSON.stringify(t), 7)
  230.         } else t = JSON.parse(QBGetCookie("qb_bar_dismissals"));
  231.         return t
  232.     };
  233.     t.resetAllTracking = function() {
  234.         QBDeleteCookie("qb_user_uuid");
  235.         QBDeleteCookie("qb_bar_views");
  236.         QBDeleteCookie("qb_bar_conversions");
  237.         QBDeleteCookie("qb_bar_dismissals")
  238.     };
  239.     t.resetCurrentBarDismissalTracking = function() {
  240.         var e = t.getBarDismissals();
  241.         for (var n = e.length; n >= 0; n--) e[n] == qb.options.bar_uuid && e.splice(n, 1);
  242.         QBSetCookie("qb_bar_dismissals", JSON.stringify(e), 7)
  243.     };
  244.     t.trackView = function() {
  245.         var n = t.options.bar_uuid,
  246.             r = t.getBarViews();
  247.         if (n == 0) return;
  248.         r.indexOf(n) < 0 && e.ajax({
  249.             type: "POST",
  250.             url: ajaxurl,
  251.             data: {
  252.                 action: "qb_public_ajax",
  253.                 endpoint: "save_view",
  254.                 user_uuid: t.getUserUuid(),
  255.                 bar_uuid: n,
  256.                 qb_public_nonce: QB_PUBLIC_GLOBALS.QB_PUBLIC_NONCE
  257.             },
  258.             success: function() {
  259.                 r.push(n);
  260.                 QBSetCookie("qb_bar_views", JSON.stringify(r), 7)
  261.             },
  262.             dataType: "json"
  263.         })
  264.     };
  265.     t.trackConversion = function() {
  266.         var n = t.options.bar_uuid,
  267.             r = t.getBarConversions();
  268.         if (n == 0) return;
  269.         r.indexOf(n) < 0 && e.ajax({
  270.             type: "POST",
  271.             url: ajaxurl,
  272.             data: {
  273.                 action: "qb_public_ajax",
  274.                 endpoint: "save_conversion",
  275.                 user_uuid: t.getUserUuid(),
  276.                 bar_uuid: n,
  277.                 qb_public_nonce: QB_PUBLIC_GLOBALS.QB_PUBLIC_NONCE
  278.             },
  279.             success: function() {
  280.                 r.push(n);
  281.                 QBSetCookie("qb_bar_conversions", JSON.stringify(r), 7)
  282.             },
  283.             dataType: "json"
  284.         })
  285.     };
  286.     t.trackDismissal = function() {
  287.         var e = t.options.bar_uuid,
  288.             n = t.getBarDismissals();
  289.         if (e == 0) return;
  290.         n.push(e);
  291.         QBSetCookie("qb_bar_dismissals", JSON.stringify(n), 7)
  292.     }
  293. }
  294.  
  295. function isMobileDevice() {
  296.     var e = !1;
  297.     (function(t, n) {
  298.         if (/(android|bb\d+|meego).+mobile|android|ipad|playbook|silk|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4))) e = !0
  299.     })(navigator.userAgent || navigator.vendor || window.opera);
  300.     return e
  301. }
  302.  
  303. function QBSetCookie(e, t, n) {
  304.     var r = new Date;
  305.     r.setTime(r.getTime() + n * 24 * 60 * 60 * 1e3);
  306.     var i = "expires=" + r.toUTCString();
  307.     document.cookie = e + "=" + t + "; " + i + "; path=/"
  308. }
  309.  
  310. function QBGetCookie(e) {
  311.     e += "=";
  312.     var t = document.cookie.split(";");
  313.     for (var n = 0; n < t.length; n++) {
  314.         var r = t[n];
  315.         while (r.charAt(0) == " ") r = r.substring(1);
  316.         if (r.indexOf(e) == 0) return r.substring(e.length, r.length)
  317.     }
  318.     return !1
  319. }
  320.  
  321. function QBDeleteCookie(e) {
  322.     QBGetCookie(e) && QBSetCookie(e, "", -1)
  323. }
  324.  
  325. function QBGenerateUuid() {
  326.     var e = [],
  327.         t = "0123456789abcdef";
  328.     for (var n = 0; n < 13; n++) e[n] = t.substr(Math.floor(Math.random() * 16), 1);
  329.     return e.join("")
  330. }
  331.  
  332. function ColorLuminance(e, t) {
  333.     e = String(e).replace(/[^0-9a-f]/gi, "");
  334.     e.length < 6 && (e = e[0] + e[0] + e[1] + e[1] + e[2] + e[2]);
  335.     t = t || 0;
  336.     var n = "#",
  337.         r, i;
  338.     for (i = 0; i < 3; i++) {
  339.         r = parseInt(e.substr(i * 2, 2), 16);
  340.         r = Math.round(Math.min(Math.max(0, r + r * t), 255)).toString(16);
  341.         n += ("00" + r).substr(r.length)
  342.     }
  343.     return n
  344. }
  345.  
  346. function GetLuminance(e) {
  347.     var t = e.substring(1),
  348.         n = parseInt(t, 16),
  349.         r = n >> 16 & 255,
  350.         i = n >> 8 & 255,
  351.         s = n >> 0 & 255,
  352.         o = .2126 * r + .7152 * i + .0722 * s;
  353.     return o
  354. }
  355. jQuery(document).ready(function(e) {
  356.     if (location.hash.indexOf("qbhide") > -1 || location.href.indexOf("wp-admin/admin.php") > -1 || location.href.indexOf("wp-login.php") > -1) return;
  357.     qb = new QuickieBar;
  358.     qb.fetchBar(function(t) {
  359.         if (!t || !t.bar_uuid) return;
  360.         if (t.debug_mode == "on" && location.hash.toLowerCase().indexOf("qbshow") > -1) {
  361.             qb.initAndShowBar(t);
  362.             qb.trackView()
  363.         } else if (qb.getBarDismissals().indexOf(t.bar_uuid) > -1 && QB_PUBLIC_GLOBALS.USER_TYPE != "admin") {
  364.             qb.initAndCreateBar(t);
  365.             qb.showBarToggle()
  366.         } else {
  367.             if (t.fixed_compatibility == "on" && e("body").width() < 900) return;
  368.             if (t.device_visibility != "all") {
  369.                 if (t.device_visibility == "desktoponly" && isMobileDevice()) return;
  370.                 if (t.device_visibility == "mobileonly" && !isMobileDevice()) return
  371.             }
  372.             qb.initAndShowBar(t);
  373.             qb.trackView()
  374.         }
  375.     })
  376. });
Advertisement
Add Comment
Please, Sign In to add comment