"use strict"; var sub = window.location.href.includes('dev') ? 'dev-support' : window.location.href.includes('www-') ? window.location.href.split('.')[0].split('//')[1].split('-')[1] : 'support'; var Cart = function Cart() { this.update(); }; Cart.prototype.add = function (product) { this.update(); }; Cart.prototype.remove = function () { this.update(); }; Cart.prototype.update = function () { var _self = this; $.ajax({ method: 'GET', url: 'https://' + sub + '.image-line.com/action/ajax/cart-portable?ts=' + new Date().getTime(), dataType: 'json', xhrFields: { withCredentials: true }, success: function success(result) { for (var resultProperty in result) { _self[resultProperty] = result[resultProperty]; } _self._populateBasket(); _self._attachBasket(); } }); }; Cart.prototype._attachBasket = function () { if (this && this.products) { var cartProducts = Object.keys(this.products); if (cartProducts.length) { var trackBasket = function trackBasket(evt) { if ($(evt.target).closest('#btnCart').length || $(evt.target).closest('#cart').length) return; $('#cart').addClass('c-cart--hidden'); $(document).off('click', trackBasket); }; $('.c-header-shop__button.c-header-shop__button-cart').addClass('c-header-shop__button-cart--filled').append('' + cartProducts.length + '').off('click').click(function () { $('#profile-dropdown').hide(); $('#cart').toggleClass('c-cart--hidden'); $(document).on('click', trackBasket); }); } } }; Cart.prototype._populateBasket = function () { var basketItems = this.products, html = []; var domainName = sub + '.image-line.com'; for (var product in this.products) { html.push('
'); html.push('
'); html.push('
' + product + '
'); html.push('
' + this.products[product] + '
'); html.push('
'); if (this.bundles != null && this.bundles.hasOwnProperty(product)) { html.push('
' + this.bundles[product] + '
'); } if (this.discounts != null && this.discounts.hasOwnProperty(product)) { html.push('
'); html.push('' + this.discounts[product].full_price + ''); html.push(''); html.push('
'); } html.push('
'); } if (this.subtotal !== null) { html.push('
'); html.push('Subtotal' + this.subtotal + ''); html.push('
'); } if (this.coupons != null && Object.keys(this.coupons).length > 0) { for (var coupon in this.coupons) { html.push('
'); html.push('Coupon ' + coupon + ' ' + this.coupons[coupon].discount + '' + this.coupons[coupon].text + ''); html.push('
'); } } if (this.vat !== null) { html.push('
'); html.push('' + this.vat.label + ' ' + this.vat.value + '' + this.vat.text + ''); html.push('
'); } html.push('
'); html.push('Total' + this.total + ''); html.push('
'); html.push('
'); html.push('Edit shopping basket'); html.push('Continue to checkout'); html.push('
'); $('.c-cart__wrapper').append('
'); $('#basket-content').html(html.join('')); $('#basket').trigger('basket-content-ready'); }; jQuery(document).ready(function ($) { function pushDataToDatalayer(status) { var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var userId = ""; if (data) { userId = data.id; } window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'userID': userId, 'userStatus': status }); } function setLoginUrlInNav(data) { var loginUrl = data.signin_url, username = ''; if (data.signedin) { username = data.name; username = username.split(' '); var fname = username[0]; var lname = username.splice(1); lname = lname.join(' '); loginUrl = data.profile_url; } $('#btnLogin').attr('href', loginUrl); if (username !== '') { $('#btnLoginName').removeClass('d-none').html('' + fname + '' + ' ' + lname); $('#btnLoginName').on('click', function () { $('#cart').addClass('c-cart--hidden'); $('#profile-dropdown').toggle(); }); $('#btnLogout').removeClass('d-none'); } else { $('#btnLoginText').removeClass('d-none'); $('#btnLogout').addClass('d-none'); } } function changeTryForFreeContent(data) { // Change Try for free copy if (data.signedin) { $('.js-try-for-free-wrapper a, .js-try-for-free').attr('href', '/fl-studio-download/').removeClass('btn--icon btn--download').html('Download'); } } function changeBuyNowContent(data) { // Change BuyNow copy if (data.signedin) { $('.js-buy-now-wrapper a, .js-buy-now').attr('href', 'https://' + sub + '.image-line.com/jshop/shop.php').removeClass('btn--icon btn--download').html('Upgrade'); } } function setCartContent(data) { return new Cart(); var itemCount, cartUrl, cartTotal, cartCurrency; //if (data.signedin) { itemCount = data.cart_items_count; cartUrl = data.cart_url; if (itemCount !== null) { $('#btnCart').attr('data-price', itemCount).removeAttr('disabled').addClass('c-header-shop__button-cart--filled'); } $('#cartCheckout').attr('href', cartUrl); $('#cartChange').attr('href', cartUrl); cartTotal = data.cart_total; cartTotal = parseFloat(cartTotal); cartCurrency = data.cart_currency; //cartCurrency = 'USD'; if (cartCurrency !== 'EUR') { cartTotal = cartTotal / data.forex_rate; } $('#cartTotal').html(cartTotal.toFixed(2) + ' ' + cartCurrency); $.each(data.cart_items, function (key, item) { var price = item.price; if (cartCurrency !== 'EUR') { price = item.price_usd; } $('#cartItems').append('
  • ' + item.name + '' + price + ' ' + cartCurrency + '
  • '); }); //} } // TODO: this should be removed function checkOwnedProducts(data) { var ownedProducts = []; $.each(data.owned, function (key, item) { ownedProducts.push(item.product_sid); }); $.each($('.c-product__wrapper, .js-download-button-wrapper'), function (index, element) { var productId = $(this).data('product-sid'); var footer = $(this).find('.c-product__footer'); if ($.inArray(productId, ownedProducts) !== -1) { footer.find('.c-product__price').remove(); footer.find('.btn-primary').remove(); footer.parents('.c-product').addClass('c-product--owned'); var downloadBtn = footer.find('.btn-outline-primary'), downloadUrl = downloadBtn.attr('href'), prodDownloadUrl = downloadUrl.replace('%prod%', productId); downloadBtn.attr('href', prodDownloadUrl); downloadBtn.show(); } else { footer.find('.btn-outline-primary').remove(); footer.parents('.c-product').addClass('c-product--not-owned'); } }); } function changeButtons(data) { var buttonWrapper = $(".js-download-button-wrapper"); var ownedProducts = []; $.each(data.owned, function (key, item) { ownedProducts.push(item.product_sid); }); var productId = buttonWrapper.data('product-sid'); if ($.inArray(productId, ownedProducts) !== -1) { buttonWrapper.find('.btn-primary').not('.btn-primary-free').remove(); $('.c-product__price').remove(); } else { buttonWrapper.find('.btn-outline-primary').remove(); } if (data.signedin == false) { $('.btn-primary-free').replaceWith('Free selection'); } } function checkPricing(data) { var currency = data.cart_currency; $.each($('.c-product__wrapper'), function (index, element) { var footer = $(this).find('.c-product__footer'); if (currency === 'EUR') { footer.find('[data-currency="USD"]').remove(); } else { footer.find('[data-currency="EUR"]').remove(); footer.find('[data-currency="USD"]').show(); } }); } function checkPricingSingle(data) { var currency = data.cart_currency; var header = $('.c-product__container').find('.c-product__header'); if (currency === 'EUR') { header.find('[data-currency="USD"]').remove(); } else { header.find('[data-currency="EUR"]').remove(); header.find('[data-currency="USD"]').show(); } } function checkWhyTryPricing(data) { var currency = data.cart_currency, eurField = $('#try_or_buy_price_eur'), usdField = $('#try_or_buy_price_usd'); if (currency === 'EUR') { usdField.remove(); } else { eurField.remove(); usdField.show(); } } /** TODO: check if this function is still being used **/ function checkEditionPricing(data) { var currency = data.cart_currency, eurField = $('.edition_price_eur'), usdField = $('.edition_price_usd'); if (currency === 'EUR') { usdField.remove(); } else { eurField.remove(); usdField.show(); } } function showOwnedFiltering(data) { $('#filter-owned').removeClass('d-none'); } function waitForCheckLoginRes() { if (typeof check_login_res !== 'undefined') { var accountInfo = check_login_res; // TURN ON ONLY FOR TESTING PURPOSES! // accountInfo.cart_currency = 'USD'; // console.table(accountInfo); if (accountInfo) { if (accountInfo.signedin) { pushDataToDatalayer('loggedOn', accountInfo); } else { pushDataToDatalayer('loggedOff'); } setLoginUrlInNav(accountInfo); setCartContent(accountInfo); changeTryForFreeContent(accountInfo); changeBuyNowContent(accountInfo); showOwnedFiltering(accountInfo); if (typeof $('.c-product__wrapper').data('product-sid') !== 'undefined') { checkPricing(accountInfo); // TODO: this should be removed // checkOwnedProducts(accountInfo); } // For content packs detail pages if (typeof $('.js-download-button-wrapper').data('product-sid') !== 'undefined') { changeButtons(accountInfo); checkPricingSingle(accountInfo); } if ($('.w-try-or-buy__availability').length > 0) { checkWhyTryPricing(accountInfo); } if ($('.c-edition__price').length > 0) { checkEditionPricing(accountInfo); } } else { console.log('check_login_res is undefined'); } } else { setTimeout(waitForCheckLoginRes, 250); } } function waitForCheckLoginFunction() { if (typeof il_check_login_cb !== 'undefined') { var loginScript = document.createElement('script'); loginScript.type = 'text/javascript'; loginScript.src = 'https://' + sub + '.image-line.com/api.php?call=check_login&callback=il_check_login_cb'; document.getElementsByTagName('head')[0].append(loginScript); waitForCheckLoginRes(); } /* else { setTimeout(waitForElement, 250); }*/ } waitForCheckLoginFunction(); // User sign out var signOutButton = document.querySelector('.js-user-sign-out'); if (signOutButton) { signOutButton.addEventListener('click', function (e) { pushDataToDatalayer('loggedOff'); }); } }); "use strict"; jQuery(document).ready(function ($) { function setVersionNumbers(data) { if (data) { // Set Windows variables $('#windows_version').html(data.pc.version); $('#windows_size').attr('data-title', data.pc.size + ' bytes').addClass('c-tooltip').html(data.pc.size_humans); $('#windows_checksum').attr('data-title', data.pc.checksum).addClass('c-tooltip'); // Set MacOS variables $('#macos_version').html(data.mac.version); $('#macos_size').attr('data-title', data.mac.size + ' bytes').addClass('c-tooltip').html(data.mac.size_humans); $('#macos_checksum').attr('data-title', data.mac.checksum).addClass('c-tooltip'); } } var versionInfo = typeof get_version_info_res !== 'undefined' ? get_version_info_res : false; if (versionInfo) { versionInfo = JSON.parse(versionInfo); var osInfo = versionInfo.prod[321]; setVersionNumbers(osInfo); } else { console.log('get_version_info_res is undefined'); } }); "use strict"; jQuery(document).ready(function ($) { var number_of_checkboxes; var plugin_owned = $('#plugin_owned'); var plugin_not_owned = $('#plugin_not_owned'); $('#filter_form').on('change', 'input[type=checkbox]', function (e) { e.preventDefault(); perform_search(); number_of_checkboxes = $('#filter_form input[type=checkbox]:checked').length; $('.c-btn-filter__number').html(number_of_checkboxes); if (number_of_checkboxes > 0) { $('.c-btn-filter__svg').removeClass('c-btn-filter__svg--show'); $('.c-btn-filter__number').addClass('c-btn-filter__number--show'); } else { $('.c-btn-filter__svg').addClass('c-btn-filter__svg--show'); $('.c-btn-filter__number').removeClass('c-btn-filter__number--show'); } }); /** * Sub filter */ var number_of_checkboxes_sub; $('#sub_filter_results').on('change', 'input[type=checkbox]', function (e) { e.preventDefault(); perform_search(); number_of_checkboxes_sub = $('#filter_form input[type=checkbox]:checked').length; $('.c-btn-filter__number').html(number_of_checkboxes_sub); if (number_of_checkboxes_sub > 0) { $('.c-btn-filter__svg').removeClass('c-btn-filter__svg--show'); $('.c-btn-filter__number').addClass('c-btn-filter__number--show'); } else { $('.c-btn-filter__svg').addClass('c-btn-filter__svg--show'); $('.c-btn-filter__number').removeClass('c-btn-filter__number--show'); } }); var number_of_checkboxes_top; $('#top_filter_form').on('change', 'input[type=radio]', function (e) { e.preventDefault(); perform_search_sub_filter(); number_of_checkboxes_top = $('#sub_filter_results #filter_form input[type=checkbox]:checked').length; $('.c-btn-filter__number').html(number_of_checkboxes_top); if (number_of_checkboxes_top > 0) { $('.c-btn-filter__svg').removeClass('c-btn-filter__svg--show'); $('.c-btn-filter__number').addClass('c-btn-filter__number--show'); } else { $('.c-btn-filter__svg').addClass('c-btn-filter__svg--show'); $('.c-btn-filter__number').removeClass('c-btn-filter__number--show'); } }); /** * Filter button */ $('.c-btn-filter').on('click', function () { $(this).toggleClass('c-btn-filter--active'); $('.c-filter__wrapper').toggleClass('c-filter__wrapper--open'); }); /** * Clear button */ $('#btn_clear_all').on('click', function (e) { e.preventDefault(); $('#filter_form input[type=checkbox]').each(function () { $(this).prop('checked', false); }); $('.c-btn-filter__svg').addClass('c-btn-filter__svg--show'); $('.c-btn-filter__number').removeClass('c-btn-filter__number--show'); perform_search(); }); /** * Distributor country filter */ $('#all_filter_results').on('change', '#country_filter_form input[type=checkbox]', function (e) { e.preventDefault(); $('#country_filter_form input[type=checkbox]').not(this).prop('checked', false); // Makes only one checkbox selectable if ($("#country_filter_form input[type=checkbox]:checked").length > 0) { // If one is checked, only execute the country filtering perform_search_country_filter(); } else { // If none are checked, execute the region filtering. This way only the countries from the region are shown again. perform_search_sub_filter(); } }); function perform_search() { var $form = $('#filter_form'); $.ajax({ type: 'POST', url: $form.attr('action'), data: $form.serialize(), success: function success(data) { // Show results $('#search_results').html(data); plugin_owned.prop('checked', false); plugin_not_owned.prop('checked', false); var accountInfo = typeof check_login_res !== 'undefined' ? check_login_res : false; if (accountInfo) { if (typeof $('.c-product__wrapper').data('product-sid') !== 'undefined') { checkOwnedProducts(accountInfo); } } }, error: function error(errormessage) { //do something else console.log('Oops: ' + JSON.stringify(errormessage)); } }); } function perform_search_sub_filter() { var $filterForm = $('#top_filter_form'); // For subfilter $.ajax({ type: 'POST', url: $filterForm.attr('action'), data: $filterForm.serialize(), success: function success(data) { // Show results $('#all_filter_results').html(data); $('#sub_filter_results').html(data); }, error: function error(errormessage) { //do something else console.log('Oops: ' + JSON.stringify(errormessage)); } }); } // Region (topfilter) to country search (trainers) function perform_search_region_to_country_filter() { var $filterForm = $('#top_filter_form'); $.ajax({ type: 'POST', url: $filterForm.attr('action'), data: $filterForm.serialize(), success: function success(data) { // Show results $('#search_results').html(data); // distributors countries within this region }, error: function error(errormessage) { //do something else console.log('Oops: ' + JSON.stringify(errormessage)); } }); } function checkOwnedProducts(data) { console.log("test"); var ownedProducts = []; $.each(data.owned, function (key, item) { ownedProducts.push(item.product_sid); }); $.each($('.c-product__wrapper'), function (index, element) { var productId = $(this).data('product-sid'); var footer = $(this).find('.c-product__footer'); if ($.inArray(productId, ownedProducts) !== -1) { footer.find('.c-product__price').remove(); footer.find('.btn-primary').remove(); footer.parents('.c-product').addClass('c-product--owned'); var downloadBtn = footer.find('.btn-outline-primary'), downloadUrl = downloadBtn.attr('href'), prodDownloadUrl = downloadUrl.replace('%prod%', productId); downloadBtn.attr('href', prodDownloadUrl); downloadBtn.show(); } else { footer.find('.btn-outline-primary').remove(); footer.parents('.c-product').addClass('c-product--not-owned'); } }); } function perform_search_country_filter() { var $countryForm = $('#country_filter_form'); $.ajax({ type: 'POST', url: $countryForm.attr('action'), data: $countryForm.serialize(), success: function success(data) { // Show results $('#search_results').html(data); }, error: function error(errormessage) { //do something else console.log('Oops: ' + JSON.stringify(errormessage)); } }); } }); "use strict"; var stopCurrentVideoPlaying = function stopCurrentVideoPlaying() { var iframe = $('.c-slider-wrap').find('iframe'); $('.c-video-poster').each(function () { $(this).removeClass('c-video-poster--hidden'); }); iframe.each(function () { $(this)[0].src = ''; }); }; var blockThumbnails = function blockThumbnails() { /** WORKAROUND WHEN SLIDERS ARE CLICKED BEFORE THE ANIMATION HAS ENDED **/ var coverDiv = document.createElement('DIV'); coverDiv.style.position = 'absolute'; coverDiv.style.width = '100%'; coverDiv.style.height = '100%'; coverDiv.style.top = '0'; coverDiv.style.zIndex = '4'; coverDiv.id = 'sliderCover'; document.querySelector('.slider-nav').appendChild(coverDiv); setTimeout(function () { return coverDiv.remove(); }, 3000); /** END WORKAROUND **/ }; "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } !function (e) { var n = !1; if ("function" == typeof define && define.amd && (define(e), n = !0), "object" == (typeof exports === "undefined" ? "undefined" : _typeof(exports)) && (module.exports = e(), n = !0), !n) { var o = window.Cookies, t = window.Cookies = e(); t.noConflict = function () { return window.Cookies = o, t; }; } }(function () { function e() { for (var e = 0, n = {}; e < arguments.length; e++) { var o = arguments[e]; for (var t in o) { n[t] = o[t]; } } return n; } function n(o) { function t(n, r, i) { var c; if ("undefined" != typeof document) { if (arguments.length > 1) { if ("number" == typeof (i = e({ path: "/" }, t.defaults, i)).expires) { var a = new Date(); a.setMilliseconds(a.getMilliseconds() + 864e5 * i.expires), i.expires = a; } i.expires = i.expires ? i.expires.toUTCString() : ""; try { /^[\{\[]/.test(c = JSON.stringify(r)) && (r = c); } catch (e) {} r = o.write ? o.write(r, n) : encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), n = (n = (n = encodeURIComponent(String(n))).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)).replace(/[\(\)]/g, escape); var s = ""; for (var f in i) { i[f] && (s += "; " + f, !0 !== i[f] && (s += "=" + i[f])); } return document.cookie = n + "=" + r + s; } n || (c = {}); for (var p = document.cookie ? document.cookie.split("; ") : [], d = /(%[0-9A-Z]{2})+/g, u = 0; u < p.length; u++) { var l = p[u].split("="), C = l.slice(1).join("="); this.json || '"' !== C.charAt(0) || (C = C.slice(1, -1)); try { var g = l[0].replace(d, decodeURIComponent); if (C = o.read ? o.read(C, g) : o(C, g) || C.replace(d, decodeURIComponent), this.json) try { C = JSON.parse(C); } catch (e) {} if (n === g) { c = C; break; } n || (c[g] = C); } catch (e) {} } return c; } } return t.set = t, t.get = function (e) { return t.call(t, e); }, t.getJSON = function () { return t.apply({ json: !0 }, [].slice.call(arguments)); }, t.defaults = {}, t.remove = function (n, o) { t(n, "", e(o, { expires: -1 })); }, t.withConverter = n, t; } return n(function () {}); }); "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /*! Lity - v2.3.1 - 2018-04-20 * http://sorgalla.com/lity/ * Copyright (c) 2015-2018 Jan Sorgalla; Licensed MIT */ !function (a, b) { "function" == typeof define && define.amd ? define(["jquery"], function (c) { return b(a, c); }) : "object" == (typeof module === "undefined" ? "undefined" : _typeof(module)) && "object" == _typeof(module.exports) ? module.exports = b(a, require("jquery")) : a.lity = b(a, a.jQuery || a.Zepto); }("undefined" != typeof window ? window : void 0, function (a, b) { "use strict"; function c(a) { var b = B(); return N && a.length ? (a.one(N, b.resolve), setTimeout(b.resolve, 500)) : b.resolve(), b.promise(); } function d(a, c, d) { if (1 === arguments.length) return b.extend({}, a); if ("string" == typeof c) { if (void 0 === d) return void 0 === a[c] ? null : a[c]; a[c] = d; } else b.extend(a, c); return this; } function e(a) { for (var b, c = decodeURI(a.split("#")[0]).split("&"), d = {}, e = 0, f = c.length; e < f; e++) { c[e] && (b = c[e].split("="), d[b[0]] = b[1]); } return d; } function f(a, c) { return a + (a.indexOf("?") > -1 ? "&" : "?") + b.param(c); } function g(a, b) { var c = a.indexOf("#"); return -1 === c ? b : (c > 0 && (a = a.substr(c)), b + a); } function h(a) { return b('').append(a); } function i(a, c) { var d = c.opener() && c.opener().data("lity-desc") || "Image with no description", e = b('' + d + ''), f = B(), g = function g() { f.reject(h("Failed loading image")); }; return e.on("load", function () { if (0 === this.naturalWidth) return g(); f.resolve(e); }).on("error", g), f.promise(); } function j(a, c) { var d, e, f; try { d = b(a); } catch (a) { return !1; } return !!d.length && (e = b(''), f = d.hasClass("lity-hide"), c.element().one("lity:remove", function () { e.before(d).remove(), f && !d.closest(".lity-content").length && d.addClass("lity-hide"); }), d.removeClass("lity-hide").after(e)); } function k(a) { var c = J.exec(a); return !!c && o(g(a, f("https://www.youtube" + (c[2] || "") + ".com/embed/" + c[4], b.extend({ autoplay: 1 }, e(c[5] || ""))))); } function l(a) { var c = K.exec(a); return !!c && o(g(a, f("https://player.vimeo.com/video/" + c[3], b.extend({ autoplay: 1 }, e(c[4] || ""))))); } function m(a) { var c = M.exec(a); return !!c && (0 !== a.indexOf("http") && (a = "https:" + a), o(g(a, f("https://www.facebook.com/plugins/video.php?href=" + a, b.extend({ autoplay: 1 }, e(c[4] || "")))))); } function n(a) { var b = L.exec(a); return !!b && o(g(a, f("https://www.google." + b[3] + "/maps?" + b[6], { output: b[6].indexOf("layer=c") > 0 ? "svembed" : "embed" }))); } function o(a) { return '