Skip to main content
Topic: SP Shoutbox BBC-Buttons (Read 4661 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

SP Shoutbox BBC-Buttons

Hello!

In Simple Portal the BBC-Buttons in Shoutbox don't work, I cannot use them?
They also look a bit funny, ;)  like the old ones from SMF?
Their backgrounds disappear, if I touch them and they don't come back.

Re: SP Shoutbox BBC-Buttons

Reply #1

Looks like SP uses the surroundText function that was present in SMF probably for the editor.
I guess simply replicate the function would do the trick. What do you think @Spuds?
Bugs creator.
Features destroyer.
Template killer.

Re: SP Shoutbox BBC-Buttons

Reply #2

The function is that one:
Code: [Select]
// Surrounds the selected text with text1 and text2.
function surroundText(text1, text2, oTextHandle)
{
// Can a text range be created?
if ('caretPos' in oTextHandle && 'createTextRange' in oTextHandle)
{
var caretPos = oTextHandle.caretPos, temp_length = caretPos.text.length;

caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text1 + caretPos.text + text2 + ' ' : text1 + caretPos.text + text2;

if (temp_length == 0)
{
caretPos.moveStart('character', -text2.length);
caretPos.moveEnd('character', -text2.length);
caretPos.select();
}
else
oTextHandle.focus(caretPos);
}
// Mozilla text range wrap.
else if ('selectionStart' in oTextHandle)
{
var begin = oTextHandle.value.substr(0, oTextHandle.selectionStart);
var selection = oTextHandle.value.substr(oTextHandle.selectionStart, oTextHandle.selectionEnd - oTextHandle.selectionStart);
var end = oTextHandle.value.substr(oTextHandle.selectionEnd);
var newCursorPos = oTextHandle.selectionStart;
var scrollPos = oTextHandle.scrollTop;

oTextHandle.value = begin + text1 + selection + text2 + end;

if (oTextHandle.setSelectionRange)
{
var goForward = is_opera ? text1.match(/\n/g).length : 0, goForwardAll = is_opera ? (text1 + text2).match(/\n/g).length : 0;
if (selection.length == 0)
oTextHandle.setSelectionRange(newCursorPos + text1.length + goForward, newCursorPos + text1.length + goForward);
else
oTextHandle.setSelectionRange(newCursorPos, newCursorPos + text1.length + selection.length + text2.length + goForwardAll);
oTextHandle.focus();
}
oTextHandle.scrollTop = scrollPos;
}
// Just put them on the end, then.
else
{
oTextHandle.value += text1 + text2;
oTextHandle.focus(oTextHandle.value.length - 1);
}
}

You can add it to the portal.js file in themes/default/scripts it should work.
Bugs creator.
Features destroyer.
Template killer.

Re: SP Shoutbox BBC-Buttons

Reply #3

Thank you very much, emanuele! They are working now.

But they still look like this...
Last Edit: September 15, 2014, 05:41:00 pm by Ruth

Re: SP Shoutbox BBC-Buttons

Reply #4

Ack!  I forgot to update those buttons  :-[  I'll get an update together to fix them (its going to be a couple of files that you will have to replace, its not going to be a simple "add"

Quote from: emanuele – Looks like SP uses the surroundText function that was present in SMF probably for the editor.
I guess simply replicate the function would do the trick. What do you think @Spuds?
Yup, that will take care of it, thanks!  ... I may rename it to sp_surroundText just to avoid a collision with other addons or what not.

Re: SP Shoutbox BBC-Buttons

Reply #5

Hello, Spuds!

I think, this will be a lot of work for you... ::)

For the moment, can I change the "old surround Text function" a little? I mean, that the "old backgrounds" of the BBC-Buttons are not displayed. It will be okay if it just looks like this:

Re: SP Shoutbox BBC-Buttons

Reply #6

I made the updates and uploaded a new package (see the other thread) ...

If you made portal.css changes you will need to add them back to the new portal.css which has the code for those bbc buttons, I've attached an image of what they look like now.

You can do what you are suggesting (I think there was a function in portal.js that was looking for a .gif background image, changing that to .png may work fine, but you are probably better off using the new code.

Re: SP Shoutbox BBC-Buttons

Reply #7

Thank you very much, Spuds. You are quite quick!

I think it's easier for me to install the portal again.

I will wait until the bug (?) is fixed about collapsing the shoutbox.

Re: SP Shoutbox BBC-Buttons

Reply #8

I think its fixed, at least some of it, and its now in the latest package in the download link.

Re: SP Shoutbox BBC-Buttons

Reply #9

Thank you very much, Spuds!

I installed the portal now again and created a new shoutbox.
Everything is working quite well, even the collapsing of the shoutbox in portal and forum. :)

Most of the BBC-Buttons are working, also that one for [img], but the little image on this button is missing.

Can I add this image by myself?
Last Edit: September 18, 2014, 09:46:31 am by Ruth

Re: SP Shoutbox BBC-Buttons

Reply #10

Darn ... I'm being terribly sloppy these days.

In portal.css find .shoutbox-image div and change it to =>  .shoutbox-img div

There are also a few other mistakes :(
.shoutbox-superscript div    change to =>  .shoutbox-sup div
.shoutbox-subscript div   change to =>  .shoutbox-sub div
.shoutbox-tt div   change to => .shoutbox-tele div

Re: SP Shoutbox BBC-Buttons

Reply #11

Quote from: Spuds – There are also a few other mistakes :(

Who cares?  :P  We don't need this buttons in shoutbox...  ;)

I made the changes, Spuds, thank you very much.

To use another color or font is not possible in shoutbox?
I selected this buttons, but they are not shown.

Re: SP Shoutbox BBC-Buttons

Reply #12

There are no buttons for font and size, you have to enter them manually and they will just work (have not tested that statement!) ... The reason is those buttons also require a dropdown and that's just to much for a shoutbox block.

Re: SP Shoutbox BBC-Buttons

Reply #13

I see...yes, it would be too narrow there...

Thank you for your explanation and for all your help, Spuds! :)