From ebf515264b4c2a6aeb31dddde377c60333df6249 Mon Sep 17 00:00:00 2001 From: razvanaldea89 Date: Mon, 25 Feb 2019 20:21:05 +0200 Subject: [PATCH] colorpicker update / colorpicker form functionality minor update --- build/js/custom.js | 2 +- build/js/custom.min.js | 2 +- production/form.html | 4 ++-- production/form_advanced.html | 11 ++++++++--- src/js/custom.js | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/build/js/custom.js b/build/js/custom.js index 2e8a4a4..866413c 100644 --- a/build/js/custom.js +++ b/build/js/custom.js @@ -1158,7 +1158,7 @@ function init_InputMask() { } function init_ColorPicker() { - "undefined" != typeof $.fn.colorpicker && (console.log("init_ColorPicker"), $(".demo1").colorpicker(), $(".demo2").colorpicker(), $("#demo_forceformat").colorpicker({ + "undefined" != typeof $.fn.colorpicker && (console.log("init_ColorPicker"), $(".demo1").colorpicker(), $(".demo2").colorpicker( {format: 'auto'}), $("#demo_forceformat").colorpicker({ format: "rgba", horizontal: !0 }), $("#demo_forceformat3").colorpicker({ diff --git a/build/js/custom.min.js b/build/js/custom.min.js index 163b20d..a439a0f 100644 --- a/build/js/custom.min.js +++ b/build/js/custom.min.js @@ -1,3 +1,3 @@ -function setContentHeight(){var e=(window.location.href.split("#")[0].split("?")[0],$("body")),a=($("#menu_toggle"),$("#sidebar-menu"),$(".sidebar-footer")),t=$(".left_col"),n=$(".right_col"),o=$(".nav_menu"),i=$("footer");n.css("min-height",$(window).height());var r=e.outerHeight(),l=e.hasClass("footer_fixed")?-10:i.height(),s=t.eq(1).height()+a.height(),c=r File upload error '+t+" ").prependTo("#alerts")}"undefined"!=typeof $.fn.wysiwyg&&(console.log("init_wysiwyg"),$(".editor-wrapper").each(function(){var a=$(this).attr("id");$(this).wysiwyg({toolbarSelector:'[data-target="#'+a+'"]',fileUploadError:e})}),window.prettyPrint,prettyPrint())}function init_cropper(){if("undefined"!=typeof $.fn.cropper){console.log("init_cropper");var e=$("#image"),a=$("#download"),t=$("#dataX"),n=$("#dataY"),o=$("#dataHeight"),i=$("#dataWidth"),r=$("#dataRotate"),l=$("#dataScaleX"),s=$("#dataScaleY"),c={aspectRatio:16/9,preview:".img-preview",crop:function(e){t.val(Math.round(e.x)),n.val(Math.round(e.y)),o.val(Math.round(e.height)),i.val(Math.round(e.width)),r.val(e.rotate),l.val(e.scaleX),s.val(e.scaleY)}};$('[data-toggle="tooltip"]').tooltip(),e.on({"build.cropper":function(e){console.log(e.type)},"built.cropper":function(e){console.log(e.type)},"cropstart.cropper":function(e){console.log(e.type,e.action)},"cropmove.cropper":function(e){console.log(e.type,e.action)},"cropend.cropper":function(e){console.log(e.type,e.action)},"crop.cropper":function(e){console.log(e.type,e.x,e.y,e.width,e.height,e.rotate,e.scaleX,e.scaleY)},"zoom.cropper":function(e){console.log(e.type,e.ratio)}}).cropper(c),$.isFunction(document.createElement("canvas").getContext)||$('button[data-method="getCroppedCanvas"]').prop("disabled",!0),"undefined"==typeof document.createElement("cropper").style.transition&&($('button[data-method="rotate"]').prop("disabled",!0),$('button[data-method="scale"]').prop("disabled",!0)),"undefined"==typeof a[0].download&&a.addClass("disabled"),$(".docs-toggles").on("change","input",function(){var a,t,n=$(this),o=n.attr("name"),i=n.prop("type");e.data("cropper")&&("checkbox"===i?(c[o]=n.prop("checked"),a=e.cropper("getCropBoxData"),t=e.cropper("getCanvasData"),c.built=function(){e.cropper("setCropBoxData",a),e.cropper("setCanvasData",t)}):"radio"===i&&(c[o]=n.val()),e.cropper("destroy").cropper(c))}),$(".docs-buttons").on("click","[data-method]",function(){var e,t,n=$(this),o=n.data();if(!n.prop("disabled")&&!n.hasClass("disabled")&&i.data("cropper")&&o.method){if(o=$.extend({},o),"undefined"!=typeof o.target&&(e=$(o.target),"undefined"==typeof o.option))try{o.option=JSON.parse(e.val())}catch(i){console.log(i.message)}switch(t=i.cropper(o.method,o.option,o.secondOption),o.method){case"scaleX":case"scaleY":$(this).data("option",-o.option);break;case"getCroppedCanvas":t&&($("#getCroppedCanvasModal").modal().find(".modal-body").html(t),a.hasClass("disabled")||a.attr("href",t.toDataURL()))}if($.isPlainObject(t)&&e)try{e.val(JSON.stringify(t))}catch(i){console.log(i.message)}}}),$(document.body).on("keydown",function(a){if(e.data("cropper")&&!(this.scrollTop>300))switch(a.which){case 37:a.preventDefault(),e.cropper("move",-1,0);break;case 38:a.preventDefault(),e.cropper("move",0,-1);break;case 39:a.preventDefault(),e.cropper("move",1,0);break;case 40:a.preventDefault(),e.cropper("move",0,1)}});var d,u=$("#inputImage"),m=window.URL||window.webkitURL;m?u.change(function(){var a,t=this.files;e.data("cropper")&&t&&t.length&&(a=t[0],/^image\/\w+$/.test(a.type)?(d=m.createObjectURL(a),e.one("built.cropper",function(){m.revokeObjectURL(d)}).cropper("reset").cropper("replace",d),u.val("")):window.alert("Please choose an image file."))}):u.prop("disabled",!0).parent().addClass("disabled")}}function init_knob(){if("undefined"!=typeof $.fn.knob){console.log("init_knob"),$(".knob").knob({change:function(e){},release:function(e){console.log("release : "+e)},cancel:function(){console.log("cancel : ",this)},draw:function(){if("tron"==this.$.data("skin")){this.cursorExt=.3;var e,a=this.arc(this.cv),t=1;return this.g.lineWidth=this.lineWidth,this.o.displayPrevious&&(e=this.arc(this.v),this.g.beginPath(),this.g.strokeStyle=this.pColor,this.g.arc(this.xy,this.xy,this.radius-this.lineWidth,e.s,e.e,e.d),this.g.stroke()),this.g.beginPath(),this.g.strokeStyle=t?this.o.fgColor:this.fgColor,this.g.arc(this.xy,this.xy,this.radius-this.lineWidth,a.s,a.e,a.d),this.g.stroke(),this.g.lineWidth=2,this.g.beginPath(),this.g.strokeStyle=this.o.fgColor,this.g.arc(this.xy,this.xy,this.radius-this.lineWidth+1+2*this.lineWidth/3,0,2*Math.PI,!1),this.g.stroke(),!1}}});var e,a=0,t=0,n=0,o=$("div.idir"),i=$("div.ival"),r=function(){n++,o.show().html("+").fadeOut(),i.html(n)},l=function(){n--,o.show().html("-").fadeOut(),i.html(n)};$("input.infinite").knob({min:0,max:20,stopper:!1,change:function(){e>this.cv?a?(l(),a=0):(a=1,t=0):e