PageSourceSearch

https://art-a-porter.com/Themes/AAP/Scripts/main.js

js art-a-porter.com collected 2026-09-28 15:22:50 UTC 17,681 bytes, 152 lines download raw bytes

1var __lc = {}; __lc.license = 6381151; (function () { var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true; lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s); })(); $.validator.unobtrusive.adapters.addBool("mustbetrue", "required"); if (!String.prototype.format) { String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; }
2$.validator.addMethod('requiredif', function (value, element, parameters) { var id = '#' + element.id.replace("StateProvinceId", parameters['dependentproperty']); var valEle = $(element); var selected = valEle.val() == "0" ? "" : valEle.val(); var control = $(id); return !(control.val() && (valEle.children().length > 1) && !selected); }); $.validator.unobtrusive.adapters.add('requiredif', ['dependentproperty'], function (options) { options.rules['requiredif'] = { dependentproperty: options.params['dependentproperty'] }; options.messages['requiredif'] = options.message; }); var isMobile = { Android: function () { return navigator.userAgent.match(/Android/i); }, BlackBerry: function () { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function () { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function () { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function () { return navigator.userAgent.match(/IEMobile/i); }, any: function () { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; function appendQueryString(url, queryVars) {
3    var firstSeperator = (url.indexOf('?') == -1 ? '?' : '&'); var queryStringParts = new Array(); for (var key in queryVars) { queryStringParts.push(key + '=' + queryVars[key]); }
4    var queryString = queryStringParts.join('&'); return url + firstSeperator + queryString;
5}
6$(function () {
7    $('.toggle-menu').jPushMenu({ closeOnClickLink: false }); $('#mobile-navbar-collapse-1').on('click', 'li.content-push-left', function (e) {
8        var self = $(this); var parent_container = $('#left-menu-container'); var directUl = self.find('> ul').clone(); var currentLeft = parent_container.find('> ul:first-child').css('left'); directUl.css({ left: parseInt(currentLeft) - 260 + 'px' })
9        parent_container.prepend(directUl.removeClass('hide').addClass('mob-sub-menu')); parent_container.animate({ left: "+=260" }, 200); e.stopPropagation();
10    }); $('#mobile-navbar-collapse-1').on('click', 'li.mobile-breadcrumb', function (e) { var self = $(this); var parent_container = $('#left-menu-container'); parent_container.animate({ left: "-=260" }, 200, function () { self.closest('ul.nav').remove(); }); e.stopPropagation(); }); $('a[data-toggle="div"]').click(function () {
11        var self = $(this); var target = $(self.data('target')); var source = $(self.data('source')); if (target.length > 0) { target.toggle(); }
12        if (source.length > 0) { source.toggle(); }
13    }); var page_history = {
14        elem: { obj: null, event: null }, set_action: function (elem, event) { this.elem.obj = elem; this.elem.event = event; }, exec: function () {
15            if (this.elem.obj == null) { return; }
16            if (this.elem.event == null) { return; }
17            switch (this.elem.event.target.nodeName) {
18                case 'A': var href = $(this.elem.obj).attr('href'); if (href != '#' && href.indexOf('javascript') == -1) { window.location = this.elem.event.target.href; break; }
19                default: location.reload();
20            }
21        }
22    }; $(document).ready(function () {
23        $('#signupDlg').on("show.bs.modal", function () { $('.jPushMenuBtn,body,.cbp-spmenu').removeClass('disabled active cbp-spmenu-open cbp-spmenu-push-toleft cbp-spmenu-push-toright menu-active'); $('#signupDlg').find("#SignupEmail").val(""); })
24        $('#loginDlg').on("shown.bs.modal", function () { $('#loginDlg').find("#Password").focus(); })
25        $('#signupDlg').on("shown.bs.modal", function () { $('#signupDlg').find("#SignupEmail").focus(); })
26        $(document).on("submit", "#loginFrm", function () {
27            var self = $(this); if (self.valid()) { var ajaxLoading = MaskElement(self.closest(".modal-content")); $.post("/ajaxLogin", self.serialize(), function (response) { if (response.Error) { var summaryErrZone = self.find('.validation-summary-errors'); summaryErrZone.html(response.Msg); summaryErrZone.removeClass('hide'); ajaxLoading.remove(); } else { page_history.exec(); } }) }
28            return false;
29        }); $('body').on('click', '.require-login-popup', function (e) { page_history.set_action(this, e); e.preventDefault(); $('#signupDlg').modal("show"); return false; }); $('body').on('click', '.require-login-popup .not-require-login-popup', function (e) { e.stopPropagation(); }); $('#signup-form').submit(function () {
30            var self = $(this); if (self.valid()) {
31                var ajaxLoading = MaskElement(self.closest(".modal-content")); $.post("/ajaxSignup", self.serialize(), function (response) {
32                    $('.login-modal-dlg').modal('hide'); if (response.IsRegistedEmail) { $('#loginDlg').find('#Email').val(response.Email); $('#loginDlg').modal('show'); $.validator.unobtrusive.parse($('#loginDlg').find('form')); } else { $('#confirmEmailDgl').find('#ConfirmEmail').val(response.Email).trigger("change"); $('#confirmEmailDgl').find('#ReConfirmEmail').val(""); $('#confirmEmailDgl').modal('show'); $.validator.unobtrusive.parse($('#confirmEmailDgl').find('form')); }
33                    ajaxLoading.remove();
34                })
35            }
36            return false;
37        }); $(document).on("submit", "#confirmEmailFrm", function () {
38            var self = $(this); if (self.valid()) {
39                var ajaxLoading = MaskElement(self.closest(".modal-content")); $.post("/ajaxConfirmEmail", self.serialize(), function (response) {
40                    if (!response.Success) { if (response.IsRegistedEmail != undefined && response.IsRegistedEmail == true) { $('.login-modal-dlg').modal('hide'); $('#loginDlg').find('#Email').val(response.Email); $('#loginDlg').modal('show'); $.validator.unobtrusive.parse($('#loginDlg').find('form')); } else { var summaryErrZone = self.find('.validation-summary-errors'); var error = response.Errors; summaryErrZone.empty(); $.each(response.Errors, function (index, val) { summaryErrZone.append('<p>' + val + '</p>'); }); summaryErrZone.removeClass('hide'); } } else { $('body').append(response.CompleteRegistrationScript); $('.login-modal-dlg').modal('hide'); $('#notificationDlg .modal-content .message').html(response.Msg); self[0].reset(); $('#notificationDlg').modal("show"); $('#notificationDlg').on('hide.bs.modal', function () { page_history.exec(); }); }
41                    ajaxLoading.remove();
42                })
43            }
44            return false;
45        })
46        $('body').on('click', '.change-email-btn', function () { $('#confirmEmailFrm input[type="text"]').val(""); })
47        $('body').on('click', '.already-collector-btn', function () { $('.login-modal-dlg').modal('hide'); $('#loginDlg').find("#Email").val(""); $('#loginDlg').find("#Password").val(""); $('#loginDlg').modal('show'); $.validator.unobtrusive.parse($('#loginDlg').find('form')); })
48        $('body').on('click', '.forgot-password-btn', function () { $('.login-modal-dlg').modal('hide'); $('#forgotPasswordDlg').find("#Email").val($('#loginDlg').find("#Email").val()); $('#forgotPasswordDlg').modal('show'); })
49        $('#forgotPasswordFrm').submit(function () {
50            var self = $(this); if (self.valid()) {
51                var ajaxLoading = MaskElement(self.closest(".modal-content")); $.post("/passwordRecoverySend", self.serialize(), function (response) {
52                    if (response.Success) { $('.login-modal-dlg').modal('hide'); $('#loginDlg').find('#Email').val(response.Email); $('#loginDlg').modal('show'); $.validator.unobtrusive.parse($('#loginDlg').find('form')); $('.login-welcome-back').addClass('hidden'); $('.login-new-password').removeClass('hidden'); } else { var summaryErrZone = self.find('.validation-summary-errors'); var error = response.Errors; summaryErrZone.empty(); $.each(response.Errors, function (index, val) { summaryErrZone.append('<p>' + val + '</p>'); }); summaryErrZone.removeClass('hide'); }
53                    ajaxLoading.remove();
54                })
55            }
56            return false;
57        }); $('#signupDlg').on("hide.bs.modal", function () { $('.login-welcome-back').removeClass('hidden'); $('.login-new-password').addClass('hidden'); })
58    }); $('.search-product-link').click(function () { $('.search-product-dropdown:not(.open)').fadeIn(200).removeClass('hide'); $('.search-product-keyword').focus(); }); $('body').click(function () { $('.search-product-dropdown:not(.open)').fadeOut(200); }); $('.search-product-dropdown, .search-product-link').click(function () { event.stopPropagation(); });
59    $('.search-product-dropdown .cross-icon').click(function () {
60        $('.search-product-keyword').val('');
61        var searchProduct = $('.search-product-dropdown');
62        searchProduct.removeClass('open');
63        searchProduct.addClass('hide');
64        //if (window.location.pathname.match("search")) {
65        //    window.history.back();
66        //    $('.search-product-keyword').val('');
67        //}
68    });
69    $('.mob-search').click(function () {
70        var self = $(this); if (self.hasClass("mob-input-open")) { return false; }
71        var parent = $(this).closest('div'); parent.nextAll('.mob-tobehide').removeClass('visible-xs-block').fadeOut(200).promise().done(function () { parent.next().removeClass('hide').find('form').animate({ "width": "33%" }, 200, function () { self.addClass("mob-input-open"); $('.search-product-keyword-mob').focus(); }); });
72    }); $('.search-product-keyword-mob').blur(function () { var self = $(this); var parentDiv = $(this).closest('div'); var parent = $(this).closest('form'); parent.animate({ "width": "0px" }, 200, function () { parentDiv.nextAll('.mob-tobehide').fadeIn(200).addClass('visible-xs-block hide'); $('.mob-search').removeClass("mob-input-open"); parentDiv.addClass('hide'); }); });
73}); function getScrollLimit() {
74    if ($('.fixed-sub-menu').attr("style").match("absolute")) {
75        $('.fixed-sub-menu').attr("style", "left:20px;z-index: 800; position: absolute;top: 100px;margin - left: 0px;width: 159px;");
76    }
77    if ($('.recently-viewed-products-wrapper').length > 0) { return $('.recently-viewed-products-wrapper').offset().top - $('.fixed-sub-menu').outerHeight(true) - 30; }
78    else if ($('.artist-details-arts').length > 0) { return $('.artist-details-arts').offset().top - $('.fixed-sub-menu').outerHeight(true); }
79    else if ($('.exhibition-controls-blackBtn').length > 0) { return $('.exhibition-controls-blackBtn').offset().top - $('.fixed-sub-menu').outerHeight(true); }
80    else { return $('#footer').offset().top - $('.fixed-sub-menu').outerHeight(true); 
81    }
82}
83function applyScrollToFixed() {
84    var marginTop = 100; if ($('.search-product-dropdown').hasClass('open')) { marginTop = 136; }
85    if ($('.artist-name-details').length) {
86        marginTop = 60;
87        if ($('#fixedTopBar').length) { marginTop += $('#fixedTopBar').outerHeight(true); }
88    }
89    $('.fixed-sub-menu').scrollToFixed({ marginTop: marginTop, limit: function () { return getScrollLimit(); } });
90}
91$(document).ready(function () { applyScrollToFixed(); }); function getUrlParameter(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } }
92$(document).ready(function () { if (getUrlParameter("orderby") != null || (getUrlParameter("sale") != null && getUrlParameter("sale") === "1")) { $('.sort-by-toggle a').click(); $('.sort-by-toggle-mob a').click(); }; }); $(document).ready(function () {
93    $('.normal-watch-list .artis-add-to-watch-list').click(function () {
94        var $this = $(this); var $wrapper = $this.closest('.product-image-wrapper')
95        var artistId = $wrapper.data('artistid'); $.ajax({ cache: false, type: 'POST', url: '/Artist/AddArtistToWatchList', data: { artistId: artistId }, dataType: 'json', success: function (data) { if (!data.Error) { $this.text(data.Text); } }, error: function (xhr, ajaxOptions, thrownError) { } }); return false;
96    });
97});
98
99$(document).ready(function () {
100    //shop
101    //$('.shop').click(function (e) {
102    //    //alert('clicked');
103    //    var $this = $(this).data('productid');
104    //    //var $wrapper = $this.closest('.artwork-item-wrapper')
105    //    var artworkId = $(this).data('productid');
106    //    var url = '/Portfolio/Shop?artworkId=' + artworkId;
107    //    alert("artwork id " + $(this).data('productid'));
108    //    $.ajax({
109    //        cache: false,
110    //        type: 'GET',
111    //        url: url,
112    //        success: function (response) {
113    //            console.log(response.url);
114    //            window.location = response.url;
115    //        },
116    //        error: function (xhr, ajaxOptions, thrownError) { }
117    //    });
118    //});
119    //    var serverVoting = function (artworkId, successCallback) { $.ajax({ cache: false, type: 'POST', url: '/Portfolio/Voting', data: { artworkId: artworkId }, dataType: 'json', success: function (data) { if (typeof successCallback === "function") { successCallback(data); } }, error: function (xhr, ajaxOptions, thrownError) { } }); }
120    //    $('.support-artwork:not(.require-login-popup)').click(function (e) {
121    //        if ($(e.target).hasClass('text-underline')) { }
122    //        else {
123    //            var $this = $(this); var $wrapper = $this.closest('.product-image-wrapper')
124    //            var artworkId = $wrapper.data('productid'); var $voteArtwork = $this.find('.vote-artwork'); serverVoting(artworkId, function (data) { if (!data.Error) { $voteArtwork.text(data.Text); if ($wrapper.hasClass('voted-artwork')) { $wrapper.removeClass('voted-artwork'); } else { $wrapper.addClass('voted-artwork') } } }); return false;
125    //        }
126    //    }); $('.vote-artwork-mob').click(function () {
127    //        var $this = $(this); var $wrapper = $this.closest('.artwork-item-wrapper')
128    //        var artworkId = $wrapper.data('productid'); serverVoting(artworkId, function (data) { if (!data.Error) { var icon = $this.find('i'); if (icon.hasClass('fa-minus')) { icon.removeClass('fa-minus').addClass('fa-plus'); } else { icon.removeClass('fa-plus').addClass('fa-minus'); } } }); return false;
129    //    });
130})
131$(document).ready(function () {
132    if ($('.recently-viewed-products-wrapper').length > 0) {
133        var ajaxLoading = LoadAjax($('.recently-viewed-products-wrapper')); $.ajax({
134            cache: false, type: 'GET', url: 'recentlyViewedProductsAjax', dataType: 'json', success: function (data) {
135                if (data.Success) { $('.recently-viewed-products-wrapper').html(data.Html); $(".recently-viewed-products-wrapper img.lazy-image").lazyLoadXT(); }
136                ajaxLoading.remove();
137            }, error: function (xhr, ajaxOptions, thrownError) { ajaxLoading.remove(); }
138        });
139    }
140}); $(document).ready(function () { $.extend($.lazyLoadXT, { scrollContainer: 'body' }); $('.main-images-mobile').slick({ centerMode: true, slidesToShow: 1, dots: true, arrows: true, centerPadding: '20%', initialSlide: -1 }); $('.main-images-mobile').slick('slickNext'); $('#zoom-image img').bind("load", function () { var self = $(this); self.next().fadeOut(); self.fadeIn(); }); var currentTop; $("body").on('click', '.main-product-img', function () { currentTop = $(window).scrollTop(); $('#zoom-image').fadeIn(0); var id = $(this).data('id'); var offsetTop = $('#zoom-image-' + id).offset().top; window.scrollTo(0, offsetTop) }); $('#zoom-image').click(function () { $('#zoom-image').fadeOut(0); $('body').css('overflow', ''); window.scrollTo(0, currentTop) }); }); $(window).load(function () {
141    function onYouTubeIframeAPIReady() {
142        var videos = $('iframe.youtube-video'), players = [], playingID = null; for (var i = 0; i < videos.length; i++) {
143            var currentIframeID = videos[i].id; players[currentIframeID] = new YT.Player(currentIframeID, { events: {} }); videos[i].onmouseover = function (e) {
144                if ($(window).width() < 960) { return false; }
145                var currentHoveredElement = e.target; players[currentHoveredElement.id].playVideo(); playingID = currentHoveredElement.id;
146            };
147        }
148    }
149    onYouTubeIframeAPIReady();
150}); $(document).on('show.bs.modal', function () { if ($(document).height() <= $(window).height()) { $('body').addClass("modal-open-noscroll"); } })
151$(document).on('hide.bs.modal', function () { $('body').removeClass("modal-open-noscroll"); })
152jQuery.fn.watch = function (id, fn) { return this.each(function () { var self = this; var oldVal = self[id]; $(self).data('watch_timer', setInterval(function () { if (self[id] !== oldVal) { fn.call(self, id, oldVal, self[id]); oldVal = self[id]; } }, 200)); }); return self; }; jQuery.fn.unwatch = function (id) { return this.each(function () { clearInterval($(this).data('watch_timer')); }); };

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.