Beispiel #1
0
    exports.init = function (container, forceReload, useAliImgService) {

        useAliImgService != undefined && (useAliService = useAliImgService);
        container = container || document.body;

        var $nodes1 = $(container).filter('img[' + IMG_DATA_SRC + ']');
        var $nodes2 = $(container).find('img[' + IMG_DATA_SRC + ']');

        var lazyID, $item;

        function add(index, item) {
            $item = $(item);
            if ($item.attr(IMG_DATA_SRC)) {
                lazyID = util_base.getUid(item, forceReload);
                //判断是否初始化过该图片
                if (!hashMapStore[lazyID]) {
                    mvcArrImages.push(item);
                    hashMapStore[lazyID] = 1;
                }
            }
        }

        $.each($nodes1, add);
        $.each($nodes2, add);
    };
Beispiel #2
0
 p.getList = function(){
     var list = [];
     $.each(this.list,function(index,item){
         list.push('<li data-src="'+item.src+'">'+item.name+'</li>');
     });
     return list.join("");
 };
                searchTime = setTimeout(function () {
                    var hotWordsArray = [];
                    var sw = $searchInput.val();
                    if (prevStr === $searchInput.val()) {
                        return false;
                    }
                    $.post('https://mip.zhaopin.com/searchjob/SearchRedolent', {
                        keyword: $searchInput.val()
                    }, function (data, textStatus, jqxhr) {
                        $SearchLsWrap.show().children('dd').remove();
                        if (data.HotWords.length > 0) {
                            hotWordsArray = data.HotWords;
                        } else {
                            $SearchLsWrap.find('dt').hide();
                        }
                    }, 'json');
                    if (hotWordsArray.length > 0) {
                        $.each(hotWordsArray, function (i, v) {
                            v.Word = v.Word.replace(sw, '<span class="gl">' + sw + '</span>');
                            $('<dd><a>' + v.Word + '</a><span class="add"></span></dd>').prependTo($SearchLsWrap);
                        });
                        $SearchLsWrap.find('.clear').hide();
                    }
                    prevStr = $searchInput.val();

                }, 500);
        that.changeWheel = function (idx, time, manual) {
            if (dw) {
                var i = 0,
                    nr = idx.length;

                $.each(s.wheels, function (j, wg) {
                    $.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++;
                    });
                    if (!nr) {
                        return false;
                    }
                });
            }
        };
            }).then(function (text) {
                var parse = JSON.parse(text);
                var data = parse[0].data;
                var categoryIdsReplace = categoryIds.replace(/,/g, '_');
                var idsArry = ids.split(',');
                $.each(data, function (index, val) {
                    var quote = val.quote;
                    var digits = 2;
                    var time = quote.q59;
                    if (typeof (time) !== 'undefined') {
                        if (new Date(time).getTime() > newTime) {
                            newTime = time;
                        }
                    }
                    digits = quote.digits;
                    if (isNaN(digits)) {
                        digits = 2;
                    }
                    index += 1;
                    $.each(idsArry, function (idsIndex, val) {
                        var textColor = undefined;
                        var valueStr = undefined;
                        if (colorSet[val]) {
                            textColor = getColor(val, 'q2', quote);
                        } else if (specalColorMap[val] !== undefined) {
                            textColor = getColor('q63', 'q2', quote);
                        }

                        if (colorSet[val]) {
                            valueStr = format(quote[val], digits);
                        } else if (val === 'q70') {
                            valueStr = format(quote[val], digits);
                        } else if (val === 'q80') {
                            valueStr = format(quote[val], 2) + '%';
                        } else {
                            valueStr = quote[val];
                        }
                        if (val === 'q68' || val === 'q67') {
                            var alinkUrl = linkUrl;
                            var ahtml = dealALinkUrl(alinkUrl, quote, val, linkUrlJson);
                            $('#' + index + '_' + categoryIdsReplace + '_' + val).html(ahtml);
                        } else {
                            $('#' + index + '_' + categoryIdsReplace + '_' + val).html(valueStr);
                        }
                        $('#' + index + '_' + categoryIdsReplace + '_' + val).addClass(textColor);
                    });

                    var dateFormat = $('#' + categoryIdsReplace + '_updateTime').attr('dateFormat');
                    if (dateFormat === undefined) {
                        dateFormat = 'yyyy-MM-dd HH:mm:ss';
                    }
                    $('#' + categoryIdsReplace + '_updateTime').html('更新时间  ' + formatDate(new Date(time), dateFormat));



                });
            });
 return function(msgMap) {
     
     
     
     $.each(msgMap, function(k,v){
         this.find('[name='+ k +']').parent().find('[data-err]').html(v);
     }.bind(this))
     
 }
 function event(name, args) {
     var ret;
     args.push(that);
     $.each([theme, pres, settings], function (i, v) {
         if (v && v[name]) { // Call preset event
             ret = v[name].apply(e, args);
         }
     });
     return ret;
 }
