For people who have morphed their profile page (eg: mine), a problem used to be the inability to present the current image views, gallery count and image counts due to its dynamic nature.
Fret not Using the following Javascript code will get the work done. Note that this works with non-IE browsers only. See below how to handle IE.
- Code: Select all
function getElementsByAttribute(attr,val,container)
{
container = container||document
var all = document.getElementsByTagName('*')
var arr = []
for(var k=0;k<all.length;k++)
if(all[k].getAttribute(attr) == val)
arr[arr.length] = all[k]
return arr
}
function showTotal() {
if (getElementsByAttribute("class","wb","document")[6].childNodes[5].firstChild.nodeValue) {
views=getElementsByAttribute("class","wb","document")[6].childNodes[5].firstChild.nodeValue;
temp=getElementsByAttribute("class","wb","document")[6].childNodes[2].nodeValue;
galleriesImages = temp.split(' ');
galleries=galleriesImages[6];
images=galleriesImages[9];
document.getElementById('totalview').firstChild.nodeValue=views;
document.getElementById('totalgalleries').firstChild.nodeValue=galleries;
document.getElementById('totalimages').firstChild.nodeValue=images;
}
else alert('Your browser doesn\'t support the Level 1 DOM');
}
Use it as follows in HTML of profile:
- Code: Select all
<!--[if !IE]>--><script type="text/javascript" src="http://host.com/location/profile.js" /><!--<![endif]-->
Over <b id="totalview">rough_no_for_IE</b> views
Galleries:<b id="totalgalleries">rough_no_for_IE</b>
Images:<b id="totalimages">rough_no_for_IE</b>
<!--[if !IE]>--><body onload="showTotal()"><!--<![endif]-->
rought_no_for_IE has to be substituted for a rough number that will be shown to IE users. Firefox and Opera users will see the correct dynamic numbers.
Of course you need to save the Javascript as profile.js and change the location of host.com in the html above. Note that the details you get when you logged in as yourself may looked messed up, but for anyone else (other pbase users and non-logged in visitors) it will display correctly.
Code released under GPL 2.0