PageSourceSearch

https://www.fhs.se/sitevision/system-resource/e030055c9174a21d9346…0ad372b66ba11826de040a433286273/js/jcrop.js

js fhs.se collected 2026-10-02 03:35:22 UTC 15,459 bytes, 2 lines download raw bytes

1(self.webpackChunk_sv_portlet=self.webpackChunk_sv_portlet||[]).push([[7477],{1100:(e,t,n)=>{"use strict";n.r(t);n(6684)},6684:()=>{var e;(e=window.$svjq).Jcrop=function(t,n){var o,r=e.extend({},e.Jcrop.defaults),a=navigator.userAgent.toLowerCase(),i=/msie/.test(a),s=/msie [1-6]\./.test(a);function c(e){return Math.round(e)+"px"}function u(e){return r.baseClass+"-"+e}function d(t){var n=e(t).offset();return[n.left,n.top]}function l(e){return[e.pageX-o[0],e.pageY-o[1]]}function h(t){"object"!=typeof t&&(t={}),r=e.extend(r,t),e.each(["onChange","onSelect","onRelease","onDblClick"],(function(e,t){"function"!=typeof r[t]&&(r[t]=function(){})}))}function f(e,t,n){if(o=d(M),$.setCursor("move"===e?e:e+"-resize"),"move"===e)return $.activateHandlers(function(e){var t=e;return Q.watchKeys(),function(e){G.moveOffset([e[0]-t[0],e[1]-t[1]]),t=e,V.update()}}(t),v,n);var a=G.getFixed(),i=p(e),s=G.getCorner(p(i));G.setPressed(G.getCorner(i)),G.setCurrent(s),$.activateHandlers(function(e,t){return function(n){if(r.aspectRatio)switch(e){case"e":case"w":n[1]=t.y+1;break;case"n":case"s":n[0]=t.x+1}else switch(e){case"e":case"w":n[1]=t.y2;break;case"n":case"s":n[0]=t.x2}G.setCurrent(n),V.update()}}(e,a),v,n)}function p(e){switch(e){case"n":case"ne":return"sw";case"s":case"e":case"se":return"nw";case"w":case"sw":return"ne";case"nw":return"se"}}function g(e){return function(t){return!(r.disabled||"move"===e&&!r.allowMove||(o=d(M),E=!0,f(e,l(t)),t.stopPropagation(),t.preventDefault(),1))}}function b(e,t,n){var o=e.width(),r=e.height();o>t&&t>0&&(o=t,r=t/e.width()*e.height()),r>n&&n>0&&(r=n,o=n/e.height()*e.width()),T=e.width()/o,K=e.height()/r,e.width(o).height(r)}function w(e){return{x:e.x*T,y:e.y*K,x2:e.x2*T,y2:e.y2*K,w:e.w*T,h:e.h*K}}function v(e){var t=G.getFixed();t.w>r.minSelect[0]&&t.h>r.minSelect[1]?(V.enableHandles(),V.done()):V.release(),$.setCursor(r.allowSelect?"crosshair":"default")}function y(e){if(r.disabled)return!1;if(!r.allowSelect)return!1;E=!0,o=d(M),V.disableHandles(),$.setCursor("crosshair");var t=l(e);return G.setPressed(t),V.update(),$.activateHandlers(m,v,"touch"===e.type.substring(0,5)),Q.watchKeys(),e.stopPropagation(),e.preventDefault(),!1}function m(e){G.setCurrent(e),V.update()}function C(){var t=e("<div></div>").addClass(u("tracker"));return i&&t.css({opacity:"0",backgroundColor:"white"}),t}"object"!=typeof t&&(t=e(t)[0]),"object"!=typeof n&&(n={}),h(n);var x={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0},S=e(t),k=!0;if("IMG"==t.tagName){if(0!=S[0].width&&0!=S[0].height)S.width(S[0].width),S.height(S[0].height);else{var z=new Image;z.src=S[0].src,S.width(z.width),S.height(z.height)}var M=S.clone().removeAttr("id").css(x).show();M.width(S.width()),M.height(S.height()),S.after(M).hide()}else M=S.css(x).show(),k=!1,null===r.shade&&(r.shade=!0);b(M,r.boxWidth,r.boxHeight);var O=M.width(),j=M.height(),H=e("<div />").width(O).height(j).addClass(u("holder")).css({position:"relative",backgroundColor:r.bgColor}).insertAfter(S).append(M);r.addClass&&H.addClass(r.addClass);var D=e("<div />"),F=e("<div />").width("100%").height("100%").css({zIndex:"310",position:"absolute",overflow:"hidden"}),I=e("<div />").width("100%").height("100%").css("zIndex","320"),B=e("<div />").css({position:"absolute",zIndex:"600"}).on("dblclick",(function(){var e=G.getFixed();r.onDblClick.call(re,e)})).insertBefore(M).append(F,I);k&&(D=e("<img />").attr("src",M.attr("src")).css(x).width(O).height(j),F.append(D)),s&&B.css({overflowY:"hidden"});var A,P,J,R,T,K,E,q,W=r.boundary,Y=C().width(O+2*W).height(j+2*W).css({position:"absolute",top:c(-W),left:c(-W),zIndex:"290"}).on("mousedown",y),_=r.bgColor,L=r.bgOpacity;o=d(M);var X=function(){function e(){var e,t={},n=["touchstart","touchmove","touchend"],o=document.createElement("div");try{for(e=0;e<n.length;e++){var r=n[e],a=(r="on"+r)in o;a||(o.setAttribute(r,"return;"),a="function"==typeof o[r]),t[n[e]]=a}return t.touchstart&&t.touchend&&t.touchmove}catch(e){return!1}}return{createDragger:function(e){return function(t){return!(r.disabled||"move"===e&&!r.allowMove||(o=d(M),E=!0,f(e,l(X.cfilter(t)),!0),t.stopPropagation(),t.preventDefault(),1))}},newSelection:function(e){return y(X.cfilter(e))},cfilter:function(e){return e.pageX=e.originalEvent.changedTouches[0].pageX,e.pageY=e.originalEvent.changedTouches[0].pageY,e},isSupported:e,support:!0===r.touchSupport||!1===r.touchSupport?r.touchSupport:e()}}(),G=function(){var e,t,n=0,o=0,a=0,i=0;function s(){if(!r.aspectRatio)return t=a-n,s=i-o,A&&Math.abs(t)>A&&(a=t>0?n+A:n-A),P&&Math.abs(s)>P&&(i=s>0?o+P:o-P),R/K&&Math.abs(s)<R/K&&(i=s>0?o+R/K:o-R/K),J/T&&Math.abs(t)<J/T&&(a=t>0?n+J/T:n-J/T),n<0&&(a-=n,n-=n),o<0&&(i-=o,o-=o),a<0&&(n-=a,a-=a),i<0&&(o-=i,i-=i),a>O&&(n-=e=a-O,a-=e),i>j&&(o-=e=i-j,i-=e),n>O&&(i-=e=n-j,o-=e),o>
1j&&(i-=e=o-j,o-=e),d(u(n,o,a,i));var e,t,s,c,l,h,f,p=r.aspectRatio,g=r.minSize[0]/T,b=r.maxSize[0]/T,w=r.maxSize[1]/K,v=a-n,y=i-o,m=Math.abs(v),C=Math.abs(y);return 0===b&&(b=10*O),0===w&&(w=10*j),m/C<p?(l=i,h=C*p,(c=v<0?n-h:h+n)<0?(c=0,f=Math.abs((c-n)/p),l=y<0?o-f:f+o):c>O&&(c=O,f=Math.abs((c-n)/p),l=y<0?o-f:f+o)):(c=a,f=m/p,(l=y<0?o-f:o+f)<0?(l=0,h=Math.abs((l-o)*p),c=v<0?n-h:h+n):l>j&&(l=j,h=Math.abs(l-o)*p,c=v<0?n-h:h+n)),c>n?(c-n<g?c=n+g:c-n>b&&(c=n+b),l=l>o?o+(c-n)/p:o-(c-n)/p):c<n&&(n-c<g?c=n-g:n-c>b&&(c=n-b),l=l>o?o+(n-c)/p:o-(n-c)/p),c<0?(n-=c,c=0):c>O&&(n-=c-O,c=O),l<0?(o-=l,l=0):l>j&&(o-=l-j,l=j),d(u(n,o,c,l))}function c(e){return e[0]<0&&(e[0]=0),e[1]<0&&(e[1]=0),e[0]>O&&(e[0]=O),e[1]>j&&(e[1]=j),[Math.round(e[0]),Math.round(e[1])]}function u(e,t,n,o){var r=e,a=n,i=t,s=o;return n<e&&(r=n,a=e),o<t&&(i=o,s=t),[r,i,a,s]}function d(e){return{x:e[0],y:e[1],x2:e[2],y2:e[3],w:e[2]-e[0],h:e[3]-e[1]}}return{flipCoords:u,setPressed:function(e){e=c(e),a=n=e[0],i=o=e[1]},setCurrent:function(n){n=c(n),e=n[0]-a,t=n[1]-i,a=n[0],i=n[1]},getOffset:function(){return[e,t]},moveOffset:function(e){var t=e[0],r=e[1];0>n+t&&(t-=t+n),0>o+r&&(r-=r+o),j<i+r&&(r+=j-(i+r)),O<a+t&&(t+=O-(a+t)),n+=t,a+=t,o+=r,i+=r},getCorner:function(e){var t=s();switch(e){case"ne":return[t.x2,t.y];case"nw":return[t.x,t.y];case"se":return[t.x2,t.y2];case"sw":return[t.x,t.y2]}},getFixed:s}}(),N=function(){var t=!1,n=e("<div />").css({position:"absolute",zIndex:"240",opacity:"0"}),o={top:s(),left:s().height(j),right:s().height(j),bottom:s()};function a(){return i(G.getFixed())}function i(e){o.top.css({left:c(e.x),width:c(e.w),height:c(e.y)}),o.bottom.css({top:c(e.y2),left:c(e.x),width:c(e.w),height:c(j-e.y2)}),o.right.css({left:c(e.x2),width:c(O-e.x2)}),o.left.css({width:c(e.x)})}function s(){return e("<div />").css({position:"absolute",backgroundColor:r.shadeColor||r.bgColor}).appendTo(n)}function u(){t||(t=!0,n.insertBefore(M),a(),V.setBgOpacity(1,0,1),D.hide(),d(r.shadeColor||r.bgColor,1),V.isAwake()?h(r.bgOpacity,1):h(1,1))}function d(e,t){ne(f(),e,t)}function l(){t&&(n.remove(),D.show(),t=!1,V.isAwake()?V.setBgOpacity(r.bgOpacity,1,1):(V.setBgOpacity(1,1,1),V.disableHandles()),ne(H,0,1))}function h(e,o){t&&(r.bgFade&&!o?n.animate({opacity:1-e},{queue:!1,duration:r.fadeTime}):n.css({opacity:1-e.toString()}))}function f(){return n.children()}return{update:a,updateRaw:i,getShades:f,setBgColor:d,enable:u,disable:l,resize:function(e,t){o.left.css({height:c(t)}),o.right.css({height:c(t)})},refresh:function(){r.shade?u():l(),V.isAwake()&&h(r.bgOpacity)},opacity:h}}(),V=function(){var t,n=370,o={},a={},i={},s=!1;function d(t,n){var o=e("<div />").on("mousedown",g(t)).css({cursor:t+"-resize",position:"absolute",zIndex:n.toString()}).addClass("ord-"+t);return X.support&&o.bind("touchstart.jcrop",X.createDragger(t)),I.append(o),o}function l(){var e=G.getFixed();G.setPressed([e.x,e.y]),G.setCurrent([e.x2,e.y2]),h()}function h(e){if(t)return f(e)}function f(e){var n,o,a,i,s=G.getFixed();n=s.w,o=s.h,B.width(Math.round(n)).height(Math.round(o)),a=s.x,i=s.y,r.shade||D.css({top:c(-i),left:c(-a)}),B.css({top:c(i),left:c(a)}),r.shade&&N.updateRaw(s),t||(B.show(),r.shade?N.opacity(L):p(L,!0),t=!0),e?r.onSelect.call(re,w(s)):r.onChange.call(re,w(s))}function p(e,n,o){(t||n)&&(r.bgFade&&!o?M.animate({opacity:e},{queue:!1,duration:r.fadeTime}):M.css("opacity",e.toString()))}function b(){if(s=!0,r.allowResize)return I.show(),!0}function v(){s=!1,I.hide()}function y(e){e?(q=!0,v()):(q=!1,b())}r.dragEdges&&Array.isArray(r.createDragbars)&&function(e){var t;for(t=0;t<e.length;t++)i[e[t]]=d(e[t],n++).addClass("jcrop-dragbar")}(r.createDragbars),Array.isArray(r.createHandles)&&function(e){var t,o,i,s;for(t=0;t<e.length;t++)a[e[t]]=(o=e[t],i=void 0,s=void 0,i=r.handleSize,s=d(o,n++).css({opacity:r.handleOpacity.toString()}).addClass(u("handle")),i&&s.width(i).height(i),s)}(r.createHandles),r.drawBorders&&Array.isArray(r.createBorders)&&function(t){var n,a,i,s;for(a=0;a<t.length;a++){switch(t[a]){case"n":n="hline";break;case"s":n="hline bottom";break;case"e":n="vline right";break;case"w":n="vline"}o[t[a]]=(i=n,s=void 0,s=e("<div />").css({position:"absolute",opacity:r.borderOpacity.toString()}).addClass(u(i)),F.append(s),s)}}(r.createBorders),e(document).on("touchstart.jcrop-ios",(function(t){e(t.currentTarget).hasClass("jcrop-tracker")&&t.stopPropagation()}));var m=C().on("mousedown",g("move")).css({cursor:"move",position:"absolute",zIndex:"360"});return X.support&&m.bind("touchstart.jcrop",X.createDragger("move")),F.append(m),v(),{updateVisible:h,update:f,release:function(){v(),B.hide(),r.shade?N.opacity(1):p(1),t=!1,r.onRelease.call(re)},refresh:l,isAwake:function(){return t},setCursor:function(e){m.css("cursor",e)}
1,enableHandles:b,enableOnly:function(){s=!0},showHandles:function(){s&&I.show()},disableHandles:v,animMode:y,setBgOpacity:p,done:function(){y(!1),l()}}}(),$=function(){var t=function(){},n=function(){},o=r.trackDocument;function a(e){return t(l(e)),!1}function i(o){return o.preventDefault(),o.stopPropagation(),E&&(E=!1,n(l(o)),V.isAwake()&&r.onSelect.call(re,w(G.getFixed())),Y.css({zIndex:"290"}),e(document).off(".jcrop"),t=function(){},n=function(){}),!1}function s(e){return t(l(X.cfilter(e))),!1}function c(e){return i(X.cfilter(e))}return o||Y.mousemove(a).mouseup(i).mouseout(i),M.before(Y),{activateHandlers:function(r,u,d){return E=!0,t=r,n=u,function(t){Y.css({zIndex:"450"}),t?e(document).on("touchmove.jcrop",s).on("touchend.jcrop",c):o&&e(document).on("mousemove.jcrop",a).on("mouseup.jcrop",i)}(d),!1},setCursor:function(e){Y.css("cursor",e)}}}(),Q=function(){var t=e('<input type="radio" />').css({position:"fixed",left:"-120px",width:"12px"}).addClass("jcrop-keymgr"),n=e("<div />").css({position:"absolute",overflow:"hidden"}).append(t);function o(e,t,n){r.allowMove&&(G.moveOffset([t,n]),V.updateVisible(!0)),e.preventDefault(),e.stopPropagation()}return r.keySupport&&(t.on("keydown",(function(e){if(e.ctrlKey||e.metaKey)return!0;var t=e.shiftKey?10:1;switch(e.keyCode){case 37:o(e,-t,0);break;case 39:o(e,t,0);break;case 38:o(e,0,-t);break;case 40:o(e,0,t);break;case 27:r.allowSelect&&V.release();break;case 9:return!0}return!1})).on("blur",(function(e){t.hide()})),s||!r.fixedSupport?(t.css({position:"absolute",left:"-20px"}),n.append(t).insertBefore(M)):t.insertBefore(M)),{watchKeys:function(){r.keySupport&&(t.show(),t.trigger("focus"))}}}();function U(e){Z([e[0]/T,e[1]/K,e[2]/T,e[3]/K]),r.onSelect.call(re,w(G.getFixed())),V.enableHandles()}function Z(e){G.setPressed([e[0],e[1]]),G.setCurrent([e[2],e[3]]),V.update()}function ee(){r.disabled=!0,V.disableHandles(),V.setCursor("default"),$.setCursor("default")}function te(){r.disabled=!1,oe()}function ne(t,n,o){var a=n||r.bgColor;r.bgFade&&e.fx.step.hasOwnProperty("backgroundColor")&&r.fadeTime&&!o?t.animate({backgroundColor:a},{queue:!1,duration:r.fadeTime}):t.css("backgroundColor",a)}function oe(e){r.allowResize?e?V.enableOnly():V.enableHandles():V.disableHandles(),$.setCursor(r.allowSelect?"crosshair":"default"),V.setCursor(r.allowMove?"move":"default"),r.hasOwnProperty("trueSize")&&(T=r.trueSize[0]/O,K=r.trueSize[1]/j),r.hasOwnProperty("setSelect")&&(U(r.setSelect),V.done(),delete r.setSelect),N.refresh(),r.bgColor!=_&&(ne(r.shade?N.getShades():H,r.shade&&r.shadeColor||r.bgColor),_=r.bgColor),L!=r.bgOpacity&&(L=r.bgOpacity,r.shade?N.refresh():V.setBgOpacity(L)),A=r.maxSize[0]||0,P=r.maxSize[1]||0,J=r.minSize[0]||0,R=r.minSize[1]||0,r.hasOwnProperty("outerImage")&&(M.attr("src",r.outerImage),delete r.outerImage),V.refresh()}X.support&&Y.bind("touchstart.jcrop",X.newSelection),I.hide(),oe(!0);var re={setImage:function(e,t){V.release(),ee();var n=new Image;n.onload=function(){var o=n.width,a=n.height,i=r.boxWidth,s=r.boxHeight;M.width(o).height(a),M.attr("src",e),D.attr("src",e),b(M,i,s),O=M.width(),j=M.height(),D.width(O).height(j),Y.width(O+2*W).height(j+2*W),H.width(O).height(j),N.resize(O,j),te(),"function"==typeof t&&t.call(re)},n.src=e},animateTo:function(e,t){var n=e[0]/T,o=e[1]/K,a=e[2]/T,i=e[3]/K;if(!q){var s=G.flipCoords(n,o,a,i),c=G.getFixed(),u=[c.x,c.y,c.x2,c.y2],d=u,l=r.animationDelay,h=s[0]-u[0],f=s[1]-u[1],p=s[2]-u[2],g=s[3]-u[3],b=0,w=r.swingSpeed;n=d[0],o=d[1],a=d[2],i=d[3],V.animMode(!0);var v=function(){b+=(100-b)/w,d[0]=Math.round(n+b/100*h),d[1]=Math.round(o+b/100*f),d[2]=Math.round(a+b/100*p),d[3]=Math.round(i+b/100*g),b>=99.8&&(b=100),b<100?(Z(d),y()):(V.done(),V.animMode(!1),"function"==typeof t&&t.call(re))};y()}function y(){window.setTimeout(v,l)}},setSelect:U,setOptions:function(e){h(e),oe()},tellSelect:function(){return w(G.getFixed())},tellScaled:function(){return G.getFixed()},setClass:function(e){H.removeClass().addClass(u("holder")).addClass(e)},disable:ee,enable:te,cancel:function(){V.done(),$.activateHandlers(null,null)},release:V.release,destroy:function(){H.remove(),S.show(),S.css("visibility","visible"),e(t).removeData("Jcrop")},focus:Q.watchKeys,getBounds:function(){return[O*T,j*K]},getWidgetSize:function(){return[O,j]},getScaleFactor:function(){return[T,K]},getOptions:function(){return r},ui:{holder:H,selection:B}};return i&&H.bind("selectstart",(function(){return!1})),S.data("Jcrop",re),re},e.fn.Jcrop=function(t,n){var o;return this.each((function(){if(e(this).data("Jcrop")){if("api"===t)return e(this).data("Jcrop");e(this).data("Jcrop").setOptions(t)}else"IMG"==this.tagName?e.Jcrop.Loader(this,(function(){e(this).css({display:"block",visibility:"hidden"}),o=e.Jcrop(this,t),"function"==typeof n&&n.call(o)}
1)):(e(this).css({display:"block",visibility:"hidden"}),o=e.Jcrop(this,t),"function"==typeof n&&n.call(o))})),this},e.Jcrop.Loader=function(t,n,o){var r=e(t),a=r[0];r.on("load.jcloader",(function e(){a.complete?(r.unbind(".jcloader"),"function"==typeof n&&n.call(a)):window.setTimeout(e,50)})).on("error.jcloader",(function(e){r.off(".jcloader"),"function"==typeof o&&o.call(a)})),a.complete&&"function"==typeof n&&(r.off(".jcloader"),n.call(a))},e.Jcrop.defaults={allowSelect:!0,allowMove:!0,allowResize:!0,trackDocument:!0,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:.6,bgFade:!1,borderOpacity:.4,handleOpacity:.5,handleSize:null,aspectRatio:0,keySupport:!0,createHandles:["n","s","e","w","nw","ne","se","sw"],createDragbars:["n","s","e","w"],createBorders:["n","s","e","w"],drawBorders:!0,dragEdges:!0,fixedSupport:!0,touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}}}}]);
2//# sourceMappingURL=jcrop.js.map

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.