$(function () { _68.init(); var gt = $('#gotop.gotop').click(function () { $('html,body').animate({ scrolltop: 0 }, 300); return false; }); $(window) .resize(function () { _68.center($('.floatbox')); _68.center($('#upmsg')); }) .scroll(function () { if (_68.toplock != null) $(window).scrolltop(_68.toplock); if (gt.length > 0) { if ($(window).scrolltop() > 50) gt.show(); else gt.hide(); } }) ; $(document) .click(function () { $('select[size]').click(); }) .keydown(function (e) { if (e.keycode == 27) _68.fb.hide($('.floatbox:last')); for (var i = 0; _68.event.keydown.data && i < _68.event.keydown.data.length; i++) { _68.event.keydown.data[i].call(e); } }) ; $('form[search]').each(function () { var f = this; $(f).submit(function () { _68.form.trim($(f).find('input')); if (f.k.value == '' || f.k.value.length < 2) { f.k.focus(); return false; } if ($(f.t).val() == 'p') $(f).attr('action', '/u/designer'); else $(f).attr('action', '/work/'); $(f.t).attr('disabled', true); f.submit(); }).find('input[name=k]').blur(function () { if ($(this).val() == '') $(this).css({ color: '' }); }).focus(function () { $(this).css({ color: 'inherit' }); }); }); $('a[feedback]').click(function () { _68.fb.show('/float/feedback'); return false; }); }); var _68 = { signin: '/login?r=' + encodeuri(top.window.location.pathname + top.window.location.search), me: true, hang: null, //挂起的操作,成功登录调用。 toplock: null, event: { keydown: { data: [], add: function (name, call) { this.data.push({ name: name, call: call }) }, remove: function (name) { for (var i = 0; this.data && i < this.data.length; i++) { if (this.data[i].name == name) this.data.splice(i, 1); } } } }, init: function (e) { _68.me = false; if (typeof e == 'undefined') e = $(document); e.find('select').each(function () { var s = $(this); s.find('option').css('color', function () { return this.style.color == '' ? s.css('color') : this.style.color; }); }).change(function () { var s = $(this).blur(); s.css('color', function () { var o = s.find('option:selected'); return o.length > 0 ? o[0].style.color : ''; }); }).change(); e.find('input[verifycode]').focus(function () { var vimg = $(this.form).find('img[verifycode]'); if (!vimg.is(':visible')) { vimg.click(function () { $(this).attr('src', '/verify?' + math.random()) }).click().show().css({ verticalalign: 'top', cursor: 'pointer' }).attr('title', '点击刷新'); } }); e.find('select[child]').change(function () { //带child属性的select项子项获取事件处理,忽略大小写,暂时只支持两级。 var s = $(this), c = s.attr('child'), v = s.attr('val'); s.parent('label').height('auto').width('auto'); var o = s.find(':selected'); if (typeof o.attr('ischd') != 'undefined') return; s.find('[ischd]').remove(); if (o.val() == '') return; $.json('/do?' + c, { c: o.val() }, function (r) { if (typeof r == 'object' && r != null) { var t = o; for (var i = 0; i < r.length; i++) t = $('