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

    A script for all closed topics

    Mati
    Mati
    Active Poster


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

    Solved A script for all closed topics

    Post by Mati 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
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: A script for all closed topics

    Post by Ange Tuteur 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.
    Mati
    Mati
    Active Poster


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

    Solved Re: A script for all closed topics

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

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


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

    Solved Re: A script for all closed topics

    Post by Ange Tuteur 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);
      }
    });
    Mati
    Mati
    Active Poster


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

    Solved Re: A script for all closed topics

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

    Thank you very much! Smile
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: A script for all closed topics

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

    You're welcome Smile

    Topic archived

    Have a good day. ^^

      Current date/time is November 11th 2024, 6:31 pm