site_profouzors_net/assets/js/holder.min.js

1 line
8.5 KiB
JavaScript
Raw Permalink Normal View History

2022-08-25 23:12:00 +02:00
var Holder=Holder||{};!function(e,t){function n(e,t){var n="complete",i="readystatechange",o=!1,a=o,r=!0,s=e.document,d=s.documentElement,l=s.addEventListener?"addEventListener":"attachEvent",u=s.addEventListener?"removeEventListener":"detachEvent",h=s.addEventListener?"":"on",c=function(r){(r.type!=i||s.readyState==n)&&(("load"==r.type?e:s)[u](h+r.type,c,o),!a&&(a=!0)&&t.call(e,null))},g=function(){try{d.doScroll("left")}catch(e){return setTimeout(g,50),void 0}c("poll")};if(s.readyState==n)t.call(e,"lazy");else{if(s.createEventObject&&d.doScroll){try{r=!e.frameElement}catch(f){}r&&g()}s[l](h+"DOMContentLoaded",c,o),s[l](h+i,c,o),e[l](h+"load",c,o)}}function i(e){e=e.match(/^(\W)?(.*)/);var t=document["getElement"+(e[1]?"#"==e[1]?"ById":"sByClassName":"sByTagName")](e[2]),n=[];return null!==t&&(n=t.length?t:0===t.length?t:[t]),n}function o(e,t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);return n}function a(e,t,n){t=parseInt(t,10),e=parseInt(e,10);var i=Math.max(t,e),o=Math.min(t,e),a=1/12,r=Math.min(.75*o,.75*i*a);return{height:Math.round(Math.max(n.size,r))}}function r(e){var t=e.ctx,n=e.dimensions,i=e.template,o=e.ratio,r=e.holder,s="literal"==r.textmode,d="exact"==r.textmode,l=a(n.width,n.height,i),u=l.height,h=n.width*o,c=n.height*o,f=i.font?i.font:"sans-serif";g.width=h,g.height=c,t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.background,t.fillRect(0,0,h,c),t.fillStyle=i.foreground,t.font="bold "+u+"px "+f;var m=i.text?i.text:Math.floor(n.width)+"x"+Math.floor(n.height);if(s){var n=r.dimensions;m=n.width+"x"+n.height}else if(d&&r.exact_dimensions){var n=r.exact_dimensions;m=Math.floor(n.width)+"x"+Math.floor(n.height)}var x=t.measureText(m).width;return x/h>=.75&&(u=Math.floor(.75*u*(h/x))),t.font="bold "+u*o+"px "+f,t.fillText(m,h/2,c/2,h),g.toDataURL("image/png")}function s(e,t,n,i){var a=n.dimensions,s=n.theme,d=n.text?decodeURIComponent(n.text):n.text,u=a.width+"x"+a.height;s=d?o(s,{text:d}):s,s=n.font?o(s,{font:n.font}):s,t.setAttribute("data-src",i),n.theme=s,t.holder_data=n,"image"==e?(t.setAttribute("alt",d?d:s.text?s.text+" ["+u+"]":u),(c||!n.auto)&&(t.style.width=a.width+"px",t.style.height=a.height+"px"),c?t.style.backgroundColor=s.background:(t.setAttribute("src",r({ctx:p,dimensions:a,template:s,ratio:y,holder:n})),n.textmode&&"exact"==n.textmode&&(x.push(t),l(t)))):"background"==e?c||(t.style.backgroundImage="url("+r({ctx:p,dimensions:a,template:s,ratio:y,holder:n})+")",t.style.backgroundSize=a.width+"px "+a.height+"px"):"fluid"==e&&(t.setAttribute("alt",d?d:s.text?s.text+" ["+u+"]":u),t.style.height="%"==a.height.slice(-1)?a.height:a.height+"px",t.style.width="%"==a.width.slice(-1)?a.width:a.width+"px",("inline"==t.style.display||""===t.style.display||"none"==t.style.display)&&(t.style.display="block"),c?t.style.backgroundColor=s.background:(x.push(t),l(t)))}function d(e,t){var n={height:e.clientHeight,width:e.clientWidth};if(!n.height&&!n.width){if(e.hasAttribute("data-holder-invisible"))throw new Error("Holder: placeholder is not visible");return e.setAttribute("data-holder-invisible",!0),setTimeout(function(){t.call(this,e)},1),null}return e.removeAttribute("data-holder-invisible"),n}function l(e){var t;t=null==e.nodeType?x:[e];for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];if(i.holder_data){var o=i.holder_data,a=d(i,l);a&&(o.fluid&&i.setAttribute("src",r({ctx:p,dimensions:a,template:o.theme,ratio:y,holder:o})),o.textmode&&"exact"==o.textmode&&(o.exact_dimensions=a,i.setAttribute("src",r({ctx:p,dimensions:o.dimensions,template:o.theme,ratio:y,holder:o}))))}}}function u(t,n){var i={theme:o(v.themes.gray,{})},a=!1;for(sl=t.length,j=0;sl>j;j++){var r=t[j];e.flags.dimensions.match(r)?(a=!0,i.dimensions=e.flags.dimensions.output(r)):e.flags.fluid.match(r)?(a=!0,i.dimensions=e.flags.fluid.output(r),i.fluid=!0):e.flags.textmode.match(r)?i.textmode=e.flags.textmode.output(r):e.flags.colors.match(r)?i.theme=e.flags.colors.output(r):n.themes[r]?n.themes.hasOwnProperty(r)&&(i.theme=o(n.themes[r],{})):e.flags.font.match(r)?i.font=e.fl