Beispiel #8
0
 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);
     });
 },
 function convert(w) {
     var ret = {
         values: [],
         keys: []
     };
     $.each(w, function (k, v) {
         ret.keys.push(k);
         ret.values.push(v);
     });
     return ret;
 }
 $('.chat-ans-more-btn').click(function () {
     $('.ans-more-list').show();
     $.each($('.ans-more-list .computedLine'), function (i) {
         if ($(this).height() < ans) {
             $(this).closest('.chat-con-box').find('.moreCon').hide();
         } else {
             $(this).closest('.chat-con-box').find('.moreCon').show();
         }
     });
     $(this).hide();
 });
 $.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);
     });
 });
 $.each(inst.settings.wheels, function (j, wg) {
     $.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++;
     });
 });
Beispiel #13
0
 reSizeImg: function(opts) {
     var self = this,
         _settings = opts || {},
         type = _settings.type || 'guessData',
         data;
     if (type == 'guessData') {
         data = self.cacheData.guessData[self.cacheData.sid];
         $.each(data, function(index, item) {
             item['picUrl'] = 'http://webmap1.map.bdimg.com/maps/services/thumbnails?width=220&height=100&quality=100&align=middle,middle&src=' + item['picUrl'];
         });
     }
     return self;
 },
 success: function (data, textStatus, jqxhr) {
     $SearchLsWrap.show().children('dd').remove();
     var sw = SearchInput.val();
     if (data.HotWords.length > 0) {
         $.each(data.HotWords, function (i, v) {
             v.Word = v.Word.replace(sw, '<span class="gl">' + sw + '</span>');
             $('<dd><a>' + v.Word + '</a><span class="add"></span></dd>').prependTo($SearchLsWrap);
         });
         $SearchLsWrap.find('.clear').hide();
     } else {
         $SearchLsWrap.find('dt').hide();
     }
 }
Beispiel #15
0
        fill = function(options,rstore){
            var commons = {
                url: options.url || "",
                title: options.title || "",
                content: options.content || "",
                img: options.img || ""
            };

            $.each(shareType,function(index,shareto){
                options[shareto] = $.extend({},commons,options[shareto] || {});
            });

            $.extend(rstore||store,options);
        },
Beispiel #16
0
	}, function(result, originData) {

		var form = '<form action="' +
			originData.url + '" method="post">'

		$.each(data, function(key, val) {
			if (key != 'tjzAjax') {
				form += '<input type="hidden" name="' + key + '" value="' + val + '" />'
			}
		});

		form += '</form>';

		$(form).appendTo($('body')).submit();
	});
            $.each(s.wheels, function (i, wg) { // Wheel groups
                html += '<div class="dwc' + (s.mode != 'scroller' ? ' dwpm' : ' dwsc') + (s.showLabel ? '' : ' dwhl') + '"><div class="dwwc dwrc"><table cellpadding="0" cellspacing="0"><tr>';
                $.each(wg, function (j, w) { // Wheels
                    wheels[l] = w;
                    lbl = w.label !== undefined ? w.label : j;
                    html += '<td><div class="dwwl dwrc dwwl' + l + '">' + (s.mode != 'scroller' ? '<a href="#" tabindex="-1" class="dwb-e dwwb dwwbp" style="height:' + hi + 'px;line-height:' + hi + 'px;"><span>+</span></a><a href="#" tabindex="-1" class="dwb-e dwwb dwwbm" style="height:' + hi + 'px;line-height:' + hi + 'px;"><span>&ndash;</span></a>' : '') + '<div class="dwl">' + lbl + '</div><div tabindex="0" aria-live="off" aria-label="' + lbl + '" role="listbox" class="dwww"><div class="dww" style="height:' + (s.rows * hi) + 'px;' + (s.fixedWidth ? ('width:' + (isFixw ? s.fixedWidth[l] : s.fixedWidth) + 'px;') : (s.minWidth ? ('min-width:' + (isMinw ? s.minWidth[l] : s.minWidth) + 'px;') : 'min-width:' + s.width + 'px;') + (s.maxWidth ? ('max-width:' + (isMaxw ? s.maxWidth[l] : s.maxWidth) + 'px;') : '')) + '"><div class="dw-ul">';
                    // Create wheel values
                    html += generateWheelItems(l);
                    html += '</div><div class="dwwol"></div></div><div class="dwwo"></div></div><div class="dwwol"></div></div></td>';
                    l++;
                });


                html += '</tr></table></div></div>';
            });
 that.destroy = function () {
     that.hide(true, false, true);
     // Remove all events from elements
     $.each(elmList, function (i, v) {
         v.off('.dw');
     });
     // Remove events from window
     $(window).off('.dwa');
     // Reset original readonly state
     if (input) {
         e.readOnly = readOnly;
     }
     // Delete scroller instance
     delete instances[e.id];
     event('onDestroy', []);
 };
