监听确认和取消两个按钮事件，用户执行插入或者清空正在播放的视频实例操作
337908
function addOkListener(){
        dialog.onok = function(){
            $G("preview").innerHTML = "";
            var currentTab =  findFocus("tabHeads","tabSrc");
            switch(currentTab){
                case "video":
                    return insertSingle();
                    break;
                case "videoSearch":
                    return insertSearch("searchList");
                    break;
                case "upload":
                    return insertUpload();
                    break;
            }
        };
        dialog.oncancel = function(){
            $G("preview").innerHTML = "";
        };
    }
598849
private void processLastCell(LastCellOfRowDummyRecord lastCell) {
		// 每行结束时， 调用handle() 方法
		this.rowHandler.handle(curSheetIndex, lastCell.getRow(), this.rowCellList);
		// 清空行Cache
		this.rowCellList.clear();
	}
391508
function (token) {
            if (isWhiteSpace(token)) {
                // 默认都要删除空白
                var remove = true;

                // 空白前面是换行 && 后面是注释的不删除
                if (token.prev && token.next && isLineBreak(token.prev) && isComment(token.next)) {
                    remove = false;
                }

                if (remove) {
                    removeToken(token);
                }
            }

            if (isLineComment(token)) {
                token.raw = token.raw.trimRight();
            }

            if (isBlockComment(token)) {
                var rawArray = token.raw.split(_config.lineSeparator);
                rawArray.forEach(function (line, i) {
                    rawArray[i] = line.trimRight();
                });
                token.raw = rawArray.join(_config.lineSeparator);
            }
        }
32301
private void clean(Connection conn) {
        this.selectColumns = null;
        this.isSQLLimit = false;
        this.orderBySQL = new StringBuilder();
        this.conditionSQL = new StringBuilder();
        this.paramValues.clear();
        this.excludedColumns.clear();
        this.updateColumns.clear();

        ifThen(localConnection.get() == null && conn != null,
                () -> conn.close());
    }
755950
private Long findTransactionBeginPosition(ErosaConnection mysqlConnection, final EntryPosition entryPosition)
                                                                                                                 throws IOException {
        // 针对开始的第一条为非Begin记录，需要从该binlog扫描
        final java.util.concurrent.atomic.AtomicLong preTransactionStartPosition = new java.util.concurrent.atomic.AtomicLong(0L);
        mysqlConnection.reconnect();
        mysqlConnection.seek(entryPosition.getJournalName(), 4L, entryPosition.getGtid(), new SinkFunction<LogEvent>() {

            private LogPosition lastPosition;

            public boolean sink(LogEvent event) {
                try {
                    CanalEntry.Entry entry = parseAndProfilingIfNecessary(event, true);
                    if (entry == null) {
                        return true;
                    }

                    // 直接查询第一条业务数据，确认是否为事务Begin
                    // 记录一下transaction begin position
                    if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
                        && entry.getHeader().getLogfileOffset() < entryPosition.getPosition()) {
                        preTransactionStartPosition.set(entry.getHeader().getLogfileOffset());
                    }

                    if (entry.getHeader().getLogfileOffset() >= entryPosition.getPosition()) {
                        return false;// 退出
                    }

                    lastPosition = buildLastPosition(entry);
                } catch (Exception e) {
                    processSinkError(e, lastPosition, entryPosition.getJournalName(), entryPosition.getPosition());
                    return false;
                }

                return running;
            }
        });

        // 判断一下找到的最接近position的事务头的位置
        if (preTransactionStartPosition.get() > entryPosition.getPosition()) {
            logger.error("preTransactionEndPosition greater than startPosition from zk or localconf, maybe lost data");
            throw new CanalParseException("preTransactionStartPosition greater than startPosition from zk or localconf, maybe lost data");
        }
        return preTransactionStartPosition.get();
    }
782336
@Override
    public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
        Single<UnitResponse> result;
        boolean flush = msg.get(FLUSH, Boolean.class, false);//是否马上提交
        msg.getArgMap().remove(FLUSH);
        //判断是否需要批量操作
        if (getBatchSize() >= MIN_BATCH_SIZE) {
            recordCacheList.add(msg.getArgMap());
            //判断是否达到批量执行的数量阈值，或者业务需要立即执行
            if (recordCacheList.size() >= getBatchSize() || flush) {
                Map<String, Object> params = new HashMap<>();
                synchronized (recordCacheList) {
                    params.put(VALUES, new ArrayList<Map>(recordCacheList));
                    recordCacheList.clear();
                }
                preBatchExecute(msg);
                result = SingleRxXian.call(getBatchGroupName(), getBatchUnitName(), params);
            } else {
                result = doCache(msg);
            }
        } else {//没有批量需求，立即执行
            result = SingleRxXian.call(getBatchGroupName(), getBatchUnitName(), msg.getArgMap());
        }
        result.subscribe(handler::handle);
    }
