PDA

View Full Version : Can someone translate this..



jzhang1013
04-16-2009, 12:07 AM
function openPortfolio(section) {
if(!_opened) openUp();
_section = section;
var image = arguments[1] || 0;
var url = 'portfolio.php?image='+image+'&section='+section;
['Cars','Nature','Long Exposure','Food','About'].each(function(e){
Element.removeClassName(e,'active');
});
Element.addClassName(section,'active');
new Ajax.Request(url);
}


So I'm using someone else's script as a base to build my own but there that bolded line that I can't understand... where is it trying to retrieve in this case images from?

magicyte
04-16-2009, 12:39 AM
The JavaScript is accessing another file called portfolio.php and portfolio.php is accessing the images. You can't tell where the JavaScript code is accessing the images from because the actually thing that accesses the images is in a PHP file. You'd have to open this PHP file and see what it returns to the JavaScript.

jzhang1013
04-16-2009, 12:42 AM
ok as I suspected... here is the php in whole....



var _timeout = 0;

function updateImage() {
if(!_show && !_imageloader.complete) {
if(++_timeout == 50) Effect.Appear('indicator',{duration:0.4,queue:'end'});
}
if(_imageloader.complete && !_show) {
$('content').innerHTML = '';
$('info').innerHTML = '1/0';
$('caption').innerHTML = '';
$('main').style.backgroundImage = 'url(/)';
Effect.Appear('arrow-left');
Effect.Appear('arrow-right');
_currentImage = 0;
_nrOfImages = 0;
clearInterval(_timer);
_timer = null;
_imageloader = null;
if(_timeout>49) Effect.Fade('indicator',{duration:0.3,queue:'end'});
_timeout = 0;
reveal();
}
}

_section = 'portfolio1';

var _imageloader = new Image();
_imageloader.src = '/';

var _timer = setInterval(updateImage, 10);

hide();

magicyte
04-16-2009, 12:56 AM
I don't think that's PHP... that code is JavaScript :/ - oh well, can you tell me which website's code you are using and the directory for the JavaScript that you borrowed?

jzhang1013
04-16-2009, 01:02 AM
this is what I'm currently referencing http://www.christofwagner.com/

magicyte
04-16-2009, 01:05 AM
Aye. I see now. This .php file gave that JavaScript output. We can only know where it's accessing the images if you read the source of the .php file which is only possible if you own the site, or if you contact the site's owner. Sorry! :(

jzhang1013
04-16-2009, 01:07 AM
oo ok hmmm....

jzhang1013
04-16-2009, 02:29 AM
or would you happen to know what was contained within the php file? guesses?