diff --git a/public/js/orchid_fields.js b/public/js/orchid_fields.js index 8ee81fb..c183335 100644 --- a/public/js/orchid_fields.js +++ b/public/js/orchid_fields.js @@ -1 +1 @@ -(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(a.push(i.value),a.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n3&&void 0!==arguments[3]&&!arguments[3]?t.removeEventListener(e,n,i):t.addEventListener(e,n,i)}function _(t,e){if(t){var n=new Image;n.onload=function(){e&&e(n)},n.src=t}}function w(t){return t.dataset.original?t.dataset.original:"A"===t.parentNode.tagName?t.parentNode.getAttribute("href"):null}function O(t,e,n){!function(t){var e=S.transitionProp,n=S.transformProp;if(t.transition){var i=t.transition;delete t.transition,t[e]=i}if(t.transform){var r=t.transform;delete t.transform,t[n]=r}}(e);var i=t.style,r={};for(var o in e)n&&(r[o]=i[o]||""),i[o]=e[o];return r}var S={transitionProp:"transition",transEndEvent:"transitionend",transformProp:"transform",transformCssProp:"transform"},x=S.transformCssProp,j=S.transEndEvent,P=function(){},k={enableGrab:!0,preloadImage:!1,closeOnWindowResize:!0,transitionDuration:.4,transitionTimingFunction:"cubic-bezier(0.4, 0, 0, 1)",bgColor:"rgb(255, 255, 255)",bgOpacity:1,scaleBase:1,scaleExtra:.5,scrollThreshold:40,zIndex:998,customSize:null,onOpen:P,onClose:P,onGrab:P,onMove:P,onRelease:P,onBeforeOpen:P,onBeforeClose:P,onBeforeGrab:P,onBeforeRelease:P,onImageLoading:P,onImageLoaded:P},C={init:function(t){var e,n;e=this,n=t,Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){e[t]=e[t].bind(n)}))},click:function(t){if(t.preventDefault(),E(t))return window.open(this.target.srcOriginal||t.currentTarget.src,"_blank");this.shown?this.released?this.close():this.release():this.open(t.currentTarget)},scroll:function(){var t=document.documentElement||document.body.parentNode||document.body,e=window.pageXOffset||t.scrollLeft,n=window.pageYOffset||t.scrollTop;null===this.lastScrollPosition&&(this.lastScrollPosition={x:e,y:n});var i=this.lastScrollPosition.x-e,r=this.lastScrollPosition.y-n,o=this.options.scrollThreshold;(Math.abs(r)>=o||Math.abs(i)>=o)&&(this.lastScrollPosition=null,this.close())},keydown:function(t){(function(t){var e=t.key||t.code;return"Escape"===e||27===t.keyCode})(t)&&(this.released?this.close():this.release(this.close))},mousedown:function(t){if(T(t)&&!E(t)){t.preventDefault();var e=t.clientX,n=t.clientY;this.pressTimer=setTimeout(function(){this.grab(e,n)}.bind(this),200)}},mousemove:function(t){this.released||this.move(t.clientX,t.clientY)},mouseup:function(t){T(t)&&!E(t)&&(clearTimeout(this.pressTimer),this.released?this.close():this.release())},touchstart:function(t){t.preventDefault();var e=t.touches[0],n=e.clientX,i=e.clientY;this.pressTimer=setTimeout(function(){this.grab(n,i)}.bind(this),200)},touchmove:function(t){if(!this.released){var e=t.touches[0],n=e.clientX,i=e.clientY;this.move(n,i)}},touchend:function(t){(function(t){t.targetTouches.length})(t)||(clearTimeout(this.pressTimer),this.released?this.close():this.release())},clickOverlay:function(){this.close()},resizeWindow:function(){this.close()}};function T(t){return 0===t.button}function E(t){return t.metaKey||t.ctrlKey}var z={init:function(t){this.el=document.createElement("div"),this.instance=t,this.parent=document.body,O(this.el,{position:"fixed",top:0,left:0,right:0,bottom:0,opacity:0}),this.updateStyle(t.options),g(this.el,"click",t.handler.clickOverlay.bind(t))},updateStyle:function(t){O(this.el,{zIndex:t.zIndex,backgroundColor:t.bgColor,transition:"opacity\n "+t.transitionDuration+"s\n "+t.transitionTimingFunction})},insert:function(){this.parent.appendChild(this.el)},remove:function(){this.parent.removeChild(this.el)},fadeIn:function(){this.el.offsetWidth,this.el.style.opacity=this.instance.options.bgOpacity},fadeOut:function(){this.el.style.opacity=0}},R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A=function(){function t(t,e){for(var n=0;nd||f>v)return{x:d,y:v}}return{x:f,y:f}}};function B(){var t=document.documentElement;return{x:Math.min(t.clientWidth,window.innerWidth)/2,y:Math.min(t.clientHeight,window.innerHeight)/2}}function q(t,e,n){["mousedown","mousemove","mouseup","touchstart","touchmove","touchend"].forEach((function(i){g(t,i,e[i],n)}))}const D=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.target=Object.create(I),this.overlay=Object.create(z),this.handler=Object.create(C),this.body=document.body,this.shown=!1,this.lock=!1,this.released=!0,this.lastScrollPosition=null,this.pressTimer=null,this.options=W({},k,e),this.overlay.init(this),this.handler.init(this)}return A(t,[{key:"listen",value:function(t){if("string"==typeof t)for(var e=document.querySelectorAll(t),n=e.length;n--;)this.listen(e[n]);else"IMG"===t.tagName&&(t.style.cursor=d,g(t,"click",this.handler.click),this.options.preloadImage&&_(w(t)));return this}},{key:"config",value:function(t){return t?(W(this.options,t),this.overlay.updateStyle(this.options),this):this.options}},{key:"open",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.onOpen;if(!this.shown&&!this.lock){var i="string"==typeof t?document.querySelector(t):t;if("IMG"===i.tagName){if(this.options.onBeforeOpen(i),this.target.init(i,this),!this.options.preloadImage){var r=this.target.srcOriginal;null!=r&&(this.options.onImageLoading(i),_(r,this.options.onImageLoaded))}return this.shown=!0,this.lock=!0,this.target.zoomIn(),this.overlay.insert(),this.overlay.fadeIn(),g(document,"scroll",this.handler.scroll),g(document,"keydown",this.handler.keydown),this.options.closeOnWindowResize&&g(window,"resize",this.handler.resizeWindow),g(i,j,(function t(){g(i,j,t,!1),e.lock=!1,e.target.upgradeSource(),e.options.enableGrab&&q(document,e.handler,!0),n(i)})),this}}}},{key:"close",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.onClose;if(this.shown&&!this.lock){var n=this.target.el;return this.options.onBeforeClose(n),this.lock=!0,this.body.style.cursor=p,this.overlay.fadeOut(),this.target.zoomOut(),g(document,"scroll",this.handler.scroll,!1),g(document,"keydown",this.handler.keydown,!1),this.options.closeOnWindowResize&&g(window,"resize",this.handler.resizeWindow,!1),g(n,j,(function i(){g(n,j,i,!1),t.shown=!1,t.lock=!1,t.target.downgradeSource(),t.options.enableGrab&&q(document,t.handler,!1),t.target.restoreCloseStyle(),t.overlay.remove(),e(n)})),this}}},{key:"grab",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.options.scaleExtra,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.options.onGrab;if(this.shown&&!this.lock){var r=this.target.el;return this.options.onBeforeGrab(r),this.released=!1,this.target.grab(t,e,n),g(r,j,(function t(){g(r,j,t,!1),i(r)})),this}}},{key:"move",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.options.scaleExtra,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.options.onMove;if(this.shown&&!this.lock){this.released=!1,this.body.style.cursor=b,this.target.move(t,e,n);var r=this.target.el;return g(r,j,(function t(){g(r,j,t,!1),i(r)})),this}}},{key:"release",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.onRelease;if(this.shown&&!this.lock){var n=this.target.el;return this.options.onBeforeRelease(n),this.lock=!0,this.body.style.cursor=p,this.target.restoreOpenStyle(),g(n,j,(function i(){g(n,j,i,!1),t.lock=!1,t.released=!0,e(n)})),this}}}]),t}();function M(t){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(t)}function V(t,e){for(var n=0;n{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}!function(e,n){function i(t,n){this.element=t,this.settings=e.extend({},e.fn.rate.settings,n),this.set_faces={},this.build()}e.fn.textWidth=function(){var t=e(""+e(this).html()+"");t.css("font-size",e(this).css("font-size")).hide(),t.prependTo("body");var n=t.width();if(t.remove(),0==n){var i=0;return e(this).eq(0).children().each((function(){i+=e(this).textWidth()})),i}return n},e.fn.textHeight=function(){var t=e(""+e(this).html()+"");t.css("font-size",e(this).css("font-size")).hide(),t.prependTo("body");var n=t.height();return t.remove(),n},Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},String.prototype.getCodePointLength=function(){return this.length-this.split(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g).length+1},String.fromCodePoint=function(){for(var t=Array.prototype.slice.call(arguments),e=t.length;e-- >0;){var n=t[e]-65536;n>=0&&t.splice(e,1,55296+(n>>10),56320+(1023&n))}return String.fromCharCode.apply(null,t)},e.fn.rate=function(n){if(void 0===n||"object"===t(n))return this.each((function(){e.data(this,"rate")||e.data(this,"rate",new i(this,n))}));if("string"==typeof n){var r,o=arguments;return this.each((function(){var t=e.data(this,"rate");t instanceof i&&"function"==typeof t[n]&&(r=t[n].apply(t,Array.prototype.slice.call(o,1))),"destroy"===n&&(e(t.element).off(),e.data(this,"rate",null))})),void 0!==r?r:this}},i.prototype.build=function(){this.layers={},this.value=0,this.raise_select_layer=!1,this.settings.initial_value&&(this.value=this.settings.initial_value),e(this.element).attr("data-rate-value")&&(this.value=e(this.element).attr("data-rate-value"));var t=this.value/this.settings.max_value*100;if("string"==typeof this.settings.symbols[this.settings.selected_symbol_type]){var n=this.settings.symbols[this.settings.selected_symbol_type];this.settings.symbols[this.settings.selected_symbol_type]={},this.settings.symbols[this.settings.selected_symbol_type].base=n,this.settings.symbols[this.settings.selected_symbol_type].selected=n,this.settings.symbols[this.settings.selected_symbol_type].hover=n}var i=this.addLayer("base-layer",100,this.settings.symbols[this.settings.selected_symbol_type].base,!0),r=this.addLayer("select-layer",t,this.settings.symbols[this.settings.selected_symbol_type].selected,!0),o=this.addLayer("hover-layer",0,this.settings.symbols[this.settings.selected_symbol_type].hover,!1);this.layers.base_layer=i,this.layers.select_layer=r,this.layers.hover_layer=o,e(this.element).on("mousemove",e.proxy(this.hover,this)),e(this.element).on("click",e.proxy(this.select,this)),e(this.element).on("mouseleave",e.proxy(this.mouseout,this)),e(this.element).css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}),this.settings.hasOwnProperty("update_input_field_name")&&this.settings.update_input_field_name.val(this.value)},i.prototype.addLayer=function(t,n,i,r){for(var o="
",s=0;s"+i[s]+""):(this.settings.convert_to_utf8&&(i=String.fromCodePoint(i)),o+=""+i+"");var a=e(o+="
").addClass("rate-"+t).appendTo(this.element);return e(a).css({width:n+"%",height:e(a).children().eq(0).textHeight(),overflow:"hidden",position:"absolute",top:0,display:r?"block":"none","white-space":"nowrap"}),e(this.element).css({width:e(a).textWidth()+"px",height:e(a).height(),position:"relative",cursor:this.settings.cursor}),a},i.prototype.updateServer=function(){null!=this.settings.url&&e.ajax({url:this.settings.url,type:this.settings.ajax_method,data:e.extend({},{value:this.getValue()},this.settings.additional_data),success:e.proxy((function(t){e(this.element).trigger("updateSuccess",[t])}),this),error:e.proxy((function(t,n,i){e(this.element).trigger("updateError",[t,n,i])}),this)})},i.prototype.getValue=function(){return this.value},i.prototype.hover=function(t){var n=parseInt(e(this.element).css("padding-left").replace("px","")),i=t.pageX-e(this.element).offset().left-n,r=this.toValue(i,!0);if(r!=this.value&&(this.raise_select_layer=!1),!this.raise_select_layer&&!this.settings.readonly){var o=this.toWidth(r);if(this.layers.select_layer.css({display:"none"}),this.settings.only_select_one_symbol){var s=Math.floor(r);this.layers.hover_layer.css({width:"100%",display:"block"}),this.layers.hover_layer.children("span").css({visibility:"hidden"}),this.layers.hover_layer.children("span").eq(0!=s?s-1:0).css({visibility:"visible"})}else this.layers.hover_layer.css({width:o+"%",display:"block"})}},i.prototype.select=function(t){if(!this.settings.readonly){this.getValue();var n=parseInt(e(this.element).css("padding-left").replace("px","")),i=t.pageX-e(this.element).offset().left-n,r=this.toWidth(this.toValue(i,!0));this.setValue(this.toValue(r)),this.raise_select_layer=!0}},i.prototype.mouseout=function(){this.layers.hover_layer.css({display:"none"}),this.layers.select_layer.css({display:"block"})},i.prototype.toWidth=function(t){return t/this.settings.max_value*100},i.prototype.toValue=function(t,e){var n,i=(n=e?t/this.layers.base_layer.textWidth()*this.settings.max_value:t/100*this.settings.max_value)/this.settings.step_size;return i-Math.floor(i)<5e-5&&(n=Math.round(n/this.settings.step_size)*this.settings.step_size),n=(n=Math.ceil(n/this.settings.step_size)*this.settings.step_size)>this.settings.max_value?this.settings.max_value:n},i.prototype.getElement=function(t,n){return e(this.element).find(".rate-"+t+" span").eq(n-1)},i.prototype.getLayers=function(){return this.layers},i.prototype.setFace=function(t,e){this.set_faces[t]=e},i.prototype.setAdditionalData=function(t){this.settings.additional_data=t},i.prototype.getAdditionalData=function(){return this.settings.additional_data},i.prototype.removeFace=function(t){delete this.set_faces[t]},i.prototype.setValue=function(t){if(!this.settings.readonly){t<0?t=0:t>this.settings.max_value&&(t=this.settings.max_value);var n=this.getValue();this.value=t,e(this.element).trigger("change",{from:n,to:this.value}),e(this.element).find(".rate-face").remove(),e(this.element).find("span").css({visibility:"visible"});var i=Math.ceil(this.value);if(this.set_faces.hasOwnProperty(i)){var r="
"+this.set_faces[i]+"
",o=this.getElement("base-layer",i),s=this.getElement("select-layer",i),a=this.getElement("hover-layer",i),l=o.textWidth()*(i-1)+(o.textWidth()-e(r).textWidth())/2;e(r).appendTo(this.element).css({display:"inline-block",position:"absolute",left:l}).addClass("rate-face"),o.css({visibility:"hidden"}),s.css({visibility:"hidden"}),a.css({visibility:"hidden"})}if(this.settings.only_select_one_symbol)c=this.toWidth(this.settings.max_value),this.layers.select_layer.css({display:"block",width:c+"%",height:this.layers.base_layer.css("height")}),this.layers.hover_layer.css({display:"none",height:this.layers.base_layer.css("height")}),this.layers.select_layer.children("span").css({visibility:"hidden"}),this.layers.select_layer.children("span").eq(0!=i?i-1:0).css({visibility:"visible"});else{var c=this.toWidth(this.value);this.layers.select_layer.css({display:"block",width:c+"%",height:this.layers.base_layer.css("height")}),this.layers.hover_layer.css({display:"none",height:this.layers.base_layer.css("height")})}e(this.element).attr("data-rate-value",this.value),this.settings.change_once&&(this.settings.readonly=!0),this.updateServer(),e(this.element).trigger("afterChange",{from:n,to:this.value}),this.settings.hasOwnProperty("update_input_field_name")&&this.settings.update_input_field_name.val(this.value)}},i.prototype.increment=function(){this.setValue(this.getValue()+this.settings.step_size)},i.prototype.decrement=function(){this.setValue(this.getValue()-this.settings.step_size)},e.fn.rate.settings={max_value:5,step_size:.5,initial_value:0,symbols:{utf8_star:{base:"☆",hover:"★",selected:"★"},utf8_hexagon:{base:"⬡",hover:"⬢",selected:"⬢"},hearts:"♥",fontawesome_beer:'',fontawesome_star:{base:'',hover:'',selected:''},utf8_emoticons:{base:[128549,128531,128530,128516],hover:[128549,128531,128530,128516],selected:[128549,128531,128530,128516]}},selected_symbol_type:"utf8_star",convert_to_utf8:!1,cursor:"default",readonly:!1,change_once:!1,only_select_one_symbol:!1,ajax_method:"POST",additional_data:{}}}(jQuery,window)})(); \ No newline at end of file +(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(a.push(i.value),a.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n3&&void 0!==arguments[3]&&!arguments[3]?t.removeEventListener(e,n,i):t.addEventListener(e,n,i)}function _(t,e){if(t){var n=new Image;n.onload=function(){e&&e(n)},n.src=t}}function w(t){return t.dataset.original?t.dataset.original:"A"===t.parentNode.tagName?t.parentNode.getAttribute("href"):null}function O(t,e,n){!function(t){var e=S.transitionProp,n=S.transformProp;if(t.transition){var i=t.transition;delete t.transition,t[e]=i}if(t.transform){var r=t.transform;delete t.transform,t[n]=r}}(e);var i=t.style,r={};for(var o in e)n&&(r[o]=i[o]||""),i[o]=e[o];return r}var S={transitionProp:"transition",transEndEvent:"transitionend",transformProp:"transform",transformCssProp:"transform"},x=S.transformCssProp,j=S.transEndEvent,P=function(){},k={enableGrab:!0,preloadImage:!1,closeOnWindowResize:!0,transitionDuration:.4,transitionTimingFunction:"cubic-bezier(0.4, 0, 0, 1)",bgColor:"rgb(255, 255, 255)",bgOpacity:1,scaleBase:1,scaleExtra:.5,scrollThreshold:40,zIndex:998,customSize:null,onOpen:P,onClose:P,onGrab:P,onMove:P,onRelease:P,onBeforeOpen:P,onBeforeClose:P,onBeforeGrab:P,onBeforeRelease:P,onImageLoading:P,onImageLoaded:P},C={init:function(t){var e,n;e=this,n=t,Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){e[t]=e[t].bind(n)}))},click:function(t){if(t.preventDefault(),E(t))return window.open(this.target.srcOriginal||t.currentTarget.src,"_blank");this.shown?this.released?this.close():this.release():this.open(t.currentTarget)},scroll:function(){var t=document.documentElement||document.body.parentNode||document.body,e=window.pageXOffset||t.scrollLeft,n=window.pageYOffset||t.scrollTop;null===this.lastScrollPosition&&(this.lastScrollPosition={x:e,y:n});var i=this.lastScrollPosition.x-e,r=this.lastScrollPosition.y-n,o=this.options.scrollThreshold;(Math.abs(r)>=o||Math.abs(i)>=o)&&(this.lastScrollPosition=null,this.close())},keydown:function(t){(function(t){var e=t.key||t.code;return"Escape"===e||27===t.keyCode})(t)&&(this.released?this.close():this.release(this.close))},mousedown:function(t){if(T(t)&&!E(t)){t.preventDefault();var e=t.clientX,n=t.clientY;this.pressTimer=setTimeout(function(){this.grab(e,n)}.bind(this),200)}},mousemove:function(t){this.released||this.move(t.clientX,t.clientY)},mouseup:function(t){T(t)&&!E(t)&&(clearTimeout(this.pressTimer),this.released?this.close():this.release())},touchstart:function(t){t.preventDefault();var e=t.touches[0],n=e.clientX,i=e.clientY;this.pressTimer=setTimeout(function(){this.grab(n,i)}.bind(this),200)},touchmove:function(t){if(!this.released){var e=t.touches[0],n=e.clientX,i=e.clientY;this.move(n,i)}},touchend:function(t){(function(t){t.targetTouches.length})(t)||(clearTimeout(this.pressTimer),this.released?this.close():this.release())},clickOverlay:function(){this.close()},resizeWindow:function(){this.close()}};function T(t){return 0===t.button}function E(t){return t.metaKey||t.ctrlKey}var z={init:function(t){this.el=document.createElement("div"),this.instance=t,this.parent=document.body,O(this.el,{position:"fixed",top:0,left:0,right:0,bottom:0,opacity:0}),this.updateStyle(t.options),g(this.el,"click",t.handler.clickOverlay.bind(t))},updateStyle:function(t){O(this.el,{zIndex:t.zIndex,backgroundColor:t.bgColor,transition:"opacity\n "+t.transitionDuration+"s\n "+t.transitionTimingFunction})},insert:function(){this.parent.appendChild(this.el)},remove:function(){this.parent.removeChild(this.el)},fadeIn:function(){this.el.offsetWidth,this.el.style.opacity=this.instance.options.bgOpacity},fadeOut:function(){this.el.style.opacity=0}},R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A=function(){function t(t,e){for(var n=0;nd||f>v)return{x:d,y:v}}return{x:f,y:f}}};function q(){var t=document.documentElement;return{x:Math.min(t.clientWidth,window.innerWidth)/2,y:Math.min(t.clientHeight,window.innerHeight)/2}}function B(t,e,n){["mousedown","mousemove","mouseup","touchstart","touchmove","touchend"].forEach((function(i){g(t,i,e[i],n)}))}const D=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.target=Object.create(I),this.overlay=Object.create(z),this.handler=Object.create(C),this.body=document.body,this.shown=!1,this.lock=!1,this.released=!0,this.lastScrollPosition=null,this.pressTimer=null,this.options=W({},k,e),this.overlay.init(this),this.handler.init(this)}return A(t,[{key:"listen",value:function(t){if("string"==typeof t)for(var e=document.querySelectorAll(t),n=e.length;n--;)this.listen(e[n]);else"IMG"===t.tagName&&(t.style.cursor=d,g(t,"click",this.handler.click),this.options.preloadImage&&_(w(t)));return this}},{key:"config",value:function(t){return t?(W(this.options,t),this.overlay.updateStyle(this.options),this):this.options}},{key:"open",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.onOpen;if(!this.shown&&!this.lock){var i="string"==typeof t?document.querySelector(t):t;if("IMG"===i.tagName){if(this.options.onBeforeOpen(i),this.target.init(i,this),!this.options.preloadImage){var r=this.target.srcOriginal;null!=r&&(this.options.onImageLoading(i),_(r,this.options.onImageLoaded))}return this.shown=!0,this.lock=!0,this.target.zoomIn(),this.overlay.insert(),this.overlay.fadeIn(),g(document,"scroll",this.handler.scroll),g(document,"keydown",this.handler.keydown),this.options.closeOnWindowResize&&g(window,"resize",this.handler.resizeWindow),g(i,j,(function t(){g(i,j,t,!1),e.lock=!1,e.target.upgradeSource(),e.options.enableGrab&&B(document,e.handler,!0),n(i)})),this}}}},{key:"close",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.onClose;if(this.shown&&!this.lock){var n=this.target.el;return this.options.onBeforeClose(n),this.lock=!0,this.body.style.cursor=p,this.overlay.fadeOut(),this.target.zoomOut(),g(document,"scroll",this.handler.scroll,!1),g(document,"keydown",this.handler.keydown,!1),this.options.closeOnWindowResize&&g(window,"resize",this.handler.resizeWindow,!1),g(n,j,(function i(){g(n,j,i,!1),t.shown=!1,t.lock=!1,t.target.downgradeSource(),t.options.enableGrab&&B(document,t.handler,!1),t.target.restoreCloseStyle(),t.overlay.remove(),e(n)})),this}}},{key:"grab",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.options.scaleExtra,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.options.onGrab;if(this.shown&&!this.lock){var r=this.target.el;return this.options.onBeforeGrab(r),this.released=!1,this.target.grab(t,e,n),g(r,j,(function t(){g(r,j,t,!1),i(r)})),this}}},{key:"move",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.options.scaleExtra,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.options.onMove;if(this.shown&&!this.lock){this.released=!1,this.body.style.cursor=b,this.target.move(t,e,n);var r=this.target.el;return g(r,j,(function t(){g(r,j,t,!1),i(r)})),this}}},{key:"release",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.onRelease;if(this.shown&&!this.lock){var n=this.target.el;return this.options.onBeforeRelease(n),this.lock=!0,this.body.style.cursor=p,this.target.restoreOpenStyle(),g(n,j,(function i(){g(n,j,i,!1),t.lock=!1,t.released=!0,e(n)})),this}}}]),t}();function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function M(t,e){for(var n=0;n{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}!function(e,n){function i(t,n){this.element=t,this.settings=e.extend({},e.fn.rate.settings,n),this.set_faces={},this.build()}e.fn.textWidth=function(){var t=e(""+e(this).html()+"");t.css("font-size",e(this).css("font-size")).hide(),t.prependTo("body");var n=t.width();if(t.remove(),0==n){var i=0;return e(this).eq(0).children().each((function(){i+=e(this).textWidth()})),i}return n},e.fn.textHeight=function(){var t=e(""+e(this).html()+"");t.css("font-size",e(this).css("font-size")).hide(),t.prependTo("body");var n=t.height();return t.remove(),n},Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},String.prototype.getCodePointLength=function(){return this.length-this.split(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g).length+1},String.fromCodePoint=function(){for(var t=Array.prototype.slice.call(arguments),e=t.length;e-- >0;){var n=t[e]-65536;n>=0&&t.splice(e,1,55296+(n>>10),56320+(1023&n))}return String.fromCharCode.apply(null,t)},e.fn.rate=function(n){if(void 0===n||"object"===t(n))return this.each((function(){e.data(this,"rate")||e.data(this,"rate",new i(this,n))}));if("string"==typeof n){var r,o=arguments;return this.each((function(){var t=e.data(this,"rate");t instanceof i&&"function"==typeof t[n]&&(r=t[n].apply(t,Array.prototype.slice.call(o,1))),"destroy"===n&&(e(t.element).off(),e.data(this,"rate",null))})),void 0!==r?r:this}},i.prototype.build=function(){this.layers={},this.value=0,this.raise_select_layer=!1,this.settings.initial_value&&(this.value=this.settings.initial_value),e(this.element).attr("data-rate-value")&&(this.value=e(this.element).attr("data-rate-value"));var t=this.value/this.settings.max_value*100;if("string"==typeof this.settings.symbols[this.settings.selected_symbol_type]){var n=this.settings.symbols[this.settings.selected_symbol_type];this.settings.symbols[this.settings.selected_symbol_type]={},this.settings.symbols[this.settings.selected_symbol_type].base=n,this.settings.symbols[this.settings.selected_symbol_type].selected=n,this.settings.symbols[this.settings.selected_symbol_type].hover=n}var i=this.addLayer("base-layer",100,this.settings.symbols[this.settings.selected_symbol_type].base,!0),r=this.addLayer("select-layer",t,this.settings.symbols[this.settings.selected_symbol_type].selected,!0),o=this.addLayer("hover-layer",0,this.settings.symbols[this.settings.selected_symbol_type].hover,!1);this.layers.base_layer=i,this.layers.select_layer=r,this.layers.hover_layer=o,e(this.element).on("mousemove",e.proxy(this.hover,this)),e(this.element).on("click",e.proxy(this.select,this)),e(this.element).on("mouseleave",e.proxy(this.mouseout,this)),e(this.element).css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}),this.settings.hasOwnProperty("update_input_field_name")&&this.settings.update_input_field_name.val(this.value)},i.prototype.addLayer=function(t,n,i,r){for(var o="
",s=0;s"+i[s]+""):(this.settings.convert_to_utf8&&(i=String.fromCodePoint(i)),o+=""+i+"");var a=e(o+="
").addClass("rate-"+t).appendTo(this.element);return e(a).css({width:n+"%",height:e(a).children().eq(0).textHeight(),overflow:"hidden",position:"absolute",top:0,display:r?"block":"none","white-space":"nowrap"}),e(this.element).css({width:e(a).textWidth()+"px",height:e(a).height(),position:"relative",cursor:this.settings.cursor}),a},i.prototype.updateServer=function(){null!=this.settings.url&&e.ajax({url:this.settings.url,type:this.settings.ajax_method,data:e.extend({},{value:this.getValue()},this.settings.additional_data),success:e.proxy((function(t){e(this.element).trigger("updateSuccess",[t])}),this),error:e.proxy((function(t,n,i){e(this.element).trigger("updateError",[t,n,i])}),this)})},i.prototype.getValue=function(){return this.value},i.prototype.hover=function(t){var n=parseInt(e(this.element).css("padding-left").replace("px","")),i=t.pageX-e(this.element).offset().left-n,r=this.toValue(i,!0);if(r!=this.value&&(this.raise_select_layer=!1),!this.raise_select_layer&&!this.settings.readonly){var o=this.toWidth(r);if(this.layers.select_layer.css({display:"none"}),this.settings.only_select_one_symbol){var s=Math.floor(r);this.layers.hover_layer.css({width:"100%",display:"block"}),this.layers.hover_layer.children("span").css({visibility:"hidden"}),this.layers.hover_layer.children("span").eq(0!=s?s-1:0).css({visibility:"visible"})}else this.layers.hover_layer.css({width:o+"%",display:"block"})}},i.prototype.select=function(t){if(!this.settings.readonly){this.getValue();var n=parseInt(e(this.element).css("padding-left").replace("px","")),i=t.pageX-e(this.element).offset().left-n,r=this.toWidth(this.toValue(i,!0));this.setValue(this.toValue(r)),this.raise_select_layer=!0}},i.prototype.mouseout=function(){this.layers.hover_layer.css({display:"none"}),this.layers.select_layer.css({display:"block"})},i.prototype.toWidth=function(t){return t/this.settings.max_value*100},i.prototype.toValue=function(t,e){var n,i=(n=e?t/this.layers.base_layer.textWidth()*this.settings.max_value:t/100*this.settings.max_value)/this.settings.step_size;return i-Math.floor(i)<5e-5&&(n=Math.round(n/this.settings.step_size)*this.settings.step_size),n=(n=Math.ceil(n/this.settings.step_size)*this.settings.step_size)>this.settings.max_value?this.settings.max_value:n},i.prototype.getElement=function(t,n){return e(this.element).find(".rate-"+t+" span").eq(n-1)},i.prototype.getLayers=function(){return this.layers},i.prototype.setFace=function(t,e){this.set_faces[t]=e},i.prototype.setAdditionalData=function(t){this.settings.additional_data=t},i.prototype.getAdditionalData=function(){return this.settings.additional_data},i.prototype.removeFace=function(t){delete this.set_faces[t]},i.prototype.setValue=function(t){if(!this.settings.readonly){t<0?t=0:t>this.settings.max_value&&(t=this.settings.max_value);var n=this.getValue();this.value=t,e(this.element).trigger("change",{from:n,to:this.value}),e(this.element).find(".rate-face").remove(),e(this.element).find("span").css({visibility:"visible"});var i=Math.ceil(this.value);if(this.set_faces.hasOwnProperty(i)){var r="
"+this.set_faces[i]+"
",o=this.getElement("base-layer",i),s=this.getElement("select-layer",i),a=this.getElement("hover-layer",i),l=o.textWidth()*(i-1)+(o.textWidth()-e(r).textWidth())/2;e(r).appendTo(this.element).css({display:"inline-block",position:"absolute",left:l}).addClass("rate-face"),o.css({visibility:"hidden"}),s.css({visibility:"hidden"}),a.css({visibility:"hidden"})}if(this.settings.only_select_one_symbol)c=this.toWidth(this.settings.max_value),this.layers.select_layer.css({display:"block",width:c+"%",height:this.layers.base_layer.css("height")}),this.layers.hover_layer.css({display:"none",height:this.layers.base_layer.css("height")}),this.layers.select_layer.children("span").css({visibility:"hidden"}),this.layers.select_layer.children("span").eq(0!=i?i-1:0).css({visibility:"visible"});else{var c=this.toWidth(this.value);this.layers.select_layer.css({display:"block",width:c+"%",height:this.layers.base_layer.css("height")}),this.layers.hover_layer.css({display:"none",height:this.layers.base_layer.css("height")})}e(this.element).attr("data-rate-value",this.value),this.settings.change_once&&(this.settings.readonly=!0),this.updateServer(),e(this.element).trigger("afterChange",{from:n,to:this.value}),this.settings.hasOwnProperty("update_input_field_name")&&this.settings.update_input_field_name.val(this.value)}},i.prototype.increment=function(){this.setValue(this.getValue()+this.settings.step_size)},i.prototype.decrement=function(){this.setValue(this.getValue()-this.settings.step_size)},e.fn.rate.settings={max_value:5,step_size:.5,initial_value:0,symbols:{utf8_star:{base:"☆",hover:"★",selected:"★"},utf8_hexagon:{base:"⬡",hover:"⬢",selected:"⬢"},hearts:"♥",fontawesome_beer:'',fontawesome_star:{base:'',hover:'',selected:''},utf8_emoticons:{base:[128549,128531,128530,128516],hover:[128549,128531,128530,128516],selected:[128549,128531,128530,128516]}},selected_symbol_type:"utf8_star",convert_to_utf8:!1,cursor:"default",readonly:!1,change_once:!1,only_select_one_symbol:!1,ajax_method:"POST",additional_data:{}}}(jQuery,window)})(); \ No newline at end of file