(function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS 瑙勮寖 module.exports = mod; else if (typeof define == "function" && define.amd) // AMD 瑙勮寖 return define(['jquery','tools'], mod); else // Plain browser env 娴忚鍣 mod($,tools); })(function($,tools) { // var $ = require(['jquery']); // var tools = require(['tools']); // 瀵瑰垎椤电殑閾炬帴娣诲姞澶勭悊 if (!tools.isEmptyValue($('.pagination').toArray())) { $('.pagination>ul>li>a ').each(function(index, el) { if ($(el).attr('href') != "#") { el.href += location.search; } }); } // 楠岃瘉鐮 $('input[name="captcha"]').one('focusin', function(e) { var img = $(this).nextAll('img.captcha'); if (tools.isEmptyValue(img)) { var imgStr = ' 3 && code.length < 8 && !_self.attr('readonly')) { $.ajax({ url: SITE_URL + 'service/captcha_ajax', type: 'GET', dataType: 'json', data: { code: code } }) .done(function(data) { console.log("success"); if (data.status) { _self.removeClass('error').addClass('success'); _self.next('img').remove(); _self.attr('readonly', true); _self.nextAll('.captcha_no').remove(); _self.after(''); } else { _self.removeClass('success').addClass('error'); _self.nextAll('.captcha_ok').remove(); _self.nextAll('.captcha_no').remove(); _self.next().after( '×'); } }) .fail(function() { console.log("error"); }) .always(function() { console.log("complete"); }); } }); // 鍒锋柊楠岃瘉鐮 $(document).delegate('input[name="captcha"] ~ img.captcha', 'click', function(event) { $(this).attr('src', SITE_URL + 'captcha?t=' + Math.random() * 10); }); });