1175173
public function check()
    {
        // 清空数据和错误
        $data = $this->_errors = [];

        // 保存原来的数据
        $original = $this->_data;

        // 读取字段信息
        $fields = Arr::merge(array_keys($original), array_keys($this->_labels));

        // 现在的规则
        $rules = $this->_rules;

        // 逐个字段格式化下规则
        foreach ($fields as $field)
        {
            $data[$field] = Arr::get($this->_data, $field);

            // 如果key为true，那么规则就是所有字段都生效
            if (isset($rules[true]))
            {
                if ( ! isset($rules[$field]))
                {
                    $rules[$field] = [];
                }
                $rules[$field] = array_merge($rules[$field], $rules[true]);
            }
        }

        // 保存格式化后的规则
        $this->_data = $data;

        // 清空全局规则
        unset($rules[true]);

        // 绑定一些必要的变量
        $this->bind(':validation', $this);
        $this->bind(':data', $this->_data);

        foreach ($rules as $field => $set)
        {
            $value = Arr::get($this->_data, $field);

            // 绑定当前处理的字段和值
            $this->bind([
                ':field' => $field,
                ':value' => $value,
            ]);

            foreach ($set as $array)
            {
                // 格式：[$rule, $params]
                $rule = array_shift($array);
                $params = array_shift($array);

                foreach ($params as $key => $param)
                {
                    // 替换绑定的变量
                    if (is_string($param) && array_key_exists($param, $this->_bound))
                    {
                        $params[$key] = $this->_bound[$param];
                    }
                }

                // 默认错误名跟规则名一致，因为一般规则都是字符串表示的
                $errorName = $rule;

                // 规则是数组，说明传入的是一个callback
                if (is_array($rule))
                {
                    // 允许rule('field', [':model', 'some_rule']);
                    if (is_string($rule[0]) && array_key_exists($rule[0], $this->_bound))
                    {
                        $rule[0] = $this->_bound[$rule[0]];
                    }

                    // 把索引为1的值作为错误标记
                    $errorName = $rule[1];
                    $passed = call_user_func_array($rule, $params);
                }
                elseif ( ! is_string($rule))
                {
                    // 匿名函数不做错误处理，留待内容做处理
                    $errorName = false;
                    $passed = call_user_func_array($rule, $params);
                }
                elseif (method_exists(self::$validHelperClass, $rule))
                {
                    // 调用校验助手类来完成操作
                    $method = new ReflectionMethod(self::$validHelperClass, $rule);
                    $passed = $method->invokeArgs(null, $params);
                }
                elseif (false === strpos($rule, '::'))
                {
                    // 不符合静态方法调用的规则，那么直接按照函数调用
                    $function = new ReflectionFunction($rule);
                    $passed = $function->invokeArgs($params);
                }
                else
                {
                    // 当做一次静态函数调用
                    $temp = explode('::', $rule, 2);
                    $class = array_shift($temp);
                    $method = array_shift($temp);
                    $method = new ReflectionMethod($class, $method);
                    $passed = $method->invokeArgs(null, $params);
                }

                if ( ! in_array($rule, $this->_emptyRules) && ! Valid::notEmpty($value))
                {
                    continue;
                }

                if (false === $passed && false !== $errorName)
                {
                    $this->error($field, $errorName, $params);
                    break;
                }
                elseif (isset($this->_errors[$field]))
                {
                    // 匿名函数自己处理错误信息，这里就不处理了
                    break;
                }
            }
        }

        // 还原原来的值
        $this->_data = $original;

        return empty($this->_errors);
    }
953331
function (e) {
    if (e.type === 'touchstart') {
      // 触发了 touch 事件
      TouchHandler.touches += 1;
    } else if (['touchmove', 'touchend', 'touchcancel'].indexOf(e.type) > -1) {
      // touch 事件结束 500ms 后解除对鼠标事件的阻止
      setTimeout(function () {
        if (TouchHandler.touches) {
          TouchHandler.touches -= 1;
        }
      }, 500);
    }
  }