Beispiel #19
0
 getCacheKey: function (url, params) {
     if (typeof params == 'undefined') {
         return url;
     }
     if (typeof params == 'object') {
         var tmp = params;
         params = '';
         $.each(tmp, function (k, v) {
             params += '&' + k + '=' + v;
         });
         tmp = null;
     }
     if (typeof params == 'string') {
         url += url.indexOf('?') > -1 ? '&' + params : '?' + params;
     }
     return decodeURIComponent(url);
 },
 success: function (data) {
     var jsondata = JSON.parse(data);
     $('.pLinks1').empty();
     $('.pLinks').hide();
     $('.pLinks1').show();
     if (jsondata.length) {
         $.each(jsondata, function (index, value) {
             var htmls = '<a href="' + value.url + '" target="_self"><span class="sName">';
             htmls = htmls + value.title + '</span><span class="sStyle">';
             htmls = htmls + value.d_typename + '</span></a>';
             $('.pLinks1').append(htmls);
         });
     } else {
         var htmls = '<a href="javascript:0" target="_self" style="text-align:center;">';
         htmls = htmls + '<span class="sName">没有找到相关数据</span></a>';
         $('.pLinks1').append(htmls);
     }
 }
            setTimeout(function () {
                // Init buttons
                $.each(buttons, function (i, b) {
                    that.tap($('.dwb' + i, dw), function (e) {
                        b = (typeof b === 'string') ? that.buttons[b] : b;
                        b.handler.call(this, e, that);
                    });
                });

                if (s.closeOnOverlay) {
                    that.tap(overlay, function () {
                        that.cancel();
                    });
                }

                dw.on(START_EVENT, '.dwwl', onStart).on(START_EVENT, '.dwb-e', onBtnStart);

            }, 300);
 // 读取历史记录方法
 function readSearchLs() {
     var indexSearchHs = cs.get('indexSearchHs');
     var $SearchLsWrap = $('.indexSearchList');
     var dtBool = true;
     if (indexSearchHs == null) {
         indexSearchHs = [];
     } else {
         indexSearchHs = indexSearchHs.split(',');
     }
     if (indexSearchHs.length > 0) {
         $SearchLsWrap.children('dd').remove();
         $.each(indexSearchHs, function (i, v) {
             $('<dd><a>' + v + '</a><span class="add"></span></dd>').prependTo($SearchLsWrap);
         });
         $SearchLsWrap.show().find('dt').show().children('.clear').show();
     } else {
         dtBool = false;
         $SearchLsWrap.hide();
     }
 }
            parseValue: function (value, inst) {
                var val = value.split(' '),
                    ret = [],
                    i = 0,
                    keys;

                $.each(inst.settings.wheels, function (j, wg) {
                    $.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++;
                    });
                });
                return ret;
            }
        function generateWheelItems(i) {
            var html = '<div class="dw-bf">',
                ww = wheels[i],
                w = ww.values ? ww : convert(ww),
                l = 1,
                labels = w.labels || [],
                values = w.values,
                keys = w.keys || values;

            $.each(values, function (j, v) {
                if (l % 20 == 0) {
                    html += '</div><div class="dw-bf">';
                }
                html += '<div role="option" aria-selected="false" class="dw-li dw-v" data-val="' + keys[j] + '"' + (labels[j] ? ' aria-label="' + labels[j] + '"' : '') + ' style="height:' + hi + 'px;line-height:' + hi + 'px;"><div class="dw-i">' + v + '</div></div>';
                l++;
            });

            html += '</div>';
            return html;
        }
        function getCurrentPosition(t) {
            var style = window.getComputedStyle ? getComputedStyle(t[0]) : t[0].style,
                matrix,
                px;

            if (has3d) {
                $.each(['t', 'webkitT', 'MozT', 'OT', 'msT'], function (i, v) {
                    if (style[v + 'ransform'] !== undefined) {
                        matrix = style[v + 'ransform'];
                        return false;
                    }
                });
                matrix = matrix.split(')')[0].split(', ');
                px = matrix[13] || matrix[5];
            } else {
                px = style.top.replace('px', '');
            }

            return Math.round(m - (px / hi));
        }
