if(!window.jQuery){ var poll_28; var timeout_28 = 100; var headID = document.getElementsByTagName("head")[0]; var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.src = 'https://cheerwants.com/system/bannerassets/jquery.min.js'; headID.appendChild(newScript); poll_28 = function () { setTimeout(function () { timeout_28--; if (typeof jQuery !== 'undefined') { start_load_28(); } else if (timeout_28 > 0) { poll_28(); } else { /* External library failed to load */ } }, 100); }; poll_28(); } else { jQuery(document).ready(function(){ addBannerScript_28(); }); } function start_load_28(){ jQuery(document).ready(function(){ addBannerScript_28(); }); } function addBannerScript_28(){ var jQuery_Class = 1; (function(){ var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; jQuery.Class = function(){}; jQuery.Class.create = function(prop) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn){ return function() { var tmp = this._super; this._super = _super[name]; var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } function Class() { if ( !initializing && Class.prototype.init ) return Class.prototype.init.apply(this, arguments); } Class.prototype = prototype; Class.prototype.constructor = Class; Class.extend = arguments.callee; return Class; }; jQuery.querySelectorAll = function(){ return jQuery.apply(jQuery, arguments); }; jQuery.querySelector = function(){ return jQuery.querySelectorAll.apply(jQuery, arguments)[0]; }; jQuery.fn.forEach = function(fn){ return this.each(function(i){ fn(this, i); }); }; jQuery.fn.attach = function(fn){ var attach = fn.attach || (new fn).attach || function(){}; return this.forEach(function(elem){ attach.call(fn, elem); }); }; jQuery.DOM = buildClass(["prepend", "append", ["before", "insertBefore"], ["after", "insertAfter"], "wrap", "wrapInner", "wrapAll", "clone", "empty", "remove", "replaceWith", ["removeAttr", "removeAttribute"], ["addClass", "addClassName"], ["hasClass", "hasClassName"], ["removeClass", "removeClassName"], ["offset", "getOffset"]], [["text", "Text"], ["html", "HTML"], ["attr", "Attribute"], ["val", "Value"], ["height", "Height"], ["width", "Width"], ["css", "CSS"]]); jQuery.Traverse = buildClass([ ["children", "getChildElements"], ["find", "getDescendantElements"], ["next", "getNextSiblingElements"], ["nextAll", "getAllNextSiblingElements"], ["parent", "getParentElements"], ["parents", "getAncestorElements"], ["prev", "getPreviousSiblingElements"], ["prevAll", "getAllPreviousSiblingElements"], ["siblings", "getSiblingElements"], ["filter", "filterSelector"] ]); jQuery.Events = buildClass([["bind", "addEventListener"], ["unbind", "removeEventListener"], ["trigger", "triggerEvent"], "hover", "toggle"]); jQuery.fn.buildAnimation = function(options){ var self = this; return { start: function(){ self.animate(options); }, stop: function(){ self.stop(); } }; }; jQuery.Effects = buildClass(["show", "hide", "toggle", "buildAnimation", "queue", "dequeue"]); jQuery.fn.ajax = jQuery.ajax; jQuery.Ajax = buildClass([["ajax", "request"], ["load", "loadAndInsert"], ["ajaxSetup", "setup"], ["serialize", "getSerializedString"], ["serializeArray", "getSerializedArray"]]); function buildClass(methods, getset){ var base = {}; jQuery.each(getset || [], function(i, name){ if ( !(name instanceof Array) ) name = [name, name]; methods.push([name[0], "get" + name[1]], [name[0], "set" + name[1]]); }); jQuery.each(methods, function(i, name){ var showName = name; if ( name instanceof Array ) { showName = name[1]; name = name[0]; } base[showName] = jQuery.Class.create({ init: function(){ var args = Array.prototype.slice.call(arguments); if ( this.constructor == base[showName] ) this.arguments = args; else return base[showName].prototype.attach.apply( base[showName], args ); }, arguments: [], attach: function(elem){ var args = arguments.length == 1 ? this.arguments : Array.prototype.slice.call(arguments, 1); if ( args.length ) { var fn = args[ args.length - 1 ]; if ( typeof fn == "function" ) { args[ args.length - 1 ] = function(){ var args = Array.prototype.slice.call(arguments); return fn.apply( this, [this].concat(args) ); }; } } return jQuery.fn[name].apply( jQuery(elem), args ); } }); }); return base; } })(); /* * TipTip * Copyright 2010 Drew Wilson * www.drewwilson.com * code.drewwilson.com/entry/tiptip-jquery-plugin * * Version 1.3 - Updated: Mar. 23, 2010 * * This Plug-In will create a custom tooltip to replace the default * browser tooltip. It is extremely lightweight and very smart in * that it detects the edges of the browser window and will make sure * the tooltip stays within the current window size. As a result the * tooltip will adjust itself to be displayed above, below, to the left * or to the right depending on what is necessary to stay within the * browser window. It is completely customizable as well via CSS. * * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses: * https://www.opensource.org/licenses/mit-license.php * https://www.gnu.org/licenses/gpl.html */ (function($){$.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('
');var tiptip_content=$('
');var tiptip_arrow=$('
');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('
')))}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow")}return this.each(function(){var org_elem=$(this);if(opts.content){var org_title=opts.content}else{var org_title=org_elem.attr(opts.attribute)}if(org_title!=""){if(!opts.content){org_elem.removeAttr(opts.attribute)}var timeout=false;if(opts.activation=="hover"){org_elem.hover(function(){active_tiptip()},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}else if(opts.activation=="focus"){org_elem.focus(function(){active_tiptip()}).blur(function(){deactive_tiptip()})}else if(opts.activation=="click"){org_elem.click(function(){active_tiptip();return false}).hover(function(){},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}function active_tiptip(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else if(opts.defaultPosition=="top"){t_class="_top"}else if(opts.defaultPosition=="left"){t_class="_left"}else if(opts.defaultPosition=="right"){t_class="_right"}var right_compare=(w_compare+left)parseInt($(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop());var bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay)}function deactive_tiptip(){opts.exit.call(this);if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut)}}})}})(jQuery); var Banner_28 = jQuery.Class.create({ init : function(options){ this.id=options.id; this.title=options.title; this.bm_link=options.bm_link; this.get_banner=options.get_banner; this.shop_name=options.shop_name; this.TextError ="Can't load data. The server doesn't respond."; this.TextError2="No products found."; this.CurrentPage=1; this.ProductsOnPage=options.onpage; this.ToolTip = 1; this.Cache = {}; this.AddCSS(); this.BuildBanner(); _page = parseInt(this.CurrentPage); this.GetListing({ page : (this.CurrentPage) }); }, BuildBanner : function(){ ID = '28'; tmpl = '
'+this.title+'
'; tmpl+= '
'; tmpl+= ' '; tmpl+= '
'; tmpl+= ' '; tmpl+= ' '; tmpl+= '
'; jQuery('#widget-wr-28').html('
'+tmpl+'
'); var _this = this; jQuery('#ListForward-28').click(function(){ _this.CycleForward(); }); jQuery('#ListBack-28').click(function(){ _this.CycleBack(); }); }, AddCSS : function(){ var s = document.createElement('link'); s.rel="stylesheet"; s.type = "text/css"; s.href="https://cheerwants.com/index.php?route=affiliate/showbanner/getcss&b=28"; jQuery('head').append(s); }, is_object : function ( mixed_var ){ if(mixed_var instanceof Array) { return false; } else { return (mixed_var !== null) && (typeof( mixed_var ) == 'object'); } }, GetListing : function(ReqData){ /** check cash */ page_ = ReqData['page']; if ( this.is_object(this.Cache[page_]) ) { data = this.Cache[page_]; this.returnResponse_28(data); return; } this.ShowLoad(); var _this = this; returnResponse_28 = function(data){ _this.returnResponse_28(data); }; ReqDataUrl = '&'; jQuery.each(ReqData, function(key,val){ ReqDataUrl = ReqDataUrl+key+'='+val+'&' }); var crossDomainUrl = 'https://cheerwants.com/index.php?route=affiliate/showbanner/getdata&b=28'+ReqDataUrl+'pagelimit='+this.ProductsOnPage+'&jsoncallback=?'; jQuery.ajax({ url : crossDomainUrl, dataType : 'jsonp'/*, error : function (xhr, ajaxOptions, thrownError) { jQuery('#WidgetData-'+_this.id).html(_this.TextError+'
'+xhr+'
'+ajaxOptions+'
'+thrownError); }*/ }); }, CycleForward : function (){ _page = parseInt(this.CurrentPage)+1; this.GetListing({page : _page}); }, CycleBack : function (){ _page = parseInt(this.CurrentPage)-1; this.GetListing({page : _page}); }, returnResponse_28 : function(data){ this.HideLoad(); var _this = this; /** check for empty */ if (data.products == 0){ jQuery('#WidgetData-28').hide().html(_this.TextError2).fadeIn('fast'); return ; } /** add data to cash start*/ page =parseInt( data.request.page ); this.Cache[page] = data ; /** add data to cash END*/ datatxt_28=''; jQuery.each(data.products, function(i,product){ datatxt_28+=_this.GetOneItem_28(product); }); jQuery('#WidgetData-28').hide().html(datatxt_28).fadeIn('fast'); this.AddToolTip(); this.ManageControl_28(data); if ( data.request.page ) this.CurrentPage = data.request.page; }, ManageControl_28 : function(data){ /** add control */ if ( data.request.nextpage == 1 ){ jQuery('#ListForward-28').css('visibility','visible'); } else { jQuery('#ListForward-28').css('visibility','hidden'); }; if ( data.request.page == 1 ){ jQuery('#ListBack-28').css('visibility','hidden'); } else { jQuery('#ListBack-28').css('visibility','visible'); } }, AddToolTip : function(){ if(this.ToolTip==1){ jQuery(".p_tooltil").tipTip({ 'defaultPosition' : 'top', 'delay' : '100' }); } }, GetOneItem_28 : function(product){ tip_txt = ''; if(this.ToolTip==1){ tip_txt = '
'+product.price+product.special+'
'; } txt = '
'; txt+= '
'; txt+= '
'; txt+= ' '; txt+= ' '+product.name+''; txt+= ' '; txt+= '
'; txt+= '
'; txt+= ' '; txt+= '
'+product.description+'
'; txt+= '
'; txt+= '
'; txt+= '
'; txt+= '
'; return txt; }, ShowLoad : function(){ /*jQuery('#WidgetData-'+this.id).fadeOut('fast', function(){ jQuery(this).html('loading...').show(); });*/ jQuery('#WidgetData-'+this.id).html('loading...').show(); }, HideLoad:function(){ } }); /* jQuery(document).ready(function(){ */ jQuery('#Widget-28').html('Loading...'); wid_28 = new Banner_28({ 'id' : '28', 'title' : '輕.頑.味 ~ 搞定快樂!', 'bm_link' : 'https://cheerwants.com?tracking=5b9a0099180e5&_b=28', 'get_banner' : 'https://cheerwants.com/index.php?route=affiliate/banner', 'onpage' : '3', 'shop_name' : "輕頑味-搞定快樂" }); /* }); */ }