PageSourceSearch

https://lybrae.nl/wp-content/cache/min/1/wp-content/themes/lybrae/…/checkbox_options.js?ver=1788429633

js lybrae.nl collected 2026-10-06 13:18:24 UTC 3,037 bytes, 10 lines download raw bytes

1(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory():typeof define==='function'&&define.amd?define(factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,global.checkbox_options=factory())})(this,(function(){'use strict';const hash_key=value=>{if(typeof value==='undefined'||value===null)return null;return get_hash(value)};const get_hash=value=>{if(typeof value==='boolean')return value?'1':'0';return value+''};const preventDefault=(evt,stop=!1)=>{if(evt){evt.preventDefault();if(stop){evt.stopPropagation()}}};const getDom=query=>{if(query.jquery){return query[0]}
2if(query instanceof HTMLElement){return query}
3if(isHtmlString(query)){var tpl=document.createElement('template');tpl.innerHTML=query.trim();return tpl.content.firstChild}
4return document.querySelector(query)};const isHtmlString=arg=>{if(typeof arg==='string'&&arg.indexOf('<')>-1){return!0}
5return!1};function plugin(userOptions){var self=this;var orig_onOptionSelect=self.onOptionSelect;self.settings.hideSelected=!1;const cbOptions=Object.assign({className:"tomselect-checkbox",checkedClassNames:undefined,uncheckedClassNames:undefined},userOptions);var UpdateChecked=function UpdateChecked(checkbox,toCheck){if(toCheck){checkbox.checked=!0;if(cbOptions.uncheckedClassNames){checkbox.classList.remove(...cbOptions.uncheckedClassNames)}
6if(cbOptions.checkedClassNames){checkbox.classList.add(...cbOptions.checkedClassNames)}}else{checkbox.checked=!1;if(cbOptions.checkedClassNames){checkbox.classList.remove(...cbOptions.checkedClassNames)}
7if(cbOptions.uncheckedClassNames){checkbox.classList.add(...cbOptions.uncheckedClassNames)}}};var UpdateCheckbox=function UpdateCheckbox(option){setTimeout(()=>{var checkbox=option.querySelector('input.'+cbOptions.className);if(checkbox instanceof HTMLInputElement){UpdateChecked(checkbox,option.classList.contains('selected'))}},1)};self.hook('after','setupTemplates',()=>{var orig_render_option=self.settings.render.option;self.settings.render.option=(data,escape_html)=>{var rendered=getDom(orig_render_option.call(self,data,escape_html));var checkbox=document.createElement('input');if(cbOptions.className){checkbox.classList.add(cbOptions.className)}
8checkbox.addEventListener('click',function(evt){preventDefault(evt)});checkbox.type='checkbox';
8const hashed=hash_key(data[self.settings.valueField]);UpdateChecked(checkbox,!!(hashed&&self.items.indexOf(hashed)>-1));rendered.prepend(checkbox);return rendered}});self.on('item_remove',value=>{var option=self.getOption(value);if(option){option.classList.remove('selected');UpdateCheckbox(option)}});self.on('item_add',value=>{var option=self.getOption(value);if(option){UpdateCheckbox(option)}});self.hook('instead','onOptionSelect',(evt,option)=>{if(option.classList.contains('selected')){option.classList.remove('selected');self.removeItem(option.dataset.value);self.refreshOptions();preventDefault(evt,!0);return}
9orig_onOptionSelect.call(self,evt,option);UpdateCheckbox(option)})}
10return plugin}))

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.