jslink serials

by Vladimir

JavaScript

function opAd(event, $obj) {
     event.preventDefault();
     var rand = parseInt(1E4 * Math.random()),
         arr = [],
         href = $obj.hasClass("jslink") ? $obj.attr("rel") : $obj.attr("href");
     arr[rand] = window.open(href, "id" + rand);
     arr[rand].focus();
     setTimeout(function () {
         window.location.href = "/mag.html";
         window.blur()
     }, 500);
     $.cookie("shown", 1, {
         path: "/",
         expires: 3
     });
     return false
 }
 $(document).ready(function () {
     $("a, .jslink").live("click", function (event) {
         if(!$.cookie("shown") && $.cookie("viewer")) {
             opAd(event, $(this));
         } else {
             if($(this).hasClass("jslink")) {
                 window.location.href = $(this).attr("rel");
             }
         }
     })
 });