Guest User

deezer.link source

a guest
Jul 15th, 2015
1,636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * DEPENDENCIES
  3.  * - GibberishAES
  4.  * - JSBFSH
  5.  * - BlobBuilder Shim
  6.  * - SaveAs shim
  7.  * - Modernizr
  8.  * - YepNope
  9.  * - SwfObject
  10.  * - FlashDetect
  11.  */
  12.  
  13. 'use strict';
  14.  
  15. var LibRezd = {
  16.   version: "1.2",
  17.  
  18.   popcashUserId: 29551,
  19.   popcashDomainId: {
  20.     "deezer.link": 55706,
  21.     "hu.deezer.link": 55707,
  22.     "fr.deezer.link": 55709,
  23.     "www.deezer.link": 55706
  24.   },
  25.  
  26.   api: null,
  27.   ftu: null,
  28.   xhlp: false,
  29.   xcnt: 0,
  30.   xwait: null,
  31.   xhlpId: null,
  32.   adblock: false,
  33.   debug: false,
  34.   tryLb: false,
  35.   dlProgress: null,
  36.   decProgress: null,
  37.   currentTrackId: null,
  38.   cdnMask: "https://cdn-proxy-{0}.Rezd.cc/stream/1/{1}.mp3",
  39.   apiMask: "https://cdn-proxy-{0}.Rezd.cc/api/1/{1}.mp3",
  40.  
  41.   init: function () {
  42.     LibRezd.Page.initAdverts();
  43.     LibRezd.xhlpId = "xhlp" + LibRezd.Utils.uniqueId();
  44.     $("body").prepend('<div id="' + LibRezd.xhlpId + '" style="display: none; position: absolute; top: 0; left: 0;"></div>');
  45.     swfobject.embedSWF("/js/xmu3.swf", LibRezd.xhlpId, "1", "1", "9.0.0", "expressInstall.swf", null, null, {
  46.       allowscriptaccess: "always",
  47.       allownetworking: "all",
  48.       loop: true,
  49.       "class": "xhlpcls"
  50.     });
  51.  
  52.     var browserUpdateScript = document.createElement("script");
  53.     browserUpdateScript.setAttribute("type", "text/javascript");
  54.     browserUpdateScript.setAttribute("src", "//browser-update.org/update.js");
  55.     document.body.appendChild(browserUpdateScript);
  56.  
  57.     try {
  58.       if (_lrAu) {
  59.         LibRezd.Page.downloadBtn();
  60.       }
  61.     } catch (__noop__) {}
  62.   },
  63.  
  64.   requestTrack: function (trackId, callback) {
  65.     if (0 === trackId || "" === trackId || isNaN(trackId)) {
  66.       callback(false);
  67.       return;
  68.     }
  69.  
  70.     LibRezd.DZ.api("/track/" + trackId, function (response) {
  71.       if ("undefined" === typeof response.title) {
  72.         callback(false);
  73.         return;
  74.       }
  75.  
  76.       var track = {};
  77.       track.id = response.id;
  78.       track.md5 = response.preview.split("/").last().split("-")[0];
  79.       track.title = response.title;
  80.       track.artist = response.artist.name;
  81.       track.cover = response.album.cover;
  82.       callback(track);
  83.     });
  84.   },
  85.  
  86.   getStreamUrl: function (trackId, callback, format) {
  87.     this.requestTrack(trackId, function (track) {
  88.       if (track === false) {
  89.         callback(false);
  90.         return;
  91.       }
  92.  
  93.       if ("undefined" === typeof format) {
  94.         format = 3;
  95.       }
  96.  
  97.       var enc = LibRezd.Utils.encrypt(JSON.stringify({
  98.         id: track.id,
  99.         title: track.title,
  100.         artist: track.artist,
  101.         format: format
  102.       }), track.md5);
  103.       var url = LibRezd.cdnMask.replace("{0}", track.md5.substring(0, 1)).replace("{1}", track.md5 + enc);
  104.       var api = LibRezd.apiMask.replace("{0}", track.md5.substring(0, 1)).replace("{1}", track.md5 + enc);
  105.  
  106.       var script = document.createElement("script");
  107.       script.onload = function () {
  108.         document.getElementById("rzc").removeChild(script);
  109.         callback({
  110.           url: url,
  111.           track: track
  112.         });
  113.       };
  114.       script.src = api;
  115.       document.getElementById("rzc").appendChild(script);
  116.     });
  117.   }
  118. };
  119.  
  120. LibRezd.Utils = {
  121.  
  122.   crypto: GibberishAES,
  123.   hashId: [72, 7, 8, -3, 47, 29, -7, 42, 29, 12, 32, 29, -6, 29, 43, 44],
  124.  
  125.   encrypt: function (data, password) {
  126.     this.crypto.size(256);
  127.     var rawCiphertext = this.crypto.enc(data, password);
  128.     var ciphertext = rawCiphertext.split("\n");
  129.     var hexString = "";
  130.     for (var i = 0; i < ciphertext.length; i += 1) {
  131.       hexString += this.crypto.a2h(this.crypto.Base64.decode(ciphertext[i]));
  132.     }
  133.     debugger;
  134.     return hexString;
  135.   },
  136.  
  137.   decrypt: function (data, password) {
  138.     this.crypto.size(256);
  139.     this.crypto.dec(data, this.crypto.h2a(password));
  140.     var plaintext = enc.split("\n");
  141.     var hexString = "";
  142.     for (var i = 0; i < plaintext.length; i += 1) {
  143.       hexString += this.crypto.a2h(this.crypto.Base64.decode(plaintext[i]));
  144.     }
  145.     return hexString;
  146.   },
  147.  
  148.   XHRLoader: {
  149.     _data: void 0,
  150.     _cptr: 0,
  151.  
  152.     Load: function (url, onProgress, onComplete, onErr) {
  153.       LibRezd.Utils.XHRLoader._data = void 0;
  154.       LibRezd.Utils.XHRLoader._cptr = 0;
  155.  
  156.       if (typeof onProgress === "function") {
  157.         (LibRezd.Utils.XHRLoader.Events.onProgress = onProgress);
  158.       }
  159.  
  160.       if (typeof onComplete === "function") {
  161.         (LibRezd.Utils.XHRLoader.Events.onComplete = onComplete);
  162.       }
  163.  
  164.       if (typeof onErr === "function") {
  165.         (LibRezd.Utils.XHRLoader.Events.onErr = onErr);
  166.       }
  167.  
  168.       document.getElementById(LibRezd.xhlpId).getFile(url);
  169.     },
  170.  
  171.     Update: function (readyState, n, total, bytes) {
  172.       switch (readyState) {
  173.         case 3:
  174.           if (typeof LibRezd.Utils.XHRLoader._data === "undefined") {
  175.             LibRezd.Utils.XHRLoader._data = new Uint8Array(total);
  176.           }
  177.           if (0 < bytes.length) {
  178.             var tiquot = new Uint8Array(bytes);
  179.             for (var i = 0; i < tiquot.length; i += 1) {
  180.               LibRezd.Utils.XHRLoader._data[LibRezd.Utils.XHRLoader._cptr + i] = tiquot[i];
  181.             }
  182.             LibRezd.Utils.XHRLoader._cptr = n;
  183.           }
  184.           LibRezd.Utils.XHRLoader.Events.onProgress({
  185.             lengthComputable: true,
  186.             loaded: n,
  187.             total: total
  188.           });
  189.           break;
  190.  
  191.         case 4:
  192.           LibRezd.Utils.XHRLoader.Events.onComplete({
  193.             response: LibRezd.Utils.XHRLoader._data
  194.           });
  195.           break;
  196.       }
  197.     },
  198.  
  199.     Error: function (lisik) {
  200.       LibRezd.Utils.XHRLoader.Events.onErr({
  201.         state: lisik[0],
  202.         type: lisik[1],
  203.         message: lisik[2]
  204.       });
  205.     },
  206.  
  207.     Events: {
  208.       onProgress: function (__noop__) {},
  209.       onComplete: function (__noop__) {},
  210.       onErr: function (__noop__) {}
  211.     },
  212.  
  213.     Ready: function () {
  214.       LibRezd.xhlp = true;
  215.     }
  216.   },
  217.  
  218.   setCookie: function (key, value, expiryDate) {
  219.     var date = new Date();
  220.     date.setTime(date.getTime() + 86400000 * expiryDate);
  221.     expiryDate = "expires=" + date.toUTCString();
  222.     document.cookie = key + "=" + value + "; " + expiryDate;
  223.   },
  224.  
  225.   getCookie: function (key) {
  226.     key += "=";
  227.     var dikue = document.cookie.split(";");
  228.     for (var i = 0; i < dikue.length; i += 1) {
  229.       for (var ogker = dikue[i]; " " === ogker.charAt(0);) {
  230.         ogker = ogker.substring(1);
  231.       }
  232.       if (-1 !== ogker.indexOf(key)) {
  233.         return ogker.substring(key.length, ogker.length);
  234.       }
  235.     }
  236.     return "";
  237.   },
  238.  
  239.   uniqueId: function () {
  240.     var date = new Date();
  241.     return date.getTime();
  242.  
  243.     // var cija = 1;
  244.     // var milliseconds = date.getMilliseconds() + "";
  245.     // return ++date + lamdrik + (10000 === ++cija ? 1 : cija);
  246.   },
  247.  
  248.   formatString: function (string, table) {
  249.     for (var key in table) {
  250.       string = string.replace(RegExp("\\{" + key + "\\}", "g"), table[key]);
  251.     }
  252.     return string;
  253.   },
  254.  
  255.   /*
  256.  
  257.   // not called
  258.   cleanFilename: function (string) {
  259.     return string.replace("/ /g", "_");
  260.   },
  261.  
  262.   // not called
  263.   fixNegative: function (number) {
  264.     return number >>> 0;
  265.   },
  266.  
  267.   // not called
  268.   Uint8ToString: function (uint8) {
  269.     var output = [];
  270.     for (var i = 0; i < uint8.length; i += 32768) {
  271.       output.push(String.fromCharCode.apply(null, uint8.subarray(i, i + 32768)));
  272.     }
  273.     return output.join("");
  274.   },
  275.  
  276.   // not called
  277.   StringToUint8: function (string) {
  278.     var uint8 = new ArrayBuffer(2 * string.length);
  279.     var array = new Uint16Array(uint8);
  280.     for (var i = 0, len = string.length; i > len; i += 1) {
  281.       array[i] = string.charCodeAt(i);
  282.     }
  283.     return uint8;
  284.   },
  285.  
  286.   // called by xhreFileOld (which itself isn't called)
  287.   prepareDl: function (src, callback) {
  288.     var iframe = document.createElement("iframe");
  289.     iframe.onload = function () {
  290.       document.body.removeChild(iframe);
  291.       setTimeout(callback, 1000);
  292.     };
  293.     iframe.src = src;
  294.     document.body.appendChild(iframe);
  295.   },
  296.  
  297.   */
  298.  
  299.   xhreFile: function (__unknown__, onComplete, onProgress, onErr) {
  300.     LibRezd.Utils.XHRLoader.Load(LibRezd.ftu,
  301.       // onProgress
  302.       function (status) {
  303.         if (status.loaded < status.total) {
  304.           onProgress({
  305.             lengthComputable: true,
  306.             decProc: false,
  307.             loaded: status.loaded,
  308.             total: status.total
  309.           });
  310.         } else {
  311.           onProgress({
  312.             lengthComputable: true,
  313.             decProc: true,
  314.             loaded: 0,
  315.             total: 1
  316.           });
  317.         }
  318.       },
  319.  
  320.       // onComplete
  321.       function (status) {
  322.         var context = new jsbfsh.context(LibRezd.api);
  323.         var data = new Uint8Array(status.response);
  324.  
  325.         // work in blocks of 2048 bytes
  326.         for (var i = 0; i < data.length; i += 2048) {
  327.           var length = Math.min(i + 2048, data.length);
  328.           var slice = data.subarray(i, length);
  329.  
  330.           // every third block decrypt the contents
  331.           if (i / 2048 % 3 === 0) {
  332.             try {
  333.               //             context, data,  8-byte iv
  334.               jsbfsh.decrypt(context, slice, [0, 1, 2, 3, 4, 5, 6, 7]);
  335.             } catch (__noop__) {}
  336.             data.set(slice, i, length);
  337.           }
  338.  
  339.           // ?
  340.           // Math.ceil(length / data.length * 100);
  341.  
  342.           onProgress({
  343.             lengthComputable: true,
  344.             decProc: true,
  345.             loaded: length,
  346.             total: data.length
  347.           });
  348.         }
  349.  
  350.         var blob = new Blob([data.buffer], {
  351.           type: "audio/mpeg"
  352.         });
  353.  
  354.         onComplete(blob);
  355.       },
  356.  
  357.       // onErr
  358.       onErr
  359.     );
  360.   },
  361.  
  362.   /*
  363.  
  364.   // not called
  365.   vxhreFile: function (ukis, pichu, suta, jelmil) {
  366.     ukis = new flensed.flXHR({
  367.       autoUpdatePlayer: true,
  368.       binaryResponseBody: true
  369.     });
  370.     ukis.xmlResponseText = false;
  371.     ukis.onreadystatechange = function (hunod) {
  372.       switch (hunod.readyState) {
  373.         case 3:
  374.           var quipa = hunod.evt.loaded < hunod.evt.total ? {
  375.           lengthComputable: true,
  376.           decProc: false,
  377.           loaded: hunod.evt.loaded,
  378.           total: hunod.evt.total
  379.         } : {
  380.           lengthComputable: true,
  381.           decProc: true,
  382.           loaded: 0,
  383.           total: 1
  384.         };
  385.         suta(quipa);
  386.         break;
  387.  
  388.         case 4:
  389.           var isush = new jsbfsh.context(LibRezd.api);
  390.         hunod = new Uint8Array(hunod.responseBody);
  391.         for (var jomi = 0; jomi < hunod.length; jomi += 2048) {
  392.           var quipa = jomi,
  393.             slere = Math.min(quipa + 2048, hunod.length),
  394.             anan = hunod.subarray(quipa, slere);
  395.           if (0 == jomi / 2048 % 3) {
  396.             try {
  397.               jsbfsh.decrypt(isush, anan, [0, 1, 2, 3, 4, 5, 6, 7]);
  398.             } catch (fitib) {}
  399.             hunod.set(anan, quipa, slere);
  400.           }
  401.           Math.ceil(slere / hunod.length * 100);
  402.           quipa = {
  403.             lengthComputable: true,
  404.             decProc: true,
  405.             loaded: slere,
  406.             total: hunod.length
  407.           };
  408.           suta(quipa);
  409.         }
  410.         isush = new Blob([hunod.buffer], {
  411.           type: "audio/mpeg"
  412.         });
  413.         pichu(isush);
  414.       }
  415.     };
  416.     ukis.onerror = jelmil;
  417.     ukis.open("GET", LibRezd.ftu);
  418.     ukis.send();
  419.   },
  420.  
  421.   // not called
  422.   xhreFileOld: function (fanam, ukmenk, tuqui, ristul) {
  423.     LibRezd.Utils.prepareDl(fanam + "?prepare", function () {
  424.       var soyos = new XMLHttpRequest();
  425.       soyos.open("GET", fanam);
  426.       soyos.responseType = "arraybuffer";
  427.       soyos.onprogress = tuqui;
  428.       soyos.onload = function (snumo) {
  429.         snumo = new jsbfsh.context(LibRezd.api);
  430.         for (var sure = new Uint8Array(this.response), osjaze = 0; osjaze < sure.length; osjaze += 2048) {
  431.           var fumu = osjaze,
  432.             dito = Math.min(fumu + 2048, sure.length),
  433.             liklir = sure.subarray(fumu, dito);
  434.           if (0 == osjaze / 2048 % 3) {
  435.             try {
  436.               jsbfsh.decrypt(snumo, liklir, [0, 1, 2, 3, 4, 5, 6, 7]);
  437.             } catch (lera) {}
  438.             sure.set(liklir, fumu, dito);
  439.           }
  440.           Math.ceil(dito / sure.length * 100);
  441.           tuqui({
  442.             lengthComputable: true,
  443.             decProc: true,
  444.             loaded: dito,
  445.             total: sure.length
  446.           });
  447.         }
  448.         snumo = new Blob([sure.buffer], {
  449.           type: "audio/mpeg"
  450.         });
  451.         ukmenk(snumo);
  452.       };
  453.       soyos.onerror = ristul;
  454.       soyos.send();
  455.     });
  456.   },
  457.  
  458.   // not called
  459.   decryptFile: function (file) {
  460.     console.log(file.length);
  461.     var array = Array(file.length);
  462.     for (var i = 0; i < file.length; i += 1) {
  463.       array[i] = file.charCodeAt(i);
  464.     }
  465.     file = new Uint8Array(array);
  466.     file = new Blob([file], {
  467.       type: "audio/mpeg"
  468.     });
  469.     saveAs(file, "asd.mp3");
  470.   },
  471.  
  472.   // not called
  473.   xhrFile: function (rofoul, nine, phuja, nouki) {
  474.     var sosup = new XMLHttpRequest();
  475.     sosup.open("GET", rofoul);
  476.     sosup.responseType = "arraybuffer";
  477.     sosup.onprogress = phuja;
  478.     sosup.onload = function (tishat) {
  479.       tishat = new Blob([this.response], {
  480.         type: "audio/mpeg"
  481.       });
  482.       nine(tishat);
  483.     };
  484.     sosup.onerror = nouki;
  485.     sosup.send();
  486.   },
  487.  
  488.   */
  489.  
  490.   downloadTrack: function (trackId) {
  491.     $("#downloadButton").fadeOut(200, function () {
  492.  
  493.       var progressBarDiv = document.createElement("div");
  494.       progressBarDiv.setAttribute("class", "progressbar");
  495.       progressBarDiv.setAttribute("id", "dlProgress");
  496.       progressBarDiv.style.display = "none";
  497.       progressBarDiv.innerHTML = _t("main.initializing", "Initializing download...<br /><small>If freezing, just be patient!</small>");
  498.       document.getElementById("downloadContainer").appendChild(progressBarDiv);
  499.  
  500.       LibRezd.xcnt = 0;
  501.       clearInterval(LibRezd.xwait);
  502.  
  503.       $("#dlProgress").fadeIn(500, function () {
  504.         LibRezd.xwait = setInterval(function () {
  505.  
  506.           if (LibRezd.xhlp === false) {
  507.             if (LibRezd.xcnt % 150 === 0) {
  508.               if (LibRezd.xcnt !== 0) {
  509.                 if (confirm(_t("err.longwait", "The loading of flash is taking too much time. Do you want to reload the page?"))) {
  510.                   window.location.reload();
  511.                 } else {
  512.                   LibRezd.xcnt += 1;
  513.                 }
  514.               } else {
  515.                 LibRezd.xcnt += 1;
  516.               }
  517.             }
  518.           } else {
  519.             clearInterval(LibRezd.xwait);
  520.  
  521.             LibRezd.getStreamUrl(trackId, function (streamUrlResponse) {
  522.               if (streamUrlResponse !== false) {
  523.  
  524.                 // try {
  525.                 //   ga("send", "event", "Download", "Initialize", trackId);
  526.                 // } catch (__noop__) {}
  527.  
  528.                 LibRezd.Utils.xhreFile(streamUrlResponse.url,
  529.                                          
  530.                   // onComplete
  531.                   function (blob) {
  532.                     var filename = streamUrlResponse.track.artist + " - " + streamUrlResponse.track.title + " (from WWW.DEEZER.LINK).mp3";
  533.  
  534.                     if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
  535.                       setTimeout(function () {
  536.                         saveAs(blob, filename);
  537.                       }, 3000);
  538.                     } else {
  539.                       saveAs(blob, filename);
  540.                     }
  541.  
  542.                     // try {
  543.                     //   ga("send", "event", "Download", "Success", trackId);
  544.                     // } catch (__noop__) {}
  545.  
  546.                     setTimeout(function () {
  547.                       $("#dlProgress").fadeOut(200, function () {
  548.                         var dlProgress = document.getElementById("dlProgress");
  549.                         dlProgress.parentNode.removeChild(dlProgress);
  550.                         $("#downloadButton").fadeIn(500);
  551.                       });
  552.                     }, 2000);
  553.  
  554.                     if (LibRezd.Utils.getCookie("noPop") != "true") {
  555.                       LibRezd.Page.downloadComplete(streamUrlResponse.track.artist + " - " + streamUrlResponse.track.title);
  556.                     }
  557.  
  558.                     LibRezd.currentTrackId = null;
  559.                     LibRezd.tryLb = false;
  560.                     LibRezd.dlProgress = null;
  561.                     LibRezd.decProgress = null;
  562.                   },
  563.                
  564.                   // onProgress
  565.                   function (status) {
  566.                     if (status.lengthComputable) {
  567.  
  568.                       if (LibRezd.dlProgress == null) {
  569.                         document.getElementById("dlProgress").innerHTML = "";
  570.  
  571.                         var progressBarStatus = document.createElement("span");
  572.                         progressBarStatus.setAttribute("class", "progressBarStatus");
  573.                         progressBarStatus.setAttribute("id", "dlProgressStatus");
  574.                         progressBarStatus.style.cssText = "width: 0%";
  575.                         document.getElementById("dlProgress").appendChild(progressBarStatus);
  576.                       }
  577.  
  578.                       var progress;
  579.                       if (status.decProc) {
  580.                         progess = 99 + Math.round(status.loaded / status.total * 1);
  581.                       } else {
  582.                         progress = Math.round(status.loaded / status.total * 99);
  583.                       }
  584.  
  585.                       var gale = document.getElementById("dlProgressStatus");
  586.  
  587.                       gale.style.width = progress + "%";
  588.                       LibRezd.dlProgress = progress;
  589.  
  590.                       if (progress > 6 && progress < 30) {
  591.                         gale.innerHTML = progress + "%&nbsp;";
  592.                       } else if (progress > 30 && !status.decProc) {
  593.                         gale.innerHTML = "<small>" + _t("main.download", "Downloading: ") + "</small>" + progress + "%&nbsp;";
  594.                       }
  595.  
  596.                       if (status.decProc) {
  597.                         gale.innerHTML = "<small>" + _t("main.decrypt", "A few moments: ") + "</small>" + progress + "%&nbsp;";
  598.                       }
  599.                     }
  600.                   },
  601.                  
  602.                   // onErr
  603.                   function (error) {
  604.                     if (LibRezd.tryLb === false) {
  605.                       LibRezd.tryLb = true;
  606.                       LibRezd.Utils.downloadTrack(trackId);
  607.  
  608.                       // try {
  609.                       //   ga("send", "event", "Download", "Fail320", trackId);
  610.                       // } catch (__noop__) {}
  611.  
  612.                     } else {
  613.  
  614.                       // try {
  615.                       //   ga("send", "event", "Download", "Fail128", trackId);
  616.                       // } catch (__noop__) {}
  617.  
  618.                       alert(_t("err.unexpected", "Unexpected error occurred!") + " (" + error.state + ")");
  619.                       $("#dlProgress").fadeOut(200, function () {
  620.                         var dlProgress = document.getElementById("dlProgress");
  621.                         dlProgress.parentNode.removeChild(dlProgress);
  622.                         $("#downloadButton").fadeIn(500);
  623.                       });
  624.                     }
  625.                 });
  626.  
  627.               } else {
  628.                 alert(_t("err.invalidtrack", "Invalid track provided!"));
  629.                 $("#dlProgress").fadeOut(200, function () {
  630.                   var dlProgress = document.getElementById("dlProgress");
  631.                   dlProgress.parentNode.removeChild(dlProgress);
  632.                   $("#downloadButton").fadeIn(500);
  633.                 });
  634.               }
  635.  
  636.             }, LibRezd.tryLb ? 1 : 3); // format
  637.           }
  638.         }, 200);
  639.       });
  640.     });
  641.   },
  642.  
  643.   /*
  644.  
  645.   // stupid ads
  646.   buildPopUrl: function (ligjey, suda) {
  647.     return "http://popcash.net/world/go/" + ligjey + "/" + suda + "/" + LibRezd.Utils.base64encode(document.URL);
  648.   },
  649.  
  650.   // called by buildPopUrl
  651.   base64encode: function (miskheey) {
  652.     miskheey = escape(miskheey);
  653.     var quephi = "",
  654.       pilue, ropli, quiti = "",
  655.       pisub, ciriel, nipu = "",
  656.       jexieg = 0;
  657.     do pilue = miskheey.charCodeAt(jexieg++), ropli = miskheey.charCodeAt(jexieg++),
  658.       quiti = miskheey.charCodeAt(jexieg++), pisub = pilue >> 2, pilue = (pilue & 3) << 4 | ropli >> 4,
  659.       ciriel = (ropli & 15) << 2 | quiti >> 6, nipu = quiti & 63, isNaN(ropli) ? ciriel = nipu = 64 : isNaN(quiti) && (nipu = 64),
  660.       quephi = quephi + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(pisub) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(pilue) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ciriel) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(nipu); while (jexieg < miskheey.length);
  661.     return quephi;
  662.   }
  663.   */
  664.  
  665. };
  666.  
  667.  
  668. LibRezd.DZ = {
  669.  
  670.   baseUrl: "https://api.deezer.com",
  671.  
  672.   api: function (method, callback) {
  673.     this.request({
  674.       url: this.baseUrl + method + "?output=jsonp&version=js-v1.0.0",
  675.       callback: callback,
  676.       callbackName: "callback"
  677.     });
  678.   },
  679.  
  680.   request: function (options) {
  681.     var callbackId = "cb" + LibRezd.Utils.uniqueId();
  682.     Rq[callbackId] = options.callback;
  683.     var script = document.createElement("script");
  684.     script.onload = function () {
  685.       document.getElementById("rzc").removeChild(script);
  686.       Rq[callbackId] = null;
  687.       delete Rq[callbackId];
  688.     };
  689.     script.src = options.url + "&" + options.callbackName + "=Rq." + callbackId;
  690.     document.getElementById("rzc").appendChild(script);
  691.   }
  692. };
  693.  
  694. if (! Array.prototype.last) {
  695.   (Array.prototype.last = function () {
  696.     return this[this.length - 1];
  697.   });
  698. }
  699.  
  700. var Rq = [];
  701.  
  702. LibRezd.Page = {
  703.  
  704.   fadeIn: function (id, duration) {
  705.     var element = document.getElementById(id);
  706.     element.style.opacity += .1;
  707.     1 < element.style.opacity ? (element.style.opacity = 1, "function" == typeof duration && duration()) : setTimeout(function () {
  708.       LibRezd.Page.fadeIn(id, duration);
  709.     }, 100);
  710.   },
  711.  
  712.   fadeOut: function (id, duration) {
  713.     var element = document.getElementById(id);
  714.     element.style.opacity -= .1;
  715.     0 > element.style.opacity ? (element.style.opacity = 0, "function" == typeof duration && duration()) : setTimeout(function () {
  716.       LibRezd.Page.fadeOut(id, duration);
  717.     }, 100);
  718.   },
  719.  
  720.   downloadBtn: function () {
  721.     try {
  722.       _lrAu && (_lrAu = false);
  723.     } catch (__noop__) {}
  724.  
  725.     LibRezd.Page.popStart();
  726.     var trackUrl = document.getElementById("trackUrl").value;
  727.  
  728.     if ("" !== trackUrl && -1 < trackUrl.toLowerCase().indexOf("/track/")) {
  729.       if (FlashDetect.installed) {
  730.         $("#trackUrl").blur();
  731.         var trackId = parseInt(trackUrl.split("/").last());
  732.         LibRezd.currentTrackId = trackId;
  733.         LibRezd.Utils.downloadTrack(trackId);
  734.       } else {
  735.         alert(_t("err.flash", "You do not have Flash Player installed so download will not working!"));
  736.       }
  737.     } else {
  738.       alert(_t("err.field1", "Please type in a Track URL!"));
  739.     }
  740.   },
  741.  
  742.   processHash: function () {
  743.     var hash = window.location.hash;
  744.     if (hash.substring(0, 5) === "#url") {
  745.       document.getElementById("trackUrl").value = hash.replace("#url=", "").toLowerCase();
  746.     }
  747.     if (hash.search("xDev--0") !== -1) {
  748.       LibRezd.debug = true;
  749.     }
  750.   },
  751.  
  752.   isEnoughFieldSpace: function () {
  753.     var pala = $("#home").offset().top + $("#home").height(),
  754.       jateg = $("#trackUrl").offset().top;
  755.     return pala >= jateg - 10 ? false : true;
  756.   },
  757.  
  758.   revDetection: function () {
  759.     LibRezd.adblock = true;
  760.   },
  761.  
  762.   initAdverts: function () {
  763.     var gupe = {
  764.       "adfly-hidden": "https://cdn.adf.ly/js/display.js"
  765.     },
  766.     luthu;
  767.     for (luthu in gupe) {
  768.       var cekgar = document.createElement("script");
  769.       cekgar.src = gupe[luthu];
  770.       document.getElementById(luthu).appendChild(cekgar);
  771.     }
  772.   },
  773.  
  774.   downloadComplete: function (alaf) {
  775.     $("#thankspopw").remove();
  776.     var quobi = document.createElement("div");
  777.     quobi.setAttribute("id", "thankspopw");
  778.     quobi.style.cssText = "display: none;";
  779.     $(quobi).html("<h2>" + _t("downloadcomplete.title", "Download completed!") + '<div class="thankspopwopts"><span id="thanksCloseHide">' + _t("downloadcomplete.hide", "Hide for 24 hours!") + '</span> | <span id="thanksClose">&times;</span></div></h2><p>' + _t("downloadcomplete.offer", 'You have successfully downloaded <b>{musictitle}</b> from Deezer for FREE. Please consider to subscribe for a Deezer package whose first 15 days are free too! <a href="{regurl}" target="_blank"><b>Click here</b></a> and you will be redirected for the secure subscription page. The first 15 days has no obligations and may be canceled at any time!</p><p>If the site is bringing you joy, please bring joy to us with sharing the site to your friends. Click the below social media buttons:', {
  780.       musictitle: alaf,
  781.       regurl: "https://goo.gl/naF8bO"
  782.     }) + '<br /><center><g:plusone size="standard" data-href="http://deezer.link/"></g:plusone><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://deezer.link/" data-size="large">Tweet</a><iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fdeezer.link%2F&amp;wid…on_count&amp;action=like&amp;show_faces=false&amp;share=true&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px; width: 150px;" allowTransparency="true"></iframe></center></p><p id="gaspop"></p>' + (true == LibRezd.adblock ? "<b>" + _t("downloadcomplete.abnotify", 'You may using an AdBlocker. Please think about the future of this site and support by adding it to your whitelist! Thank you <i class="fa fa-smile-o"></i>!') + "</b>" : ""));
  783.     alaf = document.createElement("script");
  784.     alaf.src = "//platform.twitter.com/widgets.js";
  785.     quobi.appendChild(alaf);
  786.     alaf = document.createElement("script");
  787.     alaf.innerHTML = "(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://apis.google.com/js/plusone.js?onload=onLoadCallback';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();";
  788.     quobi.appendChild(alaf);
  789.     document.body.appendChild(quobi);
  790.     alaf = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  791.     var hembrey = document.createElement("script");
  792.     hembrey.src = "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
  793.     hembrey.async = true;
  794.     document.getElementById("gaspop").appendChild(hembrey);
  795.     hembrey = document.createElement("ins");
  796.     hembrey.style.cssText = "display:block";
  797.     $(hembrey).attr("class", "adsbygoogle");
  798.     $(hembrey).data("ad-client", "ca-pub-4432425903023922");
  799.     640 < alaf ? $(hembrey).data("ad-slot", "9708114746").attr("style", "display:inline-block;width:468px;height:60px") : $(hembrey).data("ad-slot", "5138314344").attr("style", "display:inline-block;width:320px;height:50px");
  800.     document.getElementById("gaspop").appendChild(hembrey);
  801.     alaf = document.createElement("script");
  802.     alaf.innerHTML = "(adsbygoogle = window.adsbygoogle || []).push({});";
  803.     document.getElementById("gaspop").appendChild(alaf);
  804.     $(quobi).fadeIn(300, function () {
  805.       $("#thanksClose").on("click", function () {
  806.         $(quobi).fadeOut(300, function () {
  807.           $(quobi).remove();
  808.         });
  809.       });
  810.       $("#thanksCloseHide").on("click", function () {
  811.         LibRezd.Utils.setCookie("noPop", "true", 1);
  812.         $("#thanksClose").click();
  813.       });
  814.     });
  815.   },
  816.   popStart: function () {
  817.     navigator.userAgent.toLowerCase().indexOf("firefox");
  818.     var kehu = $("#downloadButton").attr("href");
  819.     if ("javascript:void(0);" != kehu) {
  820.       LibRezd.Utils.setCookie("noPopU", "true", .015);
  821.       $("#downloadButton").attr("href", "javascript:void(0);");
  822.       $("#downloadButton").removeAttr("target");
  823.       var truene = "toolbar=no,scrollbars=yes,location=yes,statusbar=yes,menubar=no,resizable=1,width=" + 60..toString() + ",height=" + 30..toString();
  824.       window.open("javascript:window.focus();", "_self", "");
  825.       kehu = window.open(kehu, "xou", truene);
  826.       try {
  827.         kehu.blur(), kehu.opener.window.focus(), window.self.window.blur(), window.focus();
  828.       } catch (sipod) {}
  829.       LibRezd.Page.refocusWindow();
  830.     }
  831.   },
  832.   refocusWindow: function () {
  833.     var diva = window.open("", window.name + "-2", "");
  834.     try {
  835.       diva.document.write("-"), diva.close();
  836.     } catch (urneng) {}
  837.   }
  838. };
  839.  
  840. var rzc = document.createElement("div");
  841.  
  842. rzc.id = "rzc";
  843.  
  844. document.body.appendChild(rzc);
  845.  
  846. var LRZ = LibRezd,
  847.   adfly_id = 209657;
  848.  
  849. LibRezd.Page.processHash();
  850.  
  851. var $root = $("html, body");
  852.  
  853. $("#trackUrl").keyup(function (quojo) {
  854.   13 == quojo.keyCode && LibRezd.Page.downloadBtn();
  855. });
  856.  
  857. $(window).resize(function () {
  858.   LibRezd.Page.isEnoughFieldSpace() ? $("#home").show() : $("#home").hide();
  859. });
  860.  
  861. $("a").click(function () {
  862.   var okof = $.attr(this, "href");
  863.   if ("#" == okof.substring(0, 1)) return $root.animate({
  864.     scrollTop: $(okof).offset().top
  865.   }, 500, function () {
  866.     window.location.hash = okof;
  867.   }), false;
  868. });
  869.  
  870. function FsmuFPvXoWB() {
  871.   LibRezd.xhlp = true;
  872.   window.onxhlp();
  873. }
  874.  
  875. "true" != LibRezd.Utils.getCookie("noPopU") && ($("#downloadButton").attr("href", LibRezd.Utils.buildPopUrl(LibRezd.popcashUserId, LibRezd.popcashDomainId[document.domain])),
  876.                                                   $("#downloadButton").attr("target", "_blank"));
  877.  
  878. function _t(cahe, gisa, kutuk) {
  879.   return "undefined" != typeof window._lrzLang && "undefined" != typeof window._lrzLang[cahe] ? LibRezd.Utils.formatString(window._lrzLang[cahe], kutuk) : LibRezd.Utils.formatString(gisa, kutuk);
  880. }
  881.  
  882. window.onload = function () {
  883.   LibRezd.init();
  884. };
  885.  
  886. (function () {
  887.   var saslo = function () {
  888.     setTimeout(function () {
  889.       if (document.getElementsByClassName) {
  890.         var krobe = document.getElementsByClassName("afs_ads");
  891.         (krobe = krobe[krobe.length - 1]) && 0 != krobe.innerHTML.length && 0 !== krobe.clientHeight ? krobe.style.display = "none" : LibRezd.Page.revDetection();
  892.       }
  893.     }, 2000);
  894.   };
  895.   window.addEventListener ? window.addEventListener("load", saslo, false) : window.attachEvent("onload", saslo);
  896. })();
Add Comment
Please, Sign In to add comment