760662
private void preHandling(){
		target = stringPreHandlingModule.delKeyword(target, "\\s+"); //清理空白符
		target = stringPreHandlingModule.delKeyword(target, "[的]+"); //清理语气助词
		target = stringPreHandlingModule.numberTranslator(target);//大写数字转化
	}
641307
public boolean pause(Long channelId, boolean needTermin) {
        ChannelStatus currstatus = status(channelId);
        boolean status = false;
        boolean result = !needTermin;
        if (currstatus.isStart()) { // stop的优先级高于pause，这里只针对start状态进行状态更新
            updateStatus(channelId, ChannelStatus.PAUSE);
            status = true; // 避免stop时发生rollback报警
        }

        if (needTermin) {
            try {
                // 调用termin进行关闭
                result |= termin(channelId, TerminType.ROLLBACK);
            } catch (Throwable e) {
                updateStatus(channelId, ChannelStatus.PAUSE); // 出错了，直接挂起
                throw new ArbitrateException(e);
            }
        }

        return result && status;
    }
384135
public function reset()
    {
        if($this->db instanceof \Imi\Db\Drivers\CoroutineMysql\Driver)
        {
            $this->db->getInstance()->setDefer(false);
        }
        // 如果在事务中，则回滚
        if($this->db->inTransaction())
        {
            $this->db->rollBack();
        }
    }
447563
public void invoke() throws ActionException {
		Integer position = interceptorPosition.get();
		if (position == null) {
			position = 0;
		}

		if (interceptors != null && position < interceptors.length) {
			//执行过滤器，递归调用本方法
			interceptorPosition.set(position + 1);
			interceptors[position].invoke(this);
		}else {
			//过滤器执行完毕，执行本体方法
			invokeActionMethod();
			// 执行了Action本体方法，说明过滤器使用完毕，清理游标防止重复执行
			resetInterceptorPosition();
		}
	}
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)
    }
  }
728956
function addListener(resolver, status, callback) {
        if (resolver.status === status) {
            // 设置延迟
            // 为了让then函数先返回再执行回调
            // see #2.2.4
            Resolver.nextTick(
                function () {
                    callback(resolver.data);
                }
            );
        }
        else if (status === STATUS.FULFILLED) {
            resolver.fulfillList.push(callback);
        }
        else if (status === STATUS.REJECTED) {
            resolver.rejectList.push(callback);
        }
    }
440158
public void execute(int key, Runnable runnable) {
        if (StringUtil.isEmpty(key)) {
            throw new IllegalArgumentException("入参key不允许为空！");
        }
        int mod = Math.abs(key % map.size());
        LOG.debug("_sequential   选取第" + mod + "根线程执行任务，threadKey=" + key);
        ThreadPoolExecutor executor = map.get(mod);
        executor.execute(ThreadPoolManager.wrapRunnable(runnable, MsgIdHolder.get()));
    }
20948
function (range) {
            //每次获取cells之前必须先清除上次的选择，否则会对后续获取操作造成影响
            this.clearSelected();
            var beginRowIndex = range.beginRowIndex,
                beginColIndex = range.beginColIndex,
                endRowIndex = range.endRowIndex,
                endColIndex = range.endColIndex,
                cellInfo, rowIndex, colIndex, tdHash = {}, returnTds = [];
            for (var i = beginRowIndex; i <= endRowIndex; i++) {
                for (var j = beginColIndex; j <= endColIndex; j++) {
                    cellInfo = this.indexTable[i][j];
                    rowIndex = cellInfo.rowIndex;
                    colIndex = cellInfo.colIndex;
                    // 如果Cells里已经包含了此Cell则跳过
                    var key = rowIndex + '|' + colIndex;
                    if (tdHash[key]) continue;
                    tdHash[key] = 1;
                    if (rowIndex < i || colIndex < j || rowIndex + cellInfo.rowSpan - 1 > endRowIndex || colIndex + cellInfo.colSpan - 1 > endColIndex) {
                        return null;
                    }
                    returnTds.push(this.getCell(rowIndex, cellInfo.cellIndex));
                }
            }
            return returnTds;
        }
1201399
private function stop() {
        if (!file_exists($this->pidFile)) {
            _throw('事件监听守护进程尚未运行');
        }

        $masterPid = file_get_contents($this->pidFile);
        posix_kill($masterPid, SIGTERM);

        //检查是否已停止运行
        while (file_exists($this->pidFile)) {
            sleep(3);
        }

        echo "事件监听守护进程已停止运行\n";
    }