smughack: Bulk Zoom Thumbnail

devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
ok...I saw this request and thought I would give it a go :D

Add present this code has only been enabled for the "traditional" style. Note, at present the code, has a hard-coded thumbnail resolution and location (to be enhanced later)

Add this code to your javascript block...
<divtags.length ;="" i=""><divtags.length ;="" i=""><divtags.length ;="" i="">
</divtags.length><divtags.length ;="" i="">[php]
var thumbnailArray = new Array();
var thumbnailCount;
var thumbnailItem;

addEvent(window, "load", addBulkThumbnail);

function addBulkThumbnail()
{
if ((IsClass("loggedIn")) && (IsClass("traditional")))
{
divTag = document.getElementById("photoTools");
objButton = document.createElement("input");
divTag.appendChild(objButton);
objButton.setAttribute('value', 'Bulk Zoom Thumbnail');
try
{
objButton.type = "button";
}
catch(e)
{
objButton.tageName = "button";
objButton.setAttribute('value', 'Bulk Zoom Thumbnail');

}
objButton.className = "buttons";
try
{
objButton.attachEvent('onclick', processThumbnails);
}
catch(e)
{
objButton.addEventListener('click', processThumbnails, false);
}
}
}

function processThumbnails()
{

if (!confirm("Are you sure you want to bulk process this thumbnails ?"))
return;

if ((IsClass("loggedIn")) && (IsClass("traditional")))
{
re = /.smugmug.com\/gallery\/[0-9]+\/[0-9]+\/([0-9]+)/

divTag = document.getElementById("photos");

if (divTag)
{
divTags = divTag.getElementsByTagName("div");

for (i=0; i
{
if (divTags.className == "photo")
{
re.exec(divTags.innerHTML);
thumbnailArray[thumbnailArray.length] = RegExp.$1;
}
}
thumbnailCount = thumbnailArray.length;
thumbnailItem = 0;
zoomThumbnails();
}
}
}

function zoomThumbnails()
{
var thumbnailId = thumbnailArray.pop();

if (thumbnailId)
{
thumbnailItem++;
document.getElementById("ajaxWorking").innerHTML = "Processing thumbnail " + thumbnailItem + " of " + thumbnailCount + "...";

toggleDIV('ajaxWorking','','block');
postArray = new Array();
postArray = 'newthumb';
postArray = thumbnailId;
postArray = "doit";
postArray = "2907";
postArray = "2907";
postArray = "0";
postArray = "0";
ajax_query(zoomThumbnails, webServer+'/photos/tools.mg', postArray, true, true);
}
else
window.location = window.location;
}

function IsClass(sClass)
{
sClassName = document.body.className;
re = new RegExp(sClass + "( |$)")

if (!sClassName)
return false;
return re.test(sClassName);
}
[/php]
<divtags.length ;="" i="">Enjoy :D

David</divtags.length></divtags.length></divtags.length></divtags.length>
David Parry
SmugMug API Developer
My Photos

Comments

  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited January 26, 2006
    OK i put it on my demo site. No worky. CHeck your body tag code - is it all showing ?

    And, how do I execute it?
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited January 26, 2006
    Andy wrote:
    OK i put it on my demo site. No worky. CHeck your body tag code - is it all showing ?

    And, how do I execute it?

    obviously u need the body tag around the onload event, but vBulletin keeps stripping it out.

    Also found a bug in mozilla, trying to fix it.
    David Parry
    SmugMug API Developer
    My Photos
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited January 26, 2006
    devbobo wrote:
    obviously u need the body tag around the onload event, but vBulletin keeps stripping it out.

    Also found a bug in mozilla, trying to fix it.

    David: NOTHING is obvious to me, I am a "hack" whilst you are a h4ck3r lol3.gif
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited January 26, 2006
    Andy wrote:
    David: NOTHING is obvious to me, I am a "hack" whilst you are a h4ck3r lol3.gif

    Andy,

    the code has been updated, but now you need to remove the onload event handler.

    Let me know how you get on, it should a "Bulk Zoom Thumbnail" button next to the "Gallery Tools" on "Traditional" style.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited January 26, 2006
    devbobo wrote:
    Andy,

    the code has been updated, but now you need to remove the onload event handler.

    Let me know how you get on, it should a "Bulk Zoom Thumbnail" button next to the "Gallery Tools" on "Traditional" style.

    Cheers,

    David


    ne_nau.gif sorry David - tried on IE and also FF on Mac - nothin....

    http://zions.smugmug.com/gallery/956882
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited January 26, 2006
    David, your last message is bad.
    It's b0rking the thread.
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited January 26, 2006
    I tried it on your site. In Firefox - didn't seem to work though I saw it going thru the motions..

    Keep at it :D I'll be back in the morning, my time..
Sign In or Register to comment.