supplyManage.js 3.43 KB
/*! dili 2016-01-06 */
define("pophint",function(require,exports,module){require("fancybox");var pophint=function(target,options){this.target=target,this.href=null,this._opts={showid:"s-cancel-ensure",content:"您确定要继续操作吗?",on:"s-f-confirm",off:"s-f-remove",onName:"确定",offName:"取消",operation:function(target){},cancelOpera:function(target){},showButton:!0,head:null},this._opts=$.extend(this._opts,options),this.init()};return pophint.prototype={init:function(){var _this=this;$(_this.target).is("a")&&(_this.href=$(_this.target).attr("href"),$(_this.target).attr("href","javascript:void( 0 )")),!$("#s-cancel-ensure").length>0&&this.makeHtml(),this.setContent(),_this.setpop()},makeHtml:function(){var _this=this,html='<span href="#s-cancel-ensure" id="fancybox-cancel-ensure"></span><div class="cancel-ensure" id="s-cancel-ensure" style="display: none;"><div class="s-chd"></div><div class="cbd">您确定要继续操作吗?</div><div class="s-cft"><button class="submitBtn  s-f-confirm">'+_this._opts.onName+'</button><button class="submitBtn grayBtn s-f-remove">'+_this._opts.offName+"</button></div></div>";!$("#s-cancel-ensure").length>0&&$("body").append(html),$("#fancybox-cancel-ensure").click(function(){}).fancybox({padding:0,closeBtn:!1,scrolling:"visible",keys:{close:null},helpers:{overlay:{closeClick:!1}},afterClose:function(){_this._opts.operation=function(){},_this._opts.cancelOpera=function(){}}})},setpop:function(){var _this=this;$("#fancybox-cancel-ensure").trigger("click"),_this._opts.showButton?$(".s-cft .s-f-remove").show():$(".s-cft .s-f-remove").hide(),$(".s-f-confirm").bind("click",function(){_this._opts.operation.call(_this,_this.target),$(_this.target).is("a")&&(window.location.href=_this.href),_this._opts.operation=function(){},_this._opts.cancelOpera=function(){},$.fancybox.close()}),$(".s-f-remove").bind("click",function(){return _this._opts.cancelOpera.call(_this,_this.target),$(_this.target).is("a")&&$(_this.target).attr("href",_this.href),_this._opts.cancelOpera=function(){},_this._opts.operation=function(){},$.fancybox.close(),!1})},setContent:function(){var _this=this,head=this._opts.head;$("#"+_this._opts.showid).find(".cbd").html(_this._opts.content),$("#"+_this._opts.showid).find(".s-f-confirm").html(_this._opts.onName),$("#"+_this._opts.showid).find(".s-f-remove").html(_this._opts.offName),"string"==typeof head&&head.length&&$("#"+_this._opts.showid).find(".s-chd").html(head).show()}},pophint}),define(function(require,exports,module){var _Pophint=require("pophint");$(function(){function makeInp(target,evDom,callback){var tag=$(target),valObj=tag.find("input"),val=parseInt(valObj.val());if(val&&$(evDom).hasClass("now-sure")){if(0===callback())return;return tag.after("<span>"+val+"/"+tag.attr("data-unit")+"</span>"),tag.prev().remove(),void tag.remove()}tag.hide(),tag.prev().show(),valObj.val("")}$(".sure-operation").length>0&&$(".sure-operation").click(function(){new _Pophint(this,{operation:function(target){},content:"<p>你确定需要<span>关闭供应</span>吗?</p>关闭后买家将<span>不能看见该供应</span>",showButton:!0,head:"向卖家询价",onName:"确定",offName:"跳转",cancelOpera:function(target){window.location.href="http://www.qq.com"}})}),$(".a-new").fancybox({padding:0}),$(".now-reply").live({click:function(){$(this).hide().next().show()}}),$(".now-input").live({click:function(event){"button"==event.target.tagName.toLowerCase()&&makeInp(this,event.target,function(){})}})})});