PDA

View Full Version : any suggestions pls?


smudge
Mar-21-2007, 03:26 AM
hi

sorry another quick query .... orginally I put the slide show feature in on my friends site www.acsphotos.smugmug.com (http://www.acsphotos.smugmug.com) however she has changed her mind and just wants a static on her page. So because she wasnt sure if at a later stage she would want the slide show back i just changed it to one page and was gonna set the timer so that it just run on that pic for a much longer time. However i dont want it to affect the other slide shows and at the same time i really dont want to create alot of hassle with codes over something that prob can be rectified so simply.

Would i be better off to delete all the slide show codes out to take this off her home page and put a still image in her page ... ive got text i have to add to which i will put in the bio part, however if i load the pic into the bio too will it come out small as i need to keep it at the size it currently is on the page.

any suggestions or url instruction links would be appreciated.

many thanks

S :)

Andy
Mar-21-2007, 03:39 AM
Yes, delete the slideshow code from your JS, copy and save the footer and CSS slideshow code for later use.

Load the pic in the Footer HTML box. Give it a div,
follow the same instructions that we give for a header pic, just modify to taste.

smudge
Mar-21-2007, 06:01 AM
Yes, delete the slideshow code from your JS, copy and save the footer and CSS slideshow code for later use.

Load the pic in the Footer HTML box. Give it a div,
follow the same instructions that we give for a header pic, just modify to taste.

Hi Andy

I took all the relevant code out and it disabled the link for Client Area (2nd home page) ... i have pasted it all back in but i seem to have lost loads of things, mostly the galleries with all the pics in there. i have pasted in here the codes that i took out and have put back in... any suggestions pls?

this is JS
/*=========================*/
/*== SLIDE SHOW ==*/
/*== version 0.58 ==*/
/*== Updated 15 Mar 2007 ==*/
/*=========================*/
var SLIDE_SHOW = 0;
var RANDOM_PHOTO = 1;
var slideshowContainer;
var sSlide;
var sCaption;
var ssSlides;
var ssSlideTotal;
var ssSlideTimer;
var ssOldSlide;
var ssFadeTimer;
var ssFade;
var ssTimerId;
var blank;

function PrepSlideEnvironment() {
tmpCookie = getCookie("Template");
blank = new Image();
blank.src = "/img/spacer.gif";
if (typeof(slideshowType) == "undefined" || (slideshowType != SLIDE_SHOW && slideshowType != RANDOM_PHOTO)) {
slideshowType = SLIDE_SHOW;
}
if (slideshowType == RANDOM_PHOTO) {
randomSlides = true;
}
if (typeof(slideshowContainerId) == "undefined") {
return false;
} else if (typeof(slideshowContainerId) == "string") {
slideshowContainer = YD.get(slideshowContainerId);
}
if (!slideshowContainer) {
return false;
}
if (typeof(slideshowUrl) == "undefined" || typeof(slideshowUrl) != "string") {
return false;
} else {
slideshowUrl = /(?:http:\/\/[^\/]+)?(\/\S+)/.exec(slideshowUrl)[1];
}
if (/\/gallery\/[0-9]+/.test(slideshowUrl)) {
slideSourceIsGallery = true;
} else {
slideSourceIsGallery = false;
}
if (typeof(slideHeight) == "undefined" || isNaN(slideHeight)) {
slideHeight = "200";
}
if (typeof(slideWidth) == "undefined" || isNaN(slideWidth)) {
slideWidth = "300";
}
if (typeof(photoHeight) == "undefined" || isNaN(photoHeight)) {
photoHeight = slideHeight;
}
if (typeof(photoWidth) == "undefined" || isNaN(photoWidth)) {
photoWidth = slideWidth;
}
if (typeof(slideDuration) == "undefined" || isNaN(slideDuration)) {
slideDuration = 3;
}
if (typeof(firstSlideUrl) == "undefined" || typeof(firstSlideUrl) != "string") {
firstSlideUrl = blank.src;
}
if (typeof(showSlideTransition) == "undefined" || typeof(showSlideTransition) != "boolean") {
showSlideTransition = true;
}

if (typeof(resizeToPhoto) == "undefined" || typeof(resizeToPhoto) != "boolean") {
resizeToPhoto = true;
}
if (typeof(quickStart) == "undefined" || typeof(quickStart) != "boolean") {
quickStart = true;
}
if (typeof(randomSlides) == "undefined" || typeof(randomSlides) != "boolean") {
randomSlides = false;
}
if (typeof(slideControls) == "undefined" || typeof(slideControls) != "boolean") {
slideControls = false;
}
if (typeof(slideCaptions) == "undefined" || typeof(slideCaptions) != "boolean") {
slideCaptions = false;
}
if (typeof(slidesClickable) == "undefined" || typeof(slidesClickable) != "boolean") {
slidesClickable = false;
}
return true;
}

