quick and dirty hack to count views at lightbox
first u need to edit lightbox_s.js
add this function after the global vars near line 140-150
function download_counter(id){
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.getElementById("target").innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("POST", "addHit.php", false);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
xmlHttp.send('pid='+id);
}
find "showImage: function()" and add patch it like this:
from:
this.preloadNeighborImages();
to:
this.preloadNeighborImages();
download_counter(imageArray[activeImage][3]);
next find this:
for (var i=0; i<anchors.length; i++){
var anchor = anchors[i];
if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))){
imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'), anchor.getAttribute('picpage')));
and patch it like this:
for (var i=0; i<anchors.length; i++){
var anchor = anchors[i];
if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))){
imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'), anchor.getAttribute('picpage'), anchor.getAttribute('pid')));
now u have to patch your theme.php:
find:
$picList .= "<a href=\"$picture_url_fullsize\" picpage=\"$picture_page\" rel=\"lightbox[list]\" title=\"$pic_title\" >";
and replace with:
$picList .= "<a href=\"$picture_url_fullsize\" picpage=\"$picture_page\" rel=\"lightbox[list]\" pid=\"$picture[pid]\" title=\"$pic_title\" >";
comments are welcome