The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Message background issue in quates

View previous topic View next topic Go down

Solved Message background issue in quates

Post by Kami-sama on August 7th 2017, 5:36 pm

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:http://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
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Message background issue in quates

Post by SLGray on August 7th 2017, 7:28 pm

Are you manually entering that line of code?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 40461
Reputation : 2730
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Message background issue in quates

Post by Ch@lo Valdez on August 7th 2017, 8:03 pm

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();
});

avatar
Ch@lo Valdez
Forumember

Male Posts : 131
Reputation : 45
Language : spanish

Back to top Go down

Solved Re: Message background issue in quates

Post by Kami-sama on August 7th 2017, 10:12 pm

SLGray wrote:Are you manually entering that line of code?
No, the code is added by default and not visible in post creation, nor post editing.

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();
});

you mean to replace my current post BG code with your suggested one?
Or add it extra?
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Message background issue in quates

Post by Ch@lo Valdez on August 8th 2017, 4:22 am

Just add my script and try quote one post with that tag
avatar
Ch@lo Valdez
Forumember

Male Posts : 131
Reputation : 45
Language : spanish

Back to top Go down

Solved Re: Message background issue in quates

Post by Kami-sama on August 8th 2017, 11:33 am

Well that did not work. Just adds
Code:
[quote="Admin"]
and no actual quot is done.
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Message background issue in quates

Post by Justice™ on August 9th 2017, 6:46 am

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=.+\]/, ""));
}
}
})
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Message background issue in quates

Post by Kami-sama on August 9th 2017, 11:53 am

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:
Code:
[quote="TEST"][postbg=URL]text[/quote]

Then it prints:
Code:
[quote="TEST"]

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 Very Happy
Just added in the code PNG:
Code:
area.val(area.val().replace(/\[postbg=.+\png]/, ""));
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Message background issue in quates

Post by Kami-sama on August 9th 2017, 12:01 pm

Is it possible for multi-quote too?
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Message background issue in quates

Post by Justice™ on August 9th 2017, 1:05 pm

Probably yes. I don't know how multi quotes work, but you should try this code:
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:
Code:
/\[postbg=.+png\]
it's png\, not \png.
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Message background issue in quates

Post by Kami-sama on August 9th 2017, 6:41 pm

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.
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Message background issue in quates

Post by Justice™ on August 9th 2017, 6:51 pm

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, ""));
}
}
})
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Message background issue in quates

Post by Kami-sama on August 9th 2017, 7:17 pm

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 Wink
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Message background issue in quates

Post by SLGray on August 9th 2017, 8:03 pm

Problem solved & topic archived.
Please read our forum rules:  ESF General Rules


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 40461
Reputation : 2730
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum