function hoverLine(id) { $('#line_'+id).addClass('hover'); } function unhoverLine(id){ $('#line_'+id).removeClass('hover'); } function downloadStatusOfCurrentItem(itemId, statusURL, hash) { url = statusURL; if (hash != '') { url += '&hash=' + hash; } $.getJSON(url, function(data) { if (typeof data.error == 'undefined') { var dwn_pr = data.downloaded_percent > 100 ? 100 : data.downloaded_percent; var dec_pr = data.decoded_percent > 100 ? 100 : data.decoded_percent; var progress = ((dwn_pr + dec_pr) / 2).toFixed(); if(progress == 100){ progress = 99; } $(itemId + ' .downloading-progress span').text(progress + '%'); $(itemId + ' #js-progressbar').val(progress); } if (data.finished != 1) { downloadStatusOfCurrentItem(itemId, statusURL, data.hash); }else { $(itemId + ' .downloads-btns-wrap').show(); $(itemId + ' .downloading-progress').remove(); } }); } function downloadStatus(id, statusURL) { var viewAllLink = "/downloads/info/" + id; var itemId = "#download_item_" + id; $.getJSON(statusURL, function(data) { if (data.error == null) { let progress = data.progress >= 100 ? 99 : Math.round(data.progress); $(itemId + ' .downloading-progress span').text(progress + '%'); $(itemId + ' #js-progressbar').val(progress); } if (data.status != "FINISHED") { downloadStatus(id, statusURL); }else { let countFiles = data.count_files; let url = countFiles > 1 ? data.url : data.files[0]['url']; if(countFiles > 1){ $(itemId + ' .show-info') } $(itemId).addClass('download-finished'); $(itemId + ' .link-for-zip').attr('href', url); $(itemId + ' .downloads-btns-wrap').show(); $(itemId + ' .downloading-progress').remove(); $(itemId + ' .download-set-data').html("Files: " + data.count_files + " | View all files
Size: " + data.size); } }); } var nzbSizeSet = 0; var nzbFilesSet = 0; var statusURL = ''; var filesURL = ''; var filesLimit = 200; var filesReloaded = 0; function updateStatus(hash) { if (hash != '') { url = statusURL + '&hash=' + hash; } else { url = statusURL; } $.getJSON(url, function(data) { //console.log(data); if (typeof data.error == 'undefined') { // Global data if (nzbSizeSet==0 && data.files_size_formatted.length > 0) { $('#nzb_size').html(data.files_size_formatted); nzbSizeSet = 1; } if (nzbFilesSet==0 && data.files_amount_formatted.length > 0) { $('#nzb_files').html(data.files_amount_formatted); nzbFilesSet = 1; } // Status data $('#status_downloaded_amount').html(data.downloaded_amount); $('#status_downloaded_size').html(data.downloaded_size_formatted); $('#status_decoded_amount').html(data.decoded_amount); $('#status_decoded_size').html(data.decoded_size_formatted); if (data.errors_amount > 0) { $('#status_errors_amount').html(data.errors_amount); $('#status_errors').show(); } downloaded_width = data.downloaded_percent; if (downloaded_width > 100 ) downloaded_width = 100; $('#status_downloaded_progress').width(downloaded_width+'%'); decoded_width = data.decoded_percent; if (decoded_width > 100 ) decoded_width = 100; $('#status_decoded_progress').width(decoded_width+'%'); } if (data.finished != 1) { updateStatus(data.hash); if (data.files_amount > 0) { $('#download_status').show(); // Reload files if (data.decoded_amount > 0) { if (data.decoded_amount > filesLimit) { files_need = filesLimit; } else { files_need = data.decoded_amount; } if (files_need > $('.file_ready').length) { reloadFiles(force = 0); } } } } else { // Download button $('#download_loading').hide(); if (data.files_amount > 1) { $('.downloads-btns-wrap').show(); } else { $('.download_file').show(); } $('#download_status').hide(); $('#download_finished').show(); // Reload files reloadFiles(1); } }); } function reloadFiles(force) { min_update_delay = 3000; // 3 sec if (new Date()-filesReloaded < min_update_delay && force == 0) { return false; } filesReloaded = new Date(); $.get(filesURL, function(data) { $('#files_content').html(data); $('#files_container').show(); }); } function validate_email(field) { with (field) { apos=field.indexOf("@"); dotpos=field.lastIndexOf("."); if (apos<1||dotpos-apos<2) { return false; } else { return true; } } } function support() { var errors = 0; email = $('#email').val(); subject = $('#subject').val(); problem = $('#problem').val(); //captcha = $('#captcha').val(); // Check email if (email.length==0 || validate_email(email) == false) { $('#error_email').show(); errors = errors+1; } else { $('#error_email').hide(); } // Check subject if (subject.length==0) { $('#error_subject').show(); errors = errors+1; } else { $('#error_subject').hide(); } // Check problem if (problem.length==0) { $('#error_problem').show(); errors = errors+1; } else { $('#error_problem').hide(); } // Check captcha /*if (captcha.length != 4) { $('#error_captcha').show(); errors = errors+1; } else { $('#error_captcha').hide(); }*/ if (errors > 0) { return false; } $('#support_submit').attr('disabled', 'disabled'); return true; } function ticket_message() { var errors = 0; problem = $('#problem').val(); // Check problem if (problem.length==0) { $('#error_problem').show(); errors = errors+1; } else { $('#error_problem').hide(); } if (errors > 0) { return false; } $('#ticket_message_submit').attr('disabled', 'disabled'); return true; } var zxcTO; function Scroll(id,dis){ var obj=document.getElementById(id) obj.scrollLeft=obj.scrollLeft+dis; zxcTO=setTimeout( function(){ Scroll(id,dis); },10); } //v1.7 // Flash Player Version Detection // Detect Client Browser type // Copyright 2005-2008 Adobe Systems Incorporated. All rights reserved. var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; function ControlVersion() { var version; var axo; var e; // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry try { // version will be set for 7.X or greater players axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); version = axo.GetVariable("$version"); } catch (e) { } if (!version) { try { // version will be set for 6.X players only axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); // installed player is some revision of 6.0 // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, // so we have to be careful. // default to the first public version version = "WIN 6,0,21,0"; // throws if AllowScripAccess does not exist (introduced in 6.0r47) axo.AllowScriptAccess = "always"; // safe to call for 6.0r47 or greater version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 4.X or 5.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 3.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = "WIN 3,0,18,0"; } catch (e) { } } if (!version) { try { // version will be set for 2.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); version = "WIN 2,0,0,11"; } catch (e) { version = -1; } } return version; } // JavaScript helper required to detect Flash Player PlugIn version information function GetSwfVer(){ // NS/Opera version >= 3 check for Flash plugin in plugin array var flashVer = -1; if (navigator.plugins != null && navigator.plugins.length > 0) { if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; var descArray = flashDescription.split(" "); var tempArrayMajor = descArray[2].split("."); var versionMajor = tempArrayMajor[0]; var versionMinor = tempArrayMajor[1]; var versionRevision = descArray[3]; if (versionRevision == "") { versionRevision = descArray[4]; } if (versionRevision[0] == "d") { versionRevision = versionRevision.substring(1); } else if (versionRevision[0] == "r") { versionRevision = versionRevision.substring(1); if (versionRevision.indexOf("d") > 0) { versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); } } var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; } } // MSN/WebTV 2.6 supports Flash 4 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; // WebTV 2.5 supports Flash 3 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; // older WebTV supports Flash 2 else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; else if ( isIE && isWin && !isOpera ) { flashVer = ControlVersion(); } return flashVer; } // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) { versionStr = GetSwfVer(); if (versionStr == -1 ) { return false; } else if (versionStr != 0) { if(isIE && isWin && !isOpera) { // Given "WIN 2,0,0,11" tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] tempString = tempArray[1]; // "2,0,0,11" versionArray = tempString.split(","); // ['2', '0', '0', '11'] } else { versionArray = versionStr.split("."); } var versionMajor = versionArray[0]; var versionMinor = versionArray[1]; var versionRevision = versionArray[2]; // is the major.revision >= requested major.revision AND the minor version >= requested minor if (versionMajor > parseFloat(reqMajorVer)) { return true; } else if (versionMajor == parseFloat(reqMajorVer)) { if (versionMinor > parseFloat(reqMinorVer)) return true; else if (versionMinor == parseFloat(reqMinorVer)) { if (versionRevision >= parseFloat(reqRevision)) return true; } } return false; } } function AC_AddExtension(src, ext) { if (src.indexOf('?') != -1) return src.replace(/\?/, ext+'?'); else return src + ext; } function AC_Generateobj(objAttrs, params, embedAttrs) { var str = ''; if (isIE && isWin && !isOpera) { str += ' '; } str += ''; } else { str += ''); document.write(''); } function gettrailobj(){ if (document.getElementById) return document.getElementById("trailimageid").style else if (document.all) return document.all.trailimagid.style } function gettrailobjnostyle(){ if (document.getElementById) return document.getElementById("trailimageid") else if (document.all) return document.all.trailimagid } function truebody(){ return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body } function showtrail(imagename,title,set_pht_amount,set_publication,set_views,description){ if(title.imagename < 1) return false; document.onmousemove=followmouse; newHTML =''; if(title.length > 1){ newHTML = newHTML + ''; } newHTML = newHTML + ''; if(description.length > 1){ newHTML = newHTML + ''; } newHTML = newHTML + '
Set #' + title + '
'; if(set_pht_amount.length > 1){ newHTML = newHTML + 'Photos inside: ' + set_pht_amount + ''; } newHTML = newHTML + ''; if(set_publication.length > 1){ newHTML = newHTML + '
Published: ' + set_publication + '
'; } newHTML = newHTML + '
'; if(set_views.length > 1){ newHTML = newHTML + '
Popularity: ' + set_views + ' views
'; } newHTML = newHTML + '
' + description + '
'; gettrailobjnostyle().innerHTML = newHTML; gettrailobj().visibility="visible"; } function hidetrail(){ gettrailobj().visibility="hidden" document.onmousemove="" gettrailobj().left="-500px" } function followmouse(e){ var xcoord=offsetfrommouse[0] var ycoord=offsetfrommouse[1] var shift = 110; var limit = 500; var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-60 var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight) //if (document.all){ // gettrailobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '
B = ' + truebody().clientHeight; //} else { // gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '
D = ' + window.innerHeight; //} if (typeof e != "undefined"){ if (docwidth - e.pageX < limit){ xcoord = e.pageX - xcoord - limit; // Move to the left side of the cursor } else { xcoord += e.pageX; } if (docheight - e.pageY < (currentimageheight + shift)){ ycoord += e.pageY - Math.max(0,(shift + currentimageheight + e.pageY - docheight - truebody().scrollTop)); } else { ycoord += e.pageY; } } else if (typeof window.event != "undefined"){ if (docwidth - event.clientX < limit){ xcoord = event.clientX + truebody().scrollLeft - xcoord - limit; // Move to the left side of the cursor } else { xcoord += truebody().scrollLeft+event.clientX } if (docheight - event.clientY < (currentimageheight + shift)){ ycoord += event.clientY + truebody().scrollTop - Math.max(0,(shift + currentimageheight + event.clientY - docheight)); } else { ycoord += truebody().scrollTop + event.clientY; } } var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15 var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight) if(ycoord < 0) { ycoord = ycoord*-1; } gettrailobj().left=xcoord+"px" gettrailobj().top=ycoord+"px" } function ch_color(id,classname) { document.getElementById(id).className=classname; return true; } function reloadCode() { document.getElementById('captcha_img').src = '/captcha/?'+Math.random()*20; } function validate_email(field) { with (field) { apos=field.indexOf("@"); dotpos=field.lastIndexOf("."); if (apos<1||dotpos-apos<2) { return false; } else { return true; } } } function checkCoinbaseTransaction(eventCode){ var data = { code: eventCode, isAjax: true } $.post('/coinbase/result/', data, function(result) { var err = false; var array = {}; try { array = JSON.parse(result); } catch(e) { err = true; } window.location.replace(array.redirect_to); }); } // mobile-menu $(document).ready(function() { $('#navToggle').before(''); $('.overlayMenu').wrap('
'); $('.overlayMenu').append('
'); $('.static-tag-list').find('.tag-list a').clone().appendTo('.tag-list-menu'); $('.overlayMenu .tag-list-menu').before('
'); $('.main-menu a').clone().prependTo('.mobile-main-menu'); if($('.profile-data-wrapper').length > 0) { $('.tag-list-menu').prepend('

Tags

'); $('.profile-data-wrapper').clone().prependTo('.overlayMenu'); } if($('.tag-list-menu').children().length == 0){ $('#navToggle').css({'display':'none'}); } $("#navToggle").click(function() { $(this).toggleClass("active"); $(".overlay").toggleClass("open"); // this line ▼ prevents content scroll-behind $("body").toggleClass("locked"); }); }); // end mobile-menu // mobile-search-form $(document).ready(function() { var searchBtnStart = $('.mobile-search-btn').html(); if($('.search-form').length == 0){ $('.mobile-search-btn').css({'display':'none'}); } $('.mobile-search-btn').click(function(){ var show = $(this).attr('data-show'); if(show == 'false'){ $('.search-form').removeClass('mobile-hidden-search-form'); $('.search-form .q').focus(); $(this).attr('data-show', 'true'); $(this).html(''); }else{ $('.search-form').addClass('mobile-hidden-search-form'); $(this).attr('data-show', 'false'); $(this).html(searchBtnStart); } }); }); // end mobile-search-form // download page refresh timer $(document).ready(function() { if($('#refresh-timer-on').length > 0){ var $refreshBtnText = $('.update-page-btn').text(); var time = 15; $('.update-page-btn').text($refreshBtnText + ' (' + time + ')'); setInterval(function() { if(time >= 0){ $('.update-page-btn').text($refreshBtnText + ' (' + time-- + ')'); } if(time == 0){ location.reload(); } }, 1000); } }); // end download page refresh timer var RotatingThumbs = { interval : 500, timer : null, img : null, origSRC : '', thumbs : [], current : 0, debug : false, rotate : function(img,thumbIDs) { if ( this.timer ) window.clearTimeout(this.timer); img.onmouseout = function() { RotatingThumbs.img.onload = function(){}; RotatingThumbs.img.onmouseout = function(){}; window.clearTimeout(RotatingThumbs.timer); RotatingThumbs.img.src = RotatingThumbs.origSRC; for ( var i=0; i= RotatingThumbs.thumbs.length ) RotatingThumbs.current = 0; RotatingThumbs.debugMsg('Pumping thumb #' + RotatingThumbs.current); RotatingThumbs.img.src = RotatingThumbs.thumbs[RotatingThumbs.current].src; }, debugMsg : function(msg) { if ( !this.debug ) return; if ( !this.debugDiv ) { this.debugDiv = document.createElement('div'); this.debugDiv.style.position = 'absolute'; this.debugDiv.style.left = 0 + 'px'; this.debugDiv.style.top = 0 + 'px'; this.debugDiv.style.backgroundColor = '#880000'; this.debugDiv.style.color = '#FFF'; document.body.appendChild(this.debugDiv); } this.debugDiv.innerHTML += '
' + msg; } }