function loadSlideshow() {
if (!PrepSlideEnvironment()) {
return false;
}
slideshowContainer.innerHTML = '<img src="http://www.smugmug.com/img/spacer.gif" alt="" id="ssSlide" height="' + slideHeight + '" width="' + slideWidth + '" style="opacity: .99; background-image: url(' + firstSlideUrl + '); background-repeat: no-repeat; background-position: center;" />';
if (slideCaptions) {
slideshowContainer.innerHTML += '<div id="ssCaption"></div>';
}
if (slideControls) {
slideshowContainer.innerHTML += '<div id="ssControl"><a title="Previous Slide" id="ssPrev" class="ssBtn" href="javascript: void(0);" onclick="prevSlide();"><img src="/img/spacer.gif" border="0" /></a><a title="Next Slide" id="ssNext" class="ssBtn" href="javascript: void(0);" onclick="nextSlide();"><img src="/img/spacer.gif" border="0" /></a><a title="Pause Slideshow" id="ssPause" class="ssBtn" href="javascript: void(0);" onclick="pauseSlideshow();"><img src="/img/spacer.gif" border="0" /></a><a title="Resume Slideshow" id="ssPlay" class="ssBtn" href="javascript: void(0);" onclick="resumeSlideshow();"><img src="/img/spacer.gif" border="0" /></a></div>';
}
sSlide = YD.get('ssSlide');
sCaption = YD.get('ssCaption');
if (slidesClickable) {
sSlide.style.cursor = 'pointer';

if (firstSlideUrl != blank.src) {
ssAddSlideClick(slideshowUrl);
}
}
ssSlides = [];
ssSlideTotal = 0;
ssSlideTimer = 0;
ssOldSlide = 0;
ssFadeTimer = 100;
ssFade = "out";
if (slideSourceIsGallery) {
ajax_query(slideshowHandler, '/photos/sspopup.mg?AlbumID=' + /\/gallery\/([0-9]+)/.exec(slideshowUrl)[1], null, true);
} else {
var postArray = [];
postArray['TemplateID'] = '8';
postArray['origin'] = slideshowUrl;
ajax_query(slideshowHandler, '/homepage/templatechange.mg', postArray, true);
}
}

