Tình hình là em mới làm forum mới nhưng muốn tìm code quote nhanh của PunBB , em đã tìm rất nhiều nhưng thử vẫn không thành công.
Nay em muốn tìm lại chính nó ạ.
Thanks nhiều ạ !
Nay em muốn tìm lại chính nó ạ.
Thanks nhiều ạ !
function getSelectionText() {
var text;
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != 'Control') {
text = document.selection.createRange().text;
}
return text;
}
function fadeIn(newEl, display) {
newEl.style.opacity = 0;
newEl.style.display = display || 'inline';
(function fade() {
var val = parseFloat(newEl.style.opacity);
if (!((val += .1) > 1)) {
newEl.style.opacity = val;
requestAnimationFrame(fade);
}
})();
}
$(function() {
if(_userdata["session_logged_in"] === 1) {
var newEl = document.createElement('span');
newEl.className = 'quote_selection';
newEl.innerHTML = 'Quote';
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.quote_selection {' +
' background: #f0f0f0;' +
' color: #333;' +
' cursor: pointer;' +
' border-radius: 3px;' +
' -webkit-border-radius: 3px;' +
' -moz-border-radius: 3px;' +
' display: none;' +
' -webkit-touch-callout: none;' +
' -webkit-user-select: none;' +
' -khtml-user-select: none;' +
' -moz-user-select: none;' +
' -ms-user-select: none;' +
' user-select: none;' +
' padding: 2px 8px;' +
' position: absolute;' +
' border: 1px solid #ddd;' +
' text-shadow: rgba(255,255,255,0.55) 0px 1px 0px;' +
' font-size: 11px;' +
' -webkit-box-shadow: rgba(0,0,0,0.1) 0px 1px 3px;' +
' -moz-box-shadow: rgba(0,0,0,0.1) 0px 1px 3px;' +
' box-shadow: rgba(0,0,0,0.1) 0px 1px 3px;' +
'}';
document.body.appendChild(style);
document.body.appendChild(newEl);
var x = document.querySelectorAll('.post-entry');
for (var i = 0; i < x.length; i++) {
x[i].addEventListener('mouseup', function(e) {
var selectedTxt = getSelectionText();
if (selectedTxt) {
fadeIn(newEl);
newEl.style.top = e.pageY + 'px';
newEl.style.left = e.pageX + 'px';
var author = this.parentNode.firstChild.firstChild.firstChild.textContent;
newEl.onclick = function() {
$('#text_editor_textarea').sceditor('instance').insertText('[quote="' + author + '"]' + getSelectionText() + '[/quote]');
newEl.style.display = 'none';
};
} else {newEl.style.display = 'none';}
});
}
}
});
https://www.google.com/#q=quote+kh%C3%B4ng+chuy%E1%BB%83n+trang+forumotion
trandangduat wrote:EM đã thử hết nhưng ko thành công ạ
// Quick quote by markai
$(function(){
$('.post a[href*="mode=quote"]').click(function(t){t.preventDefault();var e=$(".sceditor-container").attr("class");if(e.indexOf("sourceMode")>-1)var o=!0;else var o=!1;var i=($(this).closest(".post"),$(this).attr("href"));$("body").append('<div class="quoteload" style="position: fixed;top: 0;width: 100%;height: 100%;background: rgba(0, 0, 0, 0.35);z-index: 999;"><img src="http://printon.md/images/loading.gif" style="position: absolute;top: 35%;left: 45%;"></div>'),$.get(i).done(function(t){var e=$(t).find("#text_editor_textarea").text();0==o&&$(".sceditor-button-source").trigger("click"),$("#quick_reply textarea").sceditor("instance").insert(e),$(".sceditor-button-source").trigger("click"),$("body").animate({scrollTop:$("#quick_reply").offset().top},"200"),$(".quoteload").remove()})});
});
Kelvin_Kingleon wrote:mấy chú thích làm cho mọi thứ rắc rối hóa :v
tạo file js, check vào in the topic
áp dụng cho quickrep mặc định của punbb
- Code:
function getSelectionText() {
var text;
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != 'Control') {
text = document.selection.createRange().text;
}
return text;
}
function fadeIn(newEl, display) {
newEl.style.opacity = 0;
newEl.style.display = display || 'inline';
(function fade() {
var val = parseFloat(newEl.style.opacity);
if (!((val += .1) > 1)) {
newEl.style.opacity = val;
requestAnimationFrame(fade);
}
})();
}
$(function() {
if(_userdata["session_logged_in"] === 1) {
var newEl = document.createElement('span');
newEl.className = 'quote_selection';
newEl.innerHTML = 'Quote';
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.quote_selection {' +
' background: #f0f0f0;' +
' color: #333;' +
' cursor: pointer;' +
' border-radius: 3px;' +
' -webkit-border-radius: 3px;' +
' -moz-border-radius: 3px;' +
' display: none;' +
' -webkit-touch-callout: none;' +
' -webkit-user-select: none;' +
' -khtml-user-select: none;' +
' -moz-user-select: none;' +
' -ms-user-select: none;' +
' user-select: none;' +
' padding: 2px 8px;' +
' position: absolute;' +
' border: 1px solid #ddd;' +
' text-shadow: rgba(255,255,255,0.55) 0px 1px 0px;' +
' font-size: 11px;' +
' -webkit-box-shadow: rgba(0,0,0,0.1) 0px 1px 3px;' +
' -moz-box-shadow: rgba(0,0,0,0.1) 0px 1px 3px;' +
' box-shadow: rgba(0,0,0,0.1) 0px 1px 3px;' +
'}';
document.body.appendChild(style);
document.body.appendChild(newEl);
var x = document.querySelectorAll('.post-entry');
for (var i = 0; i < x.length; i++) {
x[i].addEventListener('mouseup', function(e) {
var selectedTxt = getSelectionText();
if (selectedTxt) {
fadeIn(newEl);
newEl.style.top = e.pageY + 'px';
newEl.style.left = e.pageX + 'px';
var author = this.parentNode.firstChild.firstChild.firstChild.textContent;
newEl.onclick = function() {
$('#text_editor_textarea').sceditor('instance').insertText('[quote="' + author + '"]' + getSelectionText() + '[/quote]');
newEl.style.display = 'none';
};
} else {newEl.style.display = 'none';}
});
}
}
});
P/S: hôm sau đặt cái đề chú ý tí nhé ^_~
trandangduat wrote:@markai30 : Vẫn không được ạ
Hay là em gửi nick Admin của forum em cho anh sửa nhé
Cũng có thể là forum em bị xung đột
|
|