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

    Add more links to this script

    Mati
    Mati
    Active Poster


    Posts : 1932
    Reputation : 333
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Add more links to this script

    Post by Mati Fri Sep 04, 2015 5:48 pm

    Is it possible to add more links to this script...

    Code:
    jQuery(function() {
    if (document.location.href.indexOf('/f9-graphics-design') > -1 ) {
    jQuery('.page-title').after('<div class="rules"><strong><span style="font-size: 18px;"><i class="fa fa-exclamation-triangle"></i> Forum rules</span></strong>
    <br>
    Hello and welcome to the community.</div>');
    }
    });


    Last edited by Mati on Sat Sep 05, 2015 3:02 pm; edited 1 time in total
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Add more links to this script

    Post by Ange Tuteur Fri Sep 04, 2015 7:03 pm

    Hi @Mati,

    You mean for the condition, correct ? If so you can use regular expressions like this :
    Code:
    jQuery(function() {
      if (/\/f(?:1|2|9)-/.test(window.location.href)) {
        jQuery('.page-title').after('<div class="rules"><strong><span style="font-size: 18px;"><i class="fa fa-exclamation-triangle"></i> Forum rules</span></strong><br>Hello and welcome to the community.</div>');
      }
    });

    The forum ids are where you see "1|2|9" separate each individual forum id by a bar. ( | )
    Mati
    Mati
    Active Poster


    Posts : 1932
    Reputation : 333
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Re: Add more links to this script

    Post by Mati Fri Sep 04, 2015 7:51 pm

    Hi @Ange Tuteur

    I'm not sure if I explained good but here is what I want to do

    In the Forum Directory "Promote Your Forum" category I have 10 forums

    And I want to add this code for each of them without adding the links

    Code:
    jQuery(function() {
    if (document.location.href.indexOf('/f10-computers-internet') > -1 ) {
    jQuery('.page-title').after('<div class="rules"><strong><span style="font-size: 18px;"><i class="fa fa-exclamation-triangle"></i> Forum rules</span></strong>
    <br>
     Welcome to Forum Directory! We want to thank you for wanting to submit your forum into our Forum Directory. \n We want to provide you with the best service possible, \n so if you have any suggestions, \n we will be glad to hear them.
    <br>
    <br>
    <strong><span style="font-size: 18px;"><i class="fa fa-exclamation-circle"></i> Guidelines:</span></strong><br>
    Before posting a new topic for our Forum Directory, \n we ask that you read through these few guidelines we have.
    <br>
    You are required to have minimum of 2 posts.
    <br>
    You may bump your topic every 12 hours.
    <br>
    We ask that you use the template when you open a new topic.
    </div>');
    }
    });

    Forum link -> http://forumdirectory.forumotion.net/
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Add more links to this script

    Post by Ange Tuteur Fri Sep 04, 2015 8:29 pm

    Are you going to be using the same message for each section, or will they be different. Let me know Smile
    Mati
    Mati
    Active Poster


    Posts : 1932
    Reputation : 333
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Re: Add more links to this script

    Post by Mati Fri Sep 04, 2015 9:06 pm

    The same message for each section. Very Happy
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Add more links to this script

    Post by Ange Tuteur Fri Sep 04, 2015 9:13 pm

    Oh, in that case, you should be able to use the solution in this message. Just replace the after() content with whatever you want in those sections, and of course change the forum IDs to the ones you want it in. Smile
    Mati
    Mati
    Active Poster


    Posts : 1932
    Reputation : 333
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Re: Add more links to this script

    Post by Mati Sat Sep 05, 2015 2:39 pm

    I got that @Ange Tuteur and how about this code?

    Code:
    $(function() {
        if (location.pathname == '/post' && location.search == '?f=10&mode=newtopic') {
          $('#text_editor_textarea').val('[b]Field 1[/b]:\n[b]Field 2[/b]: Don\'t fill this field in\n[b]Field 3[/b]:');
        }
    });
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Add more links to this script

    Post by Ange Tuteur Sat Sep 05, 2015 2:48 pm

    We should be able to do the same thing, except we'll only check for a match in location.search. ^^
    Code:
    $(function() {
      if (/f=(?:10|11|12)&mode=newtopic/.test(window.location.search)) {
        $('#text_editor_textarea').val('[b]Field 1[/b]:\n[b]Field 2[/b]: Don\'t fill this field in\n[b]Field 3[/b]:');
      }
    });

    10|11|12 is the same as the last script; the ids of the forums. Smile
    Mati
    Mati
    Active Poster


    Posts : 1932
    Reputation : 333
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Re: Add more links to this script

    Post by Mati Sat Sep 05, 2015 3:02 pm

    Thanks a lot mate this can be locked now. Smile
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Add more links to this script

    Post by Ange Tuteur Sat Sep 05, 2015 3:16 pm

    You're welcome ^^

    Topic archived

    Have a good weekend. Very Happy

      Current date/time is Thu Nov 14, 2024 8:00 pm