仅限登录用户，没有登录就做页面跳转，通常用在页头
433859
public static function gate(bool $bReturn = TRUE): bool {

		if (Session::auth()) {
			return FALSE;
		}

		$sReturn = '';
		if (!$_POST && $bReturn) {
			$sReturn = '?return=' . urlencode($_SERVER["REQUEST_URI"]);
		}
		Page::jump('/passport/login' . $sReturn);
		return TRUE;
	}
119460
function () {
                    var index = 0;

                    while (index < fireLength) {

                        if ([].indexOf.call(arguments, list[index]) !== -1) {

                            // 从队列中删除当前回调
                            list.splice(index, 1);

                            // 如果当前回调队列被多层嵌套执行
                            // 上几层队列也可能会受到影响
                            if (firing) {
                                if (fireQueue.length) {
                                    fireQueue.forEach(function (value, key) {
                                        // 被删除的回调位于当前索引位置前面
                                        // 当前索引位置自减1
                                        if (index <= value) {
                                            fireQueue[key]--;
                                        }
                                    });
                                }

                                // 如果被删除的函数的索引位置在fireIndex的前面
                                // fireIndex自减1

                                if (index <= fireIndex) {
                                    fireIndex--;
                                }
                            }

                            // 回调列表长度改变
                            fireLength--;
                        } else {
                            index++;
                        }
                    }

                    return this;
                }
1019723
function PageView(url, id, options) {
                var _this = _super.call(this, options) || this;
                _this._pageOptions = null;
                _this._basePage = null;
                _this._statusMgr = null;
                // PageView 設定
                _this._pageOptions = $.extend({}, { owner: _this }, options);
                _this._basePage = _this._pageOptions.basePage ? new _this._pageOptions.basePage(url, id, _this._pageOptions) : new UI.BasePage(url, id, _this._pageOptions);
                // StatusManager
                _this._statusMgr = new UI.StatusManager();
                // Backbone.View 用の初期化
                var delegates = _this.events ? true : false;
                _this.setElement(_this.$page, delegates);
                return _this;
            }
262104
public function show() {
        if(0 == $this->totalRows) return '';

        /* 生成URL */
        $this->parameter[$this->p] = '[PAGE]';
        $this->url = U(ACTION_NAME, $this->parameter);
        /* 计算分页信息 */
        $this->totalPages = ceil($this->totalRows / $this->listRows); //总页数
        if(!empty($this->totalPages) && $this->nowPage > $this->totalPages) {
            $this->nowPage = $this->totalPages;
        }

        /* 计算分页临时变量 */
        $now_cool_page      = $this->rollPage/2;
		$now_cool_page_ceil = ceil($now_cool_page);
		$this->lastSuffix && $this->config['last'] = $this->totalPages;

        //上一页
        $up_row  = $this->nowPage - 1;
        $up_page = $up_row > 0 ? '<a class="prev" href="' . $this->url($up_row) . '">' . $this->config['prev'] . '</a>' : '';

        //下一页
        $down_row  = $this->nowPage + 1;
        $down_page = ($down_row <= $this->totalPages) ? '<a class="next" href="' . $this->url($down_row) . '">' . $this->config['next'] . '</a>' : '';

        //第一页
        $the_first = '';
        if($this->totalPages > $this->rollPage && ($this->nowPage - $now_cool_page) >= 1){
            $the_first = '<a class="first" href="' . $this->url(1) . '">' . $this->config['first'] . '</a>';
        }

        //最后一页
        $the_end = '';
        if($this->totalPages > $this->rollPage && ($this->nowPage + $now_cool_page) < $this->totalPages){
            $the_end = '<a class="end" href="' . $this->url($this->totalPages) . '">' . $this->config['last'] . '</a>';
        }

        //数字连接
        $link_page = "";
        for($i = 1; $i <= $this->rollPage; $i++){
			if(($this->nowPage - $now_cool_page) <= 0 ){
				$page = $i;
			}elseif(($this->nowPage + $now_cool_page - 1) >= $this->totalPages){
				$page = $this->totalPages - $this->rollPage + $i;
			}else{
				$page = $this->nowPage - $now_cool_page_ceil + $i;
			}
            if($page > 0 && $page != $this->nowPage){

                if($page <= $this->totalPages){
                    $link_page .= '<a class="num" href="' . $this->url($page) . '">' . $page . '</a>';
                }else{
                    break;
                }
            }else{
                if($page > 0 && $this->totalPages != 1){
                    $link_page .= '<span class="current">' . $page . '</span>';
                }
            }
        }

        //替换分页内容
        $page_str = str_replace(
            array('%HEADER%', '%NOW_PAGE%', '%UP_PAGE%', '%DOWN_PAGE%', '%FIRST%', '%LINK_PAGE%', '%END%', '%TOTAL_ROW%', '%TOTAL_PAGE%'),
            array($this->config['header'], $this->nowPage, $up_page, $down_page, $the_first, $link_page, $the_end, $this->totalRows, $this->totalPages),
            $this->config['theme']);
        return "<div>{$page_str}</div>";
    }
