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"); function process_name(name, len) { if (typeof(name) != 'string') { return ''; } var len = parseInt(len); if (isNaN(len)) { len = 8; } if (name.length <= len) { return name; } var half = Math.floor(len / 2); return name.substr(0, half) + '...' + name.substr(name.length - half); } function _done() { var reurl = getRequestValue('redirect_uri'); if (!reurl || reurl.length <= 0) { reurl = document.referrer; } if (reurl && reurl.length > 0) { window.location.href = reurl; return true; } else { return false; } } function getRequestValue(name){ var _search = window.location.search, _val = _search.match(new RegExp("[\?\&]" + name + "=([^\&]*)(\&?)","i")); return _val ? _val[1] : _val; } function linkDatePicker(params) { var firstObj = null;//第一个对象 if (!params) { return; } for (filter in params) { var tmpJ = $(filter); if (!firstObj) { firstObj = tmpJ; } tmpJ.val(params[filter]); } if (firstObj[0].form) { for (i in firstObj[0].form) { if (i == 'form') { alert(i); } } $(firstObj[0].form).submit(); } } function yellowNotice(con) { if (con) { $('#yellownotice').show().find('.con').html(con); } } $(function(){ //消息显示控件 (function(){ var $popup_msg = $('#popup-msg'), hideTimer = null, hideInterval = 10000, minShowTime = 300, startTime = 0; function popup_msg(msg, type, interval) { type = type || 'error'; hideInterval = (interval || 10) * 1000; $popup_msg.html(msg).show(); $popup_msg.addClass(type); var offset_width = $popup_msg.attr('offsetWidth')||$popup_msg.prop('offsetWidth'); var left = ($(document).width() - offset_width) / 2; $popup_msg.css('left', left);//.hide().slideDown(); startTime = + new Date; hideTimer = setTimeout(function(){ hide_msg() }, hideInterval); } function hide_msg() { if (hideTimer) { window.clearTimeout(hideTimer); hideTimer = null; } var showTime = + new Date - startTime; if (showTime < minShowTime) { hideTimer = setTimeout(function() { hide_msg() }, minShowTime - showTime); return; } $popup_msg.hide(); } window.popup_msg = popup_msg; window.hide_popup_msg = hide_msg; })(); //自动绑定日期控件 $('input.datepicker').live('focus', function() { var $t = $(this); if ($t.data('datepicker')) { return; } $t.blur(); $t.data('datepicker', 1); $t.datepicker({ onSelect: function(){ if ($t.prev().is('.input-bg')) { $t.prev().hide(); } } }); if ($t.hasClass('dp-history')) { //昨天之前的日期 var $d = new Date(); $d.setTime($d.getTime() - 86400 * 1000); $t.datepicker("option", "maxDate", $d); } if ($t.hasClass('dp-history-today')) { //今天之前的日期 var $d = new Date(); $t.datepicker("option", "maxDate", $d); } if ($t.hasClass('dp-future')) { //昨天之前的日期 var $d = new Date(); $t.datepicker("option", "minDate", $d); } }); //数字输入框控制 $('input.numeric').keyup(function(event){ this.value = this.value.replace(/[^0-9.]+/, ''); }); //过滤条件选择框变化自动提交查询表单 $('select.filter').change(function(){ this.form.submit(); }); //input 背景显示控制 $('input.input-bg').focus(function(){ var $t = $(this); $t.hide().next().trigger('focus'); if ( ! $t.next().data('input-bg')) { $t.next().data('input-bg', true).blur(function(){ if (this.value == '') { $t.show(); } }).change(function(){ if (this.value == '') { $t.show(); } }); } }).each(function(){ if ($(this).next().val() == '') { $(this).show(); } else { $(this).hide(); } }); //单选、勾选框点击触发显示框架 function bind_toggle_trigger() { $(':checkbox[rel^=trigger-],:radio[rel^=trigger-]').not('.trigger-toggle').click(function(event, from_trigger){ var $t = $(this), type = $t.attr('rel').replace(/^trigger-/, ''), $targets = $('[rel=target-' + type + ']'); $untargets = $('[rel=untarget-' + type + ']'); if ($t.is(':checked')) { $targets.show(); $untargets.hide(); } else { $targets.hide(); $untargets.show(); } if ($t.is(':radio') && ! from_trigger) { $(':radio[name=' + this.name + ']').not($t).each(function(){ $(this).triggerHandler('click', true); }); } }).each(function(){ $(this).addClass('trigger-toggle').triggerHandler('click'); }); } bind_toggle_trigger(); $(window).bind('ajax_load_page', function(){ bind_toggle_trigger(); }); //Ajax提交表单 function bind_ajax_form() { $('form.ajax').not('.bind-ajax').submit(function(event){ event.preventDefault(); //popup_msg('数据保存中...', 'info'); var form = $(this); if(form.attr('progress') == '1'){ return; } form.attr('progress','1') $.ajax({ type : 'post', dataType : 'json', url : $(this).attr('action') || location.href , data : $(this).serialize(), success : function(ret){ if (ret.code != 0) { popup_msg(ret.msg, 'error'); } else { if (ret.redirect_uri) { hide_popup_msg(); if (/javascript\s*:\s*(.+)/.test(ret.redirect_uri)) { $.globalEval(RegExp.$1); } else { if (is_popup_mode()) { popup(ret.redirect_uri); } else { window.location = ret.redirect_uri; } } } else { popup_msg(ret.msg, 'succ'); } } form.attr('progress','0') }, error : function(){ form.attr('progress','0') } }) }).each(function(){ $(this).addClass('bind-ajax'); }); } bind_ajax_form(); //记录列表操作 if ($('.list-table').length) { var $bat_action_btn = $('.btn[class*=bat-]'); $(':checkbox.sel-all,:checkbox.sel-item').click(function(){ var $t = $(this), isChecked = $t.attr('checked'); if ($t.is('.sel-all')) { if (isChecked) { $(':checkbox.sel-item,:checkbox.sel-all').attr('checked', true); $(':checkbox.sel-item').closest('tr').addClass('selected'); } else { $(':checkbox.sel-item,:checkbox.sel-all').attr('checked', false); $(':checkbox.sel-item').closest('tr').removeClass('selected'); } } else { if (isChecked) { if ($(':checkbox.sel-item:not(:checked)').length == 0) { $(':checkbox.sel-all').attr('checked', true); } $t.closest('tr').addClass('selected'); } else { $(':checkbox.sel-all').attr('checked', false); $t.closest('tr').removeClass('selected'); } } if ($(':checkbox.sel-item:checked').length == 0) { $bat_action_btn.addClass('disabled'); } else { $bat_action_btn.removeClass('disabled'); } }).triggerHandler('click'); $('.list-table tbody tr').click(function(event){ var $target = $(event.target); if ($target.is('a,:input,button')) { return; } var $checkbox = $target.closest('tr').find(':checkbox'); if ($checkbox.length) { $checkbox.attr('checked', ! $checkbox.attr('checked')); $checkbox.triggerHandler('click'); } }); window.get_selected_item_ids = function() { return $(':checkbox.sel-item:checked').map(function(){ return this.value; }).get().join(','); }; window.get_ids = function(elem) { var ids = ''; if ($(elem).is(':not([class*=bat-])')) { ids = $(elem).closest('tr').find(':checkbox').val(); } else { ids = get_selected_item_ids(); } if ( ! ids) { return; } return ids; }; } //遮罩层 var $mask = null; function show_mask() { if ($mask == null) { $mask = $('
') .appendTo(document.body) } var dw = $(document).width(), dh = $(document).height(); $mask.css({ width: dw, height: dh }).show(); } function hide_mask() { if ($mask) { $mask.hide(); } } //调出层 (function(){ var $popup = null; function init() { $popup = $(' ').appendTo(document.body); $('#popup-box .close').live('click', function(event){ event.preventDefault(); hide_popup(); }); $(document).keydown(function(event){ if (event.which == 27) { hide_popup(); } }); } function hide_popup() { hide_mask(); $popup.hide(); hide_popup_msg(); } function popup(url, title) { $popup == null && init(); show_mask(); title !== undefined && $popup.find('.title').html(title); $popup.find('.content').html('Loading...
').end().show(); var w = $popup.attr('offsetWidth'), h = $popup.attr('offsetHeight'), ww = $(window).width(), wh = $(window).height(); $popup.css({ // width : w, left : Math.max(0, (ww - w) / 2), //top : Math.max(0, (wh - h) / 2) top : document.documentElement.scrollTop + 30 }).find('.content').load(url, function(){ // var nh = $popup.attr('offsetHeight'); var nw = $popup.find('.content').attr('offsetWidth'); var nh = $popup.find('.content').attr('offsetHeight'); /* $popup.css({ left : Math.max(0, (ww - nw) / 2), top : Math.max(0, (wh - nh) / 2) }); */ $popup.find('form:not(.ajax_validation)').addClass('ajax'); $(window).trigger('ajax_load_page'); }); }; function is_popup_mode() { return $popup && $popup.is(':visible'); } $(window).bind('ajax_load_page', function(){ if ( ! $popup) return; if (is_popup_mode()) { $popup.find('a:not([href^=#]):not([href^=javascript]):not(.bind-popup)').click(function(event){ event.preventDefault(); popup($(this).attr('href')); }).each(function(){ $(this).addClass('bind-popup'); }); } if (is_popup_mode()) { $('form.filter').submit(function(event){ event.preventDefault(); var url = $(this).attr('action') || location.href; url = url.split('?')[0]; url += '?' + $(this).serialize(); popup(url); return false; }); } bind_ajax_form(); bind_ajax_validation_form(); if (is_popup_mode()) { //绑定物料预览tip元素的相应事件 } }); window.popup = popup; window.hide_popup = hide_popup; window.is_popup_mode = is_popup_mode; })(); $(function(){ $('a.popup').click(function(event){ event.preventDefault(); popup($(this).attr('href'), $(this).attr('title')); }); if($('#search_key').val()==''||$('#search_key').val()=='输入创意名称,搜索创意'){ $('#search_key').addClass('gray').val('输入创意名称,搜索创意'); }; $('#search_key').click(function(){ $(this).val(''); $(this).removeClass('gray'); }); $('#search_key').blur(function(){ if($('#search_key').val()==''||$('#search_key').val()=='输入创意名称,搜索创意'){ $('#search_key').addClass('gray').val('输入创意名称,搜索创意'); }; }) $('#material-search').click(function(){ if($('#search_key').val()==''||$('#search_key').val()=='输入创意名称,搜索创意'){ return false; }else{ $('#main-form').submit(); } return false; }) }); $('a.lnkbtn_seek,a.submit').live('click', function(event){ event.preventDefault(); var $f = $(this).closest('form'); if ($f.length) { $f.trigger('submit'); } }); if ($.browser.msie) { $('a input[type=button]').each(function(){ var $btn = $(this), $a = $btn.closest('a'), url = $a.attr('href'), target = $a.attr('target'); if (url) { $a.click(function(event){ event.preventDefault }); $btn.click(function(){ if (target == '_blank') { window.open(url); } else { window.location = url; } }); } }); } }); function replacer(str,obj){ return str.replace(/{(\w+)}/g,function(all,$1){ return typeof obj[$1] == 'undefined' ? '' : obj[$1]; }); } //充值框开始 var Dialog = { show : function(el,callback){ this.el = el = $(el).show(); this.reset(); callback&&callback(el); if(!el.data('init')){ el.delegate('.close','click',function(e){ e.preventDefault(); Dialog.hide(); }); $('#float_mask').bind('click',function(){ Dialog.hide(); }) el.data('init',true) } }, hide : function(){ if(!this.el){return;} this.el.hide(); $('#float_mask').hide(); this.el = null; }, reset : function(){ if(!this.el)return; var me = this, doc = document, width = me.el.width(), height = me.el.height(), docWidth = $(doc).width(), docHeight = $(doc).height(), clientHeight = doc.documentElement.clientHeight; me.el.css({ top : $(doc).scrollTop() + (clientHeight - height)/2, left : (docWidth - width)/2, zIndex : 1003 }); $('#float_mask').show().css({ width : docWidth, height : docHeight, zIndex : 1002 }); } } function showRecharge(){ function err(msg) { $('#recharge .form-error').html(msg); $('#recharge .tips').hide(); } Dialog.show($('#recharge'),function(el){ if(!el.data('init')){ var handler = function(){ this.value = this.value.replace(/[^\d.]/,''); } el.delegate('.btn-recharge','click',function(){ var txtVal = +el.find('[name=amount]').val(); if(!txtVal){ err('请输入正确的金额.'); return; } if(txtVal' + $comment + '
'; $html += '