ist = $('div.message'); var first_width = jmessagelist.width(); // 815 : 746; // 734 746 jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); // 734 746 var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if (!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } //var percent = xn.min(100, xn.ceil((img_width / jmessage_width) * 100)); if (img_width > jmessage_width) { if (this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { //window.open(jimg.attr('src')); }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } // 对于超宽的表格,加上响应式 function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('
'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); // 输入框自动伸缩 // var jmessage = $('#message'); // jmessage.on('focus mouseenter', function() { // if (jmessage.t) { // clearTimeout(jmessage.t); // jmessage.t = null; // } // jmessage.css('height', '8rem'); // }); // jmessage.on('blur', function() { // jmessage.t = setTimeout(function() { // jmessage.css('height', '2.5rem'); // }, 1000); // }); // 引用 / Quote $('body').on('click', '.mod_post_reply', function() { var jthis = $(this); var tid = jthis.data('tid'); var pid = jthis.data('pid'); var quser = jthis.data('quser'); var jmessage = $('#message'); var jli = jthis.closest('.post'); var qusername = $('.qusername'); var jpostlist = jli.closest('.postlist'); var jadvanced_reply = $('#advanced_reply'); var jform = $('#quick_reply_form'); var replying = $('.replying'); if(jli.hasClass('quote')) { jli.removeClass('quote'); jform.find('input[name="quotepid"]').val(0); jadvanced_reply.attr('href', xn.url('post-create-'+tid)); qusername.text(''); replying.hide('fast'); } else { jpostlist.find('.post').removeClass('quote'); jli.addClass('quote'); var s = jmessage.val(); jform.find('input[name="quotepid"]').val(pid); jadvanced_reply.attr('href', xn.url('post-create-'+tid+'-0-'+pid)); qusername.html(''+quser+''); replying.show('fast'); } jmessage.focus(); return false; }); $('li[data-active="fid-6"]').addClass('active');