Файловый менеджер - Редактировать - /home/lmsyaran/public_html/media/com_easyblog/scripts/media/constrain.min.js
Назад
EasyBlog.module("media/constrain",function(e){var t=this;EasyBlog.require().library("image").done(function(){e.fn.constrain=function(){var t=this.data("constrain");if(t instanceof e.Constrain){if(arguments.length<=0)return t;t.update(arguments[0])}else t=new e.Constrain(this,arguments[0]),this.data("constrain",t)},e.Constrain=function(t,n){var r=this,i={selector:{width:".inputWidth",height:".inputHeight",constrain:".inputConstrain"},forceConstrain:!1},s=n?n:{};r.options=e.extend(!0,{},i,s),r.options.element={width:t.find(r.options.selector.width).data("type","width"),height:t.find(r.options.selector.height).data("type","height"),constrain:t.find(r.options.selector.constrain)},r.options.initial=r.options.initial||r.options.source,r.options.allowedMax!==undefined&&(r.options.max=e.Image.resizeWithin(r.options.source.width,r.options.source.height,r.options.allowedMax.width,r.options.allowedMax.height),r.options.initial.width=Math.min(r.options.max.width,r.options.initial.width),r.options.initial.height=Math.min(r.options.max.height,r.options.initial.height)),r.options.element.width.data("initial",r.options.initial.width),r.options.element.height.data("initial",r.options.initial.height),r.fieldValues(r.calculate("width",r.options.initial)),e.each([r.options.element.width,r.options.element.height],function(t,n){var i=n.data("type"),s=r.getOppositeType(i),n=e(n),o=r.options.element[s];n.bind("keyup",function(e){if(e.keyCode==9||e.keyCode==16)return!1;r.fieldValues(r.calculate(i))}),n.bind("blur",function(){!r.options.element.constrain.is(":checked")&&e.trim(n.val())==""&&n.val(r.options.initial[i]),e.trim(n.val())==""&&e.trim(o.val())==""&&(n.val(r.options.initial[i]),o.val(r.options.initial[s]))})}),e(r.options.element.constrain).bind("change",function(){if(e(this).is(":checked")){var t=r.fieldValues(),n=t.width===""?"height":"width";r.fieldValues(r.calculate(n))}})},e.extend(e.Constrain.prototype,{calculate:function(e,t){var n=this,t=t!==undefined?t:n.fieldValues(),r=n.getOppositeType(e),i=n.options.max?n.options.max[e]:undefined,s=n.options.max?n.options.max[r]:undefined,o=n.options.source[e],u=n.options.source[r],a=t[e],f=t[r];a=a!=""&&i&&a>i?i:a;if(this.enforceConstrain())if(a=="")f="";else{var l=o/a;f=Math.round(u/l),s&&f>s&&(f=s)}var c={};return c[e]=a,c[r]=f,c},getOppositeType:function(e){return e=="width"?"height":"width"},getInput:function(t){var n=this,r=n.options.element[t].val();return r=e.trim(r),r=r.replace(RegExp("[^0-9.]","g"),""),r=parseInt(r,10),isNaN(r)?"":r},fieldValues:function(e){var t=this,n={};return e===undefined?(n.width=t.getInput("width"),n.height=t.getInput("height")):(t.options.element.width.val(Math.floor(e.width)),t.options.element.height.val(Math.floor(e.height)),n=e),n},enforceConstrain:function(){var e=this;return e.options.forceConstrain?!0:e.options.element.constrain.length<1?!0:e.options.element.constrain.is(":checked")},update:function(t){var n=this;n.options.initial=t.initial||t.source||n.options.initial,t.allowedMax!==undefined&&t.source!==undefined&&(t.max=e.Image.resizeWithin(t.source.width,t.source.height,t.allowedMax.width,t.allowedMax.height),n.options.initial.width=Math.min(t.max.width,n.options.initial.width),n.options.initial.height=Math.min(t.max.height,n.options.initial.height)),n.options=e.extend(!0,{},n.options,t),values=this.calculate("width",{width:n.options.initial.width||n.options.source.width,height:n.options.initial.height||n.options.source.height}),this.fieldValues(values)}}),t.resolve()})});
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка