The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

bbcode

2 posters

Go down

bbcode Empty bbcode

Post by randomer433 April 18th 2011, 2:24 pm

I'm not sure quite where to put this.

But I want to add a new bbcode to the list on my forum.
One thats like a spoiler but it has a select all button on it.

how would I add this?

avatar
randomer433
New Member

Posts : 6
Reputation : 0
Language : english

Back to top Go down

bbcode Empty Re: bbcode

Post by Base April 18th 2011, 2:29 pm

Hi, for the select all button, you will need to create a new HTML page and add this for its content:

Code:
function selectCode(a)
        {
          // Get ID of code block
          var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
     
          // Not IE
          if (window.getSelection)
          {
              var s = window.getSelection();
              // Safari
              if (s.setBaseAndExtent)
              {
                s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
              }
              // Firefox and Opera
              else
              {
                // workaround for bug # 42885
                if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')
                {
                    e.innerHTML = e.innerHTML + ' ';
                }
     
                var r = document.createRange();
                r.selectNodeContents(e);
                s.removeAllRanges();
                s.addRange(r);
              }
          }
          // Some older browsers
          else if (document.getSelection)
          {
              var s = document.getSelection();
              var r = document.createRange();
              r.selectNodeContents(e);
              s.removeAllRanges();
              s.addRange(r);
          }
          // IE
          else if (document.selection)
          {
              var r = document.body.createTextRange();
              r.moveToElementText(e);
              r.select();
          }
        }
        if(text){}else{ var text = 'Selecionar todos';}
        jQuery(document).ready(function(){
          jQuery("dl.codebox dt").not("dl.spoiler > dt").html('Code: <a href="#" onclick="selectCode(this); return false;" title="Select all the content" class="code-a">Select All</a>');
        });

Then, place this code in your site description:

Code:
<script src="/h#-" type="text/javascript"></script>

Replace the # sign with the page ID and the name of the page follows after the hyphen.

Smile

Regards,

Base
Base
Base
Forumaster

Male Posts : 10386
Reputation : 1695
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

bbcode Empty Re: bbcode

Post by randomer433 April 18th 2011, 6:08 pm

not quite sure that worked

I created a new html thing. and out in that code.
then in the sites discription I put in that code and I replaced the # with the forums link and then I wasn't sure what to put after the -
avatar
randomer433
New Member

Posts : 6
Reputation : 0
Language : english

Back to top Go down

bbcode Empty Re: bbcode

Post by Base April 18th 2011, 6:30 pm

After the hyphen ( - sign ), you will need to put the name of your HTML page. For example:

Code:
/h9001-select-code
Base
Base
Forumaster

Male Posts : 10386
Reputation : 1695
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

bbcode Empty Re: bbcode

Post by randomer433 April 18th 2011, 6:35 pm

i'll try that

thanks

~R433


EDIT:
Thats not doing anything.
avatar
randomer433
New Member

Posts : 6
Reputation : 0
Language : english

Back to top Go down

bbcode Empty Re: bbcode

Post by randomer433 April 18th 2011, 6:54 pm

I tried again.

Does my html name have to be as complicated as yours
avatar
randomer433
New Member

Posts : 6
Reputation : 0
Language : english

Back to top Go down

bbcode Empty Re: bbcode

Post by Base April 18th 2011, 7:35 pm

Posting consecutively is not tolerated unless separated by 24 hours since the last post. In future, please use the edit button.

It's what you want. Just make sure that you type in the code correctly. Smile
Base
Base
Forumaster

Male Posts : 10386
Reputation : 1695
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

bbcode Empty Re: bbcode

Post by randomer433 April 19th 2011, 3:15 pm

i'll try yet again
avatar
randomer433
New Member

Posts : 6
Reputation : 0
Language : english

Back to top Go down

Back to top

- Similar topics

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