1/* -------------------------------------------------------------------------- */ 2 3function startTimer(duration, display) { 4 var timer = duration, minutes, seconds; 5 6 setInterval(function () { 7 8 if (timer <= 0) { 9 location.href='/checkout'; 10 } 11 12 minutes = parseInt(timer / 60, 10); 13 seconds = parseInt(timer % 60, 10); 14 15 minutes = minutes < 10 ? "0" + minutes : minutes; 16 seconds = seconds < 10 ? "0" + seconds : seconds; 17 18 display.textContent = minutes + ":" + seconds; 19 20 if (--timer < 0) { 21 timer = duration; 22 } 23 }, 1000); 24} 25 26/* -------------------------------------------------------------------------- */ 27 28 29history.replaceState({url: location.pathname}, '', location.pathname); 30 31$(window).on('popstate', function(e) { 32 loadContent(location.pathname); 33}); 34 35/* -------------------------------------------------------------------------- */ 36 37var playing = false; 38var playid = false; 39var playlistid = 0; 40 41/* -------------------------------------------------------------------------- */ 42 43function pad(number, length) { 44 var str = '' + number; 45 while (str.length < length) { 46 str = '0' + str; 47 } 48 return str; 49} 50 51/* -------------------------------------------------------------------------- */ 52 53function millisecondsToTime(milli) { 54 var seconds = Math.floor((milli / 1000) % 60); 55 var minutes = Math.floor((milli / (60 * 1000)) % 60); 56 return pad(minutes,2) + ":" + pad(seconds,2); 57} 58 59/* -------------------------------------------------------------------------- */ 60 61function addTrackToPlaylist(num,title,mp3,random) { 62 $('#playlist').append('<li><div class="title"><a href="#" data-random="'+random+'" data-num="'+num+'" class="ninjaPlayerList" data-title="'+title+'" data-mpthree="'+mp3+'">'+title+'</a></div><a href="" class="playlist-remove remove pull-right"><span class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a></li>'); 63 $('.playlist-counter').html($('#playlist').children().length); 64} 65 66/* -------------------------------------------------------------------------- */ 67 68function playsound(mp3,id,number,random) { 69 70 var wibble = number; 71 $('#player').show(); 72 soundManager.destroySound('mySound'); 73 soundManager.unload('mySound'); 74 $('.position').css('width',("0%")); 75 $('.time').text('00:00'); 76 soundManager.createSound({ 77 url: "/audio-player/?mp3="+mp3+"&random="+random, 78 id: 'mySound', 79 whileplaying:function() { 80 81 $("#loading").hide(); 82 playing = true; 83 playid = wibble; 84 var duration = this.duration; 85 var plength = $('.track').width(); 86 var percent = (duration / plength); 87 $('.time').text(millisecondsToTime(this.position)); 88 $('.position').css('width',((this.position/this.duration)*100)+"%"); 89 90 $('#player').on('click','.track', function(e) { 91 var parentOffset = $(this).offset(); 92 var jump = (e.clientX-parentOffset.left) * percent; 93 soundManager.setPosition('mySound',jump); 94 }); 95 96 }, 97 onfinish:function() { 98 playing = false; 99 playid = false; 100 $('#player').fadeOut('fast'); 101 $('.time').text('00:00'); 102 this.destruct(); 103 } 104 }); 105 soundManager.play('mySound',{multiShotEvents: true ,onfinish: function() { 106 var number = wibble; 107 playid = false; 108 playlistid = playlistid + 1; 109 var listItems = $("#playlist>li>div.title>a.ninjaPlayerList"); 110 if (playlistid == $("#playlist").children().length) { 111 playlistid = 0; 112 } 113 listItems.each(function(idx, li) { 114 if (idx == playlistid) { 115 $('#playlist li').removeClass('playingcolor'); 116 $('#playlist li').eq(idx).addClass('playingcolor'); 117 $("#loading").show(); 118 $('.pr-1').html($(li).data("title")); 119 $('.position').css('width',("0%")); 120 $('#player').fadeIn('fast'); 121 var mp3 = $(li).data("mpthree"); 122 var random = $(li).data("random"); 123 var id = $(li).attr("id"); 124 var number = $(li).data("num"); 125 playsound(mp3,id,number,random); 126 127 } 128 }); 129 }}); 130 131 return true; 132} 133 134/* -------------------------------------------------------------------------- */ 135 136function gaTrack(path, title) { 137 ga('set', { page: path, title: title }); 138 ga('send', 'pageview'); 139} 140 141/* -------------------------------------------------------------------------- */ 142 143function loadContent(url) { 144 href2 = url.substring(1); 145 n = href2.indexOf("/"); 146 if (n>0) 147 href2 = href2.substring(0,n); 148 $('.container-filter').slideUp(); 149 $('.nav-collapse').collapse('hide'); 150 $('.master-container').fadeOut('fast', function() { 151 $('.loader').fadeIn('', function() { $('.master-container').empty() }); 152 $.ajax({ 153 url: "/_includes/content.php", 154 cache: false, 155 type: "POST", 156 data: {cid: url, ajax: 1}}) 157 .done(function(html,status,request) { 158 //ga('send', 'pageview'); 159 if (href2 == 'fade') href2 = 'fade-1'; 160 $('body').removeClass().addClass(href2); 161 $('html, body').animate({ scrollTop: 0 }, 0); 162 $('.loader').fadeOut('fast', function() { 163 $('.master-container').html(html).delay(1).fadeIn('fast', function() { 164 165 $('.jscroll').jscroll({loadingHtml: '<img src="/images/ui/preloader.gif" />'}); 166 $('.bxslider').bxSlider({ 167 mode: 'fade', 168 captions: false,
169 auto: false, 170 pager: false, 171 controls: true, 172 autoControls: false 173 }); 174 175 }); 176 }); 177 setPageTitle(request.getResponseHeader("pageTitle")); 178 }); 179 }); 180} 181 182/* -------------------------------------------------------------------------- */ 183 184function setPageTitle(string) { 185 $('title').html(decodeURIComponent(string)); 186} 187 188/* -------------------------------------------------------------------------- */ 189 190 191function basketCheck(num){ 192 if(num>0){ 193 $('#basket').css('background-color','#e9f200'); 194 }else{ 195 $('#basket').css('background-color',''); 196 } 197} 198$(function() { 199 num = $('.basket-counter').html(); 200 basketCheck(num); 201 $('body').on('change', '.shippingcontrol', function(e) { 202 e.preventDefault(); 203 $("form")[2].submit(); 204 //$('#basket').submit(); 205 }); 206 207 $('body').on('change', '.shippingcontrol_eu', function(e) { 208 e.preventDefault(); 209 $("form")[2].submit(); 210 //$('#basket').submit(); 211 }); 212 213 $('body').on('click','.playlist-remove', function(e) { 214 e.stopPropagation(); 215 e.preventDefault(); 216 $(this).parent().remove(); 217 }); 218 219 $('body').on('click', '#playlist-close', function(e) { 220 e.stopPropagation(); 221 e.preventDefault(); 222 $('#playlist-holder').hide(); 223 }); 224 225 $('body').on('click', '.playlist-toggle', function(e) { 226 e.stopPropagation(); 227 e.preventDefault(); 228 $('#playlist-holder').toggle(); 229 }); 230 231 $('body').on('click', '#playlist-clear', function(e) { 232 e.stopPropagation(); 233 e.preventDefault(); 234 $('#playlist').children().remove(); 235 $('#player').fadeOut('fast'); 236 $('.time').text('00:00'); 237 $('.playlist-counter').html($('#playlist').children().length); 238 $('#playlist-holder').hide(); 239 //soundManager.pause('mySound'); 240 playing = false; 241 playid = false; 242 soundManager.destroySound('mySound'); 243 soundManager.unload('mySound'); 244 }); 245 246 $('body').on('click','.play-all2', function(e) { 247 e.stopPropagation(); 248 e.preventDefault(); 249 var listItems = $(this).find(".tracklist li.ninjaPlayer"); 250 listItems.each(function(idx, li) { 251 var mp3 = $(li).data("mpthree"); 252 var random = $(li).data("mp3random"); 253 var id = $(li).attr("id"); 254 var num = $(li).data("num"); 255 var title = $(li).data("title"); 256 $('#playlist-holder').css('display','block'); 257 addTrackToPlaylist(num,title,mp3,random); 258 if (playing == false && idx == 0) { 259 $('#playlist li').removeClass('playingcolor'); 260 $('#playlist li').eq(idx).addClass('playingcolor'); 261 var playlistid = 0; 262 $("#loading").show(); 263 $('.pr-1').html(title); 264 $('.position').css('width',("0%")); 265 $('#player').css('display','block'); 266 $('#player').fadeIn('fast'); 267 $('#player').show(); 268 playsound(mp3,id,num,random); 269 } 270 }); 271 }); 272 273 $('body').on('click','.play-all', function(e) { 274 e.stopPropagation(); 275 e.preventDefault(); 276 var listItems = $(".formatlist-show li a.ninjaPlayer"); 277 listItems.each(function(idx, li) { 278 var mp3 = $(li).data("mpthree"); 279 var random = $(li).data("mp3random"); 280 var id = $(li).attr("id"); 281 var num = $(li).data("num"); 282 var title = $(li).data("title"); 283 $('#playlist-holder').css('display','block'); 284 addTrackToPlaylist(num,title,mp3,random); 285 if (playing == false && idx == 0) { 286 $('#playlist li').removeClass('playingcolor'); 287 $('#playlist li').eq(idx).addClass('playingcolor'); 288 var playlistid = 0; 289 $("#loading").show(); 290 $('.pr-1').html(title); 291 $('.position').css('width',("0%")); 292 $('#player').fadeIn('fast'); 293 playsound(mp3,id,num,random); 294 } 295 }); 296 }); 297 298 $('#player .play').click(function() { 299 if (playing == true) { 300 soundManager.pause('mySound'); 301 $('#player .play div').removeClass('icon-pause').addClass('icon-play2'); 302 playing = false; 303 playid = false; 304 } else { 305 soundManager.play('mySound'); 306 307 $('#player .play div').removeClass('icon-play2').addClass('icon-pause'); 308 playing = true; 309 playid = true; 310 } 311 }); 312 313$('body').on('click','.ninjaPlayerList', function(e) { 314 e.preventDefault(); 315 var mp3 = $(this).data("mpthree"); 316 var random = $(this).data("random"); 317 var id = $(this).attr("id"); 318 var num = $(this).data("num"); 319 var title = $(this).data("title"); 320 $('#playlist li').removeClass('playingcolor'); 321 $(this).parent().parent().addClass('playingcolor'); 322 $("#loading").show(); 323 $('.pr-1').html(title); 324 $('.position').css('width',("0%")); 325 $('#player').fadeIn('fast'); 326 playsound(mp3,id,num, random); 327 }); 328 329$('body').on('click','.ninjaPlayer', function(e) { 330 e.preventDefault(); 331 var mp3 = $(this).data("mpthree"); 332 var random = $(this).data("mp3random"); 333 var id = $(this).attr("id"); 334 var num = $(this).data("num"); 335 var title = $(this).data("title"); 336 if (playing == true && playid == num) { 337 playid = false;
338 $('#player').fadeOut('fast'); 339 soundManager.destroySound('mySound'); 340 soundManager.unload('mySound'); 341 } else if (playing == true) { 342 addTrackToPlaylist(num,title,mp3,random); 343 } else { 344 $("#loading").show(); 345 addTrackToPlaylist(num,title,mp3,random); 346 $('.pr-1').html(title); 347 $('.position').css('width',("0%")); 348 $('#player').fadeIn('fast'); 349 playsound(mp3,id,num,random); 350 } 351 }); 352 353 $('.jscroll').jscroll({ debug: true, loadingHtml: '<img src="/images/ui/preloader.gif" />' }); 354 355 var openSubheader = ''; 356 var href = window.location.href; 357 var urlSegment = href.substr(href.lastIndexOf('/') + 1); 358 if (urlSegment == 'fade') urlSegment = 'fade-1'; 359 $('body').removeClass().addClass(urlSegment); 360 361 $('body').on('click', '.menu-search', function(e) { 362 e.preventDefault(); 363 e.stopPropagation(); 364 $(".navbar-collapse").collapse('hide'); 365 $('.container-search').slideToggle('fast'); 366 }); 367 368 $('body').on('click','.formattab', function(e) { 369 e.preventDefault(); 370 var id = $(this).data('id'); 371 $('.formattracks').fadeOut('fast'); 372 $('#formattracks'+id).fadeIn(); 373 }); 374 375 $('body').on('click','.shop-filter-drop', function(e) { 376 $('.shop-filters').toggle(); 377 if ($('.shop-filters').is(':hidden')) { 378 var state = "closed"; 379 $('body').removeClass('noscroll'); 380 $('.shop-filter-drop').html('<span class="glyphicon glyphicon-download" aria-hidden="true"></span> Filter by format'); 381 } else { 382 var state = "open"; 383 $('body').addClass('noscroll'); 384 $('.shop-filter-drop').html('<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> Filter by format'); 385 } 386 }); 387 388 $('body').on('click','.shop-collab-drop', function(e) { 389 $('.shop-collab').toggle(); 390 if ($('.shop-collab').is(':hidden')) { 391 var state = "closed"; 392 $('body').removeClass('noscroll'); 393 $('.shop-filter-drop').html('<span class="glyphicon glyphicon-download" aria-hidden="true"></span> Filter by format'); 394 } else { 395 var state = "open"; 396 $('body').addClass('noscroll'); 397 $('.shop-filter-drop').html('<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> Filter by format'); 398 } 399 }); 400 401 $('body').on('click','.event-artist-filter-drop', function(e) { 402 $('.location-filters').hide(); 403 $('.artist-filters').toggle(); 404 if ($('.artist-filters').is(':hidden')) { 405 var state = "closed"; 406 $('body').removeClass('noscroll'); 407 $('.event-artist-filter-drop').html('<span class="glyphicon glyphicon-download" aria-hidden="true"></span> Artist'); 408 $('.event-artist-filter-drop').css('color','#fff'); 409 } else { 410 var state = "open"; 411 $('body').addClass('noscroll'); 412 $('.event-artist-filter-drop').css('color','#e9f200'); 413 $('.event-artist-filter-drop').html('<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> Artist'); 414 } 415 }); 416 417$('body').on('click','.event-location-filter-drop', function(e) { 418 $('.artist-filters').hide(); 419 $('.location-filters').toggle(); 420 if ($('.location-filters').is(':hidden')) { 421 var state = "closed"; 422 $('body').removeClass('noscroll'); 423 $('.event-location-filter-drop').html('<span class="glyphicon glyphicon-download" aria-hidden="true"></span> Location'); 424 $('.event-location-filter-drop').css('color','#fff'); 425 } else { 426 var state = "open"; 427 $('body').addClass('noscroll'); 428 $('.event-location-filter-drop').css('color','#e9f200'); 429 $('.event-location-filter-drop').html('<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> location'); 430 } 431}); 432 433 $('body').on('click','.label-filter-drop', function(e) { 434 $('.label-filters').toggle(); 435 if ($('.label-filters').is(':hidden')) { 436 var state = "closed"; 437 $('body').removeClass('noscroll'); 438 $('.label-filter-drop').html('<span class="glyphicon glyphicon-download" aria-hidden="true"></span> Label'); 439 } else { 440 var state = "open"; 441 $('body').addClass('noscroll'); 442 $('.label-filter-drop').html('<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> Label'); 443 } 444 }); 445 446 $('body').on('click', '.label-selectorXXX', function(e) { 447 e.preventDefault(); 448 var label = $(this).data('label'); 449 $('.label-artist').hide(); 450 $('.container-filter').slideUp(); 451 $('.label-filters').toggle(); 452 $('html, body').animate({ scrollTop: 0 }, 0); 453 $('.master-container').fadeOut('fast', function() { 454 $('.label-filter-drop').html('<span class="glyphicon glyphicon-download" aria-hidden="true"></span> Label'); 455 if (label == 'all') { 456 $('.featured-artist').show(); 457 $('.label-artist').hide(); 458 $('.label-filter-clear').hide(); 459 $('.item').show(); 460 $('.release-item').show(); 461 } else { 462 $('.featured-artist').hide(); 463 $('.label-filter-clear').show(); 464 $('.alphablock').hide(); 465 $('.item').hide(); 466 $('.release-item').hide(); 467 $('.'+label).show(); 468 $('.row').css('width','100%'); 469 var offset = $('.'+label).size(); 470 var newurl = "/_ajax/releases/"+label+"/"+offset; 471 $('.scroller').attr('href',newurl); 472 $('.jscroll-next').attr('href',newurl); 473 $('.jscroll-next').data('offset',offset); 474 $('.scroller').data('offset',offset); 475 var url = $('.scroller').attr('href'); 476 $('.jscroll').jscroll({ refresh: true, debug: true, loadingHtml: '<img src="/images/ui/preloader.gif" />' }); 477 $('body').removeClass('noscroll'); 478 } 479 $('.master-container').fadeIn(); 480 }); 481 }); 482 483 $('body').on('click', '.internal', function(e) { 484 485 $(".navbar-collapse").collapse('hide'); 486 href = $(this).attr("href"); 487 488 href2 = href.substring(1); 489 n = href2.indexOf("/"); 490 if (n>0) 491 href2 = href2.substring(0,n); 492 history.pushState({url: href}, href2, href); 493 loadContent(href); 494 495 e.preventDefault(); 496 e.stopPropagation(); 497 }); 498 499 $('body').on('click','.readmore', function(e) { 500 e.stopPropagation(); 501 e.preventDefault(); 502 $('.biog-small').hide(); 503 $('.biog-full').show(); 504 }); 505 506 $('body').on('click','.readless', function(e) { 507 e.stopPropagation(); 508 e.preventDefault(); 509 $('.biog-full').hide(); 510 $('.biog-small').show(); 511 }); 512 513 $('body').on('click','.paypal-commit', function(e) { 514 $('#submitBtn').click(); 515 e.stopPropagation(); 516 e.preventDefault(); 517 }); 518 519 $('body').on('click','.card-commit', function(e) { 520 $('#card-form').submit(); 521 e.stopPropagation(); 522 e.preventDefault(); 523 }); 524 525 $('body').on('mouseover', '.trackbuy', function(e) { 526 e.stopPropagation(); 527 e.preventDefault(); 528 var element = this; 529 $('.expand-buy-options').hide() 530 $(element).parent('.track-buy-button').find('.expand-buy-options').show(); 531 }); 532 533 $('body').on('mouseleave', '.expand-buy-options', function(e) { 534 e.stopPropagation(); 535 e.preventDefault(); 536 var element = this; 537 $('.expand-buy-options').hide() 538 }); 539 540 $('body').on('click', '.buyformat', function(e) { 541 e.stopPropagation(); 542 e.preventDefault(); 543 var element = this; 544 var item = $(this).data('id'); 545 var format = $(this).data('format'); 546 var type = $(this).data('type'); 547 var catno = $(this).data('catno'); 548 var price = $(this).data('price'); 549 $.ajax({ 550 url: "/_ajax/add-to-cart.php", 551 cache: false, 552 type: "POST", 553 data: {item: item, format: format, type: type, ajax: 1}}) 554 .done(function(html,status,request) { 555 if ($(this).data('catno') !== null && $(this).data('catno') !== 'undefined') { 556 fbq('track', 'AddToCart',{currency:"GBP",value: $(this).data('price'),content_ids:[$(this).data('catno')]}); 557 } 558 $('.basket-counter').html(html); 559 basketCheck(html); 560 $(element).parent().parent().hide(); 561 if (type == 'bundleit') { 562 location.href='/checkout'; 563 } 564 }); 565 }); 566 567 $('body').on('click', '.buy', function(e) { 568 569 e.stopPropagation(); 570 e.stopImmediatePropagation(); 571 e.preventDefault(); 572 $(this).addClass('disabled'); 573 //Code that animates release to basket 574 var cart = $('.shopping-basket'); 575 var imgtodrag = $('.packshot').find('img').eq(0); 576 var me = $(this); 577 if (imgtodrag) { 578 var imgclone = imgtodrag.clone() 579 .offset({ 580 top: me.offset().top, 581 left: me.offset().left 582 }) 583 .css({ 584 'opacity': '0.5', 585 'position': 'absolute', 586 'height': '150px', 587 'width': '150px', 588 'z-index': '10000' 589 }) 590 .appendTo($('body')) 591 .animate({ 592 'top': cart.offset().top + 20, 593 'left': cart.offset().left + 30, 594 'width': 75, 595 'height': 75 596 }, 1000); 597 598 imgclone.animate({ 599 'width': 0, 600 'height': 0 601 }, function () { 602 $(this).detach(); 603 }); 604 } 605 var edition = $('.edition').val(); 606 var item = $(this).data('id'); 607 var format = $(this).data('format'); 608 var type = $(this).data('type'); 609 $.ajax({ 610 url: "/_ajax/add-to-cart.php", 611 cache: false, 612 type: "POST", 613 data: {edition: edition, item: item, format: format, type: type, ajax: 1}}) 614 .done(function(html,status,request) { 615 if (edition > 0) { 616 $('.stocklevel').load("/_ajax/stocklevel.php?ajax=1&id="+item); 617 } else { 618 $('.buy').removeClass('disabled'); 619 } 620 $('.basket-counter').html(html); 621 basketCheck(html); 622 if (html==0) 623 $('.buy').removeClass('disabled'); 624 625 if ($(this).data('catno') !== null && $(this).data('catno') !== 'undefined') { 626 fbq('track', 'AddToCart',{currency:"GBP",value: $(this).data('price'), content_ids:[$(this).data('catno')]}); 627 } 628 if (type == 'bundleit') { 629 location.href='/checkout'; 630 } 631 }); 632 }); 633 634 // Newsletter modal 635 if (!sessionStorage.getItem('newsletter_dismissed')) { 636 setTimeout(function() { 637 $('#newsletter-modal').fadeIn('fast'); 638 }, 2000); 639 } 640 641 $('#newsletter-modal .newsletter-modal-close').on('click', function() { 642 $('#newsletter-modal').fadeOut('fast'); 643 sessionStorage.setItem('newsletter_dismissed', '1'); 644 }); 645 646 $('body').on('submit', '#newsletter-modal-form', function(e) { 647 e.preventDefault(); 648 var email = $('#newsletter-modal-email').val(); 649 $.ajax({ 650 url: '/_ajax/mailchimp.php', 651 type: 'POST', 652 data: { email: email }, 653 success: function(html) { 654 $('#newsletter-modal-response').html(html); 655 sessionStorage.setItem('newsletter_dismissed', '1'); 656 setTimeout(function() { 657 $('#newsletter-modal').fadeOut('fast'); 658 }, 3000); 659 } 660 }); 661 }); 662 663});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.