Diễn Đàn Hỗ Trợ Forumvi :: Share & Support Fourumvi :: Code[Javascript] Trích dẫn nhanh (Quick Quote)
[Javascript] Trích dẫn nhanh (Quick Quote)
Trang 1 trong tổng số 1 trang • Share
[Javascript] Trích dẫn nhanh (Quick Quote)
Demo:
Khi bấm vào nút quote:[You must be registered and logged in to see this link.]
Kết quả:
[You must be registered and logged in to see this link.]
Hướng dẫn:
- Tạo 1 trang js mới
Title: Quick QuotePlacement: In all the pages
Codes:
- Code:
$(function(){
var forum_version = 1,
new_button = false,
quote_image = 'http://icons.iconarchive.com/icons/fatcow/farm-fresh/16/document-quote-icon.png';
if (forum_version == 0) n = [".postbody div",".name strong a"];
if (forum_version == 1) n = [".postbody .content div",".postprofile dl dt strong a"];
if (forum_version == 2) n = [".entry-content div",".username a"];
if (forum_version == 3) n = [".post-entry div",".postprofile-details dt a + br + a"];
if (new_button == true) { q = ".quickquote"; $(forum_version==1?"li:has(.i_icon_quote)":"a:has(.i_icon_quote)").after($('<li style="display:inline-block;list-style:none;"><a href="#quick_reply"><img src="'+quote_image+'" class="quickquote" alt="Trích dẫn nhanh" title="Trích dẫn nhanh" /></a></li>')) }
if (new_button == false) { q = "a:has(.i_icon_quote)"; $("a:has(.i_icon_quote)").attr("href", "#quick_reply"); $(".i_icon_quote").attr("title", "Reply with quote") }
$(document).on('mouseup',n[0],function(e){
qtext = $(this).parents(".post");
if (window.getSelection) theSelection = window.getSelection().toString();
else if (document.getSelection) theSelection = document.getSelection();
else if (document.selection) theSelection = document.selection.createRange().text;
});
$(q).click(function () {
if (typeof qtext == 'undefined') return;
uname = qtext.find(n[1]).text();
$("div.sceditor-toolbar + iframe").contents().find("body").append('<blockquote><cite>' + uname + '</cite>' + theSelection + '</blockquote> <br />');
$('.sceditor-container textarea')[0].value += '[quote="' + uname + '"]' + theSelection + '[/quote]'
});
var n,q;
});
- Chọn phiên bản để code có thể hoạt động:
tìm- Code:
var forum_version = 1,
0 = phpbb2
1 = phpbb3
2 = punbb
3 = invision
Tùy biến button và hình ảnh button:
new_button :
true = tạo 1 nút trích dẫn nhanh
false = sử dụng nút trích dẫn mặc định
Ở code trên mình đã edit link ảnh cho phù hợp các bạn chỉ cần sửa phiên bản và có sử dụng button hay ko thôi
*Chú ý: - Các bạn nên bôi đen đoạn cần trích dẫn trước khi sử dụng
- Ở demo trên mình đã mở button quick quote nên mới có thêm một button như v
[You must be registered and logged in to see this image.]
HelpsFMvi- Ban Quản Trị FMvi
- Số bài : 104
HelpsPoints : 15428
Likes : 33
Ngày tham gia : 10/03/2016
Trạng thái :Online Offline
Tuổi : 26
Location : Ninh Thuận
[Click để xem tài sản HelpsFMvi]
Similar topics
» [Javascript] Thay đổi tiêu đề spoiler, code và quote
» [Javascript] Gửi tin nhắn riêng nhanh
» [Javascript] Chuyển hướng nhanh
» [Javascript] Cấm thành viên nhanh Ver 2.0
» [Javascript] Cấm thành viên nhanh Ver 1.0
» [Javascript] Gửi tin nhắn riêng nhanh
» [Javascript] Chuyển hướng nhanh
» [Javascript] Cấm thành viên nhanh Ver 2.0
» [Javascript] Cấm thành viên nhanh Ver 1.0
Trang 1 trong tổng số 1 trang
Diễn Đàn Hỗ Trợ Forumvi :: Share & Support Fourumvi :: Code[Javascript] Trích dẫn nhanh (Quick Quote)
Permissions in this forum:
Bạn không có quyền trả lời bài viết
|
|