$.each(wgs, function(i, wg){ if(~$.inArray(Number(wgs.eq(i).val()), arrays)){ wgs.eq(i).attr('checked', true); }else { wgs.eq(i).attr('checked', false); } })
showLoading: function () { var that=this; if(that.pageIndex==1) { var position=that.$el.css('position'), isLayout=$.inArray(position,['absolute','relative','fix'])!= -1; if(!that.$loading) { that.$loading=$(that.template); } that.$loading.css({ top: that.el.tagName=='body'?'':isLayout?0:that.$el.position().top }) .appendTo(that.$el) .show() .find('.js_msg').html(''); that.$loading.find('.js_loading').show(); that.$refreshing&&that.$refreshing.hide(); } else { var $refreshing=(that.$refreshing||(that.$refreshing=$(that.refresh))).appendTo(that.$el); $refreshing.show().find('.js_msg').html('正在载入...'); $refreshing.find('.js_loading').show(); that.$loading&&that.$loading.hide(); } },
a.each(function(i){ var d = $(this)[0], c = $.inArray(Math.min.apply(Math, conf.colArray), conf.colArray), f = conf.colArray[c]; d.style.top = f + "px"; d.style.left = c * conf.columnWidthOuter + "px"; $(conf.container + ":last").append(d); conf.colArray[c] = f + d.offsetHeight + conf.columnMargin; });
$.each(self.option('customRules'), function (key, func) { if (typeof func === 'function') { // 扩充 attributes if ($.inArray(key, attributes) === -1) { attributes.push(key); } // 扩充/替换 rules rules[key] = func; } });
fill: function() { var self = $.smeite.fallGoods, conf = self.conf; var colMaxH = Math.max.apply(Math, conf.colArray), index = $.inArray(colMaxH, conf.colArray); for(var i=0;i<conf.columns;i++){ if(i != index){ $(conf.container).append('<div class="goods-fill" style="top:' + conf.colArray[i] + 'px;left:' + i* conf.columnWidthOuter +'px;height:' + (colMaxH - conf.colArray[i] - conf.columnMargin) + 'px"></div>'); } } },
this.addRule('availableFileType', function(options) { var allow = ['.csv', '.xls'], extension = /\.[^\.]+$/.exec(options.element.value); if (!extension) { return false; } if ($.inArray(extension[0].toLowerCase(), allow) == -1) { return false; } return true; }, '无效的文件类型,请重新选择' + this.label);
server.logout(function(resp){ if (resp.code == 0) { if (~$.inArray(roleType, [1, 11, 12])) { // location.href = 'login'; } else { // city manager location.href = 'cityLogin'; } } else { dialogUi.tip(resp.msg || '退出登录失败'); } })
availableFileType: function() { var allow = ['.csv', '.xls'], extension = /\.[^\.]+$/.exec(this.element.value); if (!extension) { this.errorMessage = '无效的文件类型,请重新选择' + this.label; return false; } if ($.inArray(extension[0].toLowerCase(), allow) == -1) { this.errorMessage = '无效的文件类型,请重新选择' + this.label; return false; } return true; }
curGoodsArr.each(function(i){ var d = $(this)[0], c = $.inArray(Math.min.apply(Math, conf.colArray), conf.colArray), f = conf.colArray[c]; d.style.top = f + "px"; d.style.left = c * conf.columnWidthOuter + "px"; d.style.display="block"; if(conf.page > 1){ $img = $(this).find("img:first"); $img.attr("src", $img.attr("data-src")); } conf.colArray[c] = f + d.offsetHeight + conf.columnMargin; }).animate({
$.each(data, function(index, value) { var flag = true; if(hasInCache) { flag = !hasInCache(value, cache); } else { value = value.value ? value.value : value; if($.inArray(value, cache) > -1) { flag = false; } } if(flag) { result.push(value); } });
this.addRule('availableFileType', function(options) { var fullpath = options.element.value; var filename = fullpath.substr(fullpath.lastIndexOf('\\') + 1); var allow = ['.csv', '.xls'], extension = /\.[^\.]+$/.exec(fullpath); if (!extension) { return false; } if ($.inArray(extension[0].toLowerCase(), allow) == -1) { return false; } $('.upload-trigger', this.rootNode).addClass('fn-hide'); $('.rollback-filename', this.rootNode).text(filename).attr('title', filename).removeClass('fn-hide'); $('.reupload-file', this.rootNode).removeClass('fn-hide'); return true; }, '无效的文件类型,请重新选择' + this.label);
(function (extArr) { var temp = []; for (var i = 0, file; file = arr[i]; i++) { var ext = file.name.split('.'); ext = ext[ext.length - 1].toLowerCase(); ext = '*.' + ext; file.index = this.index++; if ($.inArray(ext, extArr) !== -1) { temp.push(file); } else { file.error = true; this.trigger('notAllowType', file); this.trigger('errerAdd', file); } } arr = temp; }).call(this, type);
_onChangeStatus: function (nStatus, oStatus) { var self = this, DOM, index; var historyContainer = $("#history-container"); if (nStatus) { DOM = this.get('DOM'); index = $.inArray(nStatus, statusEnum); DOM.children().hide().eq(index).show(); } switch (nStatus) { case 'chat-room': var delay = self.get('targets').length <= 1 ? 500 : 300; setTimeout(function () { $("#message-content").focus(); }, delay); break; case 'notice-room': case 'group-notice-room': break; case 'history': historyContainer.empty(); HistoryCalendar.set('date', new Date()); /*setTimeout(function () { HistoryCalendar.set('date', new Date()); }, 10);*/ HistoryCalendar.get('trigger').val(''); HistoryPagination.set('total', null); break; case 'group-share': self.get('target').showGroupShare(); break; case 'group-info': self.get('target').showGroupInfo(); break; case 'discussion-info': self.get('target').showDiscussionInfo(); break; } }
$('a',ShowTips).on('click',function(){ var val = that.val().split(" "); var v = $(this).html(); for (var i = 0 ; i<val.length; i++) { if(val[i] == "" || typeof(val[i]) == "undefined") { val.splice(i,1); i= i-1; } } if ( $.inArray(v,val) > -1 ) { return false } if ( Number(opts.Amount) === 1 ) { return that.val(v).focus() } else if ( val.length === Number(opts.Amount) ){ return false; } val.push(v); that.val(val.join(" ")).focus() });
map: function (data) { var i = 0; for (; i < data.length; i++) { if (data[i].status) { data[i].statusEx = statusMap[data[i].status]; //if(data[i].amount){ // data[i].amount = data[i].amount.toFixed(2); //} } //立案前(待提交、已提交、立案审核、立案补正、原告已撤诉、退回)弹出案件详情单页面,否则多页面 if(!data[i].status || $.inArray(data[i].status, beforeFillingStatus) > 0){ data[i].fillingTab = "false" }else{ data[i].fillingTab = "true" } } return data; }
checkOptions: function(){ if($.inArray(this.options.animate, this.animate) == -1){ this.options.animate = this.animate[0]; } if($.inArray(this.options.direction,this.direction) == -1){ this.options.direction = this.direction[0]; } if($.inArray(this.options.navTheme,this.navTheme) == -1){ this.options.navTheme = this.navTheme[0]; } if($.inArray(this.options.thumbsLayout,this.thumbsLayout) == -1){ this.options.thumbsLayout = this.thumbsLayout[0]; } if($.inArray(this.options.navLayout,this.navLayout) == -1){ this.options.navLayout = this.navLayout[0]; } if($.inArray(this.options.infoLayout,this.infoLayout) == -1){ this.options.infoLayout = this.infoLayout[0]; } this.options.isLoop = this.options.isLoop || false; },
allowItemType: function() { return $.inArray(this.type, itemType) == -1; },
.error(function() { if ($.inArray(callbackId, that.callbacks) > -1) { delete that.callbacks[callbackId]; that._done({}); } });
.success(function(data) { if ($.inArray(callbackId, that.callbacks) > -1) { delete that.callbacks[callbackId]; that._done(data); } })
function allowItemType(type) { return $.inArray(type, itemType) == -1; }
function indexOf(array, value) { return ~$.inArray(value, array); }
listen: function(actions, node, type) { actions = actions || {}; node = node ? $(node) : $(document); type = type || 'click'; var index = $.inArray(node[0], cache.dom); if(index !== -1) { if(cache.eventType[index] !== type) { index = -1; } } if(index === -1) { cache.dom.push(node[0]); cache.eventType.push(type); cache.action.push(actions); index = cache.action.length - 1; node[type](function(e) { var target = $(e.target); var actionKey = target.attr(actionKeyVal); var xnode = target; if(!actionKey) { xnode = target.closest('[' + actionKeyVal + ']'); actionKey = xnode.attr(actionKeyVal); } var flag = true; var fetch = cache.action[index]; var fetchAction = fetch[actionKey]; if(fetchAction) { if($.isFunction(fetchAction.not)) { // 存在not if(fetchAction.node && fetchAction.node[0] !== xnode[0]) { // 可能触发的是同一个action,但节点不同 fetchAction.not.call(fetchAction.scope || target, e, fetchAction.node, actionKey); } fetchAction.node = xnode; // 缓存住,提供给not使用 fetchAction.using = true; } if($.isFunction(fetchAction)) { flag = fetchAction.call(target, e, xnode, actionKey); } else { if($.isFunction(fetchAction.is) || $.isFunction(fetchAction.action)) { var fn = fetchAction.is || fetchAction.action; flag = fn.call(fetchAction.scope || target, e, xnode, actionKey); } } } for(var i = 0, len = cache.action.length; i < len; i++) { var temp = cache.action[i]; for(var key in temp) { if(key !== actionKey && temp[key] && temp[key].not && $.isFunction(temp[key].not) && temp[key].using) { temp[key].not.call(temp[key].scope || target, e, temp[key].node, actionKey); temp[key].using = false; } } } if(flag === -1) { // 禁用冒泡 e.stopPropagation(); } else if(flag === true) { // 都不禁用 return true; } else if(flag === false) { // 都禁用 return false; } else { // 默认无返回值时禁用默认行为,但不禁用冒泡 e.preventDefault(); } }); } else { var fetch = cache.action[index]; for(var key in actions) { fetch[key] = actions[key]; } } return node; }