PageSourceSearch

https://apero-genusskultur.de/static_assets/alien/option_selection.js

js apero-genusskultur.de collected 2026-10-09 02:49:05 UTC 7,076 bytes, 2 lines download raw bytes

1/*! alien-js 0.2.2 */
2!function(){"use strict";var a=function(a){void 0!==a&&null!==a&&this.update(a)},b={update:function(a){jQuery.extend(this,a)},optionNames:function(){var a=this.options;return a instanceof Array?a:[]},optionValues:function(a){var b=this.variants;if(!b)return null;for(var c=[],d=0;d<b.length;d++){var e=b[d],f=e["option"+(a+1).toString()]||null;-1==c.indexOf(f)&&c.push(f)}return null===c[0]?null:c},getVariant:function(a){if(a.length!==this.options.length)return null;for(var b=this.variants,c=0;c<b.length;c++){for(var d=b[c],e=!1,f=0;f<a.length;f++){if(d["option"+(f+1).toString()]!=a[f]){e=!1;break}e=!0}if(!0===e)return d}return null},getVariantById:function(a){for(var b=this.variants,c=0;c<b.length;c++)if(b[c].id==a)return b[c]}};for(var c in b)a.prototype[c]=b[c];var d=function(a,b,c,d){this.multiSelector=a,this.index=b,this.values=d,this.name=c;var e=jQuery("<select />").addClass(a.selectorClass).attr("data-option","option"+(b+1)).attr("id",a.domIdPrefix+"-option-"+b);return jQuery.each(d,function(a,b){var c=jQuery("<option/>").attr("value",b).html(b);e.append(c)}),this.element=e[0],this.element.onchange=function(c){a.updateSelectors(b,c||{})},!0},e=function(b,c){this.domIdPrefix=b,this.product=new a(c.product),this.selectors=[],this.selectorClass="single-option-selector",this.selectorDivClass="selector-wrapper",this.variantIdFieldIdSuffix="-variant-id",this.variantIdField=null,c=jQuery.extend({},{enableHistoryState:!1,onVariantSelected:function(){}},c),this.onVariantSelected=c.onVariantSelected,this.replaceSelector(b),this.initDropdown(),c.enableHistoryState?this.historyState=new Shopify.OptionSelectors.HistoryState(this):this.historyState=null},f={replaceSelector:function(a){var b=jQuery("#"+a);b.hide(),this.variantIdField=b[0];var c=(b.parent(),this.buildSelectors());jQuery.each(c,function(a,c){c.insertBefore(b)})},buildSelectors:function(){var a=this.product.optionNames(),b=this;jQuery.each(a,function(a,c){var d=new Shopify.SingleOptionSelector(b,a,c,b.product.optionValues(a));b.selectors.push(d)});var c=this.selectorDivClass,d=this.selectors,e=[];return jQuery.each(d,function(b,d){var f=jQuery(d.element),g=jQuery("<div/>").attr("class",c);if(a.length>1){var h=jQuery("<label/>").attr("for",f.attr("id")).html(d.name);g.append(h)}g.append(f),e.push(g)}),e},initDropdown:function(){var a={initialLoad:!1};if(!this.selectVariantFromDropdown(a)){var b=this;setTimeout(function(){return b.selectVariantFromParams(a)||b.fireOnChangeForFirstDropdown.call(b,a)})}},selectVariantFromParamsOrDropdown:function(a){return this.selectVariantFromParams(a)||this.selectVariantFromDropdown(a)},selectVariantFromParams:function(a){var b=window.location.search,c=new RegExp("[?|&]variant=([^&]+)"),d=c.exec(b);return d=null===d?null:decodeURIComponent(d[1]),this.selectVariant(d,a)},selectVariantFromDropdown:function(a){var b=this.domIdPrefix,c=document.getElementById(b).querySelector("[selected]");if(c){var d=c.value;return this.selectVariant(d,a)}return!1},selectVariant:function(a,b){var c=this.product.getVariantById(a);if(!c)return!1;var d=this;return jQuery.each(this.selectors,function(a,b){var e=b.element,f=e.getAttribute("data-option"),g=c[f];null!==g&&d.optionExistInSelect(e,g)&&(e.value=g)}),this.selectors[0].element.onchange(b),!0},optionExistInSelect:function(a,b){for(var c=0;c<a.options.length;c++){if(a.options[c].value===b)return!0}}
2,fireOnChangeForFirstDropdown:function(a){this.selectors[0].element.onchange(a)},selectedValues:function(){for(var a=[],b=0;b<this.selectors.length;b++){var c=this.selectors[b].element.value;a.push(c)}return a},updateSelectors:function(a,b){var c=this.selectedValues(),d=this.product.getVariant(c);d?(this.variantIdField.disabled=!1,this.variantIdField.value=d.id):this.variantIdField.disabled=!0,this.onVariantSelected(d,this,b),null!==this.historyState&&void 0!==this.historyState&&this.historyState.onVariantChange(d,this,b)}};for(var c in f)e.prototype[c]=f[c];var g=function(a){this.browserSupports()&&this.register(a)},h={register:function(a){jQuery(window).on("popstate",function(){a.selectVariantFromParamsOrDropdown({popStateCall:!0})})},onVariantChange:function(a,b,c){this.browserSupports()&&a&&!c.initialLoad&&!c.popStateCall&&window.history.replaceState({},document.title,"?variant="+a.id)},browserSupports:function(){return window.history&&window.history.pushState}};for(var c in h)g.prototype[c]=h[c];e.HistoryState=g;var i={preload:function(a,b){var c=this;jQuery.each(a,function(a,d){c.loadImage(c.getSizedImageUrl(d,b))})},loadImage:function(a){(new window.Image).src=a},switchImage:function(a,b,c){if(a&&b){var d=this.imageSize(b.src),e=this.getSizedImageUrl(a.src,d);c?c(e,a,b):b.src=e}},imageSize:function(a){var b=new RegExp(/\/resize=(.+?)\//),c=b.exec(a);return null===c?null:c[1]},getSizedImageUrl:function(a,b){if(!b)return a;var c=new RegExp(/^(https?:)?\/\/img.versacommerce.io\/((.*)\/){0,1}\+\+\/(.+)/),d=c.exec(a),e=null===d?this._simpleHash(a,4):d[2],f=null===d?"":d[3]||"",g=null===d?a:d[4];return"master"==b?g:(f=jQuery.map(f.split("/"),function(a,c){return a.match(/^resize=/)?"resize="+b+(f.match(/canvas=/)?"":"/canvas=0"):a}).join("/"),f.match(/resize=/)||(f+=(f.length>0?"/":"")+"resize="+b),f.match(/canvas=/)||(f+=(f.length>0?"/":"")+"canvas=0"),"//img.versacommerce.io/"+f+"/++/"+g.replace(/^(https?:)?\/\//,""))},_simpleHash:function(a,b){for(var c=1,d=0;d<a.length;d++)c+=a.charCodeAt(d);return c%b+1}},j={Product:a,Image:i,OptionSelectors:e,SingleOptionSelector:d,money_format:"{{amount}} EUR",formatMoney:function(a,b){return b="string"!=typeof b?this.money_format:b,a=(parseFloat(a)||0)/100,b.replace(/\{\{\s*([A-Za-z_]+)\s*\}\}/,function(b,c){var d=function(a){return a.replace(/\B(?=(\d{3})+(?!\d))/g,",")};switch(c){case"amount":return a.toFixed(2);case"amount_no_decimals":return a.toFixed(0);case"amount_with_comma_separator":return d(a.toFixed(2),",");case"amount_no_decimals_with_comma_separator":return d(a.toFixed(0))}})},each:function(a,b){jQuery.each(a,function(a,c){b(c,a)})},map:function(a,b){return jQuery.map(a,b)},arrayIncludes:function(a,b){return-1!==jQuery.inArray(b,a)},uniq:function(a){return jQuery.grep(a,function(b,c){return jQuery.inArray(b,a)==c})},isDefined:function(a){return void 0!==a},locationSearch:function(){return window.location.search},locationHash:function(){return window.location.hash},replaceState:function(a){window.history.replaceState({},document.title,a)},urlParam:function(a){var b=RegExp("[?&]"+a+"=([^&#]*)"),c=b.exec(this.locationSearch());if(c){var d=c[1].replace(/\+/g," ");return decodeURIComponent(d)}},newState:function(a,b){var c;if(this.urlParam(a)){var d=RegExp("("+a+"=)[^&#]+");c=this.locationSearch().replace(d,"$1"+b)}else c=Shopify.locationSearch(),c+=""===c?"?":"&",c+=[a,b].join("=");return c+Shopify.locationHash()},setParam:function(a,b){this.replaceState(this.newState(a,b))},_overwrite:function(){void 0===window.Shopify&&(window.Shopify={});for(var a in j)j.hasOwnProperty(a)&&!window.Shopify.hasOwnProperty(a)&&(window.Shopify[a]=j[a])}};j._overwrite()}();

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.