MyBB Community Forums

Full Version: [Free] Real time unread post count chrome extension
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[Image: c2cabbd435e08f8f973756b390f843c8.png?1343968695]
[Image: btn_donateCC_LG.gif]
Hello MyBB community,
for the past few days, I've been developing a google chrome plugin that will notify me whenever there is a new post on my forum so that I can instantly reply.

I've decided to release everything to the community.


Here's how to install it:
1. Click on the[Image: bfb2080ba011bb0af7b2d7df22bf269c.png] near the top-right of google chrome.
2. Click on settings
3. Check "Developer Mode"
4. Drag "Forum Notifier.crx" into the chrome window
5. Install the plugin
6. Upload "poll.php" to your forum's root directory, this file will output the unread post count for userid #1 (which is the user who installed the forum).
7. Right click on the extension, and click on options
8. Fill out the information, an example of mine is below:
[Image: 3f86554dde2bad8c9cea8c8af0336713.png?1343969607]

If you want to test it out with my forum, fill out the details as outlined below:

Forum URL: http://shrinkonce.com/forum
Poll URL: http://shrinkonce.com/forum/poll.php
Update: 60

For the sake of testing, my forum will always say that there are 5 unread posts.

Feel free to post below what you think of the extension I've created.

Virus scan https://www.virustotal.com/file/5259949a...343971041/
Seems like a nice idea, do you plan to write some Opera plugin?
Thank you.
I don't intend on doing so, however if you wish, it shouldn't be all too hard to program an opera or firefox extension considering the fact that this extension is just a little javascript,ajax, and PHP
function get_unread()
                {
                        //get unread threat count
                        var xmlhttp;
  if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
  else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {

                var unread = xmlhttp.responseText;
                if(unread=='notloggedin')
                {
                        var notification = webkitNotifications.                                                 createNotification(
  'images/icon.png',  // icon url - can be relative
  'ShrinkOnce.com',  // notification title
  'Please login to the main site in order for auto notifications to work'  // notification body text
  );
  notification.show();
                        
                }
                else
                {
                if(unread > 0)
                {
                var notification = webkitNotifications.                                                 createNotification(
  'images/icon.png',  // icon url - can be relative
  'ShrinkOnce.com Forum',  // notification title
  'There are ' + unread + ' forum post(s) which you have not read'  // notification body text
  );
  notification.show();
  
  chrome.browserAction.setBadgeText({ text: ''+ unread+'' });
  notification.onclick = function() { window.open(localStorage["forum_url"]+'/search.php?action=getnew'); notification.close();chrome.browserAction.setBadgeText({ text: '' });}
  //sleep for 5 seconds
  var ms = 5000;//5 seconds
  var dt = new Date();
		dt.setTime(dt.getTime() + ms);
		while (new Date().getTime() < dt.getTime());
		//then close the notification
		notification.close();


                }
                else
                {
                        chrome.browserAction.setBadgeText({ text:''});
                }
                        
                }
                setTimeout(get_unread,1000*localStorage["update_sec"]);
                
                
        
  }
  }
  xmlhttp.open("GET",localStorage["poll_url"],true);
  xmlhttp.send();
                        
                }
(ajax get request, conditional html 5 notifications)
I only half know PHP but javascript/ajax, well... Suppose this was not for me. Very cool nonetheless.
(2012-08-03, 07:49 AM)Omar G. Wrote: [ -> ]I only half know PHP but javascript/ajax, well... Suppose this was not for me. Very cool nonetheless.
Thank you, I really appreciate your comment.
Hopefully, if someone does find a feature like this useful, an extension will be developed for other popular browsers.