function slideshowHandler(response)
{
if (!slideSourceIsGallery) {
if (tmpCookie && tmpCookie != "") {
setCookie('Template', tmpCookie, 30, '/', /(?:http[s]?:\/\/)?(?:\w+\.)?(\S+[^\/])/.exec(location.href)[1]);
} else {
deleteCookie("Template", "/", /(?:http[s]?:\/\/)?(?:\w+\.)?(\S+[^\/])/.exec(location.href)[1]);
}
}
var re = /imageID\[\d+\] = "\d+";/g;
var re2 = /width\[\d+\] = "\d+";/g;
var re3 = /height\[\d+\] = "\d+";/g;
var re4 = /caption\[\d+\] = ".*";/g;
s = response.match(re);
w = response.match(re2);
h = response.match(re3);
c = response.match(re4);
var oSlide;
for (i = 0; i < s.length; i++) {
oSlide = {};
temp = s[i].split(/"/);
oSlide.ImageId = temp[1];
oSlide.File = 'http://upload.smugmug.com/photos/toolthumbs.mg?ImageID=' + temp[1] + '&tool=slideshowXL&winHeight=' + photoHeight + '&winWidth=' + photoWidth;
oSlide.Gallery = slideshowUrl + '/1/' + oSlide.ImageId;
temp = h[i].split(/"/);
oSlide.Height = temp[1];
temp = w[i].split(/"/);
oSlide.Width = temp[1];
temp = c[i].split(/"/);
oSlide.Caption = temp[1];
oSlide.Loaded = false;

if ((oSlide.Width > photoWidth) || (oSlide.Height > photoHeight)) {
if (oSlide.Width >= oSlide.Height) {
oSlide.Height = Math.round((oSlide.Height / oSlide.Width) * photoWidth);
oSlide.Width = photoWidth;
} else {
oSlide.Width = Math.round((oSlide.Width / oSlide.Height) * photoHeight);
oSlide.Height = photoHeight;
}
}
ssSlideTotal = ssSlides.push(oSlide);
}
ssSlideTotal -= 1;
if (randomSlides) {
ssSlides.shift();
ssSlides.shuffle();
ssSlides.unshift(0);
}
if (quickStart) {
ssSlideTimer = (slideDuration * 1000);
}
ssPrepSlide(1);
window.setTimeout("ssPrepSlide(2);", 0);
window.setTimeout("ssPrepSlide(ssSlideTotal);", 0);
if (slideshowType == SLIDE_SHOW) {
ssPlaySlideshow();
} else {
ssSlideSwap(1);
}
}

function ssPauseSlideshow()
{
window.clearTimeout(ssTimerId);
ssTimerId = null;
}

function ssResumeSlideshow()
{
if (!ssTimerId) {
ssTimerId = window.setTimeout("ssPlaySlideshow()", 10);
}
}

function ssPrepSlide(prep)
{
if (ssSlides[prep].Loaded == false) {
ssSlides[prep].Image = new Image();
ssSlides[prep].Image.src = ssSlides[prep].File;
ssSlides[prep].Loaded = true;
}
}

function ssMoveSlide(i) {
ssSlideTimer = 0;
ssFadeTimer = 100;
ssTransition(ssFadeTimer);
ssFade = "out";
ssSlideSwap(i);
}

function ssPlaySlideshow()
{
if (ssSlideTimer >= (slideDuration * 1000))
{
if (ssFade == 'out') {
ssTransition(ssFadeTimer -= 10);
}

if (ssFadeTimer == 0) {
ssSlideSwap(1);
ssFade = 'in';
}

if (ssFade == 'in') {
ssTransition(ssFadeTimer += 10);
}

if (ssFadeTimer == 100) {
ssSlideTimer = 0;
ssFade = 'out';
}
} else {
ssSlideTimer += 10;
}

ssTimerId = window.setTimeout("ssPlaySlideshow()", 10);
}

function ssTransition(opacity)
{
if (showSlideTransition)
{
if (opacity != 100) {
YD.setStyle(sSlide, 'opacity', (opacity / 100));
} else {
YD.setStyle(sSlide, 'opacity', '.99'); // to prevent flashing in mozilla browsers
}

// only affects Win IE
YD.setStyle(sSlide, 'filter', 'alpha(opacity=' + opacity + ')');
if (sCaption) {
YD.setStyle(sCaption, 'opacity', sSlide.style.opacity);
YD.setStyle(sCaption, 'filter', sSlide.style.filter);
}
}
}

function ssSlideSwap(i)
{
var newSlide = ssOldSlide + i;

if (newSlide > ssSlideTotal)
newSlide = 1;

if (newSlide < 1)
newSlide = ssSlideTotal;

if (ssSlides[newSlide].Loaded != false)
{
document.images['ssSlide'].src = blank.src;
YD.setStyle(sSlide, 'backgroundImage', 'url(' + ssSlides[newSlide].File + ')');
if (resizeToPhoto)
{
document.images['ssSlide'].height = ssSlides[newSlide].Height;
document.images['ssSlide'].width = ssSlides[newSlide].Width;
}
if (slidesClickable) {
ssAddSlideClick(ssSlides[newSlide].Gallery);
}

if (slideCaptions) {
YD.get('ssCaption').innerHTML = ssSlides[newSlide].Caption;
}
ssPrepSlide(newSlide < ssSlideTotal ? newSlide + i : 1);
ssOldSlide = newSlide;
} else {
ssPrepSlide(newSlide);
ssSlideSwap(i);
}
}

function ssAddSlideClick(sUrl) {
YE.purgeElement(sSlide, false, 'click');
YE.addListener(sSlide, 'click', function() {
location.href = sUrl;
})
}

Array.prototype.shuffle = function()
{
var len = this.length;
var rand, temp, i;
for (i = 0; i < len; i++)
{
rand = Math.floor(Math.random()*len);
temp = this[i];
this[i] = this[rand];
this[rand] = temp;
}
}

function pauseSlideshow()
{
YD.setStyle('ssPause', 'display', 'none');
YD.setStyle('ssPlay', 'display', 'inline');
ssPauseSlideshow();
}

function resumeSlideshow()
{
YD.setStyle('ssPause', 'display', 'inline');
YD.setStyle('ssPlay', 'display', 'none');
ssResumeSlideshow();
}

function prevSlide()
{
pauseSlideshow();
ssMoveSlide(-1);
}

function nextSlide()
{
pauseSlideshow();
ssMoveSlide(1);
}

function getCookie(name) {
var start = document.cookie.indexOf(name + "=");
var len = start + name.length + 1;

if ((!start) && (name != document.cookie.substring(0, name.length))) {
return null;
}
if (start == -1) {
return null;
}
var end = document.cookie.indexOf(";", len);
if (end == -1) {
end = document.cookie.length;
}
return unescape(document.cookie.substring(len, end));
}

function setCookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime( today.getTime() );
if (expires) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + '='+escape(value) +
((expires) ? ';expires=' + expires_date.toGMTString() : '') +
((path) ? ';path=' + path : '') +
((domain) ? ';domain=' + domain : '') +
((secure) ? ';secure' : '');
}

function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}


this goes in footer
********>
if (hasPath("galleries"))
YD.addClass(document.body, "galleries");
</********
******** type="text/javascript">
/* required slideshow variables */
slideshowContainerId = "bioBox";
slideshowUrl = "http://acsphotos.smugmug.com/gallery/2601419#137191548";
/* optional slideshow variables */
/* see properties section */
slideHeight="400";
slideWidth="640";
if (YD.hasClass(document.body,'homepage') && !YD.hasClass(document.body,'galleries'))
loadSlideshow ();
</********

this goes in CSS
#bioBox {
text-align: center;
background: none;
}
#bioBox .photo {
display: none;
}

add to JS
}
function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}

NB.... im just back in this to re-edit what i wrote, ok ive found the galleries etc, but now the pic is back there again, why is that when i delete all the relevant codes out i loose my (2nd home page) which isnt what i want. Bascially i need to keep it just as it is but have that image on the front as a still? ........ im so sorry to be troubling you (pls ignore where its written that this goes in css etc its just there for me in my saved copy thats all :) )

thanks

S :)

Allen
Mar-21-2007, 06:16 AM
...

this goes in footer
<*script*>
if (hasPath("galleries"))
YD.addClass(document.body, "galleries");
</*script*>



add to JS

function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}

NB.... im just back in this to re-edit what i wrote, ok ive found the galleries etc, but now the pic is back there again, why is that when i delete all the relevant codes out i loose my (2nd home page) which isnt what i want. Bascially i need to keep it just as it is but have that image on the front as a still? ........ im so sorry to be troubling you (pls ignore where its written that this goes in css etc its just there for me in my saved copy thats all :) )

thanks

S :) You still need the green parts above, they are not slideshow related.

smudge
Mar-21-2007, 06:33 AM
You still need the green parts above, they are not slideshow related.

Hi Al

i took out the codes again making sure that the ones you highlighted in green for me are in there. however once again ive lost the gallery (which is re-named client area).

shall i do a view source and copy the code on that page into here for you to see? ... sorry im really confused here, I only wanted to change the slide show for a static image and keep the galleries as they were and some how i have managed to totally muck up my site and loose the client area link etc :(

please can you advise, thank you

S :)

Allen
Mar-21-2007, 07:20 AM
Hi Al

i took out the codes again making sure that the ones you highlighted in green for me are in there. however once again ive lost the gallery (which is re-named client area).

shall i do a view source and copy the code on that page into here for you to see? ... sorry im really confused here, I only wanted to change the slide show for a static image and keep the galleries as they were and some how i have managed to totally muck up my site and loose the client area link etc :(

please can you advise, thank you

S :) You forgot to remove the *'s. Remove the red *'s and don't leave a space.

<*script*>
if (hasPath("galleries"))
YD.addClass(document.body, "galleries");
</*script*>

Example
<nospacescriptnospace>
or
<s ..... t>

smudge
Mar-21-2007, 08:13 AM
You forgot to remove the *'s. Remove the red *'s and don't leave a space.

<*script*>
if (hasPath("galleries"))
YD.addClass(document.body, "galleries");
</*script*>

Example
<nospacescriptnospace>
or
<s ..... t>


thanks Al

lol do i feel silly now over leaving those * in there lol, now you can see what i mean by i have many blonde moments lol.

thanks again

S :)