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 = '
';
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 ? '', '' + goods_list[i].goods_name + '', '
', '',
'¥' + goods_list[i].shop_price + ' ',
'¥' + goods_list[i].market_price + '',
'