Beispiel #26
0
        init: function () {
            var that=this,
                data=that.options.data;

            if(that.options.render) that.render=$.proxy(that.options.render,that);
            that.options.onChange&&that.bind('Change',that.options.onChange);

            that.data=data;
            that.$el.addClass('tabs');

            var $tabsNav=$('<div class="tabs-nav"><ul></ul></div>').appendTo(that.$el),
                $content=$('<div class="tabs-content"></div>').appendTo(that.$el),
                minHeight=window.innerHeight-$content.offset().top;

            that.$nav=$tabsNav.find('ul');
            that.nav=that.$nav[0];
            that.$content=$content.css({ minHeight: minHeight });

            if(that.data.length>4) {
                that.$nav.css({ width: 25*that.data.length+'%' });
            }

            $.each(that.data,function (i,item) {
                that.render(item);
            });
            that.$navItems=that.$nav.children();
            that.$panels=$content.children().css({
                minHeight: minHeight
            });

            that.itemWidth=that.$navItems.eq(0).width();
            that.minSlideIndex=0;
            that.maxSlideIndex=that.$navItems.length-4;
            that.minX= -1*that.itemWidth*(that.maxSlideIndex);
            that.maxX=that.minSlideIndex*that.itemWidth;
            that._getXY();

            $(window).on('ortchange',function () {
            });
            that.to(0);
        },
            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;
            };
    var newclubFunction = function (ans) {
        var sHeight = $('.chat-top-search').height();

        viewport.on('scroll', function () {
            var scrollTop =  viewport.getScrollTop();
            if (scrollTop < sHeight) {
                $('.chat-top').css('margin-top', -scrollTop);
            } else if (scrollTop === 0) {
                $('.chat-top').css('margin-top', 0);
            } else {
                $('.chat-top').css('margin-top', -sHeight);
            }
        });

        if ($('.computedLine').length) {
            $.each($('.computedLine'), function (i) {
                if ($(this).height() < ans) {
                    $(this).closest('.chat-con-box').find('.moreCon').hide();
                }
            });

            $('.moreCon').click(function () {
                $(this).closest('.chat-con-box').find('.computedLine').removeClass('computedLine');
                $(this).hide();
            });

            $('.chat-ans-more-btn').click(function () {
                $('.ans-more-list').show();
                $.each($('.ans-more-list .computedLine'), function (i) {
                    if ($(this).height() < ans) {
                        $(this).closest('.chat-con-box').find('.moreCon').hide();
                    } else {
                        $(this).closest('.chat-con-box').find('.moreCon').show();
                    }
                });
                $(this).hide();
            });
        }

    };
 function response(result) {
     var html = '';
     $.each(result, function (i, o) {
         if (i % 2 === 0) {
             html += '<div class="mainDetailModel lf">';
         } else {
             html += '<div class="mainDetailModel rt">';
         }
         html += '<div class="mainDetailPic"><a href="/special/';
         html += o.tag_pinyin;
         html += '.html"><img src="http://www.aidigong.com/uploadfile/';
         html += o.path;
         html += '" alt=""></a></div>';
         html += '<p class="mainDetailTitle">';
         html += o.name;
         html += '</p>';
         html += '<p class="mainDetailText">';
         html += o.seo_describe;
         html += '<a href="/special/';
         html += o.tag_pinyin;
         html += '.html">[详情]</a></p></div>';
     });
     $(ele.querySelectorAll('#' + target)[0]).html(html);
 }
Beispiel #30
0
 getRankList: function (list) {
     if (list == null || list.length == 0) {
         return '<div class="tip">暂无排行</div>';
     }
     var html = '';
     html += '<ul class="ul-rank">';
     $.each(list,function(i,item){
         if(i<3){
             html += '<li class="istop">';
         }else{
             html += '<li>';
         }
         html += '<em>'+(i+1)+'</em>';
         html += '<img src="' + item.HeadImgUrl + '" />';
         html += '<div>';
         html += item.NickName;
         html += '<p>滑行了' + (item.Point) + '米</p>';
         html += '</div>';
         html += '<div class="clear"></div>';
         html += '</li>';
     });
     html += '</ul>';
     return html;
 }