553452
function(){
		/* "ものを動かしたように描画する"でなければinputLineと同じ */
		if(this.puzzle.execConfig('dispmove')){
			this.inputMoveLine();
			return;
		}
		
		var pos, border;
		if(!this.board.borderAsLine){
			pos = this.getpos(0);
			if(this.prevPos.equals(pos)){ return;}
			border = this.prevPos.getnb(pos);
		}
		else{
			pos = this.getpos(0.35);
			if(this.prevPos.equals(pos)){ return;}
			border = this.prevPos.getborderobj(pos);
		}
		
		if(!border.isnull){
			if(this.inputData===null){ this.inputData=(border.isLine()?0:1);}
			if     (this.inputData===1){ border.setLine();}
			else if(this.inputData===0){ border.removeLine();}
			border.draw();
		}
		this.prevPos = pos;
	}
616755
function createFormContentRows() {
    var oThis = this,
        htmlStr = "";
    // 遍历生成所有行
    if (this.dataSourceObj.rows) {
        htmlStr += '<tbody role="rowgroup" id="' + this.options.id + '_form_content_tbody">';
        $.each(this.dataSourceObj.rows, function () {
            htmlStr += '<tr role="row"><td role="rowcell">';
            var value = this.value;
            $.each(oThis.gridCompColumnArr, function () {
                var f = this.options.field,
                    t = this.options.title,
                    v = $(value).attr(f);
                htmlStr += '<div>' + t + ':</div>';
                htmlStr += '<div>' + v + '</div>';
            });
            htmlStr += '</td></tr>';
        });
        htmlStr += '</tbody>';
    }
    return htmlStr;
}
154722
function onReady() {
  const self = this;

  /***
   * 判断页面是否已经ready
   */
  if (this.hasInited) return;
  this.hasInited = true;

  /***
   * window.document.body的jQuery
   */
  this.bodyDOM = window.document.body;

  /***
   * 存放完全单例对象的容器
   */
  this.singleInstances = null;

  /***
   * 创建page切换时的遮罩层
   */
  this.maskDOM = $(
    "<div class='ct-page-mask'>" +
    " <div opt='animation' class='la-ball-circus la-dark' style='color:#3e98f0;'>" +
    "   <div></div>" +
    "   <div></div>" +
    "   <div></div>" +
    "   <div></div>" +
    "   <div></div>" +
    " </div>" +
    "</div>")[0];
  this.bodyDOM.appendChild(this.maskDOM);

  fireEvent(window.document, "pageBeforeChange", [CtMobileFactory.getUrlParam(window.location.hash)]);
  /***
   * 初始化第一页
   * TODO:初始化第一页
   */
  createPage.call(this, this.getFirstId(), (Component) => {
    Component.start(0, () => {
        /***
         * if(有hash值) 加载的不是首页而是某一个指定的页面 {
         *   调用startPage即可
         *   startPage需要三部分值
         *   1.html的路径
         *   2.pageId
         *   3.parameter
         * }
         */
        const hash = window.location.hash;
        if (!hash) return false;

        const pageId = self.getPageIdByHash();
        if (!pageId) return false;

        const url = `#${pageId}`;
        const parameter = self.getParameterByHash();
        const searchObj = CtMobileFactory.getUrlParam(`${url}${parameter}`);

        self.startPage(`${url}${parameter}${parameter ? (searchObj.pageId ? '' : `&pageId=${pageId}`) : `?pageId=${pageId}`}`, {
          reload: self.config.linkCaptureReload
        });
      }
    );
  });

}
119071
function () {
            var _this = this;

            /* 滚动拉取图片 */
            domUtils.on($G('imageList'), 'scroll', function(e){
                var panel = this;
                if (panel.scrollHeight - (panel.offsetHeight + panel.scrollTop) < 10) {
                    _this.getImageData();
                }
            });
            /* 选中图片 */
            domUtils.on(this.container, 'click', function (e) {
                var target = e.target || e.srcElement,
                    li = target.parentNode;

                if (li.tagName.toLowerCase() == 'li') {
                    if (domUtils.hasClass(li, 'selected')) {
                        domUtils.removeClasses(li, 'selected');
                    } else {
                        domUtils.addClass(li, 'selected');
                    }
                }
            });
        }
