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.

Select Content overriding Add a form

3 posters

Go down

Solved Select Content overriding Add a form

Post by Pizza Boi Tue Apr 01 2014, 17:20

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 Tue Apr 01 2014, 18:49; edited 1 time in total
Pizza Boi
Pizza Boi
Hyperactive

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

Back to top Go down

Solved Re: Select Content overriding Add a form

Post by Ange Tuteur Tue Apr 01 2014, 17:54

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)
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Select Content overriding Add a form

Post by Pizza Boi Tue Apr 01 2014, 18:11

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
Pizza Boi
Pizza Boi
Hyperactive

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

Back to top Go down

Solved Re: Select Content overriding Add a form

Post by Ange Tuteur Tue Apr 01 2014, 18:22

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
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Select Content overriding Add a form

Post by Pizza Boi Tue Apr 01 2014, 18:44

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
Pizza Boi
Pizza Boi
Hyperactive

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

Back to top Go down

Solved Re: Select Content overriding Add a form

Post by SLGray Tue Apr 01 2014, 18:51

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top


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