var requireConsent = false; var event = new Event('db.basketUpdate'); function dispatchBasketUpdateEvent() { //document.querySelector('#basket').dispatchEvent(event); $('#basket').trigger('db.basketUpdate'); } function slug(str) { str = str.toLowerCase(); str = str.replace(/[^a-z0-9]+/g, '_'); str = str.replace(/^-|-$/g, ''); return str; } $(".btn-set-price").on("click",function(e) { $('.modal-format-price').removeClass('text-danger'); var inputbox = $(this).attr('data-input-price'); var payprice = $('#'+inputbox).val(); var minprice = $('#'+inputbox).attr('data-min-value'); var buyButton = $(this).attr('data-buy-button'); if (parseFloat(payprice).toFixed(2)>=parseFloat(minprice).toFixed(2)) { $('.modal-format-price').removeClass('text-danger'); $('#'+buyButton).prop('disabled',false).removeClass('disabled').attr('data-pay-as-you-want', payprice); $('#'+buyButton).html(" Pay £"+payprice); } else { $('.modal-format-price').addClass('text-danger'); $('#'+inputbox).val(minprice); }; e.preventDefault(); }); function validateFloatKeyPress(el, evt) { var charCode = (evt.which) ? evt.which : event.keyCode; var number = el.value.split('.'); if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) { return false; } //just one dot if(number.length>1 && charCode == 46){ return false; } //get the carat position var caratPos = getSelectionStart(el); var dotPos = el.value.indexOf("."); if( caratPos > dotPos && dotPos>-1 && (number[1].length > 1)){ return false; } return true; }; //thanks: http://javascript.nwbox.com/cursor_position/ function getSelectionStart(o) { if (o.createTextRange) { var r = document.selection.createRange().duplicate() r.moveEnd('character', o.value.length) if (r.text == '') return o.value.length return o.value.lastIndexOf(r.text) } else return o.selectionStart }; function init_buttons() { $(".dropdown-menu.sizes-dropdown li a").click(function(e){ e.preventDefault(); $(this).parents(".dropdown").find('.btn').html($(this).text() + ' '); $(this).parents(".dropdown").find('.btn').val($(this).data('value')); var buyButton = $(this).attr("data-product-id"); var selectedSize = $(this).attr("data-value"); var pid = $(this).attr("data-product-id"); var fid = $(this).attr("data-format"); var tid = $(this).attr("data-variation-id"); console.log(pid); console.log(fid); console.log(tid); $.get("/core/dbr.live.stock.asp", { pid: pid,fid: fid ,tid: tid }, function(data){ var sizestock = data; if (sizestock <= 0) { $('.selected-stock[data-product-id="'+pid+'"]').html('

 Out of Stock

'); } else if (sizestock <= 5) { $('.selected-stock[data-product-id="'+pid+'"]').html('

 Only '+sizestock+' REMAINING

'); $('#'+buyButton).prop('disabled',false).removeClass('disabled').attr('data-product-id', selectedSize); $('#'+buyButton).html(" Add to cart"); } if (sizestock > 5) { $('.selected-stock[data-product-id="'+pid+'"]').html('

 IN STOCK

'); $('#'+buyButton).prop('disabled',false).removeClass('disabled').attr('data-product-id', selectedSize); $('#'+buyButton).html(" Add to cart"); }; }); }); $("button.buyrelease").on('click', function(e){ $this = $(this); $(this).prop('disabled', true); mymodal = $this.attr("data-modal-format"); thumbnail_actions = $this.data("actions"); payprice = $this.attr("data-pay-as-you-want"); product = $this.attr("data-product-id"); pid = $this.attr("id"); fid = $this.attr("data-format"); variation = product.split("x"); tid = variation[1]; $('.selected-stock[data-product-id="'+pid+'"]').html(' '); $.get("/scripts/v45/core/core.cart.asp", { id: product, cartid: null, cp: payprice}, function(data){ var datarray = data.split(","); if (datarray[1] == "FAIL") { $this.html("Out of stock").addClass('btn-nostock'); humane.log("Out of Stock") } else { if (window.fbq !== undefined) { fbq('track', 'AddToCart', { content_type: 'product', content_ids: [datarray[2]], content_category: datarray[3], value:datarray[4], currency: 'GBP' }); }; if (datarray[0]>0) { if( fid==1 ) { $('*[data-product-id="'+product+'"]').html(" In your basket").addClass('incart'); } else if ( fid==4) { if (thumbnail_actions) { $('*[data-product-id="'+product+'"]').html(" In your basket").addClass('incart'); } else { $('div.sizes-group').each(function(index, el){ var sizes = $(this).find('input[name="product-sizes"]'); if( sizes.length == 1 ){ sizes.trigger('change').parent().addClass("active"); }; }); }; } else { $this.prop('disabled',false); $this.html(" Add another?").addClass('btn-addmore'); }; humane.log("Added to Basket", { timeout: 4000, clickToClose: true }); } else { humane.log("Added to Basket", { timeout: 4000, clickToClose: true }); if ( fid==4) { if (thumbnail_actions){ $this.html("Out of stock").addClass('btn-nostock'); } else { $this.html(" Select size"); $('input#s'+tid).parent().remove(); }; } else { $this.prop('disabled',true); $this.html("Out of stock").addClass('btn-nostock'); }; }; }; $("#basket").show(); $("#basket").load("/scripts/v45/core/core.basket.asp", dispatchBasketUpdateEvent); $('#modal-'+mymodal).modal('hide'); }); e.preventDefault(); }); $('div.sizes-group').each(function(index, el){ var sizes = $(this).find('input[name="product-sizes"]'); if( sizes.length == 1 ){ sizes.trigger('change').parent().addClass("active").removeClass("disabled"); }; }); } $("#btn-login").on('click', function(e){ var email = $("input#mod-email").val(); var password = $("input#mod-password").val(); var regError = $(this); regError.data('error', false); $('.error').removeClass('error'); $('.has-error').removeClass('has-error'); $('#login-error-msg').addClass('hide'); if (email == "") { $("#mod-email").addClass("error").parent('.form-group').addClass('has-error'); regError.data('error', true); } if (password == "") { $("input#mod-password").addClass("error").parent('.form-group').addClass('has-error'); regError.data('error', true); } if (regError.data('error')) { return false; } else { $.post("/scripts/v45/core/login.asp",{ email: email, password: password }, function(data) { if (data == "9") { //$('#modal-login').modal('hide'); //$('#modal-consent').modal('show'); window.location.href = window.location.href; } else if (data != "0") { $("#mod-email").addClass("error").parent('.form-group').addClass('has-error'); $("#mod-password").addClass("error").parent('.form-group').addClass('has-error'); $('#login-error-msg').removeClass('hide'); } else { window.location.href = window.location.href; // $('#user').load("/custom/core.account.user.asp"); // $('#mask').hide(); // $('.window').hide(); } }); } return false; }); if (requireConsent) { $('#modal-consent').modal('show'); } $('#btn-consent-yes').click(function (e) { $.ajax({ url: "/scripts/v45/core/marketing.consent.asp?consent=1", method: "POST" }).always(function () { window.location.href = window.location.href; }); }); $('#btn-consent-no').click(function (e) { $.ajax({ url: "/scripts/v45/core/marketing.consent.asp?consent=0", method: "POST" }).always(function () { window.location.href = window.location.href; }); }); $("#reset-password").click(function () { var email = $("input#reset-email").val(); var regError = $(this); regError.data('error', false); $('.error').removeClass('error'); $('.has-error').removeClass('has-error'); if (email == "") { $("#reset-email").addClass("error").parent('.form-group').addClass('has-error'); regError.data('error', true); } if (regError.data('error')) { return false; } else { $.post("/scripts/v45/core/password-reminder.asp",{ email: email },function(data) { $("#form-password").after(data); }); } return false; }); $(".logout").on('click', function(e){ console.log("logout") $.get("/scripts/v45/core/logout.asp", function(data) { document.location.href="/shop"; }); }); function loadPodcasts() { $("#podcasts").html(''); $.getJSON("https://api.soundcloud.com/playlists/14578?client_id=730d4377bcd3b1a38cebb106b1b16b92", function (data) { $.each(data.tracks, function (i, track) { artwork_url = track.artwork_url; comment_count = track.comment_count; created_at = track.created_at; download_count = track.download_count; favoritings_count = track.favoritings_count; playback_count = track.playback_count title = track.title; permalink = track.permalink; id = track.id; uri = track.uri; $('#podcasts').append('
'+title+'
') }); bindPodcast(); }); } function bindPodcast() { $('.podcast').click( function (e) { var podcast = this var uri = $(this).attr("data-href"); var scHeight = $(podcast).height()-20; console.log(scHeight); $('div.sc.thumbnail').show(); $('div.podcast>iframe').remove(); $('div.sc.thumbnail', this).hide(); var apiURL = "https://soundcloud.com/oembed?"; $.getJSON( apiURL, { url: uri, maxheight: scHeight, inverse: true, show_comments: false, hide_related: true, format: "json", auto_play: true }) .done(function( data ) { $(podcast).append(data.html); }); }); } function pageloaded(pagename) { $(window).load(function () { var activeSection = $("#main").data("section"); $('li.nav-'+activeSection).addClass('active'); try { window[pagename](); console.log(pagename); } catch(err) { // Handle error(s) here } }); } function podcasts() { loadPodcasts(); } function ticket() { var maxqty = $('.spinbox').attr('data-max-qty'); $('.spinbox').spinbox({value:1, step: 1, min: 1, max: maxqty, hold: false }); $(".buyticket").click(function() { var tid = $(this).attr("id"); var qid = tid.replace('e','#s'); var tqty = $(qid).spinbox('value'); var event_id = $(this).attr('data-event-id'); if (tqty>0){ $.get("/scripts/v45/core/core.cart.asp", { id: tid, event_id: event_id, qty: tqty }, function(data){ console.log(data); $("#basket").load("/scripts/v45/core/core.basket.asp", dispatchBasketUpdateEvent); $("#basket").show(); }); }; }); } function gigs(){ events(); } function events() { $.getJSON("https://api.bandsintown.com/artists//events.json?api_version=2.0&app_id=DATABEATS&callback=?", function (data) { var html = ''; $.each(data, function (i, event) { var d = moment.utc(event.datetime); html += '
'; html += '
'; html += '
'; html += '
'; html += '
'; html += '' + d.format('MMMM') + ', '; html += '' + d.format('YYYY') + ''; html += '
'; html += '
'; html += '' + d.format('DD') + ''; html += '' + d.format('dddd HH:mm') + ''; html += '
'; html += '
'; html += '
'; html += '
'; html += '

' + event.title + '

'; if (event.artists.length > 1) { html += '

w/ '; for (var i = 1; i < event.artists.length; i++) { if (i > 1) html += ', '; html += event.artists[i].name; } html += '

'; } html += '

'; html += event.venue.name + '
'; html += event.formatted_location; html += '

'; html += 'RSVP'; html += '
'; html += '
'; html += '
'; }); $('#tour-dates').append(html); }); } function vieworders_old() { $('.btn-resend').click(function (e) { $resetbutton = $(this); var vpstxid = $(this).attr('data-txid'); e.preventDefault(); $resetbutton .text('EMAIL SENT'); $.get("/core/core.send.tickets.email.asp", { id: vpstxid }, function(data){ $resetbutton .removeClass('btn-resend').addClass('disabled') }); }); $('.btn-download').click(function (e) { var pid = $(this).attr('data-pid'); var cid = $(this).attr('data-order-id'); $downloadbutton = $(this); $(this).html(' PROCESSING'); $.post("/core/startziptxt.asp", { id: cid, pid: pid }); $.post("/core/checkziptxt.asp", { id: cid, pid: pid }); var refreshId = setInterval(function() { $.post("/core/checkziptxt.asp", { id: cid, pid: pid }, function(data){ if (data == "ZIP"){ clearInterval(refreshId); $($downloadbutton).hide().after('
DOWNLOADING
'); document.location.href='/core/streamzip2.asp?id='+cid+'&pid='+pid; } }); }, 3000); return false; }); $('.btn-download-file').click(function (e) { $downloadbutton = $(this); var fid = $(this).attr('data-fid'); var tid = $(this).attr('data-tid'); var cid = $(this).attr('data-order-id'); var expanded = $(this).attr('data-expanded'); document.location.href='/core/streamfile2.asp?id='+cid+'&t='+tid+'&f='+fid+'&e='+expanded; $($downloadbutton).hide().after('
DOWNLOADING
'); return false; }); $('#modal-login').modal('show'); function removeDuplicateRows($table){ function getVisibleRowText($row){ return $row.find('td.compare').text().toLowerCase(); } $table.find('tr').each(function(index, row){ var $row = $(row); $row.nextAll('tr').each(function(index, next){ var $next = $(next); if(getVisibleRowText($next) == getVisibleRowText($row)) $next.remove(); }) }); } // removeDuplicateRows($('table#downloadvault')); var items = {}; $('#allstores div.panel-order').each(function() { items[$(this).attr('data-storename')] = true; }); var stores = new Array(); for(var i in items) { stores.push(i); } for(var i in stores) { $('').appendTo('#storesfilter'); } $('#storesfilter').on( 'change', function() { // get filter value from option value var filterstore = this.value; // use filterFn if matches value if (filterstore.trim() == "") { $('#allstores div.panel-order').show(); } else { $("#allstores div.panel-order").hide().filter('[data-storename="'+filterstore+'"]').show(); } }); // $('#downloadvault').DataTable({ // "columnDefs": [ // { // "targets": [ 0 ], // "visible": false, // "searchable": false // } // ] // ,"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]] // ,"order": [[ 0, "desc" ]] // ,"iDisplayLength": 50 // }); } function vieworders() { $('.btn-resend').click(function (e) { $resetbutton = $(this); var vpstxid = $(this).attr('data-txid'); e.preventDefault(); $resetbutton .text('EMAIL SENT'); $.get("/core/core.send.tickets.email.asp", { id: vpstxid }, function(data){ $resetbutton .removeClass('btn-resend').addClass('disabled') }); }); $('.btn-download').click(function (e) { var pid = $(this).attr('data-pid'); var cid = $(this).attr('data-order-id'); $downloadbutton = $(this); $(this).html(' PROCESSING'); $.post("https://d3.databeats.com/scripts/v45/core/startzip_s3.asp", { id: cid, pid: pid }); $.post("https://d3.databeats.com/scripts/v45/core/checkzip_s3.asp", { id: cid, pid: pid }); var refreshId = setInterval(function() { $.post("https://d3.databeats.com/scripts/v45/core/checkzip_s3.asp", { id: cid, pid: pid }, function(data){ if (data == "ZIP"){ clearInterval(refreshId); $($downloadbutton).hide().after('
DOWNLOADING
'); document.location.href='https://d3.databeats.com/scripts/v45/core/streamzip_s3.asp?id='+cid+'&pid='+pid; } }); }, 3000); return false; }); $('.btn-download-file').click(function (e) { $downloadbutton = $(this); var fid = $(this).attr('data-fid'); var tid = $(this).attr('data-tid'); var cid = $(this).attr('data-order-id'); var expanded = $(this).attr('data-expanded'); document.location.href='https://d3.databeats.com/scripts/v45/core/streamfile_s3.asp?id='+cid+'&t='+tid+'&f='+fid+'&e='+expanded; $($downloadbutton).hide().after('
DOWNLOADING
'); return false; }); $('#modal-login').modal('show'); function removeDuplicateRows($table){ function getVisibleRowText($row){ return $row.find('td.compare').text().toLowerCase(); } $table.find('tr').each(function(index, row){ var $row = $(row); $row.nextAll('tr').each(function(index, next){ var $next = $(next); if(getVisibleRowText($next) == getVisibleRowText($row)) $next.remove(); }) }); } // removeDuplicateRows($('table#downloadvault')); var items = {}; $('#allstores div.panel-order').each(function() { items[$(this).attr('data-storename')] = true; }); var stores = new Array(); for(var i in items) { stores.push(i); } for(var i in stores) { $('').appendTo('#storesfilter'); } $('#storesfilter').on( 'change', function() { // get filter value from option value var filterstore = this.value; // use filterFn if matches value if (filterstore.trim() == "") { $('#allstores div.panel-order').show(); } else { $("#allstores div.panel-order").hide().filter('[data-storename="'+filterstore+'"]').show(); } }); // $('#downloadvault').DataTable({ // "columnDefs": [ // { // "targets": [ 0 ], // "visible": false, // "searchable": false // } // ] // ,"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]] // ,"order": [[ 0, "desc" ]] // ,"iDisplayLength": 50 // }); } function processfree() { $('#modal-login').modal('show'); } function shipping() { $('#modal-login').modal('show'); } function billing() { $('#modal-login').modal('show'); } function search() { // $.getScript('https://static.databeats.com/js/jquery.highlight.js', function () { // $(".highlight").css({ backgroundColor: "#FFFF88" }); // var searchterm = $('.hero').data('query'); // $("body").highlight(searchterm); // }); if ($('#products-artwork .artwork-view').length > 12) { var lenRelease = $('#products-artwork .artwork-view').length-12; $('#products-artwork .artwork-view').each(function (index) { if (index > 11) { $(this).addClass('js-hidden').hide(); } }); $('#products-artwork').addClass('items-hidden').after(''); $('.btn-toggle-products').on('click', function () { if ($('#products-artwork').hasClass('items-hidden')) { $('#products-artwork .js-hidden').fadeIn(); $(this).html('Show less matching releases '); } else { $('#products-artwork .js-hidden').fadeOut(); $(this).html('Show all matching releases (' + lenRelease + ' more) '); } $('#products-artwork').toggleClass('items-hidden'); }); } if ($('#tracks-artwork tbody tr').length > 8) { var lenTracks = $('#tracks-artwork tbody tr').length-8; $('#tracks-artwork tbody tr').each(function (index) { if (index > 7) { $(this).addClass('js-hidden').hide(); } }); $('#tracks-artwork').addClass('items-hidden').after(''); $('.btn-toggle-tracks').on('click', function () { if ($('#tracks-artwork').hasClass('items-hidden')) { $('#tracks-artwork .js-hidden').fadeIn(); $(this).html('Show less matching tracks '); } else { $('#tracks-artwork .js-hidden').fadeOut(); $(this).html('Show all matching tracks (' + lenTracks + ' more) '); } $('#tracks-artwork').toggleClass('items-hidden'); }); } if ($('#news-artwork .artwork-view').length > 8) { var lenNews = $('#news-artwork .artwork-view').length-8; $('#news-artwork .artwork-view').each(function (index) { if (index > 7) { $(this).addClass('js-hidden').hide(); } }); $('#news-artwork').addClass('items-hidden').after(''); $('.btn-toggle-news').on('click', function () { if ($('#news-artwork').hasClass('items-hidden')) { $('#news-artwork .js-hidden').fadeIn(); $(this).html('Show less matching news '); } else { $('#news-artwork .js-hidden').fadeOut(); $(this).html('Show all matching news (' + lenNews + ' more) '); } $('#news-artwork').toggleClass('items-hidden'); }); } $('.search-results-collapse').on('hide.bs.collapse', function () { $(this).parent().find('.btn-toggle').html(''); }); $('.search-results-collapse').on('show.bs.collapse', function () { $(this).parent().find('.btn-toggle').html(''); }); } function music (){ var scwidget = SC.Widget('soundcloud-iframe'); var mcwidget = Mixcloud.PlayerWidget(document.getElementById('mixcloud-iframe')); scwidget.bind(SC.Widget.Events.READY, function () { scwidget.bind(SC.Widget.Events.PLAY, function () { mcwidget.pause(); }); }); mcwidget.ready.then(function () { mcwidget.events.play.on(mcPlayListener); console.log(mcwidget); }); function mcPlayListener() { scwidget.pause(); } } function news(){ FB.XFBML.parse(); } function dndex() { $("#home-releases .artwork-view").each(function() { var $this = $(this); $this.addClass("col-md-3 col-sm-4 col-xs-6"); $('.owl-carousel').addClass('disabled'); }); } function newsarchive(){ setBoxHeight(); $(window).resize(setBoxHeight); } function setBoxHeight() { $('.thumbnail-item-heading').height('auto'); var boxHeight = 0; $('.thumbnail-item-heading').each(function () { if ($(this).height() > boxHeight) { boxHeight = $(this).height(); } }); $('.thumbnail-item-heading').each(function () { if ($(this).height() < boxHeight) { $(this).height(boxHeight); } }); } function photos() { function loadPhotoset() { //$.getJSON("http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=a6c39a7814a851976120de7ca05d84be&photoset_id=&format=json&jsoncallback=?", $.getJSON("https://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=a6c39a7814a851976120de7ca05d84be&photoset_id=" + pid + "&format=json&jsoncallback=?", function (data) { var photosetID = ""; var title = ""; $('#photoset-heading').text('Photoset: ' + data.photoset.title); $.each(data.photoset.photo, function (i, photo) { photoid = photo.id; farm = photo.farm; server = photo.server; secret = photo.secret; phototitle = photo.title; /* title = set.title._content; */ thumb = 'http://farm' + farm + '.staticflickr.com/' + server + '/' + photoid + '_' + secret + '_n.jpg' largeimg = 'http://farm' + farm + '.staticflickr.com/' + server + '/' + photoid + '_' + secret + '_b.jpg' var img = new Image(); $(img).attr('src', thumb).addClass('imagegallery'); //$("#photosets").append(img); $("#photosets").append('
'); //$(img).wrap( //$('').attr('href', largeimg).wrap('
'+img+'
') //); }); $("a.lightbox").fancybox({ 'transitionIn': 'elastic', 'transitionOut': 'elastic', 'speedIn': 600, 'speedOut': 200, 'overlayShow': 'true', 'overlayColor': '#000', 'overlayOpacity': 0.65, 'showNavArrows': 'true' }); }); } var pid = ''; $(function () { $('.photoset').on("click", function () { var photosetID = $(this).attr('title'); url = '/photos/' + photosetID; document.location.href = url; return false; }); $.getJSON("https://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=a6c39a7814a851976120de7ca05d84be&user_id=&format=json&jsoncallback=?", function (data) { var photosetID = ""; var title = ""; $.each(data.photosets.photoset, function (i, set) { photosetID = set.id; farm = set.farm; server = set.server; primary = set.primary; secret = set.secret; title = set.title._content; thumb = 'http://farm' + farm + '.static.flickr.com/' + server + '/' + primary + '_' + secret + '_m.jpg' url = '/photos/' + photosetID + "/" + title; $('
').appendTo('#albums').attr('title', photosetID + '-' + slug(title)).append('
' + title + '
'); }); pid = $("#photos").attr("data-photoset");; if (pid == '') { //pid = $('.photoset').first().data('set-id'); pid = data.photosets.photoset[0].id; } loadPhotoset(); }); }); } function product() { var $this = $('#label-products'); if ($this.find('div.thumbnail-item').length > 1) { $this.owlCarousel({ loop: false, margin: 0, autoPlay: true, stopOnHover: true, nav : true, rewindNav : false, dots : false, slideBy : 'page', lazyLoad: true, navText : ['',''], navContainer : $this.parent().find(".owl-controls"), responsive: { 0: { items: 2, stagePadding: 15, }, 1000: { items: 3 } } }); } else { $this.addClass("col-md-3 col-sm-4 col-xs-6").removeClass("owl-carousel"); $this.show(); } $(".owl-carousel").each(function() { var $this = $(this); if ($this.find('div.thumbnail-item').length > 1) { $this.owlCarousel({ loop: true, margin: 0, autoPlay: true, stopOnHover: true, nav : true, rewindNav : false, dots : false, slideBy : 'page', lazyLoad: true, navText : ['',''], navContainer : $this.parent().find(".owl-controls"), responsive: { 0: { items: 3, stagePadding: 15, }, 1000: { items: 4 } } }); } else { $this.addClass("col-md-3 col-sm-4 col-xs-6").removeClass("owl-carousel"); $this.show(); } }); var maxHeight = 0; // assuming each div has a class of project $('div.artwork-view').each(function(){ if ($(this).height() > maxHeight) { maxHeight = $(this).height(); } }); $('div.artwork-view').height(maxHeight); var fields = "?fields=share{comment_count},og_object{engagement}"; var access_token = "&access_token=176231275725915%7Ced7e7b678f5be6ae76b127a174bf5fce"; var metaurl = document.location.href; $( "table.product-formats" ).first().clone().appendTo( ".panel-tracklist .panel-footer" ); $("a.buytrack").on('click', function(e){ /* $(this).css("backgroundPosition", "-198px 0px"); */ $(this).html("In Cart").addClass('disabled'); $(this).parent().removeClass('button'); $(this).parent().addClass('incart-small'); $(this).prop('disabled', true); $.get("/scripts/v4/core/core.cart.asp", { id: $(this).attr("id") }, function(data) { $("#basket").show(); $("#basket").load("/scripts/v45/core/core.basket.asp", dispatchBasketUpdateEvent); }); e.preventDefault(); }); $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { // newly activated tab FB.XFBML.parse(); }) if ($("#comments").hasClass('in')) { // newly activated tab FB.XFBML.parse(); }; $(".panel-tracklist .panel-footer table tr.download").hide(); $('td.buy.MP3').show().removeClass('hide'); $('tr.MP3').show(); $('.format-toggle').each(function () { if ($(this).parent().hasClass('active')) { var formatClass = $(this).data('format'); $(formatClass).show(); } }); $('.format-toggle').click(function (e) { e.preventDefault(); var formatClass = $(this).data('format'); $('td.price,td.buy').hide().removeClass('hide'); $(".panel-tracklist .panel-footer table tr").hide(); $(formatClass).show(); $('.format-toggle').parent().removeClass('active'); $(this).parent().addClass('active'); }); $("a.jp-button").on("click",function(e) { e.preventDefault(); var track = $(this).closest("td.icon").data("sample"); var id = $(this).closest('tr').attr('id'); // table row ID if ($(this).hasClass('jp-play')) { playSample(track, id); $("a.jp-button").addClass('jp-play').removeClass('jp-pause'); $(this).removeClass('jp-play').addClass('jp-pause') } else if ($(this).hasClass('jp-pause')) { $("#jquery_jplayer_audio_1").jPlayer("destroy"); $(this).addClass('jp-play').removeClass('jp-pause'); }; }); function playSample(track,id){ $("#jquery_jplayer_audio_1").jPlayer("destroy"); $("#jquery_jplayer_audio_1").jPlayer( { ready: function () { $(this).jPlayer("setMedia", { mp3: track }).jPlayer("play"); // Attempts to Auto-Play the media }, cssSelectorAncestor: '.'+id, supplied: "mp3", swfPath: "/custom/js" }); } $('.minibuy').hide(); $(".tracks").hide(); $("#tracks").show(); $(".toggleformat").click(function () { var trackformat = $(this).attr("alt"); $(".tracks").hide(); $("#"+trackformat+"tracks").show(); $.get("/core/set-format-session.asp", { format: trackformat }) return false; }); init_buttons() } function setThumbnailHeight() { $('div.mix').height('auto'); var maxHeight = 0; // assuming each div has a class of project $('div.mix').each(function () { if ($(this).height() > maxHeight) { maxHeight = $(this).height(); console.log($(this).data('title') + ' - ' + $(this).height()); } }); $('div.mix').height(maxHeight); } function products() { var $container = $('#products-artwork'); $('div.mix'+mixFilter).show(); setThumbnailHeight(); $(window).resize(setThumbnailHeight); $('.btn-list-view').click(function(event){ event.preventDefault(); $('.btn-toggle-all-tracks').removeClass("hidden"); $('#products-artwork .product').removeClass('artwork-view col-md-3 col-sm-4 mix').addClass('list-view col-xs-12 mix'); $('div.mix').height('auto'); }); $('.btn-grid-view').click(function(event){ event.preventDefault(); $('.product-tracklist').each(function() { $(this).collapse('hide'); }); $('.product-controls').each(function() { $(this).hide(); }); $('.btn-toggle-all-tracks').addClass("hidden"); $('#products-artwork .product').removeClass('list-view col-xs-12 mix').addClass('artwork-view col-md-3 col-sm-4 mix'); $('div.mix').height('auto'); var maxHeight = 0; // assuming each div has a class of project $('div.mix').each(function(){ if ($(this).height() > maxHeight) { maxHeight = $(this).height(); } }); $('div.mix').height(maxHeight); }); $('.btn-toggle-all-tracks').click(function(event){ event.preventDefault(); $(this).toggleClass('in'); if ($(this).hasClass('in')){ $(this).button('expand'); } else { $(this).button('reset'); }; $('.product-tracklist').each(function() { $(this).collapse('toggle'); }); }); $('.product-tracklist').on('hidden.bs.collapse', function(){ togglebutton = $(this).parent().find(".btn-toggletrack"); $(togglebutton).button("reset"); $(this).parent().find(".product-controls").toggleClass("hidden"); } ); $('.product-tracklist').on('shown.bs.collapse',function(){ togglebutton = $(this).parent().find(".btn-toggletrack"); $(togglebutton).button("expand"); $(this).parent().find(".product-controls").toggleClass("hidden"); }); init_buttons() } function index() { init_buttons() } function databeats() { $('.owl-carousel').filter(function (index) { return $(this).children().length < 1; }).parent().remove(); $('hr').each(function() { while($(this).prop('tagName') == $(this).next().prop('tagName')) $(this).next().remove(); }); $(".thumbs .owl-carousel").each(function() { var $this = $(this); if ($this.find('div.thumbnail-item-small').length > 1) { $this.owlCarousel({ loop: true, margin: 0, autoPlay: true, stopOnHover: true, nav : true, rewindNav : false, dots : false, lazyLoad: true, slideBy: 'page', navText : ['',''], navContainer : $this.parent().find(".owl-controls"), responsive: { 0: { items: 1 }, 600: { items: 3 }, 1000: { items: 4, stagePadding: 0 } } }); } else { $this.show(); } }); $(".thumbs .owl-carousel").each(function() { var $this = $(this); if ($this.find('div.tall-thumbnail-item').length > 1) { $this.owlCarousel({ loop: true, margin: 0, autoPlay: true, stopOnHover: true, nav : true, rewindNav : false, dots : false, lazyLoad: true, slideBy: 'page', navText : ['',''], navContainer : $this.parent().find(".owl-controls"), responsive: { 0: { items: 2, stagePadding: 15, }, 600: { items: 4, }, 1000: { items: 6, } } }); } else { $this.show(); } }); $(".artwork .owl-carousel").each(function() { var $this = $(this); if ($this.find('div.artwork-view').length > 1) { $this.owlCarousel({ loop: false, margin: 0, autoPlay: true, stopOnHover: true, nav : true, rewindNav : true, dots : false, lazyLoad: true, slideBy: 'page', navText : ['',''], navContainer : $this.parent().find(".owl-controls"), responsive: { 0: { items: 1 }, 600: { items: 3 }, 1000: { items: 4 } } }); // Custom Navigation Events } else { $this.removeClass("owl-carousel").find('.artwork-view').addClass("col-md-3 col-sm-6 col-xs-12"); $this.show(); } }); $(".events .owl-carousel").each(function() { var $this = $(this); if ($this.find('div.events-list-item').length > 1) { $this.owlCarousel({ loop: true, margin: 0, autoPlay: true, stopOnHover: true, nav : true, rewindNav : false, dots : false, navText : ['',''], navContainer : $this.parent().find(".owl-controls"), responsive: { 0: { items: 1 }, 600: { items: 1 }, 1000: { items: 1 } } }); // Custom Navigation Events } else { $this.show(); } }); $(".featured .owl-carousel").each(function() { var $this = $(this); if ($this.find('div.featured-item').length > 1) { $this.owlCarousel({ loop: true, margin: 0, autoPlay: true, stopOnHover: true, nav : true, rewindNav : false, dots : false, navText : ['',''], navContainer : $this.parent().find(".owl-controls"), responsive: { 0: { items: 1 }, 600: { items: 1 }, 1000: { items: 1 } } }); // Custom Navigation Events } else { $this.show(); } }); $("button.buyrelease").on('click', function(e){ $this = $(this); $(this).prop('disabled', true); product = $this.attr("data-product-id"); pid = $this.attr("id"); fid = $this.attr("data-format"); actions = $this.attr("data-actions"); variation = product.split("x"); tid = variation[1]; $('.selected-stock[data-product-id="'+pid+'"]').html(' '); $("input[name='product-sizes']").prop("checked",false); $("input[name='product-sizes']").parent().removeClass("active"); $.get("/scripts/v4/core/core.cart.asp", { id: product, cartid: null }, function(data){ var datarray = data.split(","); if (datarray[1] == "FAIL") { $this.html("Out of stock").addClass('btn-nostock'); // humane.log("id: "+product+" NOT ADDED ", { timeout: 8000, waitForMove: true, clickToClose: true, addnCls: 'cart-add' }); } else { if (datarray[0]>0) { if( fid==1 ) { $this.html(" In your basket").addClass('incart'); } else if ( fid==4) { if( actions=="true" ) { $this.html(" In your basket").addClass('incart'); } else { $this.html(" Select size"); }; } else { $this.prop('disabled',false); $this.html(" Add another?").addClass('btn-addmore'); }; // humane.log("format: " + fid + " . id: "+product+" . new stock: "+datarray[0]+" " +datarray[1], { timeout: 8000, waitForMove: true, clickToClose: true, addnCls: 'cart-add' }); } else { // humane.log("id: "+product+" . new stock: "+datarray[0]+" " +datarray[1], { timeout: 8000, waitForMove: true, clickToClose: true, addnCls: 'cart-add' }); if ( fid==4) { $this.html(" Select size"); $('input#s'+tid).parent().remove(); } else { $this.prop('disabled',true); $this.html("Out of stock").addClass('btn-nostock'); }; }; }; $("#basket").show(); $("#basket").load("/scripts/v45/core/core.basket.asp", dispatchBasketUpdateEvent); }); e.preventDefault(); }); } function checkout() { $("#remove-voucher").click(function(e) { $.get("/core/core.voucher.remove.asp", function(data){ window.location.href = '/checkout' }) }); $("#btn-voucherapply").click(function(e) { e.preventDefault() var vouchercode = $("input#voucher-code").val().toUpperCase(); $.get("/scripts/v45/core/core.apply.voucher.asp", { id: vouchercode, c: null}, function(data){ if (data != "1"){ $('input#voucher-code').val('invalid code') e.preventDefault() } else { window.location.href = '/checkout' } }); }); $(".paypal").hide(); $(".creditcard").show(); $(".payment_type").live('click', function() { if($(this).val()==="paypal"){ $(".paypal").show(); $(".creditcard").hide(); } else { $(".paypal").hide(); $(".creditcard").show(); } }); } function resetpassword (){ $("#update-password").on('click', function(e){ var cid = $(this).attr('data-cid'); var cpassword = $('#new-password').val(); var eid = $(this).attr('data-eid'); $.post("/core/dbr.core.update.password.asp",{ cid: cid, cpassword: cpassword, id: eid }, function(data) { if (data != "0") { console.log('updated'); window.location.href = '/vieworders'; } }); return false; }); } function contact () { $(function () { $("#contact-form").validate( { highlight: function(label) { $(label).closest('.form-group').addClass('has-error'); }, success: function(label) { label.closest('.form-group').removeClass('has-error'); } }); // Post form $("#contact-form").submit(function (event) { if (!$("#contact-form").valid()) { return false; } // prevent default posting of form event.preventDefault(); // setup some local variables var $form = $(this), // let's select and cache all the fields $inputs = $form.find("input, select, button, textarea"), // serialize the data in the form serializedData = $form.serialize(); // let's disable the inputs for the duration of the ajax request $inputs.attr("disabled", "disabled"); // fire off the request to /form.php $.ajax({ url: "/scripts/v45/core/form.contact.asp", type: "post", data: serializedData, // callback handler that will be called on success success: function (response, textStatus, jqXHR) { // log a message to the console $.get("/scripts/v45/core/form.success.htm", function (data) { $("#contact-form").fadeOut('normal', function () { $('#result').append(data).fadeIn('normal'); }); }); //$('#form-container').load('success.htm'); console.log("Hooray, it worked!"); console.log(response); console.log(textStatus); console.log(jqXHR); }, // callback handler that will be called on error error: function (jqXHR, textStatus, errorThrown) { // log the error to the console $.get("/scripts/v45/core/form.error.htm", function (data) { $("#contact-form").fadeOut('normal', function () { $('#result').append(data).fadeIn('normal', function () { $('#retry').click(function (e) { e.preventDefault(); $('#result').fadeOut('normal', function () { $('#result').html(''); $('#contact-form').fadeIn(); }); }); }); }); }); console.log("The following error occured: " + textStatus, errorThrown); }, // callback handler that will be called on completion // which means, either on success or error complete: function () { // enable the inputs $inputs.removeAttr("disabled"); } }); }); }); } function account () { $('.minibuy').hide(); $(".tracks").hide(); $("#tracks").show(); $(".toggleformat").click(function () { var trackformat = $(this).attr("alt"); $(".tracks").hide(); $("#"+trackformat+"tracks").show(); $.get("/core/set-format-session.asp", { format: trackformat }) return false; }); // $(document).bind('soundcloud:onPlayerReady', function(event, data) // { // $('#soundcloud-display').css( "height","385" ); // $('.product-img-display').hide(); // }); $('.action-button ').click(function (e) { e.preventDefault(); var od = $(this).attr('alt'); var actionhref = $(this).attr('href'); if (actionhref != "#") { $('#orderactions').remove(); $('.hiddenorder').show(); $('#'+od).addClass('hiddenorder').hide().after('
loading ...
'); $('#orderactions').load(actionhref); $('html,body').animate({ scrollTop: ($("#orderactions").offset().top-15)},'slow'); } }); $('.action-view-files ').click(function (e) { e.preventDefault(); var od = $(this).attr('alt'); var actionhref = $(this).attr('href'); if (actionhref != "#") { $('#orderactions').remove(); $('.hiddenorder').show(); $('#'+od).addClass('hiddenorder').hide().after('
loading ...
'); $('#orderactions').load(actionhref); $('html,body').animate({ scrollTop: ($("#orderactions").offset().top-15)},'slow'); } }); $('a.closeme').click(function (e) { e.preventDefault(); orderdetails = $(this).attr('href'); $('.hiddenorder').show(); $('#orderactions').remove(); }); $('a.print').click(function (e) { $( "#ticketdetails" ).print(); return( false ); }); $('a.email-ticket').click(function (e) { e.preventDefault(); var vpstxid = $(this).attr('alt') $.get("/core/core.send.tickets.email.asp", { id: vpstxid }, function(data){ $('a.email-ticket').text('EMAIL SENT'); $('a.email-ticket').removeClass('email-ticket').addClass('disabled') }); }); $('.download').click(function (e) { var pid = $(this).attr('data-pid') var cid = $(this).attr('data-order-id') $downloadbutton = $(this) $(this).text(' PROCESSING'); $.post("/core/startzip.asp", { id: cid, pid: pid }); $.post("/core/checkziptxt.asp", { id: cid, pid: pid }); var refreshId = setInterval(function() { $.post("/core/checkziptxt.asp", { id: cid, pid: pid }, function(data){ if (data == "ZIP"){ clearInterval(refreshId); $($downloadbutton).text('  DOWNLOADING').removeClass("btn-primary").addClass('btn-success'); document.location.href='/core/streamzip.asp?id='+cid+'&pid='+pid; } }); }, 3000); return false; }); $('.file').click(function (e) { var fid = $(this).attr('alt') var tid = $(this).attr('title') var cid = $(this).attr('rel') document.location.href='/core/streamfile.asp?id='+cid+'&t='+tid+'&f='+fid; $(this).text(' DOWNLOADING').removeClass("btn-primary").addClass('btn-success'); return false; }); $('.expandzip').click(function (e) { var fid = $(this).attr('alt') var tid = $(this).attr('title') var cid = $(this).attr('rel') document.location.href='/core/streamfile.asp?id='+cid+'&t='+tid+'&f='+fid+'&e=true'; $(this).text(' DOWNLOADING').removeClass("btn-primary").addClass('btn-success'); return false; }); } function showMoreCheck(button) { $(button).collapse().show(); var element = $(button).attr('data-target'); var saved = $(element).css(['top', 'overflow', 'height']); $(element).css({ top : 0, height : 0, overflow : 'scroll' }); var actualHeight = $(element).prop('scrollHeight'); var heightcheck = (actualHeight>saved['height'].replace(/[^-\d\.]/g, '')); $(element).css(saved); if (heightcheck) { $(button).hide() }; return heightcheck; } function redeem() { $('.input-group input[required], .input-group textarea[required], .input-group select[required]').on('keyup change', function () { var $form = $(this).closest('form'), $group = $(this).closest('.input-group'), $addon = $group.find('.input-group-addon'), $icon = $addon.find('span'), state = false, url = ''; if (!$group.data('validate')) { state = $(this).val() ? true : false; } else if ($group.data('validate') == "email") { state = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test($(this).val()) // }else if($group.data('validate') == 'phone') { // state = /^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/.test($(this).val()) // }else if ($group.data('validate') == "length") { // state = $(this).val().length >= $group.data('length') ? true : false; } else if ($group.data('validate') == "code") { if ($form.find('.input-group-addon.danger').length == 0) { email = $('#validate-email').val(); $.get("/scripts/v45/core/dbr.core.download.code.asp", { ecode: $(this).val(), email: email }, function (data) { if (!data.length == 0) { $('#download').html(data); } } ); } }; if (state) { $addon.removeClass('danger'); $addon.addClass('success'); $icon.attr('class', 'fa fa-check'); } else { $addon.removeClass('success'); $addon.addClass('danger'); $icon.attr('class', 'fa fa-remove'); } }); $('.input-group input[required], .input-group textarea[required], .input-group select[required]').trigger('change'); } function dimensionhome() { var item = document.getElementsByClassName('horizontal-scrol-wrapper')[0]; window.addEventListener('wheel', function(e) { if (e.deltaY > 0) item.scrollLeft += 80; else item.scrollLeft -= 80; }); } function lookbook(){ // $('#lookbook').masonry({ // // options // itemSelector: '.gallery', // columnWidth: 200 // }); } function youtube(){ var addthis_config = addthis_config||{}; addthis_config.pubid = 'ra-543bb2be6668f85e'; $.getScript( "https://s7.addthis.com/js/300/addthis_widget.js#domready=1") .done(function( script, textStatus ) { if(addthis.layers && typeof addthis.layers.refresh === 'function'){ addthis.layers.refresh(); } }) .fail(function( jqxhr, settings, exception ) { console.log(exception); }); $("#yt-toggle-more").on("click", function(){ $(this).text($(this).text() == "Show more" ? "Show less" : "Show more"); }); var y_tube = $("#playlist").youtube_video({ playlist: false, channel: false, user: 'blackacrerecords', videos: false, api_key: 'AIzaSyDYjq8C-J3AWzTWv-nLZll-rkMkV5a7PtE', max_results: 10, pagination: true, continuous: true, first_video: 0, show_playlist: 'auto', playlist_type: 'vertical', show_channel_in_playlist:false, show_channel_in_title: false, width: false, show_annotations: false, now_playing_text: 'Now Playing', load_more_text: 'Load More', autoplay: false, force_hd: false, hide_youtube_logo: false, play_control: true, time_indicator: 'full', volume_control: true, share_control: false, fwd_bck_control: true, youtube_link_control: true, fullscreen_control: true, playlist_toggle_control:true, volume: false, show_controls_on_load: true, show_controls_on_pause: true, show_controls_on_play: true, player_vars: {}, colors: { 'controls_bg': 'rgba(0, 0, 0, 0.6)', 'playlist_overlay': 'rgba(0, 0, 0, 0.6)', 'load_more_bg': 'rgba(0, 0, 0, 0.6)' }, on_done_loading: function(items) { var videolist = [], extra_stats = []; var videos = items; for (var i in videos) { videolist[i] = videos[i].snippet.resourceId.videoId; } // i is the index/key, not the item var stats_list = videolist.join(); var staturl = 'https://www.googleapis.com/youtube/v3/videos?part=snippet%2C+statistics%2C+contentDetails&id='+stats_list+'&fields=items(id%2Csnippet(title%2CpublishedAt)%2Cstatistics(viewCount,likeCount,dislikeCount,commentCount)%2CcontentDetails(duration))&maxResults=10&key=AIzaSyAGzsds5MsbqG9Z10uhfkh0yVf9Rv9IO38&'; $.getJSON(staturl, function(yt) { for (var i in yt.items) { extra_stats[i] = yt.items[i]; } var playlist_divs = $('.yesp-playlist>.yesp-playlist-video').each( function( index, element ){ $(this).data("statistics", extra_stats[index].statistics ); var publishedAt = extra_stats[index].snippet.publishedAt; var viewCount = extra_stats[index].statistics.viewCount; var likeCount = extra_stats[index].statistics.likeCount; var dislikeCount = extra_stats[index].statistics.dislikeCount; var commentCount = extra_stats[index].statistics.commentCount; var duration = extra_stats[index].contentDetails.duration; var overlord = $(element).find("div.yesp-playlist-title").append('

 '+viewCount+' views'); }); }); },on_load: function(video) { var stats = $("div").find('div.yesp-playlist-video[data-index="'+video.position+'"]').data("statistics"); var videoId = video.resourceId.videoId; var title = video.title; var description = video.description; var publishedAt = moment(video.publishedAt).format('LL'); var viewCount = stats.viewCount; var likeCount = stats.likeCount; var dislikeCount = stats.dislikeCount; var commentCount = stats.commentCount; var eventUrl = '/videos/'+videoId var sharingUrl = document.location.protocol+'//'+document.domain+eventUrl; history.pushState(videoId, video, eventUrl); $('div#yt-subscribe').hide(); $('#addthis-sharing').attr('data-url',sharingUrl).attr('data-title',title); $('#yt-fb-comments').attr('data-href',sharingUrl); if(addthis.layers && typeof addthis.layers.refresh === 'function'){ addthis.layers.refresh(); }; try{ FB.XFBML.parse(); }catch(ex){}; $('#yt-video-title').html(title ); $('#yt-view-count').html( viewCount + ' Views' ); $('#yt-video-like').html( likeCount ); $('#yt-video-dislike').html( dislikeCount ); $('#yt-video-description').html( description ); showMoreCheck('#yt-toggle-more'); $('#yt-video-published').html( 'Published on ' + publishedAt ); $('[data-toggle="tooltip"]').tooltip(); } }); }