237902
function(tmplText, data, settings) {
			// node.js buffer toString
			tmplText+="";
			
			if(settings){
				// 临时定义
				settings = defaults({}, settings, Et.tmplSettings);
				settings={
						script: new RegExp(settings.scriptBegin.replace(dotRegExp,"\\$1")+"([\\s\\S]+?)"+settings.scriptEnd.replace(dotRegExp,"\\$1"),"g"),
						out: new RegExp(settings.outBegin.replace(dotRegExp,"\\$1")+"([\\s\\S]+?)"+settings.outEnd.replace(dotRegExp,"\\$1"),"g"),
						escapeOut: new RegExp(settings.escapeOutBegin.replace(dotRegExp,"\\$1")+"([\\s\\S]+?)"+settings.escapeOutEnd.replace(dotRegExp,"\\$1"),"g"),
				};
			}else{
				// 模板标签
				if(
					Et.tmplSettings.scriptBegin!="%{" ||
					Et.tmplSettings.scriptEnd!="}%" ||
					Et.tmplSettings.outBegin!="{=" ||
					Et.tmplSettings.outEnd!="}" ||
					Et.tmplSettings.escapeOutBegin!="{-" ||
					Et.tmplSettings.escapeOutEnd!="}" 
				){
					cacheTmplSettings={
						script: new RegExp(Et.tmplSettings.scriptBegin.replace(dotRegExp,"\\$1")+"([\\s\\S]+?)"+Et.tmplSettings.scriptEnd.replace(dotRegExp,"\\$1"),"g"),
						out: new RegExp(Et.tmplSettings.outBegin.replace(dotRegExp,"\\$1")+"([\\s\\S]+?)"+Et.tmplSettings.outEnd.replace(dotRegExp,"\\$1"),"g"),
						escapeOut: new RegExp(Et.tmplSettings.escapeOutBegin.replace(dotRegExp,"\\$1")+"([\\s\\S]+?)"+Et.tmplSettings.escapeOutEnd.replace(dotRegExp,"\\$1"),"g"),
					};
				}
				settings=cacheTmplSettings;
			}
			
			tmplText = Et.unescape(tmplText);
			var render;
			var matcher = new RegExp([(settings.escapeOut || noMatch).source, (settings.out || noMatch).source, (settings.script || noMatch).source].join("|") + "|$", "g");
			var index = 0;
			var source = "_p+='";
			tmplText.replace(matcher, function(match, escapeOut, out, script, offset) {
				source += tmplText.slice(index, offset).replace(escaper, function(match) {
					return "\\" + escapes[match];
				});
				if(escapeOut) {
					source += "'+\n((_t=(" + escapeOut + "))==null?'':Et.escape(_t))+'";
				}
				if(out) {
					//source += "'+((_t=(" + out+ "))==null?'':_t)+'";
//					source += "'+" + out + "+'";
					source += "'+\n((_t=(" + out+ "))==null?'':_t)+'";
				}
				if(script) {
					source += "';" + script + "\n_p+='";
				}
				index = offset + match.length;
				return match;
			});
			source += "';";
			var vars=getVars(source); 
			// Script support 
			if(this.enableScript){
//				source=source.replace(scriptReg, function($0, $1){
//					return '<script>'+$1.trim()+'<\/script>'
//				})
				source=source.replace("<etj-script>",'<script>').replace("</etj-script>",'<\/script>');
			}
			// Style support, don't warp
			if(this.enableStyle){
//				source=source.replace(styleReg, function($0, $1){
//					return '<style>'+$1.trim()+'</style>';
//				})
				source=source.replace("<etj-style>",'<style>').replace("</etj-style>",'<\/style>');
			}
//			console.info(source);
			source = "'use strict';"+vars+"_t,_p='',out=function(){_p+=Array.prototype.join.call(arguments, '')};" + source + "return _p";
			try {
				render = new Function("data", "Et",  source);
			} catch (e) {
				e.source = "function anonymous(data,Et) {" + source + "}";;
				throw e;
			}
			if(data) {
				try{
					return render(data, Et);
				}catch(e){
					console.error(e);
				}
				
			}
			var template = function(data) {
				try{
					return render(data, Et);
				}catch(e){
					console.error(e);
				}
			};
			return template;
		}
