A script for all closed topics Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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

    A script for all closed topics

    Mati
    Mati
    Active Poster


    Posts : 1928
    Reputation : 331
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved A script for all closed topics

    Post by Mati Tue 29 Sep - 15:24

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


    Last edited by Mati on Tue 29 Sep - 17:34; 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 Tue 29 Sep - 15:52

    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 : 1928
    Reputation : 331
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Re: A script for all closed topics

    Post by Mati Tue 29 Sep - 17:12

    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 Tue 29 Sep - 17:29

    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 : 1928
    Reputation : 331
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Re: A script for all closed topics

    Post by Mati Tue 29 Sep - 17:36

    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 Tue 29 Sep - 17:38

    You're welcome Smile

    Topic archived

    Have a good day. ^^