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

    Topic Title Colour in Search List

    SophieDophs
    SophieDophs
    Forumember


    Female Posts : 375
    Reputation : 3
    Language : English

    In progress Topic Title Colour in Search List

    Post by SophieDophs March 1st 2015, 4:26 pm

    Hi guys,

    How do I get the Topic Titles in the 'latest posts' and 'today's topics' lists to show up in their respective colours?

    For example, I have set topics within a particular forum to show up with blue titles.  And in that forum they are displayed correctly. (i.e. blue - see below)

    Topic Title Colour in Search List Topic_11


    But in the latest/today's topics Lists, they just show up the same colour as every other topic. (i.e. purple - see below)

    Topic Title Colour in Search List Topic_10

    What I want is for certain forums to have their topic titles in specific colours and for these colours to show up in the topic titles in the search lists, so they are not all the same colour.  This will be much more interesting to the eye and will help members.

    Is this possible?

    Thanks.
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    In progress Re: Topic Title Colour in Search List

    Post by Ange Tuteur March 1st 2015, 10:00 pm

    Hi @SophieDophs,

    Which method are you using the color the topic titles, is it the default color list or JavaScript ? It's most likely possible to change the color of titles on the search page by checking the forum they're in. ( it's right below the topic title )

    Go to Modules > JavaScript codes management and create a new script

    Placement : In all the pages
    Code:
    /\/search/.test(window.location.pathname) && $(function() {
      var forums = {
        f43 : '#FF0000',
        f45 : '#00FF00',
        f46 : '#0000FF'
      }, r = $('.dterm'), i = 0, j = r.length, k;
      for (; i<j; i++) for (k in forums) r[i].lastChild.lastChild.href.match(/f\d+/)[0] == k && (r[i].getElementsByTagName('DIV')[0].firstChild.firstChild.style.color = forums[k]);
    });

    You'll see the following in the script above.
    Code:
      var forums = {
        f43 : '#FF0000',
        f45 : '#00FF00',
        f46 : '#0000FF'
      },

    f43 is the ID of the forum and '# FF0000' is the color I've associated that forum with. Each forum should be separated by a comma, like in the example above. To find the forum ID, simply go to the forum and copy the ID from your addressbar :
    Topic Title Colour in Search List Captu131

    You can replace the example forum IDs and colors with your own, and add to the list as well.

      Current date/time is November 11th 2024, 10:59 pm