205239
function Tab(selector, opts) {
    var _this = this;

    _this.$tab = $(selector).eq(0);
    if (!_this.$tab.length) {
      return;
    }

    // 已通过自定义属性实例化过，不再重复实例化
    var oldInst = _this.$tab.data('mdui.tab');
    if (oldInst) {
      return oldInst;
    }

    _this.options = $.extend({}, DEFAULT, (opts || {}));
    _this.$tabs = _this.$tab.children('a');
    _this.$indicator = $('<div class="mdui-tab-indicator"></div>').appendTo(_this.$tab);
    _this.activeIndex = false; // 为 false 时表示没有激活的选项卡，或不存在选项卡

    // 根据 url hash 获取默认激活的选项卡
    var hash = location.hash;
    if (hash) {
      _this.$tabs.each(function (i, tab) {
        if ($(tab).attr('href') === hash) {
          _this.activeIndex = i;
          return false;
        }
      });
    }

    // 含 mdui-tab-active 的元素默认激活
    if (_this.activeIndex === false) {
      _this.$tabs.each(function (i, tab) {
        if ($(tab).hasClass('mdui-tab-active')) {
          _this.activeIndex = i;
          return false;
        }
      });
    }

    // 存在选项卡时，默认激活第一个选项卡
    if (_this.$tabs.length && _this.activeIndex === false) {
      _this.activeIndex = 0;
    }

    // 设置激活状态选项卡
    _this._setActive();

    // 监听窗口大小变化事件，调整指示器位置
    $window.on('resize', $.throttle(function () {
      _this._setIndicatorPosition();
    }, 100));

    // 监听点击选项卡事件
    _this.$tabs.each(function (i, tab) {
      _this._bindTabEvent(tab);
    });
  }
1196217
function onReady() {
  const self = this;

  /***
   * 判断页面是否已经ready
   */
  if (this.hasInited) return;
  this.hasInited = true;

  /***
   * window.document.body的jQuery
   */
  this.bodyDOM = window.document.body;

  /***
   * 存放完全单例对象的容器
   */
  this.singleInstances = null;

  /***
   * 创建page切换时的遮罩层
   */
  this.maskDOM = $(
    "<div class='ct-page-mask'>" +
    " <div opt='animation' class='la-ball-circus la-dark' style='color:#3e98f0;'>" +
    "   <div></div>" +
    "   <div></div>" +
    "   <div></div>" +
    "   <div></div>" +
    "   <div></div>" +
    " </div>" +
    "</div>")[0];
  this.bodyDOM.appendChild(this.maskDOM);


  /***
   * initialLocalTemplate都完成后初始化第一页 and LinkCapture
   */
  Promise.all(
    [
      initialLocalTemplatePromise.call(this),
      LinkCapturePromise.call(this)
    ]
  ).then(() => {
    console.timeEnd("总用时");
    fireEvent(window.document, "pageBeforeChange", [CtMobileFactory.getUrlParam(window.location.hash)]);
    /***
     * 初始化第一页
     * TODO:初始化第一页
     */
    createPage.call(this, this.getFirstId()).then((page) => {
      page.start(0, () => {
          /***
           * if(有hash值) 加载的不是首页而是某一个指定的页面 {
           *   调用startPage即可
           *   startPage需要三部分值
           *   1.html的路径
           *   2.pageId
           *   3.parameter
           * }
           */
          const hash = window.location.hash;
          if (!hash) return false;

          const pageId = self.getPageIdByHash();
          if (!pageId) return false;

          const pageRouterConfig = self.config.router[pageId];
          if ((pageRouterConfig && !pageRouterConfig.url)) return;
          const url = (pageRouterConfig && pageRouterConfig.url) ? pageRouterConfig.url : `#${pageId}`;
          const parameter = self.getParameterByHash();
          const searchObj = CtMobileFactory.getUrlParam(`${url}${parameter}`);

          self.startPage(`${url}${parameter}${parameter ? (searchObj.pageId ? '' : `&pageId=${pageId}`) : `?pageId=${pageId}`}`, {
            reload: self.config.linkCaptureReload
          });
        }
      );
    });
  });

}
192275
function () {
            var _this = this;

            /* 滚动拉取图片 */
            domUtils.on($G('imageList'), 'scroll', function(e){
                var panel = this;
                if (panel.scrollHeight - (panel.offsetHeight + panel.scrollTop) < 10) {
                    _this.getImageData();
                }
            });
            /* 选中图片 */
            domUtils.on(this.container, 'click', function (e) {
                var target = e.target || e.srcElement,
                    li = target.parentNode,
                    nodes = $G('imageListUl').childNodes;

                if (li.tagName.toLowerCase() == 'li') {
                    updateFormState('nocolor', null, '');
                    for (var i = 0, node; node = nodes[i++];) {
                        if (node == li && !domUtils.hasClass(node, 'selected')) {
                            domUtils.addClass(node, 'selected');
                            updateFormState('colored', null, li.firstChild.getAttribute("_src"), 'repeat');
                        } else {
                            domUtils.removeClasses(node, 'selected');
                        }
                    }
                    updateBackground();
                }
            });
        }
