Post by King Joe on Nov 21, 2011 14:01:02 GMT -6
Hey guys. It's been a while since I have written a code so I decided to go back and fix up/add to the PM bar used at my old forum, NightCodes, and release it for the first time to the public.
Parts of this code are customizable but as long as you follow the directions it should be pretty easy.
If you have a question PM me at Proboards Support
Tested in:
FireFox 8
Chrome 15.0.874.121
Global Header:
<!-- NightCode PM bar
idea by Russell
coded by Nightwalker
Do not repost without permission -->
<style type="text/css"><!--
#pm {
width: 100%;
color: #FFFFFF;
background-color: #000000;
padding: 5px;
margin: 0;
position: fixed;
_position: absolute;
left: 0;
top: 0;
-moz-opacity: .70;
filter: alpha(opacity=70);
opacity: .70;
z-index: 9999;
display: none;
}
--></style>
<div id="pm"></div>
Global Footer:
<script type="text/javascript"><!--
/* NightCode PM bar
idea by Russell
coded by Nightwalker
Do not repost without permission */
var linkcol = "#238d8d" // color of the links
var prolinks = 1; // Enable profile and edit profile links for members 1=Yes 0=No
var bookmark = 0; // Enable a link to bookmarks for members
var pmpreff = 0; // Enable a link to PM Preferences for members
var stafflinks = 1; // Enable links for your staff members.
var staff = /^(admin|nightwalker)$/; // People who can see staff links. Divide each username by | with no spaces between
var adminpanel = 0; // Staff links include a link to the admin panel
var headerslinks = 1; // Staff links include links to headers/footers
var general = 0; // Staff links include a link to the general settings
var skins = 0; // Staff links includes a link to the skin page
// No need to edit below here
if(pb_username != 'Guest'){
function slideUp(e){
e = e || window.event;
var toElement = e.relatedTarget? e.relatedTarget : e.toElement;
while(toElement.tagName != 'BODY'){
if(toElement.id == 'pm')
return false;
toElement = toElement.parentNode;
}
var pm = document.getElementById('pm');
if(pm.offsetTop > 5-parseInt(pm.offsetHeight)){
pm.style.top = (pm.offsetTop-1)+'px';
setTimeout(function(){ slideUp(e); }, 5);
}else{
pm.onmouseover = slideDown;
pm.innerHTML = pm_content;
pm.onmouseout = null;
}
}
function slideDown(){
var pm = document.getElementById('pm');
if(pm.offsetTop < 0){
pm.style.top = (pm.offsetTop+1)+'px';
setTimeout(slideDown, 5);
}else{
pm.onmouseover = null;
pm.onmouseout = slideUp;
}
}
var mTd = document.getElementsByTagName('td')[2];
var total_pms = mTd.innerHTML.match(/action=pm">(\d+)\s/i)? RegExp.$1 : '';
var new_pms = mTd.innerHTML.match(/, (\d+)\ (are|is) new./i)? RegExp.$1 : '';
var headid = (location.href.match(/board=(.+?)($|&)/)?RegExp.$1:"-");
document.getElementById('pm').style.display = 'block';
if(new_pms == '0'){
var pm_content = '<center>Hello '+pb_displayname+' you have <a href="/index.cgi?action=pm"><font color="'+ linkcol +'">no</font></a> new PMs<br />[';
if(prolinks) {
pm_content += '<a href="/index.cgi?action=viewprofile"><font color="'+ linkcol +'">View Profile</font></a>|<a href="/index.cgi?action=modifyprofile&user='+pb_username+'"><font color="'+ linkcol +'">Modify Profile</font></a>|';
}
if(bookmark) {
pm_content += '<a href="/index.cgi?action=bookmarks"><font color="'+ linkcol +'">Bookmarks</font></a>|';
}
if(pmpreff) {
pm_content += '<a href="/index.cgi?action=pmprefs"><font color="'+ linkcol +'">PM Preferences</font></a>|';
}
pm_content += '<a href="#"><font color="'+ linkcol +'">Back To Top</font></a>]';
if(staff.test(pb_username) && stafflinks) {
pm_content += '<br />[';
if(adminpanel) {
pm_content += '<a href="/index.cgi?action=admin"><font color="'+ linkcol +'">Admin Panel</font></a>';
}
if(general) {
if(adminpanel) {
pm_content += '|'
}
pm_content += '<a href="/index.cgi?action=settings"><font color="'+ linkcol +'">General Settings</font></a>';
}
if(headerslinks) {
if(adminpanel || general) {
pm_content += '|'
}
pm_content += '<a href="/index.cgi?action=headersfooters2&id=*"><font color="'+ linkcol +'">Global Headers</font></a>|<a href="/index.cgi?action=headersfooters2&id='+headid+'"><font color="'+ linkcol +'">Current Page Headers</font></a>';
}
if(skins) {
if(adminpanel || general || headerslinks) {
pm_content += '|'
}
pm_content += '<a href="/index.cgi?action=skins"><font color="'+ linkcol +'">Skins</font></a>';
}
pm_content += ']</center>';
}
var pm = document.getElementById('pm');
pm.style.top = (5-parseInt(pm.offsetHeight))+'px';
pm.onmouseover = slideDown;
}else{
var pm_content = '<center>Hello '+pb_displayname+' you have <a href="/index.cgi?action=pm">'+new_pms+'</a> new PMs</center>';
}
}
//--></script>
Parts of this code are customizable but as long as you follow the directions it should be pretty easy.
If you have a question PM me at Proboards Support
Tested in:
FireFox 8
Chrome 15.0.874.121
Global Header:
<!-- NightCode PM bar
idea by Russell
coded by Nightwalker
Do not repost without permission -->
<style type="text/css"><!--
#pm {
width: 100%;
color: #FFFFFF;
background-color: #000000;
padding: 5px;
margin: 0;
position: fixed;
_position: absolute;
left: 0;
top: 0;
-moz-opacity: .70;
filter: alpha(opacity=70);
opacity: .70;
z-index: 9999;
display: none;
}
--></style>
<div id="pm"></div>
Global Footer:
<script type="text/javascript"><!--
/* NightCode PM bar
idea by Russell
coded by Nightwalker
Do not repost without permission */
var linkcol = "#238d8d" // color of the links
var prolinks = 1; // Enable profile and edit profile links for members 1=Yes 0=No
var bookmark = 0; // Enable a link to bookmarks for members
var pmpreff = 0; // Enable a link to PM Preferences for members
var stafflinks = 1; // Enable links for your staff members.
var staff = /^(admin|nightwalker)$/; // People who can see staff links. Divide each username by | with no spaces between
var adminpanel = 0; // Staff links include a link to the admin panel
var headerslinks = 1; // Staff links include links to headers/footers
var general = 0; // Staff links include a link to the general settings
var skins = 0; // Staff links includes a link to the skin page
// No need to edit below here
if(pb_username != 'Guest'){
function slideUp(e){
e = e || window.event;
var toElement = e.relatedTarget? e.relatedTarget : e.toElement;
while(toElement.tagName != 'BODY'){
if(toElement.id == 'pm')
return false;
toElement = toElement.parentNode;
}
var pm = document.getElementById('pm');
if(pm.offsetTop > 5-parseInt(pm.offsetHeight)){
pm.style.top = (pm.offsetTop-1)+'px';
setTimeout(function(){ slideUp(e); }, 5);
}else{
pm.onmouseover = slideDown;
pm.innerHTML = pm_content;
pm.onmouseout = null;
}
}
function slideDown(){
var pm = document.getElementById('pm');
if(pm.offsetTop < 0){
pm.style.top = (pm.offsetTop+1)+'px';
setTimeout(slideDown, 5);
}else{
pm.onmouseover = null;
pm.onmouseout = slideUp;
}
}
var mTd = document.getElementsByTagName('td')[2];
var total_pms = mTd.innerHTML.match(/action=pm">(\d+)\s/i)? RegExp.$1 : '';
var new_pms = mTd.innerHTML.match(/, (\d+)\ (are|is) new./i)? RegExp.$1 : '';
var headid = (location.href.match(/board=(.+?)($|&)/)?RegExp.$1:"-");
document.getElementById('pm').style.display = 'block';
if(new_pms == '0'){
var pm_content = '<center>Hello '+pb_displayname+' you have <a href="/index.cgi?action=pm"><font color="'+ linkcol +'">no</font></a> new PMs<br />[';
if(prolinks) {
pm_content += '<a href="/index.cgi?action=viewprofile"><font color="'+ linkcol +'">View Profile</font></a>|<a href="/index.cgi?action=modifyprofile&user='+pb_username+'"><font color="'+ linkcol +'">Modify Profile</font></a>|';
}
if(bookmark) {
pm_content += '<a href="/index.cgi?action=bookmarks"><font color="'+ linkcol +'">Bookmarks</font></a>|';
}
if(pmpreff) {
pm_content += '<a href="/index.cgi?action=pmprefs"><font color="'+ linkcol +'">PM Preferences</font></a>|';
}
pm_content += '<a href="#"><font color="'+ linkcol +'">Back To Top</font></a>]';
if(staff.test(pb_username) && stafflinks) {
pm_content += '<br />[';
if(adminpanel) {
pm_content += '<a href="/index.cgi?action=admin"><font color="'+ linkcol +'">Admin Panel</font></a>';
}
if(general) {
if(adminpanel) {
pm_content += '|'
}
pm_content += '<a href="/index.cgi?action=settings"><font color="'+ linkcol +'">General Settings</font></a>';
}
if(headerslinks) {
if(adminpanel || general) {
pm_content += '|'
}
pm_content += '<a href="/index.cgi?action=headersfooters2&id=*"><font color="'+ linkcol +'">Global Headers</font></a>|<a href="/index.cgi?action=headersfooters2&id='+headid+'"><font color="'+ linkcol +'">Current Page Headers</font></a>';
}
if(skins) {
if(adminpanel || general || headerslinks) {
pm_content += '|'
}
pm_content += '<a href="/index.cgi?action=skins"><font color="'+ linkcol +'">Skins</font></a>';
}
pm_content += ']</center>';
}
var pm = document.getElementById('pm');
pm.style.top = (5-parseInt(pm.offsetHeight))+'px';
pm.onmouseover = slideDown;
}else{
var pm_content = '<center>Hello '+pb_displayname+' you have <a href="/index.cgi?action=pm">'+new_pms+'</a> new PMs</center>';
}
}
//--></script>