PageSourceSearch

https://superomsk.ru/scripts/focal-circle-crop.js

js superomsk.ru collected 2026-10-02 07:40:44 UTC 4,084 bytes, 1 lines download raw bytes

1(function(){var e={viewportWidth:390,height:270},t={viewportWidth:862,height:540};e.viewportWidth/e.height,t.viewportWidth/t.height;var n=/^(\d{1,3}),(\d{1,3})(?:,(\d{1,5}))?$/;function r(e,t,n){return Math.min(n,Math.max(t,e))}function i(e){if(!e)return{x:50,y:50,zoom:100};let t=n.exec(e.trim());return t?{x:r(Number(t[1]),0,100),y:r(Number(t[2]),0,100),zoom:r(Number(t[3]??100),25,99999)}:{x:50,y:50,zoom:100}}function a(e,t){let n=t/100;return{w:e.viewportWidth*n,h:e.height*n}}function o(e,t,n){return!t||!n?100:Math.floor(Math.min(t/e.viewportWidth*100,n/e.height*100))}function s(e,t,n,i){return r(i,25,Math.max(25,o(e,t,n)))}function c(e,t,n,i,o,s=100){if(!t||!n)return{x:50,y:50};let{w:c,h:l}=a(e,s),u=c/2/t*100,d=100-u,f=l/2/n*100,p=100-f;return{x:r(i,u,d),y:r(o,f,p)}}var l=`focal-circle-crop--bg`,u=`focal-circle-crop__sr`;function d(e){try{let t=new URL(e,window.location.href);return`url("${t.pathname}${t.search}")`}catch{let t=String(e||``).replace(/^https?:\/\/[^/]+/,``);return`url("${t.startsWith(`/`)?t:`/${t}`}")`}}function f(e,t,n,r){if(!t||!n)return{};let i=s(e,t,n,r.zoom),o=a(e,i),l=c(e,t,n,r.x,r.y,i);return{backgroundRepeat:`no-repeat`,backgroundSize:`${t/o.w*100}% auto`,backgroundPosition:`${l.x}% ${l.y}%`}}function p(e,t){e&&(e.classList.remove(l),e.style.removeProperty(`background-image`),e.style.removeProperty(`background-repeat`),e.style.removeProperty(`background-size`),e.style.removeProperty(`background-position`),t&&(t.classList.remove(u,`story-focus-crop__image`),t.style.removeProperty(`opacity`),t.style.removeProperty(`position`),t.style.removeProperty(`width`),t.style.removeProperty(`height`),t.style.removeProperty(`left`),t.style.removeProperty(`top`),t.style.removeProperty(`object-fit`),t.style.removeProperty(`max-width`),t.style.removeProperty(`aspect-ratio`)))}function m(e,t,n,r){if(!e||!t)return;let a=i(n),o=()=>{if(!t.naturalWidth||!t.naturalHeight)return!1;let n=t.currentSrc||t.src,i=f(r,t.naturalWidth,t.naturalHeight,a);return p(e,t),e.classList.add(l),e.style.backgroundImage=d(n),Object.assign(e.style,i),t.classList.add(u),!0};o()||(t.addEventListener(`load`,()=>{o()},{once:!0}),typeof t.decode==`function`&&t.decode().then(()=>{o()}).catch(()=>{}))}function h(e,t=`.focal-circle-crop, .story-bubble__thumb-crop, .cicle`){for(let n of t.split(`,`).map(e=>e.trim())){let t=e.closest(n);if(t instanceof HTMLElement)return t}return null}var g=`focal-rect-crop--bg`,_=`focal-rect-crop__sr`,v=d;function y(e,t,n,r){if(!t||!n)return{};let i=s(e,t,n,r.zoom),o=a(e,i),l=c(e,t,n,r.x,r.y,i);return{backgroundRepeat:`no-repeat`,backgroundSize:`${t/o.w*100}% auto`,backgroundPosition:`${l.x}% ${l.y}%`}}function b(e,t){e&&(e.classList.remove(g),e.style.removeProperty(`background-image`),e.style.removeProperty(`background-repeat`),e.style.removeProperty(`background-size`),e.style.removeProperty(`background-position`),t&&(t.classList.remove(_,`story-focus-crop__image`),t.style.removeProperty(`opacity`),t.style.removeProperty(`position`),t.style.removeProperty(`width`),t.style.removeProperty(`height`),t.style.removeProperty(`left`),t.style.removeProperty(`top`),t.style.removeProperty(`object-fit`),t.style.removeProperty(`max-width`),t.style.removeProperty(`aspect-ratio`)))}function x(e,t,n,r){if(!e||!t)return;let a=i(n),o=()=>{if(!t.naturalWidth||!t.naturalHeight)return!1;let n=t.currentSrc||t.src,i=y(r,t.naturalWidth,t.naturalHeight,a);return b(e,t),e.classList.add(g),e.style.backgroundImage=v(n),Object.assign(e.style,i),t.classList.add(_),!0};o()||(t.addEventListener(`load`,()=>{o()},{once:!0}),typeof t.decode==`function`&&t.decode().then(()=>{o()}).catch(()=>{}))}var S={FOCAL_CIRCLE_CROP_BG_CLASS:l,FOCAL_CIRCLE_CROP_SR_CLASS:u,applyFocalCircleBackgroundCrop:m,clearFocalCircleBackgroundCrop:p,focalCircleBackgroundStyle:f,focalCircleCssBackgroundUrl:d,resolveFocalCircleContainer:h},C={FOCAL_RECT_CROP_BG_CLASS:g,FOCAL_RECT_CROP_SR_CLASS:_,applyFocalRectBackgroundCrop:x,clearFocalRectBackgroundCrop:b,focalRectBackgroundStyle:y,focalRectCssBackgroundUrl:v};window.FocalCircleCrop=S,window.FocalRectCrop=C})();

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.