819614
function() {
                // 获取现有颜色映射
                //     resource => color_index
                var colorMapping = this._getResourceColorIndexMapping();

                var resource, used, i;

                used = [];

                // 抽取已经使用的值到 used 数组
                for (resource in colorMapping) {
                    if (Object.prototype.hasOwnProperty.call(colorMapping, resource)) {
                        used.push(colorMapping[resource]);
                    }
                }

                // 枚举所有的可用值，如果还没被使用，返回
                for (i = 0; i < RESOURCE_COLOR_SERIES.length; i++) {
                    if (!~used.indexOf(i)) return i;
                }

                // 没有可用的颜色了
                return -1;
            }
1276419
function (e) {
    var self = this
    var info = this.getInfo()
    var subs = this._subs
    var i
    var l

    // 如果不等于上次方向，则触发
    if (info.landscape !== this.info.landscape) {
      this.info = merge(info)
      info.originEvent = e
      info.originType = e.type

      // 执行on
      for (i = 0, l = subs.on.length; i < l; i++) {
        subs.on[i].call(self, e)
      }

      // 执行after
      setTimeout(function () {
        for (i = 0, l = subs.after.length; i < l; i++) {
          subs.after[i].call(self, e)
        }
      }, 0)
    }
  }
446780
function renderHtml(html, state, settings = {}) {

    // 清除settings里的空或未定义项
    for (let i in settings) {
        if (typeof settings[i] === 'undefined' || settings[i] === null)
            delete settings[i]
    }

    let options = Object.assign({
        // routes: {},
        // configStore: {},
        // template: '',
        distPathName: 'dist',
        distPublicPathName: 'dist',
        injection: {}
    }, settings)

    // return template

    let { template, distPathName, distPublicPathName } = options
    let injection = Object.assign({}, options.injection)
    _distPathName = distPathName

    // 针对非开发环境，获取打包目录下的所有文件列表
    if (!distFiles[distPathName] && !__DEV__) {
        const fs = require('fs')
        const path = require('path')
        distFiles[distPathName] = fs.readdirSync(path.resolve(distPathName, 'public/client'))
    }

    function filterStyle(htmlString) {
        let styleCollectionString = htmlString.replace(/\r\n/gi, '').replace(/\n/gi, '').match(/<div id="styleCollection(.*?)>(.*?)<\/div>/gi)[0]

        // 去掉 <div id="styleCollection">...</div>
        let onlyStyle = styleCollectionString.substr(styleCollectionString.indexOf('>') + 1, styleCollectionString.length)
        onlyStyle = onlyStyle.substr(0, onlyStyle.length - 6)

        return {
            html: htmlString.replace(/\n/gi, '').replace(styleCollectionString, ''),
            styles: onlyStyle
        }
    }

    // 样式处理
    if (typeof injection.html === 'undefined' || typeof injection.component_styles === 'undefined') {
        let htmlObj = filterStyle(html)
        if (typeof injection.html === 'undefined') injection.html = htmlObj.html
        if (typeof injection.component_styles === 'undefined') injection.component_styles = htmlObj.styles
    }

    // header 的 meta 生成
    if (typeof injection.meta === 'undefined')
        injection.meta = htmlExtends.meta.map((meta) => {
            let metaStr = '<meta'
            for (var key in meta) {
                metaStr += ` ${key}="${meta[key]}"`
            }
            metaStr += '>'
            return metaStr
        }).join('')

    if (typeof injection.title === 'undefined')
        injection.title = htmlExtends.title || 'App Title'


    if (template === undefined) {
        template = `
            <!DOCTYPE html>
            <html lang="en">

            <head>
                <meta charset="UTF-8">
                <script>//inject_meta</script>
                <title><script>//inject_title</script></title>
                <script>//inject_component_styles</script>
            </head>

            <body>
                <div id="root">
                    <div><script>//inject_html</script></div>
                </div>

                <script>//inject_redux_state</script>
                <script>//inject_js</script>

            </body>

            </html>
        `
    }

    // 序列化的redux状态
    if (typeof injection.redux_state === 'undefined')
        injection.redux_state = `<script>window.__REDUX_STATE__ = ${JSON.stringify(state)};</script>`

    // 跟进环境，注入的js链接
    if (typeof injection.js === 'undefined')
        injection.js = (args) => `<script src="${args.path}/${getInjectionJsFilename('client', distPathName)}"></script>`

    if (typeof injection.pwa === 'undefined')
        injection.pwa = require('sp-pwa/injection').default
    if (typeof injection.pwa_filename === 'undefined')
        injection.pwa_filename = require('sp-pwa/injection-filename').default

    // 返回给浏览器的html
    const injection_html = injection.html
    delete injection.html

    let responseHtml = template

    for (let key in injection) {
        let value = injection[key]
        if (typeof value === 'function')
            value = value({
                path: __DEV__ ? `http://localhost:${CLIENT_DEV_PORT}/${distPublicPathName}` : `/client`,
                distPathName: distPathName,
                distFiles: distFiles[distPathName]
            })
        responseHtml = responseHtml.replace(`<script>//inject_${key}</script>`, value)
    }

    responseHtml = responseHtml.replace(`<script>//inject_html</script>`, injection_html)

    return responseHtml
}
74110
function getUrlParam(par) {
  // 获取当前URL
  var local_url = document.location.href; // 获取要取得的get参数位置

  var get$$1 = local_url.indexOf(par + '=');

  if (get$$1 == -1) {
    return false;
  } // 截取字符串


  var get_par = local_url.slice(par.length + get$$1 + 1); // 判断截取后的字符串是否还有其他get参数

  var nextPar = get_par.indexOf('&');

  if (nextPar != -1) {
    get_par = get_par.slice(0, nextPar);
  }

  return get_par;
}
942303
function () {

        var htmlFile = this.htmlFile;
        var htmlParser = this.htmlParser;
        var options = this.options;
        var resources = [];

        // 获取外链样式资源
        var cssFiles =  htmlParser.getCssFiles();

        // 获取 style 标签内容资源
        var cssContents =  htmlParser.getCssContents();


        cssFiles.forEach(function (cssFile, index) {

            if (!cssFile) {
                return;
            }

            var line = index + 1;
            var from = 'link:nth-of-type(' + line + ')';

            resources.push(
                new Resource(
                    cssFile,
                    null,
                    utils.options(options, {
                        cache: true,
                        from: from
                    })
                )
            );

        });


        cssContents.forEach(function (content, index) {

            if (!content) {
                return;
            }

            var line = index + 1;
            var from = 'style:nth-of-type(' + line + ')';
            var cssFile = htmlFile + '#' + from;
            resources.push(
                new Resource(
                    cssFile,
                    content,
                    utils.options(options, {
                        cache: false,
                        from: from
                    })
                )
            );
        });



        return Promise.all(resources.map(function (resource) {
            return new CssParser(resource);
        }))

        // 对二维数组扁平化处理
        .then(utils.reduce);
    }