Import legacy nurinda.co.id website
This commit is contained in:
1 parent
3f59bb9038
commit
6e21646ac4
13389 files changed
+3246690
No files matched your search
@@ -0,0 +1,14 @@
|
||||
(function(){function o(n){var i=e;n&&(e[n]||(e[n]={}),i=e[n]);if(!i.define||!i.define.packaged)t.original=i.define,i.define=t,i.define.packaged=!0;if(!i.require||!i.require.packaged)r.original=i.require,i.require=r,i.require.packaged=!0}var ACE_NAMESPACE="",e=function(){return this}();!e&&typeof window!="undefined"&&(e=window);if(!ACE_NAMESPACE&&typeof requirejs!="undefined")return;var t=function(e,n,r){if(typeof e!="string"){t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=n),t.modules[e]||(t.payloads[e]=r,t.modules[e]=null)};t.modules={},t.payloads={};var n=function(e,t,n){if(typeof t=="string"){var i=s(e,t);if(i!=undefined)return n&&n(),i}else if(Object.prototype.toString.call(t)==="[object Array]"){var o=[];for(var u=0,a=t.length;u<a;++u){var f=s(e,t[u]);if(f==undefined&&r.original)return;o.push(f)}return n&&n.apply(null,o)||!0}},r=function(e,t){var i=n("",e,t);return i==undefined&&r.original?r.original.apply(this,arguments):i},i=function(e,t){if(t.indexOf("!")!==-1){var n=t.split("!");return i(e,n[0])+"!"+i(e,n[1])}if(t.charAt(0)=="."){var r=e.split("/").slice(0,-1).join("/");t=r+"/"+t;while(t.indexOf(".")!==-1&&s!=t){var s=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},s=function(e,r){r=i(e,r);var s=t.modules[r];if(!s){s=t.payloads[r];if(typeof s=="function"){var o={},u={id:r,uri:"",exports:o,packaged:!0},a=function(e,t){return n(r,e,t)},f=s(a,o,u);o=f||u.exports,t.modules[r]=o,delete t.payloads[r]}s=t.modules[r]=o||s}return s};o(ACE_NAMESPACE)})(),define("ace/lib/regexp",["require","exports","module"],function(e,t,n){"use strict";function o(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function u(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t,n);for(var r=n||0;r<e.length;r++)if(e[r]===t)return r;return-1}var r={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},i=r.exec.call(/()??/,"")[1]===undefined,s=function(){var e=/^/g;return r.test.call(e,""),!e.lastIndex}();if(s&&i)return;RegExp.prototype.exec=function(e){var t=r.exec.apply(this,arguments),n,a;if(typeof e=="string"&&t){!i&&t.length>1&&u(t,"")>-1&&(a=RegExp(this.source,r.replace.call(o(this),"g","")),r.replace.call(e.slice(t.index),a,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===undefined&&(t[e]=undefined)}));if(this._xregexp&&this._xregexp.captureNames)for(var f=1;f<t.length;f++)n=this._xregexp.captureNames[f-1],n&&(t[n]=t[f]);!s&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--}return t},s||(RegExp.prototype.test=function(e){var t=r.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t})}),define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=u.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),a=e+o,f=a+s-o,l=n-a,c=n-o;if(f<a)for(var h=0;h<l;++h)this[f+h]=this[a+h];else if(f>a)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var v=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?v.apply(this,[e===void 0?Line truncated
|
||||
(function() {
|
||||
window.require(["ace/ace"], function(a) {
|
||||
if (a) {
|
||||
a.config.init(true);
|
||||
a.define = window.define;
|
||||
}
|
||||
if (!window.ace)
|
||||
window.ace = a;
|
||||
for (var key in a) if (a.hasOwnProperty(key))
|
||||
window.ace[key] = a[key];
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=e("../lib/lang"),s=e("../lib/event"),o=".ace_search {background-color: #ddd;border: 1px solid #cbcbcb;border-top: 0 none;max-width: 325px;overflow: hidden;margin: 0;padding: 4px;padding-right: 6px;padding-bottom: 0;position: absolute;top: 0px;z-index: 99;white-space: normal;}.ace_search.left {border-left: 0 none;border-radius: 0px 0px 5px 0px;left: 0;}.ace_search.right {border-radius: 0px 0px 0px 5px;border-right: 0 none;right: 0;}.ace_search_form, .ace_replace_form {border-radius: 3px;border: 1px solid #cbcbcb;float: left;margin-bottom: 4px;overflow: hidden;}.ace_search_form.ace_nomatch {outline: 1px solid red;}.ace_search_field {background-color: white;color: black;border-right: 1px solid #cbcbcb;border: 0 none;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;float: left;height: 22px;outline: 0;padding: 0 7px;width: 214px;margin: 0;}.ace_searchbtn,.ace_replacebtn {background: #fff;border: 0 none;border-left: 1px solid #dcdcdc;cursor: pointer;float: left;height: 22px;margin: 0;position: relative;}.ace_searchbtn:last-child,.ace_replacebtn:last-child {border-top-right-radius: 3px;border-bottom-right-radius: 3px;}.ace_searchbtn:disabled {background: none;cursor: default;}.ace_searchbtn {background-position: 50% 50%;background-repeat: no-repeat;width: 27px;}.ace_searchbtn.prev {background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); }.ace_searchbtn.next {background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); }.ace_searchbtn_close {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;border-radius: 50%;border: 0 none;color: #656565;cursor: pointer;float: right;font: 16px/16px Arial;height: 14px;margin: 5px 1px 9px 5px;padding: 0;text-align: center;width: 14px;}.ace_searchbtn_close:hover {background-color: #656565;background-position: 50% 100%;color: white;}.ace_replacebtn.prev {width: 54px}.ace_replacebtn.next {width: 27px}.ace_button {margin-left: 2px;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;overflow: hidden;opacity: 0.7;border: 1px solid rgba(100,100,100,0.23);padding: 1px;-moz-box-sizing: border-box;box-sizing: border-box;color: black;}.ace_button:hover {background-color: #eee;opacity:1;}.ace_button:active {background-color: #ddd;}.ace_button.checked {border-color: #3399ff;opacity:1;}.ace_search_options{margin-bottom: 3px;text-align: right;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;}",u=e("../keyboard/hash_handler").HashHandler,a=e("../lib/keys");r.importCssString(o,"ace_searchbox");var f='<div class="ace_search right"> <button type="button" action="hide" class="ace_searchbtn_close"></button> <div class="ace_search_form"> <input class="ace_search_field" placeholder="Search for" spellcheck="false"></input> <button type="button" action="findNext" class="ace_searchbtn next"></button> <button type="button" action="findPrev" class="ace_searchbtn prev"></button> <button type="button" action="findAll" class="ace_searchbtn" title="Alt-Enter">All</button> </div> <div class="ace_replace_form"> <input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input> <button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button> <button type="button" action="replaceAll" class="ace_replacebtn">All</button> </div> <div class="ace_search_options"> <span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span> <span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span> <span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span> </div></div>'.replace(/>\s+/g,">"),l=function(e,t,n){var i=r.createElement("div");i.innerHTML=f,this.element=i.firstChild,this.$init(),this.setEditor(e)};(function(){this.setEditor=function(e){e.searchBox=this,e.container.appendChild(this.element),this.editor=e},this.$initElements=function(e){this.searchBox=e.querySelector(".ace_search_form"),this.replaceBox=e.querySelector(".ace_replace_form"),this.searchOptions=e.querySelectLine truncated
|
||||
(function() {
|
||||
window.require(["ace/ext/searchbox"], function() {});
|
||||
})();
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./text_highlight_rules").TextHighlightRules,o=t.supportType="align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|min-height|min-width|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index",u=t.supportFunction="rgb|rgba|url|attr|counter|counters",a=t.supportConstant="absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero",f=t.supportConstantColor="aqua|black|blue|fuchsia|gray|green|lime|marooLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},s.getTagRule(),{defaultToken:"comment.doc",caseInsensitive:!0}]}};r.inherits(s,i),s.getTagRule=function(e){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},s.getStartRule=function(e){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:e}},s.getEndRule=function(e){return{token:"comment.doc",regex:"\\*\\/",next:e}},t.DocCommentHighlightRules=s}),define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";function a(){var e=o.replace("\\d","\\d\\-"),t={onMatch:function(e,t,n){var r=e.charAt(1)=="/"?2:1;if(r==1)t!=this.nextState?n.unshift(this.next,this.nextState,0):n.unshift(this.next),n[2]++;else if(r==2&&t==this.nextState){n[1]--;if(!n[1]||n[1]<0)n.shift(),n.shift()}return[{type:"meta.tag.punctuation."+(r==1?"":"end-")+"tag-open.xml",value:e.slice(0,r)},{type:"meta.tag.tag-name.xml",value:e.substr(r)}]},regex:"</?"+e+"",next:"jsxAttributes",nextState:"jsx"};this.$rules.start.unshift(t);var n={regex:"{",token:"paren.quasi.start",push:"start"};this.$rules.jsx=[n,t,{include:"reference"},{defaultToken:"string"}],this.$rules.jsxAttributes=[{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",onMatch:function(e,t,n){return t==n[0]&&n.shift(),e.length==2&&(n[0]==this.nextState&&n[1]--,(!n[1]||n[1]<0)&&n.splice(0,2)),this.next=n[0]||"start",[{type:this.token,value:e}]},nextState:"jsx"},n,f("jsxAttributes"),{token:"entity.other.attribute-name.xml",regex:e},{token:"keyword.operator.attribute-equals.xml",regex:"="},{token:"text.tag-whitespace.xml",regex:"\\s+"},{token:"string.attribute-value.xml",regex:"'",stateName:"jsx_attr_q",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',stateName:"jsx_attr_qq",push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},t],this.$rules.reference=[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}]}function f(e){return[{token:"comment",regex:/\/\*/,next:[i.getTagRule(),{token:"comment",regex:"\\*\\/",next:e||"pop"},{defaultToken:"comment",caseInsensitive:!0}]},{token:"comment",regex:"\\/\\/",next:[i.getTagRule(),{token:"comment",regex:"$|^",next:e||"pop"},{defaultToken:"comment",caseInsensitive:!0}]}]}var r=e("../lib/oop"),i=e("./doc_comment_highlight_rules").DocCommentHighlightRules,s=e("./text_highlight_rules").TextHighlightRules,o="[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*",u=function(e){var t=this.createKeywordMapper({"variable.language":"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",keyword:"const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static","storage.type":"const|let|var|function","constant.language":"null|Infinity|NaN|undefined","support.function":"alert","constant.language.boolean":"true|false"},"identifier"),n="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void",r="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)";this.$rules={no_regex:[i.getStartRule("doc-start"),f("no_regex"),{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/},{token:["storage.type","punctuation.operator","support.function","punctuation.operator","entity.name.function","text","keyword.operator"],regex:"("+o+")(\\.)(prototype)(\\.)("+o+")(\\s*)(=)",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{toLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
ace.define("ace/theme/usof",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!1,t.cssClass="ace-dawn",t.cssText=".ace-dawn .ace_gutter {background: #f1f1f1;color: #999}.ace-dawn {background-color: #f8f8f8;color: #666}.ace-dawn .ace_cursor {color: #000000}.ace-dawn .ace_marker-layer .ace_selection {background: rgba(30, 30, 30, 0.15)}.ace-dawn .ace_marker-layer .ace_active-line {background: rgba(36, 99, 180, 0.08)}.ace-dawn .ace_gutter-active-line {background-color : #e2e2e2}.ace-dawn .ace_keyword,.ace-dawn .ace_meta {color: #6253ad}.ace-dawn .ace_constant,.ace-dawn .ace_constant.ace_character,.ace-dawn .ace_constant.ace_character.ace_escape,.ace-dawn .ace_constant.ace_other {color: #6253ad}.ace-dawn .ace_support,.ace-dawn .ace_entity {color: #5397db}.ace-dawn .ace_support.ace_constant {color: #6253ad}.ace-dawn .ace_list,.ace-dawn .ace_markup.ace_list,.ace-dawn .ace_support.ace_function {color: #6253ad}.ace-dawn .ace_string {color: #38425c}.ace-dawn .ace_string.ace_regexp {color: #5397db}.ace-dawn .ace_comment {color: #999}.ace-dawn .ace_variable,.ace-dawn .ace_string.ace_attribute-value {color: #009975}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)})
|
||||
@@ -0,0 +1 @@
|
||||
"no use strict";(function(e){function t(e,t){var n=e,r="";while(n){var i=t[n];if(typeof i=="string")return i+r;if(i)return i.location.replace(/\/*$/,"/")+(r||i.main||i.name);if(i===!1)return"";var s=n.lastIndexOf("/");if(s===-1)break;r=n.substr(s)+r,n=n.slice(0,s)}return e}if(typeof e.window!="undefined"&&e.document)return;if(e.require&&e.define)return;e.console||(e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console),e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){postMessage({type:"error",data:{message:e,data:i.data,file:t,line:n,col:r,stack:i.stack}})},e.normalizeModule=function(t,n){if(n.indexOf("!")!==-1){var r=n.split("!");return e.normalizeModule(t,r[0])+"!"+e.normalizeModule(t,r[1])}if(n.charAt(0)=="."){var i=t.split("/").slice(0,-1).join("/");n=(i?i+"/":"")+n;while(n.indexOf(".")!==-1&&s!=n){var s=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},e.require=function(r,i){i||(i=r,r=null);if(!i.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");i=e.normalizeModule(r,i);var s=e.require.modules[i];if(s)return s.initialized||(s.initialized=!0,s.exports=s.factory().exports),s.exports;if(!e.require.tlns)return console.log("unable to load "+i);var o=t(i,e.require.tlns);return o.slice(-3)!=".js"&&(o+=".js"),e.require.id=i,e.require.modules[i]={},importScripts(o),e.require(r,i)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!="string"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id);if(typeof r!="function"){e.require.modules[t]={exports:r,initialized:!0};return}n.length||(n=["require","exports","module"]);var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case"require":return i;case"exports":return e.exports;case"module":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},require.tlns={},e.initBaseUrls=function(t){for(var n in t)require.tlns[n]=t[n]},e.initSender=function(){var n=e.require("ace/lib/event_emitter").EventEmitter,r=e.require("ace/lib/oop"),i=function(){};return function(){r.implement(this,n),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(i.prototype),new i};var n=e.main=null,r=e.sender=null;e.onmessage=function(t){var i=t.data;if(i.event&&r)r._signal(i.event,i.data);else if(i.command)if(n[i.command])n[i.command].apply(n,i.args);else{if(!e[i.command])throw new Error("Unknown command:"+i.command);e[i.command].apply(e,i.args)}else if(i.init){e.initBaseUrls(i.tlns),require("ace/lib/es5-shim"),r=e.sender=e.initSender();var s=require(i.module)[i.classname];n=e.main=new s(r)}}})(this),define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define("ace/lib/lang",["require","exports","module"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]=="object"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function s(e){if(typeof e!="object"||!e)return e;var t;if(Array.isArray(e)){t=[];for(var n=0;n<e.length;n++)t[n]=s(e[n]);return t}if(Object.prototype.toString.call(e)!=="[object Object]")return e;t={};for(var n in e)t[n]=s(e[n]);return t},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
"no use strict";(function(e){function t(e,t){var n=e,r="";while(n){var i=t[n];if(typeof i=="string")return i+r;if(i)return i.location.replace(/\/*$/,"/")+(r||i.main||i.name);if(i===!1)return"";var s=n.lastIndexOf("/");if(s===-1)break;r=n.substr(s)+r,n=n.slice(0,s)}return e}if(typeof e.window!="undefined"&&e.document)return;if(e.require&&e.define)return;e.console||(e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console),e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){postMessage({type:"error",data:{message:e,data:i.data,file:t,line:n,col:r,stack:i.stack}})},e.normalizeModule=function(t,n){if(n.indexOf("!")!==-1){var r=n.split("!");return e.normalizeModule(t,r[0])+"!"+e.normalizeModule(t,r[1])}if(n.charAt(0)=="."){var i=t.split("/").slice(0,-1).join("/");n=(i?i+"/":"")+n;while(n.indexOf(".")!==-1&&s!=n){var s=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},e.require=function(r,i){i||(i=r,r=null);if(!i.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");i=e.normalizeModule(r,i);var s=e.require.modules[i];if(s)return s.initialized||(s.initialized=!0,s.exports=s.factory().exports),s.exports;if(!e.require.tlns)return console.log("unable to load "+i);var o=t(i,e.require.tlns);return o.slice(-3)!=".js"&&(o+=".js"),e.require.id=i,e.require.modules[i]={},importScripts(o),e.require(r,i)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!="string"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id);if(typeof r!="function"){e.require.modules[t]={exports:r,initialized:!0};return}n.length||(n=["require","exports","module"]);var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case"require":return i;case"exports":return e.exports;case"module":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},require.tlns={},e.initBaseUrls=function(t){for(var n in t)require.tlns[n]=t[n]},e.initSender=function(){var n=e.require("ace/lib/event_emitter").EventEmitter,r=e.require("ace/lib/oop"),i=function(){};return function(){r.implement(this,n),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(i.prototype),new i};var n=e.main=null,r=e.sender=null;e.onmessage=function(t){var i=t.data;if(i.event&&r)r._signal(i.event,i.data);else if(i.command)if(n[i.command])n[i.command].apply(n,i.args);else{if(!e[i.command])throw new Error("Unknown command:"+i.command);e[i.command].apply(e,i.args)}else if(i.init){e.initBaseUrls(i.tlns),require("ace/lib/es5-shim"),r=e.sender=e.initSender();var s=require(i.module)[i.classname];n=e.main=new s(r)}}})(this),define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define("ace/lib/lang",["require","exports","module"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]=="object"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function s(e){if(typeof e!="object"||!e)return e;var t;if(Array.isArray(e)){t=[];for(var n=0;n<e.length;n++)t[n]=s(e[n]);return t}if(Object.prototype.toString.call(e)!=="[object Object]")return e;t={};for(var n in e)t[n]=s(e[n]);return t},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k<a.length;k++)if("."===(m=a[k]))a.splice(k,1),k-=1;else if(".."===m){if(0===k||1===k&&".."===a[2]||".."===a[k-1])continue;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o<c.length;o+=1)if(n=p(c[o],t),"require"===(k=n.f))w[o]=q.require(a);else if("exports"===k)w[o]=q.exports(a),v=!0;else if("module"===k)h=w[o]=q.module(a);else if(e(r,k)||e(s,k)||e(u,k))w[o]=j(k);else{if(!n.p)throw new Error(a+" missing "+k);n.p.load(n.n,g(f,!0),i(k),{}),w[o]=r[k]}m=d?d.apply(r[a],w):void 0,a&&(h&&h.exports!==b&&h.exports!==r[a]?r[a]=h.exports:m===b&&v||(r[a]=m))}else a&&(r[a]=d)},a=c=o=function(a,c,d,e,f){if("string"==typeof a)return q[a]?q[a](c):j(p(a,l(c)).f);if(!a.splice){if(t=a,t.deps&&o(t.deps,t.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?n(b,a,c,d):setTimeout(function(){n(b,a,c,d)},4),o},o.config=function(a){return o(a)},a._defined=r,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(r,a)||e(s,a)||(s[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){"function"==typeof b[d]&&("constructor"!==d&&c.push(d))}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){return Array.prototype.unshift.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]Line truncated
|
||||
@@ -0,0 +1,789 @@
|
||||
/*
|
||||
* usof_colpick Color Picker
|
||||
* Copyright 2013 Jose Vargas. Licensed under GPL license.
|
||||
* Based on Stefan Petre's Color Picker www.eyecon.ro, dual licensed under the MIT and GPL licenses
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
var usof_colpick = function() {
|
||||
var
|
||||
tpl = '<div class="usof_colpick">' +
|
||||
'<div class="usof_colpick_color">' +
|
||||
'<div class="usof_colpick_color_overlay1"><div class="usof_colpick_color_overlay2">' +
|
||||
'<div class="usof_colpick_selector_outer"><div class="usof_colpick_selector_inner"></div></div>' +
|
||||
'</div></div>' +
|
||||
'</div>' +
|
||||
'<div class="usof_colpick_hue"><div class="usof_colpick_hue_arrs"></div></div>' +
|
||||
'<div class="usof_colpick_alpha"><div class="usof_colpick_alpha_arrs"></div></div>' +
|
||||
'<div class="usof_colpick_gradient"></div>' +
|
||||
'<div class="usof_colpick_hex_field"><div class="usof_colpick_field_letter">#</div><input type="text" maxlength="6" size="6" /></div>' +
|
||||
// Rgb
|
||||
'<div class="usof_colpick_rgb_r usof_colpick_field">' +
|
||||
'<div class="usof_colpick_field_letter">R</div><input type="text" maxlength="3" size="3" />' +
|
||||
'</div>' +
|
||||
// rGb
|
||||
'<div class="usof_colpick_rgb_g usof_colpick_field">' +
|
||||
'<div class="usof_colpick_field_letter">G</div><input type="text" maxlength="3" size="3" />' +
|
||||
'</div>' +
|
||||
// rgB
|
||||
'<div class="usof_colpick_rgb_b usof_colpick_field">' +
|
||||
'<div class="usof_colpick_field_letter">B</div><input type="text" maxlength="3" size="3" />' +
|
||||
'</div>' +
|
||||
// Hsb
|
||||
'<div class="usof_colpick_hsb_h usof_colpick_field">' +
|
||||
'<div class="usof_colpick_field_letter">H</div><input type="text" maxlength="3" size="3" />' +
|
||||
'</div>' +
|
||||
// hSb
|
||||
'<div class="usof_colpick_hsb_s usof_colpick_field">' +
|
||||
'<div class="usof_colpick_field_letter">S</div><input type="text" maxlength="3" size="3" />' +
|
||||
'</div>' +
|
||||
// hsB
|
||||
'<div class="usof_colpick_hsb_b usof_colpick_field">' +
|
||||
'<div class="usof_colpick_field_letter">B</div><input type="text" maxlength="3" size="3" />' +
|
||||
'</div>' +
|
||||
// Alpha
|
||||
'<div class="usof_colpick_field"><input type="text" maxlength="3" size="3" /></div>' +
|
||||
'</div>',
|
||||
defaults = {
|
||||
showEvent: 'focus',
|
||||
onShow: function() {
|
||||
},
|
||||
onBeforeShow: function() {
|
||||
},
|
||||
onHide: function() {
|
||||
},
|
||||
onChange: function() {
|
||||
},
|
||||
onSubmit: function() {
|
||||
},
|
||||
colorScheme: 'light',
|
||||
livePreview: true,
|
||||
flat: false,
|
||||
layout: 'full',
|
||||
height: 156
|
||||
},
|
||||
transparentImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMFJREFUeNrsVlsOhCAM7Jg9j97/GHChMTxcC9UPTNatif0AIxhmOlMqSMpIhBiG9k/y43gP+P8Bn/FPkIbiPZQhTRSafXDKoMDL4DNqWn7fNccMlAYF66ZE/8avBvu0qUG1sPvKLQOFlo0GigfvcVGI8cQbNr8plnlxehflPELlMbMhYDzu7zaluj1onM7GL0/sB+ic7pGBxcXu+QkuqhhrJasartXQ9iqPGtQKOO20lKscbtbAIAXk8J/HEYNVgAEAHShEyUuW684AAAAASUVORK5CYII=",
|
||||
//Fill the inputs of the plugin
|
||||
fillRGBAFields = function( hsba, cal ) {
|
||||
var rgb = hsbaToRgba( hsba );
|
||||
$( cal ).data( 'usof_colpick' ).fields
|
||||
.eq( 1 ).val( rgb.r ).end()
|
||||
.eq( 2 ).val( rgb.g ).end()
|
||||
.eq( 3 ).val( rgb.b ).end()
|
||||
.eq( 7 ).val( rgb.a ).end();
|
||||
},
|
||||
fillHSBAFields = function( hsba, cal ) {
|
||||
$( cal ).data( 'usof_colpick' ).fields
|
||||
.eq( 4 ).val( Math.round( hsba.h ) ).end()
|
||||
.eq( 5 ).val( Math.round( hsba.s ) ).end()
|
||||
.eq( 6 ).val( Math.round( hsba.b ) ).end()
|
||||
.eq( 7 ).val( hsba.a ).end();
|
||||
},
|
||||
fillHexFields = function( hsba, cal ) {
|
||||
$( cal ).data( 'usof_colpick' ).fields.eq( 0 ).val( hsbaToHex( hsba ) );
|
||||
},
|
||||
//Set the round selector position
|
||||
setSelector = function( hsba, cal ) {
|
||||
$( cal ).data( 'usof_colpick' ).selector.css( 'backgroundColor', hsbaToHex( {
|
||||
h: hsba.h,
|
||||
s: 100,
|
||||
b: 100
|
||||
} ) );
|
||||
$( cal ).data( 'usof_colpick' ).selectorIndic.css( {
|
||||
left: parseInt( $( cal ).data( 'usof_colpick' ).height * hsba.s / 100, 10 ),
|
||||
top: parseInt( $( cal ).data( 'usof_colpick' ).height * ( 100 - hsba.b ) / 100, 10 )
|
||||
} );
|
||||
},
|
||||
//Set the hue selector position
|
||||
setHue = function( hsba, cal ) {
|
||||
$( cal ).data( 'usof_colpick' ).hue.css( 'top', parseInt( $( cal ).data( 'usof_colpick' ).height - $( cal ).data( 'usof_colpick' ).height * hsba.h / 360, 10 ) );
|
||||
},
|
||||
// Set the alpha selector position
|
||||
setAlpha = function( hsba, cal ) {
|
||||
var usof_colpick = $( cal ).data( 'usof_colpick' ),
|
||||
rgba = hsbaToRgba( hsba );
|
||||
if ( hsba.a === undefined ) {
|
||||
hsba.a = 1.;
|
||||
}
|
||||
usof_colpick.alpha.css( 'top', parseInt( $( cal ).data( 'usof_colpick' ).height * ( 1. - hsba.a ) ) );
|
||||
var alphaStyle = 'background: linear-gradient(to bottom, rgb(' + rgba.r + ', ' + rgba.g + ', ' + rgba.b + ') 0%, ';
|
||||
alphaStyle += 'rgba(' + rgba.r + ', ' + rgba.g + ', ' + rgba.b + ', 0) 100%) repeat scroll 0% 0%, transparent url("';
|
||||
alphaStyle += transparentImage + '") repeat scroll 0% 0%/16px;';
|
||||
usof_colpick.alphaContainer.attr( 'style', alphaStyle )
|
||||
},
|
||||
//Set current and new colors
|
||||
setCurrentColor = function( hsba, cal ) {
|
||||
$( cal ).data( 'usof_colpick' ).currentColor.css( 'backgroundColor', hsbaToHex( hsba ) );
|
||||
},
|
||||
setNewColor = function( hsba, cal ) {
|
||||
$( cal ).data( 'usof_colpick' ).newColor.css( 'backgroundColor', hsbaToHex( hsba ) );
|
||||
},
|
||||
//Called when the new color is changed
|
||||
change = function( ev ) {
|
||||
var cal = $( this ).parent().parent(), col;
|
||||
if ( this.parentNode.className.indexOf( '_hex' ) > 0 ) {
|
||||
cal.data( 'usof_colpick' ).color = col = hexToHsba( fixHex( this.value ) );
|
||||
fillRGBAFields( col, cal.get( 0 ) );
|
||||
fillHSBAFields( col, cal.get( 0 ) );
|
||||
} else if ( this.parentNode.className.indexOf( '_hsb' ) > 0 ) {
|
||||
col = fixHSBA( {
|
||||
h: parseInt( cal.data( 'usof_colpick' ).fields.eq( 4 ).val(), 10 ),
|
||||
s: parseInt( cal.data( 'usof_colpick' ).fields.eq( 5 ).val(), 10 ),
|
||||
b: parseInt( cal.data( 'usof_colpick' ).fields.eq( 6 ).val(), 10 ),
|
||||
a: parseFloat( cal.data( 'usof_colpick' ).fields.eq( 7 ).val() )
|
||||
} );
|
||||
cal.data( 'usof_colpick' ).color = col;
|
||||
fillRGBAFields( col, cal.get( 0 ) );
|
||||
fillHexFields( col, cal.get( 0 ) );
|
||||
} else {
|
||||
cal.data( 'usof_colpick' ).color = col = rgbaToHsba( fixRGBA( {
|
||||
r: parseInt( cal.data( 'usof_colpick' ).fields.eq( 1 ).val(), 10 ),
|
||||
g: parseInt( cal.data( 'usof_colpick' ).fields.eq( 2 ).val(), 10 ),
|
||||
b: parseInt( cal.data( 'usof_colpick' ).fields.eq( 3 ).val(), 10 ),
|
||||
a: parseFloat( cal.data( 'usof_colpick' ).fields.eq( 7 ).val() )
|
||||
} ) );
|
||||
fillHexFields( col, cal.get( 0 ) );
|
||||
fillHSBAFields( col, cal.get( 0 ) );
|
||||
}
|
||||
setSelector( col, cal.get( 0 ) );
|
||||
setHue( col, cal.get( 0 ) );
|
||||
setAlpha( col, cal.get( 0 ) );
|
||||
setNewColor( col, cal.get( 0 ) );
|
||||
cal.data( 'usof_colpick' ).onChange.apply( cal.parent(), [
|
||||
col,
|
||||
hsbaToHex( col ),
|
||||
hsbaToRgba( col ),
|
||||
cal.data( 'usof_colpick' ).el,
|
||||
0
|
||||
] );
|
||||
},
|
||||
//Change style on blur and on focus of inputs
|
||||
blur = function( ev ) {
|
||||
$( this ).parent().removeClass( 'usof_colpick_focus' );
|
||||
},
|
||||
focus = function() {
|
||||
$( this ).parent().parent().data( 'usof_colpick' ).fields.parent().removeClass( 'usof_colpick_focus' );
|
||||
$( this ).parent().addClass( 'usof_colpick_focus' );
|
||||
},
|
||||
//Increment/decrement arrows functions
|
||||
moveIncrement = function( ev ) {
|
||||
ev.data.field.val( Math.max( 0, Math.min( ev.data.max, parseInt( ev.data.val - ev.pageY + ev.data.y, 10 ) ) ) );
|
||||
if ( ev.data.preview ) {
|
||||
change.apply( ev.data.field.get( 0 ), [ true ] );
|
||||
}
|
||||
return false;
|
||||
},
|
||||
upIncrement = function( ev ) {
|
||||
change.apply( ev.data.field.get( 0 ), [ true ] );
|
||||
ev.data.el.removeClass( 'usof_colpick_slider' ).find( 'input' ).focus();
|
||||
$( document ).off( 'mouseup', upIncrement );
|
||||
$( document ).off( 'mousemove', moveIncrement );
|
||||
return false;
|
||||
},
|
||||
//Hue slider functions
|
||||
downHue = function( ev ) {
|
||||
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
|
||||
var current = {
|
||||
cal: $( this ).parent(),
|
||||
y: $( this ).offset().top
|
||||
};
|
||||
$( document ).on( 'mouseup touchend', current, upHue );
|
||||
$( document ).on( 'mousemove touchmove', current, moveHue );
|
||||
|
||||
var pageY = ( ( ev.type == 'touchstart' ) ? ev.originalEvent.changedTouches[ 0 ].pageY : ev.pageY );
|
||||
change.apply(
|
||||
current.cal.data( 'usof_colpick' )
|
||||
.fields.eq( 4 ).val( parseInt( 360 * ( current.cal.data( 'usof_colpick' ).height - ( pageY - current.y ) ) / current.cal.data( 'usof_colpick' ).height, 10 ) )
|
||||
.get( 0 ),
|
||||
[ current.cal.data( 'usof_colpick' ).livePreview ]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
moveHue = function( ev ) {
|
||||
var pageY = ( ( ev.type == 'touchmove' ) ? ev.originalEvent.changedTouches[ 0 ].pageY : ev.pageY );
|
||||
change.apply(
|
||||
ev.data.cal.data( 'usof_colpick' )
|
||||
.fields.eq( 4 ).val( parseInt( 360 * ( ev.data.cal.data( 'usof_colpick' ).height - Math.max( 0, Math.min( ev.data.cal.data( 'usof_colpick' ).height, ( pageY - ev.data.y ) ) ) ) / ev.data.cal.data( 'usof_colpick' ).height, 10 ) )
|
||||
.get( 0 ),
|
||||
[ ev.data.preview ]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upHue = function( ev ) {
|
||||
fillRGBAFields( ev.data.cal.data( 'usof_colpick' ).color, ev.data.cal.get( 0 ) );
|
||||
fillHexFields( ev.data.cal.data( 'usof_colpick' ).color, ev.data.cal.get( 0 ) );
|
||||
$( document ).off( 'mouseup touchend', upHue );
|
||||
$( document ).off( 'mousemove touchmove', moveHue );
|
||||
return false;
|
||||
},
|
||||
//Alpha slider function
|
||||
downAlpha = function( ev ) {
|
||||
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
|
||||
var current = {
|
||||
cal: $( this ).parent(),
|
||||
y: $( this ).offset().top
|
||||
};
|
||||
$( document ).on( 'mouseup touchend', current, upAlpha );
|
||||
$( document ).on( 'mousemove touchmove', current, moveAlpha );
|
||||
|
||||
var pageY = ( ( ev.type == 'touchstart' ) ? ev.originalEvent.changedTouches[ 0 ].pageY : ev.pageY );
|
||||
change.apply(
|
||||
current.cal.data( 'usof_colpick' )
|
||||
.fields.eq( 7 ).val( ( current.cal.data( 'usof_colpick' ).height - ( pageY - current.y ) ) / current.cal.data( 'usof_colpick' ).height )
|
||||
.get( 0 ),
|
||||
[ current.cal.data( 'usof_colpick' ).livePreview ]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
moveAlpha = function( ev ) {
|
||||
var pageY = ( ( ev.type == 'touchmove' ) ? ev.originalEvent.changedTouches[ 0 ].pageY : ev.pageY );
|
||||
change.apply(
|
||||
ev.data.cal.data( 'usof_colpick' )
|
||||
.fields.eq( 7 ).val( ( ev.data.cal.data( 'usof_colpick' ).height - ( pageY - ev.data.y ) ) / ev.data.cal.data( 'usof_colpick' ).height )
|
||||
.get( 0 ),
|
||||
[ ev.data.preview ]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upAlpha = function( ev ) {
|
||||
fillRGBAFields( ev.data.cal.data( 'usof_colpick' ).color, ev.data.cal.get( 0 ) );
|
||||
fillHexFields( ev.data.cal.data( 'usof_colpick' ).color, ev.data.cal.get( 0 ) );
|
||||
$( document ).off( 'mouseup touchend', upAlpha );
|
||||
$( document ).off( 'mousemove touchmove', moveAlpha );
|
||||
return false;
|
||||
},
|
||||
//Color selector functions
|
||||
downSelector = function( ev ) {
|
||||
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
|
||||
var current = {
|
||||
cal: $( this ).parent(),
|
||||
pos: $( this ).offset()
|
||||
};
|
||||
current.preview = current.cal.data( 'usof_colpick' ).livePreview;
|
||||
|
||||
$( document ).on( 'mouseup touchend', current, upSelector );
|
||||
$( document ).on( 'mousemove touchmove', current, moveSelector );
|
||||
|
||||
var pageX, pageY;
|
||||
if ( ev.type == 'touchstart' ) {
|
||||
pageX = ev.originalEvent.changedTouches[ 0 ].pageX;
|
||||
pageY = ev.originalEvent.changedTouches[ 0 ].pageY;
|
||||
} else {
|
||||
pageX = ev.pageX;
|
||||
pageY = ev.pageY;
|
||||
}
|
||||
|
||||
change.apply(
|
||||
current.cal.data( 'usof_colpick' ).fields
|
||||
.eq( 6 ).val( parseInt( 100 * ( current.cal.data( 'usof_colpick' ).height - ( pageY - current.pos.top ) ) / current.cal.data( 'usof_colpick' ).height, 10 ) ).end()
|
||||
.eq( 5 ).val( parseInt( 100 * ( pageX - current.pos.left ) / current.cal.data( 'usof_colpick' ).height, 10 ) )
|
||||
.get( 0 ),
|
||||
[ current.preview ]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
moveSelector = function( ev ) {
|
||||
var pageX, pageY;
|
||||
if ( ev.type == 'touchmove' ) {
|
||||
pageX = ev.originalEvent.changedTouches[ 0 ].pageX;
|
||||
pageY = ev.originalEvent.changedTouches[ 0 ].pageY;
|
||||
} else {
|
||||
pageX = ev.pageX;
|
||||
pageY = ev.pageY;
|
||||
}
|
||||
|
||||
change.apply(
|
||||
ev.data.cal.data( 'usof_colpick' ).fields
|
||||
.eq( 6 ).val( parseInt( 100 * ( ev.data.cal.data( 'usof_colpick' ).height - Math.max( 0, Math.min( ev.data.cal.data( 'usof_colpick' ).height, ( pageY - ev.data.pos.top ) ) ) ) / ev.data.cal.data( 'usof_colpick' ).height, 10 ) ).end()
|
||||
.eq( 5 ).val( parseInt( 100 * ( Math.max( 0, Math.min( ev.data.cal.data( 'usof_colpick' ).height, ( pageX - ev.data.pos.left ) ) ) ) / ev.data.cal.data( 'usof_colpick' ).height, 10 ) )
|
||||
.get( 0 ),
|
||||
[ ev.data.preview ]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upSelector = function( ev ) {
|
||||
fillRGBAFields( ev.data.cal.data( 'usof_colpick' ).color, ev.data.cal.get( 0 ) );
|
||||
fillHexFields( ev.data.cal.data( 'usof_colpick' ).color, ev.data.cal.get( 0 ) );
|
||||
$( document ).off( 'mouseup touchend', upSelector );
|
||||
$( document ).off( 'mousemove touchmove', moveSelector );
|
||||
return false;
|
||||
},
|
||||
//Submit button
|
||||
clickSubmit = function( ev ) {
|
||||
var cal = $( this ).parent();
|
||||
var col = cal.data( 'usof_colpick' ).color;
|
||||
cal.data( 'usof_colpick' ).origColor = col;
|
||||
setCurrentColor( col, cal.get( 0 ) );
|
||||
cal.data( 'usof_colpick' ).onSubmit( col, hsbaToHex( col ), hsbaToRgba( col ), cal.data( 'usof_colpick' ).el );
|
||||
},
|
||||
//Show/Hide the color picker
|
||||
show = function( ev ) {
|
||||
if ( ev ) {ev.stopPropagation();}
|
||||
var cal = $( '#' + $( this ).data( 'usof_colpickId' ) ),
|
||||
pos, top, bottomSpace, that = this,
|
||||
calWrap = $( this ).parent( '.usof-color' ).find( '.usof_colpick_wrap' )[ 0 ],
|
||||
calWrapH = $( calWrap ).height();
|
||||
cal.data( 'usof_colpick' ).onBeforeShow.apply( this, [ cal.get( 0 ) ] );
|
||||
pos = $( this ).offset();
|
||||
top = this.offsetHeight;
|
||||
bottomSpace = document.body.clientHeight - ( pos.top - window.pageYOffset );
|
||||
if ( bottomSpace < calWrapH ) {
|
||||
top = 0 - calWrapH;
|
||||
}
|
||||
$( calWrap ).css( { top: top + 'px' } );
|
||||
cal.data( 'usof_colpick' ).onShow.apply( this, [ cal.get( 0 ) ] );
|
||||
},
|
||||
hide = function( ev ) {
|
||||
if ( ev ) {ev.stopPropagation();}
|
||||
var cal = $( '#' + $( this ).data( 'usof_colpickId' ) );
|
||||
cal.data( 'usof_colpick' ).onHide.apply( this, [ cal.get( 0 ) ] );
|
||||
$( 'html' ).off( 'mousedown', hide );
|
||||
},
|
||||
//Fix the values if the user enters a negative or high value
|
||||
fixHSBA = function( hsba ) {
|
||||
if ( hsba.a === undefined ) {
|
||||
hsba.a = 1.;
|
||||
}
|
||||
return {
|
||||
h: Math.min( 360, Math.max( 0, hsba.h ) ),
|
||||
s: Math.min( 100, Math.max( 0, hsba.s ) ),
|
||||
b: Math.min( 100, Math.max( 0, hsba.b ) ),
|
||||
a: Math.min( 1., Math.max( 0., hsba.a ) )
|
||||
};
|
||||
},
|
||||
fixRGBA = function( rgba ) {
|
||||
if ( rgba.a === undefined ) {
|
||||
rgba.a = 1.;
|
||||
}
|
||||
return {
|
||||
r: Math.min( 255, Math.max( 0, rgba.r ) ),
|
||||
g: Math.min( 255, Math.max( 0, rgba.g ) ),
|
||||
b: Math.min( 255, Math.max( 0, rgba.b ) ),
|
||||
a: Math.min( 1., Math.max( 0., rgba.a ) )
|
||||
};
|
||||
},
|
||||
fixHex = function( hex ) {
|
||||
if ( hex.substr( 0, 5 ) == 'rgba(' ) {
|
||||
var parts = hex.substring( 5, s.length - 1 ).split( ',' ).map( parseFloat );
|
||||
if ( parts.length == 4 ) {
|
||||
return hex;
|
||||
}
|
||||
}
|
||||
var len = 6 - hex.length;
|
||||
if ( len > 0 ) {
|
||||
var o = [];
|
||||
for ( var i = 0; i < len; i ++ ) {
|
||||
o.push( '0' );
|
||||
}
|
||||
o.push( hex );
|
||||
hex = o.join( '' );
|
||||
}
|
||||
return hex;
|
||||
};
|
||||
return {
|
||||
init: function( opt ) {
|
||||
opt = $.extend( {}, defaults, opt || {} );
|
||||
var gradient;
|
||||
//Set color
|
||||
if ( typeof opt.color == 'string' ) {
|
||||
if ( isGradient( opt.color ) ) {
|
||||
gradient = gradientParser( opt.color );
|
||||
opt.color = hexToHsba( gradient.hex );
|
||||
} else {
|
||||
opt.color = hexToHsba( opt.color );
|
||||
}
|
||||
} else if ( opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined ) {
|
||||
opt.color = rgbaToHsba( opt.color );
|
||||
} else if ( opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined ) {
|
||||
opt.color = fixHSBA( opt.color );
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
//For each selected DOM element
|
||||
return this.each( function() {
|
||||
//If the element does not have an ID
|
||||
if ( !$( this ).data( 'usof_colpickId' ) ) {
|
||||
var options = $.extend( {}, opt );
|
||||
options.origColor = opt.color;
|
||||
//Generate and assign a random ID
|
||||
var id = 'collorpicker_' + parseInt( Math.random() * 100000 );
|
||||
$( this ).data( 'usof_colpickId', id );
|
||||
//Set the tpl's ID and get the HTML
|
||||
var cal = $( tpl ).attr( 'id', id );
|
||||
//Add class according to layout
|
||||
cal.addClass( 'usof_colpick_' + options.layout + ( options.submit ? '' : ' usof_colpick_' + options.layout + '_ns' ) );
|
||||
//Add class if the color scheme is not default
|
||||
if ( options.colorScheme != 'light' ) {
|
||||
cal.addClass( 'usof_colpick_' + options.colorScheme );
|
||||
}
|
||||
//Setup submit button
|
||||
cal.find( 'div.usof_colpick_submit' ).html( options.submitText ).click( clickSubmit );
|
||||
//Setup input fields
|
||||
options.fields = cal.find( 'input' ).change( change ).blur( blur ).focus( focus );
|
||||
//Setup hue selector
|
||||
options.selector = cal.find( 'div.usof_colpick_color' ).on( 'mousedown touchstart', downSelector );
|
||||
options.selectorIndic = options.selector.find( 'div.usof_colpick_selector_outer' );
|
||||
//Store parts of the plugin
|
||||
options.el = this;
|
||||
options.hue = cal.find( 'div.usof_colpick_hue_arrs' );
|
||||
var huebar = options.hue.parent();
|
||||
options.alphaContainer = cal.find( 'div.usof_colpick_alpha' );
|
||||
options.alpha = cal.find( 'div.usof_colpick_alpha_arrs' );
|
||||
|
||||
//Paint the hue bar
|
||||
var UA = navigator.userAgent.toLowerCase();
|
||||
var isIE = navigator.appName === 'Microsoft Internet Explorer';
|
||||
var IEver = isIE ? parseFloat( UA.match( /msie ([0-9]{1,}[\.0-9]{0,})/ )[ 1 ] ) : 0;
|
||||
var ngIE = ( isIE && IEver < 10 );
|
||||
var stops = [
|
||||
'#ff0000',
|
||||
'#ff0080',
|
||||
'#ff00ff',
|
||||
'#8000ff',
|
||||
'#0000ff',
|
||||
'#0080ff',
|
||||
'#00ffff',
|
||||
'#00ff80',
|
||||
'#00ff00',
|
||||
'#80ff00',
|
||||
'#ffff00',
|
||||
'#ff8000',
|
||||
'#ff0000'
|
||||
];
|
||||
if ( ngIE ) {
|
||||
var i, div;
|
||||
for ( i = 0; i <= 11; i ++ ) {
|
||||
div = $( '<div></div>' ).attr( 'style', 'height:8.333333%; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=' + stops[ i ] + ', endColorstr=' + stops[ i + 1 ] + '); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=' + stops[ i ] + ', endColorstr=' + stops[ i + 1 ] + ')";' );
|
||||
huebar.append( div );
|
||||
}
|
||||
} else {
|
||||
var stopList = stops.join( ',' );
|
||||
huebar.attr( 'style', 'background:linear-gradient(to bottom,' + stopList + '); ' );
|
||||
}
|
||||
cal.find( 'div.usof_colpick_hue' ).on( 'mousedown touchstart', downHue );
|
||||
cal.find( 'div.usof_colpick_alpha' ).on( 'mousedown touchstart', downAlpha );
|
||||
options.newColor = cal.find( 'div.usof_colpick_new_color' );
|
||||
options.currentColor = cal.find( 'div.usof_colpick_current_color' );
|
||||
//Store options and fill with default color
|
||||
cal.data( 'usof_colpick', options );
|
||||
fillRGBAFields( options.color, cal.get( 0 ) );
|
||||
fillHSBAFields( options.color, cal.get( 0 ) );
|
||||
fillHexFields( options.color, cal.get( 0 ) );
|
||||
setHue( options.color, cal.get( 0 ) );
|
||||
setAlpha( options.color, cal.get( 0 ) );
|
||||
setSelector( options.color, cal.get( 0 ) );
|
||||
setCurrentColor( options.color, cal.get( 0 ) );
|
||||
setNewColor( options.color, cal.get( 0 ) );
|
||||
//Append to body if flat=false, else show in place
|
||||
if ( options.flat ) {
|
||||
cal.appendTo( this ).show();
|
||||
cal.css( {
|
||||
position: 'relative',
|
||||
display: 'block'
|
||||
} );
|
||||
} else {
|
||||
cal.appendTo( $( this ).parent().children( '.usof_colpick_wrap' ) );
|
||||
if ( options.showEvent == 'focus' ) {
|
||||
$( this ).on( 'focus', function( ev ) {
|
||||
var $that = $( this );
|
||||
setTimeout( function() {
|
||||
$that.select();
|
||||
}, 5 );
|
||||
show.call( this, ev );
|
||||
} );
|
||||
|
||||
$( this ).on( 'blur', function( ev ) {
|
||||
hide.call( this, ev );
|
||||
} );
|
||||
} else {
|
||||
$( this ).on( options.showEvent, function( ev ) {
|
||||
show.call( this, ev, options.showEvent );
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
showPicker: function() {
|
||||
return this.each( function() {
|
||||
if ( $( this ).data( 'usof_colpickId' ) ) {
|
||||
show.apply( this );
|
||||
}
|
||||
} );
|
||||
},
|
||||
hidePicker: function() {
|
||||
return this.each( function() {
|
||||
if ( $( this ).data( 'usof_colpickId' ) ) {
|
||||
hide.apply( this );
|
||||
}
|
||||
} );
|
||||
},
|
||||
//Sets a color as new and current (default)
|
||||
setColor: function( col, setCurrent ) {
|
||||
var gradient;
|
||||
setCurrent = ( typeof setCurrent === "undefined" ) ? 1 : setCurrent;
|
||||
if ( typeof col == 'string' ) {
|
||||
if ( isGradient( col ) ) {
|
||||
gradient = gradientParser( col );
|
||||
col = hexToHsba( gradient.hex );
|
||||
} else {
|
||||
col = hexToHsba( col );
|
||||
}
|
||||
} else if ( col.r != undefined && col.g != undefined && col.b != undefined ) {
|
||||
col = rgbaToHsba( col );
|
||||
} else if ( col.h != undefined && col.s != undefined && col.b != undefined ) {
|
||||
col = fixHSBA( col );
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each( function() {
|
||||
if ( $( this ).data( 'usof_colpickId' ) ) {
|
||||
var cal = $( '#' + $( this ).data( 'usof_colpickId' ) );
|
||||
cal.data( 'usof_colpick' ).color = col;
|
||||
cal.data( 'usof_colpick' ).origColor = col;
|
||||
fillRGBAFields( col, cal.get( 0 ) );
|
||||
fillHSBAFields( col, cal.get( 0 ) );
|
||||
fillHexFields( col, cal.get( 0 ) );
|
||||
setHue( col, cal.get( 0 ) );
|
||||
setAlpha( col, cal.get( 0 ) );
|
||||
setSelector( col, cal.get( 0 ) );
|
||||
|
||||
setNewColor( col, cal.get( 0 ) );
|
||||
cal.data( 'usof_colpick' ).onChange.apply( cal.parent(), [
|
||||
col,
|
||||
hsbaToHex( col ),
|
||||
hsbaToRgba( col ),
|
||||
cal.data( 'usof_colpick' ).el,
|
||||
1,
|
||||
gradient,
|
||||
] );
|
||||
if ( setCurrent ) {
|
||||
setCurrentColor( col, cal.get( 0 ) );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//Color space convertions
|
||||
var hexToRgba = function( hex ) {
|
||||
if ( hex.substr( 0, 5 ) == 'rgba(' ) {
|
||||
var parts = hex.substring( 5, hex.length - 1 ).split( ',' ).map( parseFloat );
|
||||
if ( parts.length == 4 ) {
|
||||
return { r: parts[ 0 ], g: parts[ 1 ], b: parts[ 2 ], a: parts[ 3 ] };
|
||||
}
|
||||
}
|
||||
if ( hex.length == 3 ) {
|
||||
hex = hex.charAt( 0 ) + hex.charAt( 0 ) + hex.charAt( 1 ) + hex.charAt( 0 ) + hex.charAt( 2 ) + hex.charAt( 2 );
|
||||
}
|
||||
hex = parseInt( ( ( hex.indexOf( '#' ) > - 1 ) ? hex.substring( 1 ) : hex ), 16 );
|
||||
return { r: hex >> 16, g: ( hex & 0x00FF00 ) >> 8, b: ( hex & 0x0000FF ), a: 1. };
|
||||
};
|
||||
|
||||
var gradientParser = function( color ) {
|
||||
if ( m = /^linear-gradient\(([\D\d]+)\);?$/.exec( color ) ) {
|
||||
var gradient = m[ 1 ].split( ',' ),
|
||||
directions = [ 'to', 'top', 'right', 'bottom', 'left', 'turn', 'deg' ],
|
||||
index,
|
||||
colors = {
|
||||
colors: [],
|
||||
gradient: color,
|
||||
};
|
||||
|
||||
// Find gradient direction
|
||||
for ( var i = 0; i < directions.length; i ++ ) {
|
||||
index = gradient[ 0 ].indexOf( directions[ i ] );
|
||||
if ( index != - 1 ) {
|
||||
colors.direction = gradient[ 0 ];
|
||||
}
|
||||
}
|
||||
|
||||
// Find color values
|
||||
for ( var i = 0; i < gradient.length; i ++ ) {
|
||||
gradient[ i ] = gradient[ i ].trim();
|
||||
|
||||
// Look for hex values
|
||||
var hex = gradient[ i ].indexOf( '#' );
|
||||
if ( hex !== - 1 ) {
|
||||
var normalizedHex = normalizeHex( gradient[ i ].replace( '#', '' ) );
|
||||
colors.colors.push( normalizedHex );
|
||||
}
|
||||
|
||||
// Look for hex RGB
|
||||
var rgb = gradient[ i ].indexOf( 'rgb(' );
|
||||
if ( rgb !== - 1 ) {
|
||||
var rgbColor = {};
|
||||
|
||||
rgbColor.r = parseInt( gradient[ i ].replace( 'rgb(', '' ).trim() );
|
||||
rgbColor.g = parseInt( gradient[ i + 1 ].trim() );
|
||||
rgbColor.b = parseInt( gradient[ i + 2 ].replace( ')', '' ).trim() );
|
||||
colors.colors.push( rgbColor );
|
||||
}
|
||||
|
||||
// Look for hex RGBa
|
||||
var rgba = gradient[ i ].indexOf( 'rgba(' );
|
||||
if ( rgba !== - 1 ) {
|
||||
var rgbaColor = {};
|
||||
|
||||
rgbaColor.r = parseInt( gradient[ i ].replace( 'rgba(', '' ).trim() );
|
||||
rgbaColor.g = parseInt( gradient[ i + 1 ].trim() );
|
||||
rgbaColor.b = parseInt( gradient[ i + 2 ].trim() );
|
||||
rgbaColor.a = parseFloat( gradient[ i + 3 ].trim().replace( ')', '' ).trim() );
|
||||
colors.colors.push( rgbaColor );
|
||||
}
|
||||
}
|
||||
|
||||
if ( typeof colors.colors[ 0 ] == 'string' ) {
|
||||
colors.hex = colors.colors[ 0 ];
|
||||
} else {
|
||||
// Can be returned as rgba string if rgba object is passed
|
||||
colors.hex = rgbaToHex( colors.colors[ 0 ] );
|
||||
}
|
||||
|
||||
return colors;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Hex should come without leading "#"
|
||||
var normalizeHex = function( hex ) {
|
||||
var hashString;
|
||||
if ( hex.length === 3 ) {
|
||||
hex = '#' + hex[ 0 ] + hex[ 0 ] + hex[ 1 ] + hex[ 1 ] + hex[ 2 ] + hex[ 2 ];
|
||||
} else if ( hex.length <= 6 ) {
|
||||
hashString = hex.split( '' );
|
||||
while ( hashString.length < 6 ) {
|
||||
hashString.unshift( '0' );
|
||||
}
|
||||
hex = '#' + hashString.join( '' );
|
||||
}
|
||||
|
||||
return hex;
|
||||
};
|
||||
|
||||
var isGradient = function( color ) {
|
||||
if ( m = /^linear-gradient\(.+\)$/.exec( color ) ) {
|
||||
return true
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var hexToHsba = function( hex ) {
|
||||
return rgbaToHsba( hexToRgba( hex ) );
|
||||
};
|
||||
var rgbaToHsba = function( rgba ) {
|
||||
var hsba = { h: 0, s: 0, b: 0 };
|
||||
var min = Math.min( rgba.r, rgba.g, rgba.b );
|
||||
var max = Math.max( rgba.r, rgba.g, rgba.b );
|
||||
var delta = max - min;
|
||||
hsba.b = max;
|
||||
hsba.s = max != 0 ? 255 * delta / max : 0;
|
||||
if ( hsba.s != 0 ) {
|
||||
if ( rgba.r == max ) {
|
||||
hsba.h = ( rgba.g - rgba.b ) / delta;
|
||||
} else if ( rgba.g == max ) {
|
||||
hsba.h = 2 + ( rgba.b - rgba.r ) / delta;
|
||||
} else {
|
||||
hsba.h = 4 + ( rgba.r - rgba.g ) / delta;
|
||||
}
|
||||
} else {
|
||||
hsba.h = - 1;
|
||||
}
|
||||
hsba.h *= 60;
|
||||
if ( hsba.h < 0 ) {
|
||||
hsba.h += 360;
|
||||
}
|
||||
hsba.s *= 100 / 255;
|
||||
hsba.b *= 100 / 255;
|
||||
hsba.a = rgba.a;
|
||||
return hsba;
|
||||
};
|
||||
var hsbaToRgba = function( hsba ) {
|
||||
var rgb = {};
|
||||
var h = hsba.h;
|
||||
var s = hsba.s * 255 / 100;
|
||||
var v = hsba.b * 255 / 100;
|
||||
if ( s == 0 ) {
|
||||
rgb.r = rgb.g = rgb.b = v;
|
||||
} else {
|
||||
var t1 = v;
|
||||
var t2 = ( 255 - s ) * v / 255;
|
||||
var t3 = ( t1 - t2 ) * ( h % 60 ) / 60;
|
||||
if ( h == 360 ) {
|
||||
h = 0;
|
||||
}
|
||||
if ( h < 60 ) {
|
||||
rgb.r = t1;
|
||||
rgb.b = t2;
|
||||
rgb.g = t2 + t3
|
||||
} else if ( h < 120 ) {
|
||||
rgb.g = t1;
|
||||
rgb.b = t2;
|
||||
rgb.r = t1 - t3
|
||||
} else if ( h < 180 ) {
|
||||
rgb.g = t1;
|
||||
rgb.r = t2;
|
||||
rgb.b = t2 + t3
|
||||
} else if ( h < 240 ) {
|
||||
rgb.b = t1;
|
||||
rgb.r = t2;
|
||||
rgb.g = t1 - t3
|
||||
} else if ( h < 300 ) {
|
||||
rgb.b = t1;
|
||||
rgb.g = t2;
|
||||
rgb.r = t2 + t3
|
||||
} else if ( h < 360 ) {
|
||||
rgb.r = t1;
|
||||
rgb.g = t2;
|
||||
rgb.b = t1 - t3
|
||||
} else {
|
||||
rgb.r = 0;
|
||||
rgb.g = 0;
|
||||
rgb.b = 0
|
||||
}
|
||||
}
|
||||
return { r: Math.round( rgb.r ), g: Math.round( rgb.g ), b: Math.round( rgb.b ), a: hsba.a };
|
||||
};
|
||||
var rgbaToHex = function( rgba ) {
|
||||
if ( rgba.a !== undefined && rgba.a < 1. ) {
|
||||
return 'rgba(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ',' + Math.round( rgba.a * 100 ) / 100 + ')';
|
||||
}
|
||||
var hex = [
|
||||
rgba.r.toString( 16 ),
|
||||
rgba.g.toString( 16 ),
|
||||
rgba.b.toString( 16 )
|
||||
];
|
||||
$.each( hex, function( nr, val ) {
|
||||
if ( val.length == 1 ) {
|
||||
hex[ nr ] = '0' + val;
|
||||
}
|
||||
} );
|
||||
return '#' + hex.join( '' );
|
||||
};
|
||||
var hsbaToHex = function( hsba ) {
|
||||
return rgbaToHex( hsbaToRgba( hsba ) );
|
||||
};
|
||||
$.fn.extend( {
|
||||
usof_colpick: usof_colpick.init,
|
||||
usof_colpickSetColor: usof_colpick.setColor,
|
||||
usof_colpickShow: usof_colpick.showPicker,
|
||||
usof_colpickHide: usof_colpick.hidePicker
|
||||
} );
|
||||
$.extend( {
|
||||
usof_colpick: {
|
||||
normalizeHex: normalizeHex,
|
||||
rgbaToHex: rgbaToHex,
|
||||
rgbaToHsb: rgbaToHsba,
|
||||
hsbaToHex: hsbaToHex,
|
||||
hsbaToRgba: hsbaToRgba,
|
||||
hexToHsba: hexToHsba,
|
||||
hexToRgba: hexToRgba,
|
||||
gradientParser: gradientParser,
|
||||
isGradient: isGradient,
|
||||
}
|
||||
} );
|
||||
} )( jQuery );
|
||||
+2994
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user