The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Add more links to this script

View previous topic View next topic Go down

Solved Add more links to this script

Post by Mati on September 4th 2015, 6: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 September 5th 2015, 4:02 pm; edited 1 time in total

Mati
Active Poster

Posts : 1884
Reputation : 283
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://footballforums.forumotion.net/

Back to top Go down

Solved Re: Add more links to this script

Post by Ange Tuteur on September 4th 2015, 8: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. ( | )

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Add more links to this script

Post by Mati on September 4th 2015, 8: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/

Mati
Active Poster

Posts : 1884
Reputation : 283
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://footballforums.forumotion.net/

Back to top Go down

Solved Re: Add more links to this script

Post by Ange Tuteur on September 4th 2015, 9:29 pm

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

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Add more links to this script

Post by Mati on September 4th 2015, 10:06 pm

The same message for each section. Very Happy

Mati
Active Poster

Posts : 1884
Reputation : 283
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://footballforums.forumotion.net/

Back to top Go down

Solved Re: Add more links to this script

Post by Ange Tuteur on September 4th 2015, 10: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

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Add more links to this script

Post by Mati on September 5th 2015, 3: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]:');
    }
});

Mati
Active Poster

Posts : 1884
Reputation : 283
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://footballforums.forumotion.net/

Back to top Go down

Solved Re: Add more links to this script

Post by Ange Tuteur on September 5th 2015, 3: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

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Add more links to this script

Post by Mati on September 5th 2015, 4:02 pm

Thanks a lot mate this can be locked now. Smile

Mati
Active Poster

Posts : 1884
Reputation : 283
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://footballforums.forumotion.net/

Back to top Go down

Solved Re: Add more links to this script

Post by Ange Tuteur on September 5th 2015, 4:16 pm

You're welcome ^^

Topic archived

Have a good weekend. Very Happy

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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