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
3 posters

    Select Content overriding Add a form

    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    Solved Select Content overriding Add a form

    Post by Pizza Boi April 1st 2014, 7:20 pm

    Hi Very Happy

    Well, I'm really sorry for asking a lot of questions recently about scripting but I really don't know how to work around this one x.x... I've managed to fix some other scripts but not these two.

    Basically, I want these 2 scripts found here and here to work together and not cancel each other out.

    You see, I tried other things as well as changing some functions here and there but I can't manage to make it work x.x.

    Would it be possible to have those work together? Also, in the first link, would changing this portion:
    Code:
    mode=newtopic
    to something like "reply" or something may make it work that instead of posting a new topic, it can be in a reply?

    Regards,
    Pizza Boi


    Last edited by Pizza Boi on April 1st 2014, 8:49 pm; edited 1 time in total
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Select Content overriding Add a form

    Post by Ange Tuteur April 1st 2014, 7:54 pm

    Hello,

    They should work fine together since both of these are installed on the support. Post the exact code here you're trying to use. (the form)
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    Solved Re: Select Content overriding Add a form

    Post by Pizza Boi April 1st 2014, 8:11 pm

    Hi Very Happy

    This is for the select 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 Content </a>');
     Â   });

    This is for the form:

    Code:
    $(function() {
     Â   if (location.pathname == '/post' && location.search == '?f=25&mode=newtopic') {
     Â      $('#text_editor_textarea').val('FORM');
     Â   }
    });

    http://ygoda.forumtl.com/ my forum URL.

    Edit: Sorry I forgot I adjusted the value:

    Code:
    $(function() {
        if (location.pathname == '/post' && location.search == '?f=25&mode=newtopic') {
          $('#text_editor_textarea').val('[b]In-game name[/b]:\n[b]Item bought[/b]:\n[b]Paid[/b]:');
        }
    });

    Regards,
    Pizza Boi
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Select Content overriding Add a form

    Post by Ange Tuteur April 1st 2014, 8:22 pm

    I've tested both together and they're working fine. Do you have any other scripts on your forum ? If you do, I'd try disabling them one by one to see which is causing the two not to work.

    Select Content overriding Add a form Captu447
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    Solved Re: Select Content overriding Add a form

    Post by Pizza Boi April 1st 2014, 8:44 pm

    Hi Very Happy

    It worked! I actually had to re-do and re-paste all scripts... made a mistake at one of them and declared a wrong variable.

    Thanks, Ange!

    Regards,
    Pizza Boi
    SLGray
    SLGray
    Administrator
    Administrator


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

    Solved Re: Select Content overriding Add a form

    Post by SLGray April 1st 2014, 8:51 pm

    Problem solved & topic archived.



    Select Content overriding Add a form Slgray10

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

      Current date/time is September 23rd 2024, 7:21 am