Diễn đàn share thủ thuật code hay shin

Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.
Diễn đàn share thủ thuật code hay shin

    Việt hoá resize ảnh nè

    Dr.Thanh
    Dr.Thanh

    Tân Binh
    Tân Binh


    Posts : 6
    Points : 12
    Thanked : 0
    Join date : 18/04/2011
     Status Status : Dr.Thanh

     Việt hoá resize ảnh nè Empty Việt hoá resize ảnh nè

    Bài gửi by Dr.Thanh Mon Apr 18, 2011 12:14 am

    Vào viewtopic_body:
    Tìm:

    Code:
    <!-- BEGIN switch_image_resize -->
    ....
    ....
    <!-- END switch_image_resize -->

    Thay bằng:
    Code:
    <!-- BEGIN switch_image_resize -->
    <script type="text/javascript">
    //<![CDATA[
    $(function(){
      $('.post-entry .entry-content img').not('.signature_div img').css('display','none');
    });
    $(window).load(function(){
        $('.post-entry .entry-content img').not('.signature_div img').each(function(){
          if ( ( $(this).width() > {switch_image_resize.IMG_RESIZE_WIDTH} && {switch_image_resize.IMG_RESIZE_WIDTH} != 0 ) || ( $(this).height() > {switch_image_resize.IMG_RESIZE_HEIGHT} && {switch_image_resize.IMG_RESIZE_HEIGHT} != 0 ) ) {
            $(this).before(document.createElement('div')).prev().click(function(){
                return false;
            }).addClass('resizebox').append(document.createElement('div')).children().addClass('resize_border clearfix').append(document.createElement('div')).children().addClass('resize_content clearfix').append(document.createElement('a')).children().addClass('enlarge').attr('href', '#').text('Phóng to').click(function(){
                $(this).parent().parent().parent().next().css('display','none').attr('resizeWidth', $(this).parent().parent().parent().next().width()).width('');
                $(this).parent().parent().parent().next().width($(this).parent().parent().parent().next().width() > $(this).closest('.entry-content').width()?'100%':'').css('max-width','100%').css('display','inline');
                $(this).css('display','none').next('a.resize').css('display','inline-block');
                $(this).parent().parent().parent().width($(this).parent().parent().parent().next().width());
                return false;
            }).parent().append(document.createElement('a')).children().next().addClass('resize').attr('href','#').text('Thu nhỏ').click(function(){
                $(this).parent().parent().parent().next().width(parseInt($(this).parent().parent().parent().next().attr('resizeWidth'))).removeAttr('resizeWidth');
                $(this).css('display','none').prev('a.enlarge').css('display','inline-block');
                $(this).parent().parent().parent().width('').width($(this).parent().parent().parent().next().width());
                return false;
            }).parent().append(document.createElement('div')).children('a.resize').next().addClass('resize_filler').text(' ').parent().append(document.createElement('a')).children('div.resize_filler').next().addClass('fullsize').attr('href','#').click(function(){
                window.open('/viewimage.forum?u=' + encodeURIComponent($(this).parent().parent().parent().next().attr('src')));
                return false;
            }).attr('target', '_blank').text('Xem ảnh gốc');
            if ($(this).width() > ($('html').attr('dir') != 'rtl' ? $(this).closest('.entry-content').width() - $(this).prev().offset().left + $(this).closest('.entry-content').offset().left : $(this).prev().width() + $(this).prev().offset().left - $(this).closest('.entry-content').offset().left)){
                $(this).prev().find('a.fullsize').attr('href','/viewimage.forum?u=' + encodeURIComponent($(this).attr('src'))).css('display', 'inline-block');
            }
            $(this).width($(this).width() * ( ( {switch_image_resize.IMG_RESIZE_WIDTH} != 0 && ( {switch_image_resize.IMG_RESIZE_HEIGHT} == 0 || $(this).width() / $(this).height() > {switch_image_resize.IMG_RESIZE_WIDTH} / {switch_image_resize.IMG_RESIZE_HEIGHT} ) ) ? {switch_image_resize.IMG_RESIZE_WIDTH} / $(this).width() : {switch_image_resize.IMG_RESIZE_HEIGHT} / $(this).height() ) ).prev().width($(this).width());
          }
      }).css('display', 'inline');
    });
    //]]>
    </script>
    <!-- END switch_image_resize -->

      Hôm nay: Thu Apr 18, 2024 11:54 pm