PageSourceSearch

https://www.arbon.ch/public/templates/1/346-BsDropdownController.js

js arbon.ch collected 2026-10-02 11:43:20 UTC 4,214 bytes, 9 lines download raw bytes

1function BsDropdownController(e,f){this.config={toolbarBackground:".js-BsDropdownController-bg",typeConfig:[{type:"mobilenav",hasBackground:!0,skiplinkToModify:'a[href="#mainnav"]'},{type:"search",hasBackground:!0,skiplinkToModify:'a[href="#search-input"]'},{type:"dropdown",hasBackground:!0}]};this.dropdownItems=[];this.backgroundAdded=this.backgroundVisible=!1;this.init=function(a,b){if(b)for(var c in b)this.config[c]=b[c];if(a){for(b=0;b<a.length;b++){c=a[b];for(let d=0;d<this.config.typeConfig.length;d++)this.config.typeConfig[d].type===
2c.type&&(c.typeConfig=this.config.typeConfig[d]);this.dropdownItems.push(c)}this.addDOMElements();this.addEventHandler();this.modifySkiplinks()}};this.addDOMElements=function(){for(let a=0;a<this.dropdownItems.length;a++)this.dropdownItems[a].typeConfig.hasBackground&&!this.backgroundAdded&&($("body").append('<div class="'+this.config.toolbarBackground.slice(1)+'"></div>'),this.backgroundAdded=!0,$(this.config.toolbarBackground).on("click",function(){this.hideAllDropdowns()}.bind(this)))};this.addEventHandler=
3function(){for(let a=0;a<this.dropdownItems.length;a++){const b=a;$(this.dropdownItems[a].btn).on("click",function(){this.toggleContent(b)}.bind(this))}};this.modifySkiplinks=function(){let a,b;for(let c=0;c<this.dropdownItems.length;c++){const d=this.dropdownItems[c].type;d==="mobilenav"&&(a=this.dropdownItems[c]);d==="search"&&(b=this.dropdownItems[c])}if(a)$(a.typeConfig.skiplinkToModify).on("click",function(c){if(this.isElementVisible(a.btn))return c.preventDefault(),$(a.btn).click(),$(a.content).find("li:first-child>a").focus(),
4!1}.bind(this));if(b)$(b.typeConfig.skiplinkToModify).on("click",function(c){this.isElementVisible(b.content)||$(b.btn).click()}.bind(this))};this.updateView=function(){for(let a=0;a<this.dropdownItems.length;a++){const b=this.dropdownItems[a],c=a;b.visible?($(b.content).slideDown(200),$(b.btn).addClass("active").attr("aria-expanded","true"),$("html").addClass("js-"+b.type+"-active"),$(b.btn+", "+b.content).on("keydown",function(d){if(d.key==="Escape")return this.hideAllDropdowns(),$(this.dropdownItems[c].btn).focus(),
5!1;if(!d.shiftKey&&d.key==="Tab"&&d.target===this.getLastFocusableElement(this.dropdownItems[c].content))return d.preventDefault(),$(this.dropdownItems[c].btn).focus(),!1;if(d.shiftKey&&d.key==="Tab"&&$(d.target).hasClass(this.dropdownItems[c].btn.substring(1))&&$(this.dropdownItems[c].content).is(":visible"))return d.preventDefault(),this.getLastFocusableElement(this.dropdownItems[c].content).focus(),!1}.bind(this)),b.typeConfig.hasBackground||$(b.btn+", "+b.content).focusout(function(d){const g=
6document.querySelector(b.content),h=document.querySelector(b.btn);$.contains(g,d.relatedTarget)||h===d.relatedTarget||this.hideAllDropdowns()}.bind(this)),b.typeConfig.type==="search"&&$(b.content).find("input[type=search]").focus()):($(b.content).slideUp(200),$(b.btn).removeClass("active").attr("aria-expanded","false"),$("html").removeClass("js-"+b.type+"-active"))}};this.toggleContent=function(a){const b=this.getIndexArrayOfNotClickedItems(a);for(let c=0;c<b.length;c++)this.setVisibleState(b[c],
7!1);this.toggleVisibleState(a);
7this.toggleBackground();this.updateView()};this.getIndexArrayOfNotClickedItems=function(a){let b=[];for(let c=0;c<this.dropdownItems.length;c++)c!==a&&b.push(c);return b};this.hideAllDropdowns=function(){for(let a=0;a<this.dropdownItems.length;a++)this.setVisibleState(a,!1);this.updateView();this.backgroundVisible=!1;this.toggleBackground()};this.isElementVisible=function(a){return $(a).is(":visible")};this.setVisibleState=function(a,b){this.dropdownItems[a].visible=
8b};this.toggleVisibleState=function(a){this.dropdownItems[a].visible=!this.dropdownItems[a].visible;this.dropdownItems[a].typeConfig.hasBackground&&(this.backgroundVisible=this.dropdownItems[a].visible)};this.toggleBackground=function(){this.backgroundVisible?$(this.config.toolbarBackground).fadeIn(200):$(this.config.toolbarBackground).fadeOut(200)};this.getLastFocusableElement=function(a){a=document.querySelector(a).querySelectorAll('a, button, input:not([type="hidden"], textarea, select, details, [tabindex]:not([tabindex="-1"])');
9return a[a.length-1]};this.init(e,f)};

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.