text: ﻿//  https://github.com/yicheng-irun/jquery.template.js
  /*
      https://github.com/yicheng-irun/jquery.template.js
      jquery.template.js
      A mini and ease-to-use templating plugin for jQuery or Zepto
      @author Yicheng <yicheng-me@qq.com>
      @license MIT
      @version 1.1
  */(function(g){function n(b){b=b.children();for(var c=[],a,d=0;d<b.length;d++)a=b.eq(d),void 0!=a.attr("jt-model")?c.push(b.eq(d)):c=c.concat(n(a));return c}function k(b,c){if(!b.attr("jt-model-id")){for(var a=(new Date).getTime()+""+(10*Math.random()).toFixed(0);h[a];)a=(new Date).getTime()+""+(10*Math.random()).toFixed(0);h[a]=!0;b.attr("jt-model-id",a+"");var d=a,e={type:null,varp:null,varc:null,parent:c,childidlist:[],yshtml:""},f;f=n(b);for(var g=0;g<f.length;g++)e.childidlist.push(k(f[g],e));e.yshtml=b.html();f=b.attr("jt-model");void 0!=f?(f=f.split(" "),f[1]&&"if"==f[0]?(e.type="if",e.varc=f[1]):f[2]&&"in"==f[1]&&(e.type="map",e.varc=f[0],e.varp=f[2])):e.type="text";h[d]=e;b.html("");if(c)return a}return h[b.attr("jt-model-id")]}function l(b,c,a){return b==c.varname?a?c:c.value:"object"==typeof c.value&&b in c.value?c.value[b]:c.parent?l(b,c.parent,a):null}function p(b,c){var a=g.trim(b).split("."),d,e;if(a.length&&(d=l(a[0],c,!1),null!=d)){for(e=a.shift();a.length;){if("_key"==a[0])return l(e,c,!0).varkey;if(!(a[0]in d))return"";d=d[a.shift()]}return d}return""}function q(b,c){var a="",d=null,e=b.yshtml.replace(r,function(a,b,d,e){return p(b,c)});-1!=e.indexOf("jt-src")&&(d=g(document.createElement("div")).html(e),d.find("[jt-src]").each(function(a,b){g(this).attr("src",g(this).attr("jt-src"))}));if(-1!=e.indexOf("jt-model")){null==d&&(d=g(document.createElement("div")).html(e));for(var f=d.find("[jt-model]"),h=0;h<f.length;h++){var l=k(f.eq(h),b);f.eq(h).html(m(l,p(l.varp,c),c))}}return a=null==d?a+e:a+d.html()}function m(b,c,a){var d="";c={value:c,varname:b.varp,varkey:null,parent:a};if("map"==b.type)for(mi in a={value:null,varname:b.varc,varkey:null,parent:c},c.value)a.value=c.value[mi],a.varkey=mi,d+=q(b,a);else"text"==b.type&&(d+=q(b,c));return d}if(g){var h={};g.template={};g.template.VERSION="1.2";var r=/\{\{(.+?)\}\}/g;g.fn.render=function(b){for(var c,a=0;a<this.length;a++)c=k(this.eq(a),null),this.eq(a).html(m(c,b),null);return this};g.fn.renderAsString=function(b){for(var c,a=[],d=0;d<this.length;d++)c=k(this.eq(d),null),a.push(m(c,b),null);1==this.length&&(a=a[0]);return a};g.fn.renderAppend=function(b){for(var c,a=0;a<this.length;a++)c=k(this.eq(a),null),this.eq(a).append(m(c,b),null);return this};g.fn.renderPrepend=function(b){for(var c,a=0;a<this.length;a++)c=k(this.eq(a),null),this.eq(a).prepend(m(c,b),null);return this};g.template.setValueRegex=function(b){r=b}}else console.error("JQuery or Zepto is undefineded!")})(window.jQuery?window.jQuery:window.Zepto?window.Zepto:null);