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.

A script for all closed topics

View previous topic View next topic Go down

Solved A script for all closed topics

Post by Mati on September 29th 2015, 3:24 pm

I want a script to wright on all closed topics ex: "This topic is now closed to further replies."


Last edited by Mati on September 29th 2015, 5:34 pm; edited 1 time in total

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: A script for all closed topics

Post by Ange Tuteur on September 29th 2015, 3:52 pm

Hi @Mati,

Try the following :
Go to Modules > JS codes management > Create a new script

Placement : In the topics
Code:
$(function() {
  var locked = 'http://i21.servimg.com/u/f21/16/89/96/68/locked10.png',
      message = 'This topic is now closed to further replies.',
      reply = $('.i_reply')[0],
      main = document.getElementById('main-content'),
      node;

  if (reply && reply.src == locked) {
    node = document.createElement('DIV');
    node.className = 'notice_locked';
    node.innerHTML = message;
    main && main.insertBefore(node, main.firstChild);
  }
});

There's various data at the top that you can modify :

locked : The URL of your locked image
message : The message you want to display

To style the notice you can use the .notice_locked classname.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: A script for all closed topics

Post by Mati on September 29th 2015, 5:12 pm

Works perfect but is it possible to have it above quick reply box.

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: A script for all closed topics

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

Sure ! Smile

Replace the script with this :
Code:
$(function() {
  var locked = 'http://i21.servimg.com/u/f21/16/89/96/68/locked10.png',
      message = 'This topic is now closed to further replies.',
      reply = $('.i_reply')[0],
      main = document.getElementById('main-content'),
      quick = document.anchors.quickreply,
      node;

  if (reply && reply.src == locked) {
    node = document.createElement('DIV');
    node.className = 'notice_locked';
    node.innerHTML = message;
    if (main && quick) main.insertBefore(node, quick);
  }
});

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: A script for all closed topics

Post by Mati on September 29th 2015, 5:36 pm

Thank you very much! Smile

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: A script for all closed topics

Post by Ange Tuteur on September 29th 2015, 5:38 pm

You're welcome Smile

Topic archived

Have a good day. ^^

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
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