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.
The forum of the forums
4 posters

    How to get the "Quote, code, spoiler, hide" buttons working like Forumotion?

    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    In progress How to get the "Quote, code, spoiler, hide" buttons working like Forumotion?

    Post by AlexisMcDevin Sat Dec 27, 2014 8:39 am

    Tutorial topic: Select Content Button

    I searched out the tutorial topic to make the select content button. I tried with this however, it did not work as per what I want.

    How to get the "Quote, code, spoiler, hide" buttons working like Forumotion? 10866014_687139284733350_2005778788151956925_o

    As you see, select content button of "Code" show up in black and upper-cases. The border lines do not look very well.

    Quote frame also like below comment.

    The Spoiler is so terrible. All in upper-cases.

    So can you give me some codes to make "Quote, code, spoiler, hide" button will be exactly like below image?

    Myforum is phpbb3

    Link to my forum you can find in my profile.

    How to get the "Quote, code, spoiler, hide" buttons working like Forumotion? 10873506_687139251400020_2177890638595467446_o

    Thank you very much!
    Alex.


    Last edited by AlexisMcDevin on Mon Dec 29, 2014 4:03 pm; edited 1 time in total
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    In progress Re: How to get the "Quote, code, spoiler, hide" buttons working like Forumotion?

    Post by SLGray Sat Dec 27, 2014 3:16 pm

    The select content button should not appear for quotes and spoilers.



    How to get the "Quote, code, spoiler, hide" buttons working like Forumotion? Slgray10

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


    Male Posts : 134
    Reputation : 5
    Language : English

    In progress Re: How to get the "Quote, code, spoiler, hide" buttons working like Forumotion?

    Post by AlexisMcDevin Sat Dec 27, 2014 3:47 pm

    SLGray wrote:The select content button should not appear for quotes and spoilers.

    Yes, I know that. I attached the below image in my first post to talk to you all, that is what I want.
    Since, I follow tutorial but it did not work on my forum.
    So, can you help me?
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

    In progress Re: How to get the "Quote, code, spoiler, hide" buttons working like Forumotion?

    Post by _Twisted_Mods_ Sat Dec 27, 2014 8:39 pm

    here the code for spoiler

    Code:
          function selectCode(a){a=$(a).closest("dl").find(".spoiler_content")[0];if(window.getSelection){var c=window.getSelection();if(c.setBaseAndExtent)c.setBaseAndExtent(a,0,a,a.innerText.length-1);else{window.opera&&a.innerHTML.substring(a.innerHTML.length-4)=="<BR>"&&(a.innerHTML+=" ");var b=document.createRange();b.selectNodeContents(a);c.removeAllRanges();c.addRange(b)}}else document.getSelection?(c=document.getSelection(),b=document.createRange(),b.selectNodeContents(a),
                c.removeAllRanges(),c.addRange(b)):document.selection&&(b=document.body.createTextRange(),b.moveToElementText(a),b.select())}
               
              $(function(){
                    $("dl.codebox>dd>.spoiler_content").closest("dl").find('dt').append('<span onClick="selectCode(this)" class="selectCode">Select Content</span>');
              });
    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    In progress Re: How to get the "Quote, code, spoiler, hide" buttons working like Forumotion?

    Post by AlexisMcDevin Sun Dec 28, 2014 2:53 am

    _Twisted_Mods_ wrote:here the code for spoiler

    Code:
          function selectCode(a){a=$(a).closest("dl").find(".spoiler_content")[0];if(window.getSelection){var c=window.getSelection();if(c.setBaseAndExtent)c.setBaseAndExtent(a,0,a,a.innerText.length-1);else{window.opera&&a.innerHTML.substring(a.innerHTML.length-4)=="<BR>"&&(a.innerHTML+=" ");var b=document.createRange();b.selectNodeContents(a);c.removeAllRanges();c.addRange(b)}}else document.getSelection?(c=document.getSelection(),b=document.createRange(),b.selectNodeContents(a),
                c.removeAllRanges(),c.addRange(b)):document.selection&&(b=document.body.createTextRange(),b.moveToElementText(a),b.select())}
               
              $(function(){
                    $("dl.codebox>dd>.spoiler_content").closest("dl").find('dt').append('<span onClick="selectCode(this)" class="selectCode">Select Content</span>');
              });

    Below is the image after applied your code. It seems to be nothing change.
    How to get the "Quote, code, spoiler, hide" buttons working like Forumotion? 10730154_687680518012560_1860256827892210871_n
    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    In progress Re: How to get the "Quote, code, spoiler, hide" buttons working like Forumotion?

    Post by AlexisMcDevin Mon Dec 29, 2014 11:55 am

    Hi @Ange Tuteur!

    I need your help!
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    In progress Re: How to get the "Quote, code, spoiler, hide" buttons working like Forumotion?

    Post by Ange Tuteur Mon Dec 29, 2014 2:02 pm

    Change your script to :
    Code:
    function selectCode(a){a=$(a).closest("dl, blockquote").find(".cont_code,code, .hidden, div")[0];if(window.getSelection){var c=window.getSelection();if(c.setBaseAndExtent)c.setBaseAndExtent(a,0,a,a.innerText.length-1);else{window.opera&&a.innerHTML.substring(a.innerHTML.length-4)=="<BR>"&&(a.innerHTML+=" ");var b=document.createRange();b.selectNodeContents(a);c.removeAllRanges();c.addRange(b)}}else document.getSelection?(c=document.getSelection(),b=document.createRange(),b.selectNodeContents(a),
    c.removeAllRanges(),c.addRange(b)):document.selection&&(b=document.body.createTextRange(),b.moveToElementText(a),b.select())}
           
    $(function(){
      var html = '<span onClick="selectCode(this)" class="selectCode">Select Content</span>';
      $("dl.codebox > dd, dl.codebox > dd").closest("dl").find('dt').append(html);
      $('blockquote').prepend(html);
    });
    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    In progress Re: How to get the "Quote, code, spoiler, hide" buttons working like Forumotion?

    Post by AlexisMcDevin Mon Dec 29, 2014 3:56 pm

    Hi @Ange Tuteur,

    I am using these codes below:
    - CSS:
    Code:
    .selectCode { float:right; text-transform: uppercase; cursor:pointer; }
    div.cont_code { clear: right; }

    - Javascript Codes:
    Code:
    function selectCode(a){a=$(a).closest("dl, blockquote").find(".cont_code,code, .hidden, div")[0];if(window.getSelection){var c=window.getSelection();if(c.setBaseAndExtent)c.setBaseAndExtent(a,0,a,a.innerText.length-1);else{window.opera&&a.innerHTML.substring(a.innerHTML.length-4)=="<BR>"&&(a.innerHTML+=" ");var b=document.createRange();b.selectNodeContents(a);c.removeAllRanges();c.addRange(b)}}else document.getSelection?(c=document.getSelection(),b=document.createRange(),b.selectNodeContents(a),
    c.removeAllRanges(),c.addRange(b)):document.selection&&(b=document.body.createTextRange(),b.moveToElementText(a),b.select())}
     Â       
    $(function(){
     Â var html = '<span onClick="selectCode(this)" class="selectCode">Select Content</span>';
     Â $("dl.codebox > dd, dl.codebox > dd").closest("dl").find('dt').append(html);
     Â $('blockquote').prepend(html);
    });

    And here is the testing result:
    How to get the "Quote, code, spoiler, hide" buttons working like Forumotion? 10801986_688893911224554_7655755863196941904_n
    How to get the "Quote, code, spoiler, hide" buttons working like Forumotion? 10906002_688893927891219_7650938134887051437_n

    Can you review and let me know what wrong? How to fix these?

      Current date/time is Sun Sep 22, 2024 10:26 pm