PDA

View Full Version : FrogJS help



wannarun
02-16-2008, 06:15 AM
1) Script Title: FrogJS

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/frogjs/index.htm

3) Describe problem: I've been messing around with this script for hours tonight and I have no clue what I may or may not be doing wrong. I apologize for the "newbie" question/issue. I'm using Dreamweaver and I have the page done except for the slideshow script that I want to insert. I followed the steps but then realized that I need to copy all the documents from the script onto my website assets :P. I've figured out where to place frog, prototype, and scriptaculous ("assests" under scripts). Not sure about builder, controls, dragdrop, etc. Do they all need to be in the assests folder with the rest of the scripts? I guess what I'm trying to get at...is how in the heck does the program know which files to run and when? Please don't flame me for trying to learn a new hobby!;)

jscheuer1
02-16-2008, 08:06 AM
These scripts, if you are following the installation from the archive, go in a folder named scripts off of the folder in which the page with the gallery is.

That's actually a pretty good question. And, as far as I can tell, Frog Gallery only requires:

prototype.js
scriptaculous.js
effects.js
frog.js

I deleted the rest from my local installation, and the script still worked. The only one of those that isn't linked directly to the page is effects, and it is linked to by:


<script type="text/javascript" src="scripts/scriptaculous.js?load=effects"></script>

Which tells scriptaculous to load that one. It does so using this code:


var Scriptaculous = {
Version: '1.7.0',
require: function(libraryName) {
// inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
},
load: function() {
if((typeof Prototype=='undefined') ||
(typeof Element == 'undefined') ||
(typeof Element.Methods=='undefined') ||
parseFloat(Prototype.Version.split(".")[0] + "." +
Prototype.Version.split(".")[1]) < 1.5)
throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");

$A(document.getElementsByTagName("script")).findAll( function(s) {
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
}).each( function(s) {
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
var includes = s.src.match(/\?.*load=([a-z,]*)/);
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
function(include) { Scriptaculous.require(path+include+'.js') });
});
}
}

Scriptaculous.load();

Which basically just writes out the tag:


<script type="text/javascript" src="path/effects.js"></script>

where path/ is the same path as to scriptaculous.

I believe that the others are included in the distribution because, if you skip:

?load=effects

it will look for all of them and possibly throw an error if one or more are not found.

wannarun
02-16-2008, 05:02 PM
You are too awesome!! I had figured out that somewhere along all the lines of code, it would know what to do from one point to another. I stayed up until 1:30 last night referencing between 2 books. If I had put this much effort while I was in school, I'd be a millionaire! :rolleyes:

wannarun
02-16-2008, 06:00 PM
Doing the Happy Dance!!!! Got it figured out and it works beautifully!!! I was up way too late last night and if I hadn't been so sleep deprived I would have noticed that I had the wrong path names!! Duh!!! Thank you for such a great site!!