You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
8.6 KiB
JavaScript

2 years ago
!function(){var e=function(){var t=[].slice.call(arguments);return t.push(e.options),t[0].match(/^\s*#([\w:\-\.]+)\s*$/gim)&&t[0].replace(/^\s*#([\w:\-\.]+)\s*$/gim,function(e,n){var o=document,i=o&&o.getElementById(n);t[0]=i?i.value||i.innerHTML:e}),e.documentHTML&&(e.compile.call(e,e.documentHTML),e.documentHTML=""),1==arguments.length?e.compile.apply(e,t):arguments.length>=2?e.to_html.apply(e,t):void 0},t={escapehash:{"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#x27;","/":"&#x2f;"},escapereplace:function(e){return t.escapehash[e]},escaping:function(e){return"string"!=typeof e?e:e.replace(/[&<>"']/gim,this.escapereplace)},detection:function(e){return"undefined"==typeof e?"":e}},n=function(e){if("undefined"!=typeof console){if(console.warn)return void console.warn(e);if(console.log)return void console.log(e)}throw e},o=function(e,t){if(e=e!==Object(e)?{}:e,e.__proto__)return e.__proto__=t,e;var n=function(){},o=Object.create?Object.create(t):new(n.prototype=t,n);for(var i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);return o},i=function(e){var t,n,o,i=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,r=/,/,s=/^\s*(_?)(\S+?)\1\s*$/,a=/^function[^{]+{([\s\S]*)}/m,c=[];"function"==typeof e?e.length&&(t=e.toString()):"string"==typeof e&&(t=e),t=t.trim(),o=t.match(i),n=t.match(a)[1].trim();for(var p=0;p<o[1].split(r).length;p++){var l=o[1].split(r)[p];l.replace(s,function(e,t,n){c.push(n)})}return[c,n]};e.__cache={},e.version="0.6.15",e.settings={},e.documentHTML="",e.tags={operationOpen:"{@",operationClose:"}",interpolateOpen:"\\${",interpolateClose:"}",noneencodeOpen:"\\$\\${",noneencodeClose:"}",commentOpen:"\\{#",commentClose:"\\}"},e.options={cache:!0,strip:!0,errorhandling:!0,detection:!0,_method:o({__escapehtml:t,__throw:n,__juicer:e},{})},e.tagInit=function(){var t=e.tags.operationOpen+"each\\s*([^}]*?)\\s*as\\s*(\\w*?)\\s*(,\\s*\\w*?)?"+e.tags.operationClose,n=e.tags.operationOpen+"\\/each"+e.tags.operationClose,o=e.tags.operationOpen+"if\\s*([^}]*?)"+e.tags.operationClose,i=e.tags.operationOpen+"\\/if"+e.tags.operationClose,r=e.tags.operationOpen+"else"+e.tags.operationClose,s=e.tags.operationOpen+"else if\\s*([^}]*?)"+e.tags.operationClose,a=e.tags.interpolateOpen+"([\\s\\S]+?)"+e.tags.interpolateClose,c=e.tags.noneencodeOpen+"([\\s\\S]+?)"+e.tags.noneencodeClose,p=e.tags.commentOpen+"[^}]*?"+e.tags.commentClose,l=e.tags.operationOpen+"each\\s*(\\w*?)\\s*in\\s*range\\(([^}]+?)\\s*,\\s*([^}]+?)\\)"+e.tags.operationClose,u=e.tags.operationOpen+"include\\s*([^}]*?)\\s*,\\s*([^}]*?)"+e.tags.operationClose,g=e.tags.operationOpen+"helper\\s*([^}]*?)\\s*"+e.tags.operationClose,f="([\\s\\S]*?)",h=e.tags.operationOpen+"\\/helper"+e.tags.operationClose;e.settings.forstart=new RegExp(t,"igm"),e.settings.forend=new RegExp(n,"igm"),e.settings.ifstart=new RegExp(o,"igm"),e.settings.ifend=new RegExp(i,"igm"),e.settings.elsestart=new RegExp(r,"igm"),e.settings.elseifstart=new RegExp(s,"igm"),e.settings.interpolate=new RegExp(a,"igm"),e.settings.noneencode=new RegExp(c,"igm"),e.settings.inlinecomment=new RegExp(p,"igm"),e.settings.rangestart=new RegExp(l,"igm"),e.settings.include=new RegExp(u,"igm"),e.settings.helperRegister=new RegExp(g+f+h,"igm")},e.tagInit(),e.set=function(e,t){var n=this,o=function(e){return e.replace(/[\$\(\)\[\]\+\^\{\}\?\*\|\.]/gim,function(e){return"\\"+e})},i=function(e,t){var i=e.match(/^tag::(.*)$/i);return i?(n.tags[i[1]]=o(t),void n.tagInit()):void(n.options[e]=t)};if(2===arguments.length)return void i(e,t);if(e===Object(e))for(var r in e)e.hasOwnProperty(r)&&i(r,e[r])},e.register=function(e,t){var n=this.options._method;return n.hasOwnProperty(e)?!1:n[e]=t},e.unregister=function(e){var t=this.options._method;return t.hasOwnProperty(e)?delete t[e]:void 0},e.template=function(t){var n=this;this.options=t,this.__interpolate=function(e,t,n){var o,i=e.split("|"),r=i[0]||"";return i.length>1&&(e=i.shift(),o=i.shift().split(","),r="_method."+o.shift()+".call(this, "+[e].concat(o)+")"),"<%= "+(t?"_method.__escapehtml.escaping":"")+"("+(n&&n.detection===!1?"":"_method.__escapehtml.detection")+"("+r+")) %>"},this.__remo