Python Forum
modifying counter tab
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
modifying counter tab
#1
My goal is to create a user group in which any user can opt in and out of. This is a secondary user group. When in this usergroup you see the tab counter (1) Python Forum for unread posts. If your not in the user group, then you only see the title Python Forum. This only occurs when your on the main index page (not in a thread)

The PHP file returning the content is here.

The javascript function is:
var unreadPosts = {
 
    timeout:    false,
    interval:   10,
    enable:     false,
    fid:        0,
    hide:       false,
 
    updateCounter: function() {
        if (!unreadPosts.enable) {
            return;
        }
 
        $.get( "xmlhttp.php?action=unreadPosts_getUnreads&fid" + unreadPosts.fid, function( data ) {
            $("#unreadCounter").replaceWith(data);
 
        var d = data.split('<!--')[2] //strip non-counter
        var d = d.split('-->')[1] //strip to only counter
        var d = d.slice(3, -2); //remove extra paren
        var title = document.title;
       // var title = "Python Forum";
        //if title.startsWtih('('){
        //    var title = title.split(')')[1] //remove extra num if there is one
        //}
          
 
        //var title = title.split(" ").splice(1,-2)
 
        if (d != "0"){
            var newTitle = '(' + d + ') ' + "Python Forum";
            document.title = newTitle;
        }
        else{
            document.title = "Python Forum";
        }
 
 
        });
        if (unreadPosts.timeout) clearTimeout(unreadPosts.timeout);
        unreadPosts.timeout = setTimeout('unreadPosts.updateCounter()', unreadPosts.interval * 1000);
    },
};
Does anyone know how to include this?
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  modifying tutorials metulburr 22 16,124 Oct-10-2016, 12:46 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020