var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); /** * MUI JavaScript Library * versition : v1.0 * site:http://www.mfhui.com * dependent files : jquery-1.7.1.min.js, jquery.json.js, jquery.tmpl.js, micro-template.js */ /************************ * Jquery Plugin Tools * ************************/ ;;;(function($) { /** * 截字功能 * $(elem).ellipsis({ * len : 30 * }); * 中文字符占:2位 * 英文字符占:1位 * @param {[type]} options [description] * @return {[type]} [description] */ $.fn.ellipsis = function(options){ var defaults = { len : 100, txt : '...', retult : '' } var options = $.extend({}, defaults, options); this.each(function(){ var target_str = $.trim($(this).text()), target_len = options.len, retult_txt = options.retult, temp_len = 0, i = 0; for (i = 0; i < target_str.length; i++){ if (target_str.charCodeAt(i) > 255){ temp_len += 2; } else { temp_len++; } // 如果增加计数后长度大于限定长度,就直接返回临时字符串 if(temp_len > target_len){ return $(this).html(retult_txt + options.txt); } // 将当前内容加到临时字符串 retult_txt += target_str.charAt(i); } // 如果全部是单字节字符,就直接返回源字符串 return target_str; }); } /** * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget. * @requires jQuery v1.2 or above * * http://gmarwaha.com/jquery/jcarousellite/ * * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Version: 1.0.1 * Note: Requires jquery 1.2 or above from version 1.0.1 */ $.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')} /** * Placeholder plugin for jQuery * --- * Copyright 2010, Daniel Stocks (http://webcloud.se) * Released under the MIT, BSD, and GPL Licenses. */ (function(b){function d(a){this.input=a;a.attr("type")=="password"&&this.handlePassword();b(a[0].form).submit(function(){if(a.hasClass("placeholder")&&a[0].value==a.attr("placeholder"))a[0].value=""})}d.prototype={show:function(a){if(this.input[0].value===""||a&&this.valueIsPlaceholder()){if(this.isPassword)try{this.input[0].setAttribute("type","text")}catch(b){this.input.before(this.fakePassword.show()).hide()}this.input.addClass("placeholder");this.input[0].value=this.input.attr("placeholder")}}, hide:function(){if(this.valueIsPlaceholder()&&this.input.hasClass("placeholder")&&(this.input.removeClass("placeholder"),this.input[0].value="",this.isPassword)){try{this.input[0].setAttribute("type","password")}catch(a){}this.input.show();this.input[0].focus()}},valueIsPlaceholder:function(){return this.input[0].value==this.input.attr("placeholder")},handlePassword:function(){var a=this.input;a.attr("realType","password");this.isPassword=!0;if(b.browser.msie&&a[0].outerHTML){var c=b(a[0].outerHTML.replace(/type=(['"])?password\1/gi, "type=$1text$1"));this.fakePassword=c.val(a.attr("placeholder")).addClass("placeholder").focus(function(){a.trigger("focus");b(this).hide()});b(a[0].form).submit(function(){c.remove();a.show()})}}};var e=!!("placeholder"in document.createElement("input"));b.fn.placeholder=function(){return e?this:this.each(function(){var a=b(this),c=new d(a);c.show(!0);a.focus(function(){c.hide()});a.blur(function(){c.show(!1)});b.browser.msie&&(b(window).load(function(){a.val()&&a.removeClass("placeholder");c.show(!0)}), a.focus(function(){if(this.value==""){var a=this.createTextRange();a.collapse(!0);a.moveStart("character",0);a.select()}}))})}})(jQuery); /** * slideshow */ $.fn.slideshow = function(options){ var defaults = { 'control':null, 'prev':null, 'next':null, 'type':'fade', 'current_class':'current', 'control_event':true, 'slideshow_time':1000, 'auto':true, 'click_false':true, 'is_stop':true, 'auto_time':5000, 'delay_time':300 } var options = $.extend({}, defaults, options); var self = $(this); var control; var size = self.size(); var index; var current_index = 0; var start_slideshow; var delay_slideshow; // 切换的核心 function fadeslideshow(){ if(current_index != index){ if(options.control){ $(options.control).removeClass(options.current_class).eq(index).addClass(options.current_class); } if(options.slideshow_time <= 0){ self.eq(current_index).hide(); self.eq(index).show(); } else if(options.type == 'fade'){ self.eq(current_index).fadeOut(options.slideshow_time); self.eq(index).fadeIn(options.slideshow_time); } current_index = index; } } function nextEvent(){ index = (current_index + 1)%size; fadeslideshow(); } // 初始化 // 默认让第1个显示,其它的给隐藏掉 self.hide().eq(0).show(); // 点击任意一个导航对象的时候 if(options.control){ control = $(options.control); control.removeClass(options.current_class).eq(0).addClass(options.current_class); control.live('click', function(){ index = control.index($(this)); fadeslideshow(); if (options.click_false) return false; }); if(options.control_event){ control.hover(function(){ index = control.index($(this)); delay_slideshow = setTimeout(fadeslideshow, options.delay_time); }, function(){ clearTimeout(delay_slideshow); }); } } if(options.next){ $(options.next).live('click', function(){ if(self.queue().length < 1){ nextEvent(); } return false; }); } if(options.prev){ $(options.prev).live('click', function(){ if(self.queue().length < 1){ index = (current_index + size - 1)%size; fadeslideshow(); } }); } if (options.auto) { start_slideshow = setInterval(nextEvent, options.auto_time); if (options.is_stop) { self.hover(function () { clearInterval(start_slideshow); },function () { start_slideshow = setInterval(nextEvent, options.auto_time); }); } } } })(jQuery); /************************ * The Custom Tools * ************************/ ;;;(function(){ if( !window.uiMFH ){ window[ 'uiMFH' ] = { } } /** * 收藏本站 * @param {[type]} title [description] * @param {[type]} url [description] */ function addBookmark( title, url ) { if ( window.sidebar ) { window.sidebar.addPanel( title, url, "" ); } else if( document.all ) { window.external.AddFavorite( url, title ); } else if( window.opera && window.print ) { return true; } else { alert( '请使用Ctrl + D收藏本站:)' ); } } window[ 'uiMFH' ][ 'addBookmark' ] = addBookmark; /** * 头部搜索框 * @param {[type]} options [description] * @return {[type]} [description] */ function uiSearch( options ) { // 获取相应的参数 var options = options || {}, elem = options.elem; // 设置随机文字 // 目前先写死这些词组,后期联合开发一起修改 var rand_txt = new Array( '洁面', '精华', '精油', '防晒', '面膜 ', '眼唇', '鼻膜', '浓缩液', '面油', '爽肤水', '卸妆', 'BB霜', '粉饼', '隔离', '香水', '沐浴露', '护手', '护足', '脱毛膏', '发膜', '护发', '西梅汁', '胶原蛋白', '修复', '美白', '保湿', '防晒', '控油', '肌言堂', '谭丝膜语', '梦姬花园', '英国AA网', '兰侬', 'HR', '美莉安', 'katy', 'XRBRAND', '简悦', '高夫', '蜜丝佛陀' ); // 生成随机数 var rand_num = parseInt( Math.random() * rand_txt.length ); // 去除空格 $.trim( elem.val( rand_txt[rand_num] ) ); // 获取当前查询的关键词 var current_val = $.trim( elem.val() ); // 设置相应的事件处理 elem.focus( function(){ if( $( this ).val() == current_val ) { $( this ).val( '' ).css( 'color', '#000000' ); } } ).blur( function(){ if( $( this ).val() == '' ) { $( this ).val( current_val ).css( 'color', '#999999' ); } } ); } window[ 'uiMFH' ][ 'uiSearch' ] = uiSearch; /** * 滚动时,固定在顶部的函数 * @param {[type]} targetElem [description] * @param {[type]} targetClass [description] * @return {[type]} [description] */ function scrollFixed( targetElem, targetClass ){ var targetElem = targetElem, targetClass = targetClass, elemOffsetTop = targetElem.offset().top; $( window ).scroll(function(){ var bodyScrollTop = $( this ).scrollTop(); if( bodyScrollTop >= elemOffsetTop ){ targetElem.addClass( targetClass ); } else if ( bodyScrollTop < elemOffsetTop ){ $( targetElem ).removeClass( targetClass ); } }); } window[ 'uiMFH' ][ 'scrollFixed' ] = scrollFixed; /** * 图片提示效果 * @param {[type]} elem [description] * @param {[type]} tipsX [description] * @param {[type]} tipsY [description] * @return {[type]} [description] */ function uiImgTips( elem, tipsX, tipsY ) { var elem = elem; tipsX = tipsX || 20; tipsY = tipsY || 20; $( elem ).hover( function( e ) { this.myTitle = this.title; this.title = ''; var imgTitle = this.myTitle ? this.myTitle : ''; var imgSrc = $( this ).attr( 'date_url' ); var tipsImg = '
' + imgTitle + '' + imgTitle + '
'; $( 'body' ).append( tipsImg ); $( '#J_ui_img_tips' ).css( { 'top' : ( e.pageY + tipsY ) + 'px', 'left' : ( e.pageX-tipsX ) + 'px', 'z-index' : 1001 } ).show(); }, function() { this.title = this.myTitle; $( '#J_ui_img_tips' ).remove(); }).mousemove( function( e ) { $( '#J_ui_img_tips' ).css( { 'top' : ( e.pageY + tipsY ) + 'px', 'left' : ( e.pageX-tipsX ) + 'px', 'z-index' : 1001 } ); }); } window[ 'uiMFH' ][ 'uiImgTips' ] = uiImgTips; /** * 倒计时,主要计算第N天的时间 * @param {[type]} options [description] * @return {[type]} [description] */ function setSomeTime( options ) { var options = options || {}, days = options.days, endTime = options.endTime, isTime = options.isTime || false, isDate = options.isDate || false, isGreetings = options.isGreetings || false, // 今天的时间:GMT+0800 ( 中国标准时间 ) today = new Date(); if( isGreetings ) { var greetingsTxt; today.setDate( today.getDate() ); var hour = today.getHours(); return hour; } // 如果传递的参数是days(天数) if( days != '' && days != undefined ) { var date; today.setDate( today.getDate() + days ); var year = today.getFullYear(), month = today.getMonth() + 1, day = today.getDate(), hour = today.getHours(), minute = today.getMinutes(), seconds = today.getMinutes(); if( isTime ) { date = year + '-' + month + '-' + day + ' ' + hour + ':' + minute; } else if( isDate ){ date = month + '月' + day + '日'; } else { date = year + '-' + month + '-' + day + ' ' + hour + ':' + minute; } return date; } } window[ 'uiMFH' ][ 'setSomeTime' ] = setSomeTime; /** * QQ在线状态的设置 */ function setQQOnline(elem){ var visited_time = uiMFH.setSomeTime({ isGreetings : true }); // console.log(elem); if(visited_time >= 21 || visited_time <= 8){ elem.addClass('qq_not_online'); } else { elem.addClass('qq_online'); } } window[ 'uiMFH' ][ 'setQQOnline' ] = setQQOnline; /** * 设置QQ闹钟 */ function setQQClock( options ){ // 获取第二天的商品参数 var next_day_promotion = options; // 设置第二天的商品名称 var promotion_content = next_day_promotion.goods_name || '又有新产品'; // 如果第二天的商品名称太长的话,截字 if( promotion_content.length > 24 ) { promotion_content = next_day_promotion.goods_name.substring(0, 30) + '...'; } // 设置QQ闹钟的content var qq_clock_content = ''; // 设置第二天的日期 var date_options = { days : 1, isDate : true } // 如果第二天有商品的情况下 if( next_day_promotion.goods_name != undefined ){ qq_clock_content = '美肤汇24小时闪购开抢咯,' + uiMFH.setSomeTime( date_options ) + '“' + promotion_content + '”正在挑战行业价格底线!'; } // 如果第二天没有商品的情况下 else { qq_clock_content = '美肤汇24小时闪购开抢咯,' + uiMFH.setSomeTime( date_options ) + '正在挑战行业价格底线哦!'; } // 设置第二天的时间 var time_options = { days : 1, isTime : true } // QQ闹钟官方接口文档 var __qqClockShare = { content : qq_clock_content, time : setSomeTime( time_options ), url : 'http://web.archive.org/web/20160130005723/http://www.mfhui.com', advance : 5, icon : '2_1' }; // 生成图标和链接 // var qq_clock = $( '' ); var qq_clock = $(''); return qq_clock; } window[ 'uiMFH' ][ 'setQQClock' ] = setQQClock; /** * 24小时抢购 * @return {[type]} [description] */ // $promotion.end_time function setDailyPromotions() { // 设置第二天的日期 // 主要用作当天的24小时特卖活动结束后,出现的第二天的提示信息 var _tomorrow = { days : 1, isDate : true } $( '.ui_countdown' ).each( function() { var endTime = $( this ).attr( 'data-time' ); var today = new Date(); var nowTime = Date.parse( today ) / 1000, // 今天时间(毫秒值) timeLeft = endTime - nowTime, // 剩余时间(毫秒值) hour = Math.floor( timeLeft / 3600 ), // 剩余小时 minute = Math.floor( (timeLeft - hour * 3600 ) / 60 ), // 剩余分 seconds = Math.floor( timeLeft % 60 ); // 剩余秒 // 判断处理 if( endTime <= nowTime ) { $( '.ui_time_count' ).html( '今天的特卖活动已结束,请期待' + uiMFH.setSomeTime( _tomorrow ) + '的产品' ) } else { $( this ).html( '' + hour + '小时' + minute + '分钟' + seconds + '' ); } } ); // 循环执行上面的函数 setTimeout( 'uiMFH.setDailyPromotions()',1000 ); }; window[ 'uiMFH' ][ 'setDailyPromotions' ] = setDailyPromotions; /** * QQ彩贝相关信息 * 主要是通过cookie的形式进行查找及设置 * @return {[type]} [description] */ function uiQQCB() { // 得到彩贝里面的相关信息 var tmp_data = getCookie( 'ECS[cb_headshow]' ), info = tmp_data && tmp_data.replace(/\+/g, ' ' ); if( info ){ $( '#J_QQCB' ).show(); // 彩贝信息 $( '#J_QQCB .site_info' ).html( info ); // 我的彩贝用户名 var name = getCookie( 'ECS[cb_showmsg]' ); $( '#J_QQCB .n' ).html( name ); // 我的彩贝积分链接 var url = decodeURI(getCookie( 'ECS[cb_jifenurl]' )); $( '#J_QQCB .my_info a' ).attr( 'href', url ); // 如果彩贝登录过来的话,把用户名改成彩贝用户名 $( '#userinfo_username' ).html( name ); } else { $( '#J_QQCB' ).remove(); } var qq_name = getCookie( 'ECS[qq_name]' ); if( qq_name ){ // qq_name = decodeURI(qq_name); // $( '#userinfo_username' ).html( qq_name ); } } window[ 'uiMFH' ][ 'uiQQCB' ] = uiQQCB; /** * 弹出层(只为活动) * @type {Object} */ var uiPopupHd = { template : [ '
', '
', '
', '
', '
', '

', '关闭', '
', '
', '
', '确定', '取消', '
', '
', '
', '
' ].join( '' ), remove: function() { $( '#J_ui_popupHd_area' ).remove(); }, resize: function() { $('#J_ui_popupHd_mod' ).css( 'left', ( ( ( $(window).width() ) / 2 - ( parseInt( width ) /2 ) ) + $( document ).scrollLeft( ) ) + 'px').css( 'top', ( ( $(window).height() ) / 2 - ( parseInt( height ) / 2 ) + $(document).scrollTop() ) + 'px'); }, create : function( options ) { options = options || {}; width = options.width || 844; height = options.height || 270; title = options.title; mask = options.mask || false; content = options.content || '正在加载中......'; callback = options.callback; var self = this; $( '#J_ui_popupHd_area' ).remove(); $( 'body' ).append( $.tmpl( this.template, { 'content': content }) ); $( '#J_ui_popupHd_mod' ).width( width ).height( height ); $( '#J_popupHd_hd_t' ).html( title ); $( '#J_popupHd_bd' ).html( content ); if( mask ) { $( '#J_ui_mask' ).show().height( $( document ).height() ); } $( window ).resize( function(){ self.resize(); }).scroll( function(){ self.resize(); } ); self.resize(); // 弹出层的关闭操作 $('#J_popupHd_close').live('click', function(){ $( '#J_ui_popupHd_area' ).remove(); }); $( document ).keyup( function( e ) { var key = e.which; if( key == 27 ) { $( '#J_popupHd_close' ).trigger( 'click' ); } }); if( options.callback ) { if( typeof( options.callback ) == 'function' ) { options.callback(); } } }, not_exist: null } window[ 'uiMFH' ][ 'uiPopupHd' ] = uiPopupHd; /** * dialog * @param {[type]} options [各个参数] * @return {[type]} [description] */ function dialog(options){ options = options || {}; this.skin = options.skin; this.width = options.width || 500; this.height = options.height || 500; this.title = options.title; this.content = options.content || 'fuck'; this.callback = options.callback; this.closeBtn = options.closeBtn || 'x'; this.mask = options.mask; this.confirmBtn = options.confirmBtn; this.cancelBtn = options.cancelBtn; this.shadow = options.shadow || false; this.follow = options.follow || null, this.followX = options.followX || 0, this.followY = options.followY || 0, this.close_callback = options.close_callback; } dialog.prototype = { /** * 设置元素跟随定位 * @param { Object } 跟随的DOM元素 * @param { String / Object } 被跟随的DOM元素 * @param { Number } 相对于被跟随元素的X轴的偏移 * @param { Number } 相对于被跟随元素的Y轴的偏移 */ setFollow : function( elem, follow, x, y ){ var self = this; var follow_y = follow.offset().top; var follow_x = follow.offset().left; var dialog_x = follow_x - self.width + self.followX; var dialog_y = follow_y + self.followY; elem.css({"position" : 'absolute', 'top' : dialog_y, 'left' : dialog_x}); }, /** * 定位 * @param {[type]} elem [需要定位的元素] * @param {[type]} fixed [跟随定位或者绝对定位] */ setPosition : function(elem, fixed){ $(elem).css({ 'left' : ((($(window).width()) / 2 - (parseInt(this.width) /2)) + $(document).scrollLeft()) + 'px', 'top' : (($(window).height()) / 2 - (parseInt(this.height) / 2) + $(document).scrollTop()) + 'px', 'width' : this.width, 'height' : this.height }); }, /** * 创建模板 * @return {[type]} [description] */ template : function(){ var self = this; var title = this.title ? '
' + this.title + '
' : ''; var closeBtn = this.closeBtn ? '' + this.closeBtn + '' : ''; var confirmBtn = this.confirmBtn ? '' + this.confirmBtn + '' : ''; var cancelBtn = this.cancelBtn ? '' + this.cancelBtn + '' : ''; var footer = confirmBtn === '' && cancelBtn === '' ? '' : '
' + confirmBtn + cancelBtn + '
'; var arrow = this.follow ? '' : ''; var dialog_tmpl = [ '
', title, '
', footer, closeBtn, arrow, '
' ].join(''); return dialog_tmpl; }, /** * 设置弹层的皮肤 */ setSkin : function(skin){ var skin = $.trim(this.skin); $('#J_ui_dialog_area .ui_dialog_mod').addClass( 'ui_dialog_' + skin ); }, /** * 创建遮罩层 * @return {[type]} [description] */ createMask : function(){ var mask_mod = $('
'); mask_mod.height($(document).height()); return mask_mod; }, /** * 创建弹出层的内容层 * @return {[type]} [description] */ create : function(){ var tmpl_mod = this.template(); var self = this; // 如果已经那个弹出层的话(暂时这样处理) var dialog_wrap = $('#J_ui_dialog_area')[0]; if(dialog_wrap) { self.close(); } // 插入模板到body $('body').append(tmpl_mod); // 如果有皮肤需求的话 if(this.skin != undefined){ this.setSkin(this.skin); } // 插入模板内容 $('#J_ui_dialog_area .dialog_bd').html(this.content); // 渐显 $('#J_ui_dialog_area').fadeIn(200); // 回调函数 if(this.callback){ if(typeof(this.callback) == 'function') { this.callback(); } } // 定位,包括滚动、改变大小 if(self.follow){ this.setFollow( $('#J_ui_dialog_area'), self.follow, self.followX, self.followY ); } else { this.setPosition($('#J_ui_dialog_area')); $(window).resize(function(){ self.setPosition($('#J_ui_dialog_area')); }).scroll(function(){ self.setPosition($('#J_ui_dialog_area')); }); } if(this.mask == undefined || this.mask){ var maskMod = this.createMask(); $('body').append(maskMod); maskMod.show(); } // 绑定关闭事件 $('#J_ui_dialog_cancel, #J_ui_dialog_close').live('click', function(){ self.close(); return false; }); // 绑定Esc键 $(document).keyup(function(e){ var key = e.which; if(key == 27){ self.close(); return false; } }); }, /** * 关闭弹出层 * @return {[type]} [description] */ close : function(){ var self = this; $('#J_ui_dialog_area').remove(); if(self.mask == undefined || self.mask){ $('#J_ui_mask').remove(); } if(this.close_callback){ if(typeof(this.close_callback) == 'function') { this.close_callback(); } } } }; window[ 'uiMFH' ][ 'dialog' ] = dialog; /** * [creditMsg description] * @param {[type]} options [description] * @return {[type]} [description] */ function creditMsg(options){ options = options || {}; this.skin = options.skin; this.width = options.width || 500; this.height = options.height || 500; this.title = options.title; this.content = options.content || 'fuck'; this.right = options.right; this.bottom = options.bottom; this.footer = options.footer || '订阅美肤汇邮件,预知更多优惠订阅美肤汇QQ邮件'; this.callback = options.callback; this.close_btn = options.close_btn || 'x'; this.close_callback = options.close_callback; this.is_fixed = this.is_fixed || false; } creditMsg.prototype = { /** * 创建模板 * @return {[type]} [description] */ template : function(){ var self = this, greetings_txt, greetings_time = uiMFH.setSomeTime({ isGreetings : true }); if(greetings_time >= 5 && greetings_time <= 7){ greetings_txt = '早上好!美肤汇欢迎您!'; } else if(greetings_time >= 7 && greetings_time <= 10){ greetings_txt = '上午好!美肤汇欢迎您!'; } else if(greetings_time >= 10 && greetings_time <= 12){ greetings_txt = '中午好!美肤汇欢迎您!'; } else if(greetings_time >= 12 && greetings_time <= 16){ greetings_txt = '下午好!美肤汇欢迎您!'; } else if(greetings_time >= 17 && greetings_time <= 22){ greetings_txt = '晚上好!美肤汇欢迎您!'; } else if(greetings_time >= 23 || greetings_time <= 5){ greetings_txt = '夜深了!美肤汇欢迎您!'; } else { greetings_txt = '您好,美肤汇欢迎您!'; } // var title = this.title ? '
' + this.title + '
' : ''; var title = this.title ? '
' + this.title + '
' : '
' + greetings_txt + '
', close_btn = this.close_btn ? '' + this.close_btn + '' : '', footer = this.footer ? '
' + this.footer + '
' : '', msg_tmpl = [ '
', title, '
', footer, close_btn, '
' ].join(''); return msg_tmpl; }, /** * 设置皮肤 */ setSkin : function(){ var skin = $.trim(this.skin); $('#J_ui_msg_area .ui_msg_mod').addClass( 'ui_msg_' + skin ); }, /** * 定位 * @param {[type]} elem [需要定位的元素] * @param {[type]} fixed [跟随定位或者绝对定位] */ setPosition : function(elem, fixed){ var right = this.right; var bottom = this.bottom; }, /** * 创建内容层 * @return {[type]} [description] */ create : function(){ var self = this; var tmpl_mod = this.template(); // 插入模板到body $('body').append(tmpl_mod); // 如果有皮肤需求的话 if(this.skin != undefined){ this.setSkin(this.skin); } // 插入模板内容 $('#J_ui_msg_area .msg_bd').html(this.content); var set_timeout = setTimeout(function(){ $('#J_ui_msg_area').animate({ 'right' : self.right, 'bottom' : self.bottom }, 1000, function(){ // 清除set_credit_msg这个cookie,防止重复滑出 if(getCookie('set_credit_msg') == '1'){ removeCookie('set_credit_msg'); } }); }, 1000); // 回调函数 if(this.callback){ if(typeof(this.callback) == 'function') { this.callback(); } } // 定位,包括滚动、改变大小 // $(window).resize(function(){ // self.setPosition($('#J_ui_msg_area')); // }).scroll(function(){ // self.setPosition($('#J_ui_msg_area')); // }); // self.setPosition($('#J_ui_msg_area')); // 绑定关闭事件 $('#J_ui_msg_cancel, #J_ui_msg_close').live('click', function(){ self.close(); return false; }); // 绑定Esc键 $(document).keyup(function(e){ var key = e.which; if(key == 27){ self.close(); return false; } }); }, /** * 关闭 * @return {[type]} [description] */ close : function(){ var self = this; $('#J_ui_msg_area').animate({ 'right' : -this.width }, 800, function(){ $('#J_ui_msg_area').remove(); }); if(this.close_callback){ if(typeof(this.close_callback) == 'function') { this.close_callback(); } } } } window[ 'uiMFH' ][ 'creditMsg' ] = creditMsg; })(); /** * 中英文截字 * 预期计算:中文2字节,英文1字节 * @param {[type]} str [description] * @param {[type]} len [description] * @return {[type]} [description] */ function toolSubstr( str, len ) { if( !str || !len ) return; var l = 0; var s = 0; var temp = ''; for ( l = 0; l < str.length; l++ ) { if ( str.charCodeAt( l ) > 255 ) { s += 2; } else { s++; } //如果增加计数后长度大于限定长度,就直接返回临时字符串 if( s > len ) { return temp + '...'; } //将当前内容加到临时字符串 temp += str.charAt( l ); } //如果全部是单字节字符,就直接返回源字符串 return str; } /** * 猜你喜欢 * @param {[type]} current_history [description] * @return {[type]} [description] */ function getSlideRecom(current_history, condition){ if(condition != 1 && condition != undefined){ return false; } var history_arrary = current_history.split(','); var history_arrary_last = parseInt(history_arrary[0]); // console.log(history_arrary_last); // 获取当前时间 var greetings_time = uiMFH.setSomeTime({ isGreetings : true }); var greetings_txt; if(greetings_time >= 5 && greetings_time <= 7){ greetings_txt = '早上好!新的一天,祝您购物好心情:)'; } else if(greetings_time >= 7 && greetings_time <= 10){ greetings_txt = '上午好!工作学习的同时注意适当休息放松哦:)'; } else if(greetings_time >= 10 && greetings_time <= 12){ greetings_txt = '中午好!购物的同时记得按时吃饭哦:)'; } else if(greetings_time >= 12 && greetings_time <= 16){ greetings_txt = '下午好!注意多喝水,补充身体能量:)'; } else if(greetings_time >= 17 && greetings_time <= 22){ greetings_txt = '晚上好!美肤汇愿您购物愉快!满意而归:)'; } else if(greetings_time >= 23 || greetings_time <= 5){ greetings_txt = '夜深了!注意早点睡眠,健康生活:)'; } else { greetings_txt = '小汇猜你可能喜欢下面的化妆品:)'; } var slide_area = $('#J_slide_recom_area'); var template = [ '
', '
', '
', '
' + greetings_txt + '
', '
', '
', '
    ', '
  • ', '正在加载......', '
  • ', '
', '
', '', '
', '
' ].join(''); if(slide_area.length == 0){ $('body').append(template); } var attr = $('#J_slide_recom_area').attr('data-result'); // 显示模块 $('#J_slide_recom_area').show(); $('#J_slide_recom_area').animate({ right : '0px' }, 500); // 如果没有数据的情况下才发送异步请求 if(attr == 'empty'){ $('#J_slide_recom_area').attr('data-result', 'full'); $.post('module.php?mod=product&act=footer_goods&goods_id=' + history_arrary_last + '&json=1', getSlideRecomCallback); } } function getSlideRecomCallback(result){ $('#J_slide_recom_list').empty(); var guess_item; var goods_list = result && result.goods_list; for(var i = 0; i < goods_list.length; i++){ guess_item = [ '
  • ', '
    ', '', '' + goods_list[i].goods_name + '', '', '
    ', '
    ', '

    ', '' + goods_list[i].goods_name + '', '

    ', '

    ', '¥' + goods_list[i].shop_price + ' ', '¥' + goods_list[i].market_price + '', '

    ', '
    ', '
  • ' ].join(''); $('#J_slide_recom_list').append(guess_item); } // 截字 var goods_name = $( '#J_slide_recom_list .goods_name a' ); goods_name.each(function(){ var goods_name_txt = $(this).text(); var sub_goods_name_txt = toolSubstr(goods_name_txt, 30); $(this).text(sub_goods_name_txt); }); } } /* FILE ARCHIVED ON 00:57:23 Jan 30, 2016 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 11:02:48 Sep 28, 2025. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ /* playback timings (ms): captures_list: 0.727 exclusion.robots: 0.036 exclusion.robots.policy: 0.022 esindex: 0.015 cdx.remote: 17.208 LoadShardBlock: 132.088 (3) PetaboxLoader3.datanode: 164.005 (4) load_resource: 212.924 PetaboxLoader3.resolve: 109.864 */