Message background issue in quates
3 posters
Page 1 of 1
Message background issue in quates
Technical Details
Forum version : #phpBB2
Position : Founder
Concerned browser(s) : Google Chrome
Who the problem concerns : Yourself
Forum link : ( link is hidden, you must reply to see )
Description of problem
Hey!I followed this tutorial for message background:https://help.forumotion.com/t137252-button-to-choose-the-message-background#926885
The issue is, that when quoting a message with a background, it posts something like this:
- Code:
[quote="Kami-Sama"][postbg=https://i.solidfiles.com/VVRV5A7R85nnr.png]TEXT[/quote]
The part "postbg=LINK" actually shows in the quote.
Any ideas how to overcome this?
Also, maybe there would be no issue if message background would be applied by default depending on user group? Instead of having ability for user to choose BG himself.
Last edited by Kami-sama on August 9th 2017, 7:18 pm; edited 3 times in total
Re: Message background issue in quates
Are you manually entering that line of code?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Message background issue in quates
please try with this code, is a instant quote and remove that tag
- Code:
//-Written by Chalo ------ Open Source 2014-2017 -----//
//--------- http://www.opensourcephpbb3.com ----------//
//------------------- Version: 1.6 -------------------//
var quote = {
lang: {
notice_original: 'Quoting ajax by Chyalo',
quoting: 'Quoting post #',
color_c: 'linear-gradient(to bottom, #87e0fd 0%,#53cbf1 40%,#05abe0 100%)',
},
init: function () { this.form = document.forms.post; this.sceditor = $(this.form.message).sceditor('instance'); this.click(); }, click: function () { var a = document.getElementsByTagName('a'), len = a.length; for (var i = 0; i < len; i++) { a[i].href.match(/post\?p=(\d+)&mode=quote/g) && (a[i].setAttribute('onclick', 'quote.quote(this.href);return false')); } }, quote: function (d) { quote.sceditor.updateOriginal(); this.XML('', d, function (x) { var o = x.responseXML, a = o.forms.post.message, e = o.forms.post.subject.value, f = a.value.replace(/\[postbg=(.*)\]/g, ''); quote.sceditor.val(f); quote.sC(quote.form, 300); quote.notice(quote.lang.quoting + d.match(/p=(\d+)/)[1], quote.lang.color_c, 'off', 3000); }); }, notice: function (e, t, a, b) { var o, n, s, l, i; b = 'undefined' != typeof b ? b : '1000'; i = document.getElementsByClassName('notice_reply'); n = document.getElementsByClassName('sceditor-group')[0]; s = n.parentNode; o = i.length ? i[0] : document.createElement('DIV'); l = 'height:20px;line-height: 1.5;border-radius: 3px; text-shadow: 0 1px rgba(255, 255, 255, 0.46)'; !i.length && (o.classList.add('notice_reply'), o.style.cssText = l, s.insertBefore(o, n)); o.style.display = 'block'; o.innerHTML = 'undefined' == typeof e ? quote.lang.notice_original : e; o.style.background = 'undefined' == typeof t ? quote.lang.color_a : t; if (a == 'off') { setTimeout(function () { 'block' == o.style.display && (o.style.display = 'none') }, b) } }, sC: function (o, e, t, s) { e = e || 500, s = s || window; var a = o.clientHeight < 150 ? o.clientHeight * 2 : o.clientHeight < 300 ? o.clientHeight : o.clientHeight > 400 && '', n = s.scrollTop - a || window.pageYOffset - a; if ('number' == typeof o) var r = parseInt(o); else var r = quote.gT(o, n); var l = Date.now(), i = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (o) { window.setTimeout(o, 15) }, a = function () { var c = Date.now() - l; s !== window ? s.scrollTop = quote.pS(n, r, c, e) : window.scroll(0, quote.pS(n, r, c, e)), c > e ? 'function' == typeof t && t(o) : i(a) }; a() }, eC: function (t) { return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1 }, pS: function (o, e, s, r) { return o + (e - o) * quote.eC(s / r) }, gT: function (o, e) { return 'HTML' === o.nodeName ? -e : o.getBoundingClientRect().top + e }, XML: function (a, b, f) { var c; c = window.XMLHttpRequest ? new XMLHttpRequest : window.ActiveXObject && (new ActiveXObject('Microsoft.XMLHTTP')); 'undefined' != typeof a ? c.open('POST', b) : c.open('GET', b, true); c.responseType = 'document'; c.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); c.send('undefined' != typeof a ? a : ''); c.onreadystatechange = function () { this.readyState == 4 && this.status == 200 && (f(this)); }; }};
document.addEventListener('DOMContentLoaded', function () {
/\/?t\d+.*/.test(window.location.pathname) && document.getElementById('logout') && quote.init();
});
Ch@lo Valdez- Forumember
- Posts : 138
Reputation : 50
Language : spanish
Re: Message background issue in quates
No, the code is added by default and not visible in post creation, nor post editing.SLGray wrote:Are you manually entering that line of code?
you mean to replace my current post BG code with your suggested one?Ch@lo Valdez wrote:please try with this code, is a instant quote and remove that tag
- Code:
//-Written by Chalo ------ Open Source 2014-2017 -----//
//--------- http://www.opensourcephpbb3.com ----------//
//------------------- Version: 1.6 -------------------//
var quote = {
lang: {
notice_original: 'Quoting ajax by Chyalo',
quoting: 'Quoting post #',
color_c: 'linear-gradient(to bottom, #87e0fd 0%,#53cbf1 40%,#05abe0 100%)',
},
init: function () { this.form = document.forms.post; this.sceditor = $(this.form.message).sceditor('instance'); this.click(); }, click: function () { var a = document.getElementsByTagName('a'), len = a.length; for (var i = 0; i < len; i++) { a[i].href.match(/post\?p=(\d+)&mode=quote/g) && (a[i].setAttribute('onclick', 'quote.quote(this.href);return false')); } }, quote: function (d) { quote.sceditor.updateOriginal(); this.XML('', d, function (x) { var o = x.responseXML, a = o.forms.post.message, e = o.forms.post.subject.value, f = a.value.replace(/\[postbg=(.*)\]/g, ''); quote.sceditor.val(f); quote.sC(quote.form, 300); quote.notice(quote.lang.quoting + d.match(/p=(\d+)/)[1], quote.lang.color_c, 'off', 3000); }); }, notice: function (e, t, a, b) { var o, n, s, l, i; b = 'undefined' != typeof b ? b : '1000'; i = document.getElementsByClassName('notice_reply'); n = document.getElementsByClassName('sceditor-group')[0]; s = n.parentNode; o = i.length ? i[0] : document.createElement('DIV'); l = 'height:20px;line-height: 1.5;border-radius: 3px; text-shadow: 0 1px rgba(255, 255, 255, 0.46)'; !i.length && (o.classList.add('notice_reply'), o.style.cssText = l, s.insertBefore(o, n)); o.style.display = 'block'; o.innerHTML = 'undefined' == typeof e ? quote.lang.notice_original : e; o.style.background = 'undefined' == typeof t ? quote.lang.color_a : t; if (a == 'off') { setTimeout(function () { 'block' == o.style.display && (o.style.display = 'none') }, b) } }, sC: function (o, e, t, s) { e = e || 500, s = s || window; var a = o.clientHeight < 150 ? o.clientHeight * 2 : o.clientHeight < 300 ? o.clientHeight : o.clientHeight > 400 && '', n = s.scrollTop - a || window.pageYOffset - a; if ('number' == typeof o) var r = parseInt(o); else var r = quote.gT(o, n); var l = Date.now(), i = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (o) { window.setTimeout(o, 15) }, a = function () { var c = Date.now() - l; s !== window ? s.scrollTop = quote.pS(n, r, c, e) : window.scroll(0, quote.pS(n, r, c, e)), c > e ? 'function' == typeof t && t(o) : i(a) }; a() }, eC: function (t) { return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1 }, pS: function (o, e, s, r) { return o + (e - o) * quote.eC(s / r) }, gT: function (o, e) { return 'HTML' === o.nodeName ? -e : o.getBoundingClientRect().top + e }, XML: function (a, b, f) { var c; c = window.XMLHttpRequest ? new XMLHttpRequest : window.ActiveXObject && (new ActiveXObject('Microsoft.XMLHTTP')); 'undefined' != typeof a ? c.open('POST', b) : c.open('GET', b, true); c.responseType = 'document'; c.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); c.send('undefined' != typeof a ? a : ''); c.onreadystatechange = function () { this.readyState == 4 && this.status == 200 && (f(this)); }; }};
document.addEventListener('DOMContentLoaded', function () {
/\/?t\d+.*/.test(window.location.pathname) && document.getElementById('logout') && quote.init();
});
Or add it extra?
Re: Message background issue in quates
Just add my script and try quote one post with that tag
Ch@lo Valdez- Forumember
- Posts : 138
Reputation : 50
Language : spanish
Re: Message background issue in quates
Well that did not work. Just adds
and no actual quot is done.
|
Re: Message background issue in quates
Hi,
The code from the tutorial adds the postbg part to posts with background, causing trouble when quoting. Placing this js code on all pages should solve the issue:
The code from the tutorial adds the postbg part to posts with background, causing trouble when quoting. Placing this js code on all pages should solve the issue:
- Code:
$(function(){
if(/mode=quote/.test(location.search)){
var area=$("textarea");
if(area){
area.val(area.val().replace(/\[postbg=.+\]/, ""));
}
}
})
Guest- Guest
Re: Message background issue in quates
Wolfuryo wrote:Hi,
The code from the tutorial adds the postbg part to posts with background, causing trouble when quoting. Placing this js code on all pages should solve the issue:
- Code:
$(function(){
if(/mode=quote/.test(location.search)){
var area=$("textarea");
if(area){
area.val(area.val().replace(/\[postbg=.+\]/, ""));
}
}
})
Ah, see what you did here. The problem is I think it removes too much.
For example if the quote is:
|
Then it prints:
|
Maybe would be easier specifying exactly the image URL?
(they are static so to say. Not likely that will change anytime soon.)
EDIT: so I resolved it myself lol
Just added in the code PNG:
|
Re: Message background issue in quates
Probably yes. I don't know how multi quotes work, but you should try this code:
About the first code:you should write the regular expression this way:
it's png\, not \png.
- Code:
$(function(){
if(/mode=quote/.test(location.search)){
var area=$("textarea");
if(area){
area.val(area.val().replace(/\[postbg=.+png\]/g, ""));
}
}
})
About the first code:you should write the regular expression this way:
|
Guest- Guest
Re: Message background issue in quates
Well the multi-quotes work like this:
- select multi-quote button next to each post you want to quote
- select button "ADD REPLY"
Therefor in the top, the mode is no longer quote, but it's actually "mode=reply"
I guess this probably is not possible with multi-quotes. I could live with that, no prob.
- select multi-quote button next to each post you want to quote
- select button "ADD REPLY"
Therefor in the top, the mode is no longer quote, but it's actually "mode=reply"
I guess this probably is not possible with multi-quotes. I could live with that, no prob.
Re: Message background issue in quates
This should solve the multiquotes:
- Code:
$(function(){
if(/mode=quote|mode=reply/.test(location.search)){
var area=$("textarea");
if(area){
area.val(area.val().replace(/\[postbg=.+png\]/g, ""));
}
}
})
Guest- Guest
Re: Message background issue in quates
For some reason I thought, that adding mode=reply would ruin the initial BG code.
Now remembered how it works. Silly me.
Thank you lots, for making my crazy ideas work! SOLVED
You are THE mind, the code, the script. I bow before you.
@Ange Tuteur you should update the tutorial with Wolfuryo code
Now remembered how it works. Silly me.
Thank you lots, for making my crazy ideas work! SOLVED
You are THE mind, the code, the script. I bow before you.
@Ange Tuteur you should update the tutorial with Wolfuryo code
Re: Message background issue in quates
Problem solved & topic archived.
|
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Similar topics
» Private Message Issue
» Private message Layout issue
» Homepage Message Profile Issue
» Private Message Image Issue
» Thanked Message - Code issue
» Private message Layout issue
» Homepage Message Profile Issue
» Private Message Image Issue
» Thanked Message - Code issue
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum