Facebook Twitter Pinterest Share

vBulletin 3.X Add-ons & Template Modifications All the latest vBulletin 3.X Add-ons & Template Modifications.


New Thread  Post Reply
Bootsum's Avatar
Bootsum : Newbie +
Bootsum is on a distinguished road
offline Joined: Nov 2007 Posts: 5 Thanked: 1
  #1  
Thread Starter Unread 01-16-08
Ajax notification of a new personal message

Please press "thanks" button if you like this release.
"Thanks" is a way to encourage me to share more.


A small mod that puts a flashing envelope in the top right corner of your screen when you get a new personal message, even if youre sitting idle. You dont have to open / reload any pages to see the notification

My default, it checks once per minute but its configurable in the javascript

PLEASE - Read the instructions, anything in there that is asked here will be ignored or simply a RTFM reply.

Ive tried it with FF2 / IE6 and Opera 9.21. Ive tried it on two forums running 3.6.5 but it should work on 3.6.0-3.6.7

Edit footer template, add this to the very bottom
     <if condition="$bbuserinfo[userid] > 0">
<if condition="$vboptions['ajaxchecknewpmactive']">
<script>
        sessionurl = '$session[sessionurl]';
        checkNewPM()
</script>

<if condition="$vboptions[ajaxchecknewpm_position]=='F'">
<div id="ajaxnewpmdiv" style="
    position:absolute;
    display:none;
    width:32px;height:32px;left:0px;top:0px;
    padding:0px;background:transparent;
    border:0px solid #ffffff"><a href="private.php?$session[sessionurl_q]"><img src="images/newpm.gif" alt="You have a new PM" border="0"></a></div>

<script type="text/javascript"><!--
/* Script by: www.jtricks.com
 * Version: 20060303
 * Latest version:
 * www.jtricks.com/javascript/navigation/floating.html
 */
var target_x = -60;
var target_y = 12;

var has_inner = typeof(window.innerWidth) == 'number';
var has_element = document.documentElement && document.documentElement.clientWidth;

var fm_id='ajaxnewpmdiv';
var floating_menu =
    document.getElementById
    ? document.getElementById(fm_id)
    : document.all
      ? document.all[fm_id]
      : document.layers[fm_id];

var fm_shift_x, fm_shift_y, fm_next_x, fm_next_y;

function move_menu()
{
    if (document.layers)
    {
        floating_menu.left = fm_next_x;
        floating_menu.top = fm_next_y;
    }
    else
    {
        floating_menu.style.left = fm_next_x + 'px';
        floating_menu.style.top = fm_next_y + 'px';
    }
}

function compute_shifts()
{
    fm_shift_x = has_inner
        ? pageXOffset
        : has_element
          ? document.documentElement.scrollLeft
          : document.body.scrollLeft;
    if (target_x < 0)
        fm_shift_x += has_inner
            ? window.innerWidth
            : has_element
              ? document.documentElement.clientWidth
              : document.body.clientWidth;

    fm_shift_y = has_inner
        ? pageYOffset
        : has_element
          ? document.documentElement.scrollTop
          : document.body.scrollTop;
    if (target_y < 0)
        fm_shift_y += has_inner
            ? window.innerHeight
            : has_element
              ? document.documentElement.clientHeight
              : document.body.clientHeight;
}

function float_menu()
{
    var step_x, step_y;

    compute_shifts();

    step_x = (fm_shift_x + target_x - fm_next_x) ;
    if (Math.abs(step_x) < .5)
        step_x = fm_shift_x + target_x - fm_next_x;

    step_y = (fm_shift_y + target_y - fm_next_y) ;
    if (Math.abs(step_y) < .5)
        step_y = fm_shift_y + target_y - fm_next_y;

    if (Math.abs(step_x) > 0 ||
        Math.abs(step_y) > 0)
    {
        fm_next_x += step_x;
        fm_next_y += step_y;
        move_menu();
    }

    setTimeout('float_menu()', 20);
};

compute_shifts();
if (document.layers)
{
    // Netscape 4 cannot perform init move
    // when the page loads.
    fm_next_x = 0;
    fm_next_y = 0;
}
else
{
    fm_next_x = fm_shift_x + target_x;
    fm_next_y = fm_shift_y + target_y;
    move_menu();
}
float_menu();
//--></script>
</if>
</if>
</if>
Edit headerinclude and add this to the bottom

      <script type="text/javascript" src="clientscript/vbulletin_ajax_checknewpm.js"></script> 
Edit template navbar
Find this
HTML Code:
<strong><phrase 1="$vbphrase[pmpercent_nav_compiled]">$vbphrase[your_pm_box_is_x_full]</phrase></strong></if>
</div>
</td>
And below that, add this
     [COLOR=#ff0000]<if condition=[COLOR=#0000ff]"$vboptions[ajaxchecknewpm_position]=='N'"[/COLOR]>[/COLOR]
[COLOR=#008080]<td class=[COLOR=#0000ff]"alt2"[/COLOR] valign=[COLOR=#0000ff]"top"[/COLOR] nowrap=[COLOR=#0000ff]"nowrap"[/COLOR]>[/COLOR][COLOR=#000080]<div id=[COLOR=#0000ff]"ajaxnewpmdiv"[/COLOR] style=[COLOR=#0000ff]"
    display:none;
    width:32px;height:32px;left:0px;top:0px;
    padding:0px;background:transparent;
    border:0px solid #ffffff"[/COLOR]>[/COLOR][COLOR=#008000]<a href=[COLOR=#0000ff]"private.php?$session[sessionurl_q]"[/COLOR]>[/COLOR][COLOR=#800080]<img src=[COLOR=#0000ff]"images/newpm.gif"[/COLOR] alt=[COLOR=#0000ff]"You have a new PM"[/COLOR] border=[COLOR=#0000ff]"0"[/COLOR]>[/COLOR][COLOR=#008000]</a>[/COLOR][COLOR=#000080]</div>[/COLOR][COLOR=#008080]</td>[/COLOR]
[COLOR=#ff0000]</if>[/COLOR]
NOTICE : If you have the New PM Notification mod installed (http://www.vbulletin.org/forum/showthread.php?t=124056) you will need to remove it by searching for and deleting this text in the navbar template
     [COLOR=#ff0000]<if condition=[COLOR=#0000ff]"$bbuserinfo['pmunread']"[/COLOR]>[/COLOR]
                [COLOR=#008080]<td class=[COLOR=#0000ff]"alt2"[/COLOR] valign=[COLOR=#0000ff]"top"[/COLOR] nowrap=[COLOR=#0000ff]"nowrap"[/COLOR]>[/COLOR]
        [COLOR=#008000]<a href=[COLOR=#0000ff]"/forum/private.php?$session[sessionurl]"[/COLOR]>[/COLOR][COLOR=#800080]<img src=[COLOR=#0000ff]"$stylevar[imgdir_misc]/newpm.gif"[/COLOR] alt=[COLOR=#0000ff]"You have a new PM"[/COLOR] border=[COLOR=#0000ff]"0"[/COLOR]>[/COLOR][COLOR=#008000]</a>[/COLOR]
                [COLOR=#008080]</td>[/COLOR]
        [COLOR=#ff0000]</if>[/COLOR]
If you want the floating notifier on a new page load and not the ajax checking, edit the JS file and delete


     setTimeout("checkNewPM()", checkdelay);
Youll need to:
Upload 1 GIF file
Upload 1 Javascript file
Import 1 XML product

Makes 1 plugin hook into misc.php (adds ajaxchecknewpm function)

History 19 July 2007
Version 1.1
  • Bug fix, IE complains when a guest gets a permission denied response when it expects XML. Removed Guests from checking for PMs via Ajax
  • Added options to have the Notification in the navbar as well as floating.
if you have 1.0 installed, youll need to upload the Jaavscript file again, uninstall / reinstall the XML product and make the template changes to footer (not headerinc) and add 1 to navbar


Download:
http://rapidshare.com/files/83826358/Script_AjaxNewPMChecker_v1.1.zip.html

Last edited by Bootsum; 01-17-08 at 07:53 AM.
DjMorley's Avatar
DjMorley : Member
DjMorley is on a distinguished road
offline Joined: Nov 2007 Location: Bolton/Preston Posts: 44 Thanked: 0
  #2  
Unread 01-17-08
where are the

GIF file
Javascript file
XML product file

files to upload ?
Bootsum's Avatar
Bootsum : Newbie +
Bootsum is on a distinguished road
offline Joined: Nov 2007 Posts: 5 Thanked: 1
  #3  
Thread Starter Unread 01-17-08
Sorry, it appears the link was erased when I pasted the content.

Here you are:

Download:
http://rapidshare.com/files/83826358/Script_AjaxNewPMChecker_v1.1.zip.html
tr1p's Avatar
tr1p : 50+
tr1p will become famous soon enough
offline Joined: Oct 2007 Posts: 84 Thanked: 6
  #4  
Unread 01-17-08
Originally Posted by Bootsum View Post
Hover to view full quote
Sorry, it appears the link was erased when I pasted the content.

Here you are:

Download:
http://rapidshare.com/files/83826358/Script_AjaxNewPMChecker_v1.1.zip.html
can u attach file here or any other hosting sites coz rapidshare dont work on me
DjMorley's Avatar
DjMorley : Member
DjMorley is on a distinguished road
offline Joined: Nov 2007 Location: Bolton/Preston Posts: 44 Thanked: 0
  #5  
Unread 01-17-08
i Attached the file for you
Attached Files Click the thanks button to view this attachment.

Last edited by DjMorley; 01-17-08 at 08:42 AM.
The Mask's Avatar
The Mask : Newbie +
The Mask is on a distinguished road
offline Joined: Jan 2008 Posts: 8 Thanked: 0
  #6  
Unread 01-29-08
There are some errors in navbar code you provided

So I tried to fix it and came up with this code

<color=#ff0000></font><if condition=<color=#0000ff></color></color>
<color=#008080></color=#008080><td class=<color=#0000ff></color><color=#0000ff></color></color><color=#000080><div id=<color=#0000ff></color> 
<color=#0000ff>

    <div style= "display:none;
    width:32px;height:32px;left:0px;top:0px;
    padding:0px;background:transparent;
    border:0px solid #ffffff"</color>></color><color=#008000><a href=<color=#0000ff>"private.php?$session<sessionurl_q>"</color>></color><color=#800080><img src=<color=#0000ff>"images/newpm.gif"</color> alt=<color=#0000ff>"You have a new PM"</color> border=<color=#0000ff>"0"</color></color><color=#008000></a></color><color=#000080></div></color><color=#008080></td></color>
<color=#ff0000></if></color>
Now it is working fine

Test it.

Later.
New Thread  Post Reply

Thread Tools

Bookmarks
  • Submit Thread to Facebook
  • Submit Thread to Twitter
  • Submit Thread to Pinterest
  • Submit Thread to LinkedIn
  • Submit Thread to Reddit
Tags
personal, message, notification, ajax
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Powered by GYSN Underground 2021