[Code] Thu gọn bài viết cho mọi phiên bản

20/01/2012



/* Thu gọn bài viết - www.FMvi.org */
.baivietdai{overflow:hidden}
.thugon span:hover{text-shadow:1px 1px 1px #000;cursor:pointer}
.thugon{background-color:#F6FF9D;border:3px double #0668AD;clear:both;margin:0;padding:2px 10px}
.viewfull{background:url(//ssl.gstatic.com/ui/v1/zippy/arrow_down.png) no-repeat scroll 3px 7px transparent;padding:0 15px}
.viewhide{display:none;background:url(//ssl.gstatic.com/ui/v1/icons/mail/arrow_up.png) no-repeat scroll 3px 7px transparent;padding:0 15px}
.fullOff{background:url(http://i48.servimg.com/u/f48/16/58/89/73/power_11.png) no-repeat scroll 0 2px transparent;margin-top:-2px;padding:2px 5px 2px 20px}
.fullOn{display:none;background:url(http://i48.servimg.com/u/f48/16/58/89/73/power_10.png) no-repeat scroll 0 2px transparent;margin-top:-2px;padding:2px 5px 2px 20px}

https://zone-a7.forumvi.com/t89-topic




[Code] Thu gọn bài viết cho mọi phiên bản Flag_r10Chức năng:
  • Rút gọn những bài viết dài hơn 350px.
  • Hiệu ứng trượt khi thu gọn bài viết.
  • Có thể Bật/Tắt dễ dàng.


Hướng dẫn cho phpBB3

Bước 1: Thêm vào CSS
ACP - Display - Pictures and Colors - Colors - CSS Stylesheet:

Code:
/* Thu gọn bài viết - www.FMvi.org */
.baivietdai{overflow:hidden}
.thugon span:hover{text-shadow:1px 1px 1px #000;cursor:pointer}
.thugon{background-color:#F6FF9D;border:3px double #0668AD;clear:both;margin:0;padding:2px 10px}
.viewfull{background:url(//ssl.gstatic.com/ui/v1/zippy/arrow_down.png) no-repeat scroll 3px 7px transparent;padding:0 15px}
.viewhide{display:none;background:url(//ssl.gstatic.com/ui/v1/icons/mail/arrow_up.png) no-repeat scroll 3px 7px transparent;padding:0 15px}
.fullOff{background:url(http://i48.servimg.com/u/f48/16/58/89/73/power_11.png) no-repeat scroll 0 2px transparent;margin-top:-2px;padding:2px 5px 2px 20px}
.fullOn{display:none;background:url(http://i48.servimg.com/u/f48/16/58/89/73/power_10.png) no-repeat scroll 0 2px transparent;margin-top:-2px;padding:2px 5px 2px 20px}

Bước 2: Thêm vào javascript
ACP - Modules - HTML & JAVASCRIPT - Javascript codes management
Add a Javascript Code
  • Title * : Thu gọn bài viết dài
  • Placement : In the topics
  • Javascript Code * :
    Code:
    var CopyrightNoticeEn = 'Copyright ©️  by FmVi. All Rights Reserved. Use, modification, and/or distribution of this script is not allowed without direct permission from baivong (gialangsangai2000@yahoo.com). This entire copyright notice must remain in the original, copied, or modified script';
    var CopyrightNoticeVi = 'Bản quyền ©️ FmVi. Giữ toàn quyền. Việc sử dụng, sửa đổi , và / hoặc phân phối mã này mà không được phép trực tiếp từ baivong (gialangsangai2000@yahoo.com) là không được phép. Toàn bộ thông báo bản quyền này phải được giữ nguyên khi sao chép, hoặc sửa đổi';
    $(function () {
       $(".postbody .content").each(function () {
          if ($(this).height() >= 350) {
             $(this).after('<p class="thugon"><span class="viewfull">Xem toàn bộ</span><span class="viewhide">Thu gọn</span><span class="fullOff" style="float:right">Tắt chức năng thu gọn</span><span class="fullOn" style="float:right">Bật chức năng thu gọn</span></p>');
             $(this).addClass("baivietdai");
             $(".baivietdai").height(315);
          }
       });
       if (my_getcookie("thugonbaiviet") == "yes") {
          $(".fullOn, .viewhide").show();
          $(".fullOff, .viewfull").hide();
          $(".baivietdai").height("100%");
       }
       $(".viewfull").chóng mặt(function () {
          $(this).parent().prev().height("100%");
          $(this).hide().next().show();
       });
       $(".viewhide").chóng mặt(function () {
          $(this).parent().prev().animate({
             height: "315px"
          }, 1000);
          $(this).hide().prev().show();
       });
       $(".fullOff").chóng mặt(function () {
          my_setcookie("thugonbaiviet", "yes", true);
          $(".baivietdai").height("100%");
          $(".fullOn, .viewhide").show();
          $(".fullOff, .viewfull").hide();
       });
       $(".fullOn").chóng mặt(function () {
          my_setcookie("thugonbaiviet", "no", true);
          $(".baivietdai").animate({
             height: "315px"
          }, 1000);
          $(".fullOn, .viewhide").hide();
          $(".fullOff, .viewfull").show();
       });
    });

Tương tự phpBB3, ở bước 2, tìm:
Code:
$(".postbody .content")
Thay bằng:
Code:
$(".postbody").find("div:first")

Viết bởi baivong - [You must be registered and logged in to see this link.]



Hướng dẫn cho punBB, Invision


Nhận xét

Bài đăng phổ biến từ blog này

Chuyện lạ như thật?

Muốn