To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.generalOpen lugnet.general in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 General / 44618
44617  |  44619
Subject: 
Tool for downloading set pictures from lego.com
Newsgroups: 
lugnet.publish, lugnet.general
Date: 
Mon, 29 Dec 2003 21:04:34 GMT
Viewed: 
83 times
  
If you're like me, you register every purchased set in your own collection
database. And you'll augment each set record with a set picture downloaded from
lego.com.
To save some tedious work, I made a javascripted page, wich runs locally on my
machine. I type in the set number, and it grabs the three standard set pics from
shop.lego.com
For your convenience, the page is added below. Just save it as a .htm file on
your machine. For this page to function, a personal web server must be running
on your machine. This is simply because the page uses url parameters.
There is no built-in save-function for the pics; just use your right mouse
button to save the jpg's. (If your browser attempts to save it as a .bmp, hit f5
(reload) first. This may be a bug in my browser only).

Ofcourse, this tool is very simple but has some relevant advantages over
navigating the site:
1. You get all three pictures with one  mouseclick, instead of going through
each picture in turn.
2. You can access sets which are not available anymore/yet/in your country. This
method bypasses the availability check.

Note, this tool is provided to be run from your local machine *only*. It is
expressly not intended to be run from your web site, since it is considered bad
form on the internet to use 'deep linking' (linking to pictures directly without
its original context).
Also note, this tool will cease functioning whenever TLG changes the url's of
their pictures. Besides, if you prefer a script to grab a certain range of set
pics automatically, see my earlier post. (I may combine both functions in one
page someday.)

Eric Brok
LEGO on my Mind
http://home.zonnet.nl/ericbrok/legomind


-------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Picture grabber</title>
</head>

<script>

function URLGetString( ){
      urlArr=location.href.split('?');
      if(urlArr.length<2)
        return;
      paramArray=urlArr[1].split('&');
      for(var i=0;i<paramArray.length;i++){
      var t=paramArray[i].split('=');
       if(1<t.length){
     this[t[0]]=t[1];
   }
      }
}

function _URLGetString_exists(strProperty){
      return(typeof this[strProperty]!='undefined');
}

URLGetString.prototype.exists=_URLGetString_exists;

var params=new URLGetString();
var set=new String;
var local=new String;
var localDir=new String;
var pic1=new String;
var pic2=new String;
var pic3=new String;

if (params.exists('set')) set=params.set; else set='';
if (params.exists('local')) local=params.local; else local='false';
if (params.exists('pic1')) pic1=params.pic1; else pic1='true';
if (params.exists('pic2')) pic2=params.pic2; else pic2='false';
if (params.exists('pic3')) pic3=params.pic3; else pic3='false';
if (params.exists('localDir')) localDir=params.localDir; else localDir='';
if (local=='undefined') local='false';
if (pic1=='undefined') pic1='false';
if (pic2=='undefined') pic2='false';
if (pic3=='undefined') pic3='false';
if (local=='true') {
picdir1=localDir;
picdir2=localDir;
picdir3=localDir;
}
else {
picdir1='http://cache.lego.com/images/shop/Products/TYPE10/LEGO-US-2057/';
picdir2='http://cache.lego.com/images/shop/Products/TYPE04/LEGO-US-2057/';
picdir3='http://cache.lego.com/images/shop/Products/TYPE07/LEGO-US-2057/';
}

function processForm(){
newSet=document.all.getSet.value;
document.location='grabit.htm?set='+newSet+'&pic1='+document.all.getGrabPic1.checked+'&pic2='+document.all.getGrabPic2.checked+'&pic3='+document.all.getGrabPic3.checked+'&local='+document.all.getLocal.checked+'&localDir='+document.all.getLocalDir.value;

}

function showPics(thisSet){
var pre=new String;
if (thisSet.length==5) pre='0';
if (thisSet.length==4) pre='00';
if (thisSet.length==3) pre='000';
if(pic1=='true')
document.all.pic1.src=picdir1+'Set384x288us'+pre+thisSet+'.jpg';
if(pic1=='true') document.all.pic1Caption.innerHTML=document.all.pic1.src;
if(pic2=='true')
document.all.pic2.src=picdir2+'Box384x288us'+pre+thisSet+'.jpg';
if(pic2=='true') document.all.pic2Caption.innerHTML=document.all.pic2.src;
if(pic3=='true')
document.all.pic3.src=picdir3+'Alt384x288us'+pre+thisSet+'.jpg';
if(pic3=='true') document.all.pic3Caption.innerHTML=document.all.pic3.src;
}

function prefillForm(){
document.all.getLocalDir.value=localDir;
if (local=='true') document.all.getLocal.checked=true; else
document.all.getLocal.checked=false;
if (pic1=='true') document.all.getGrabPic1.checked=true; else
document.all.getGrabPic1.checked=false;
if (pic2=='true') document.all.getGrabPic2.checked=true; else
document.all.getGrabPic2.checked=false;
if (pic3=='true') document.all.getGrabPic3.checked=true; else
document.all.getGrabPic3.checked=false;
}

function onPageLoad(){
prefillForm();
showPics(set);
}



</script>




<body onload="onPageLoad()">

<h1>Set <script>document.write(set)</script></h1>

<table>
<tr>
<td><img id="pic1" src="" width="384" height="288"></td>
<td><img id="pic2" src="" width="384" height="288"></td>
<td><img id="pic3" src="" width="384" height="288"></td>
</tr>
<tr>
<td><h6><span id="pic1Caption">Picture A</span></h6></td>
<td><h6><span id="pic2Caption">Picture B</span></h6></td>
<td><h6><span id="pic3Caption">Picture C</span></h6></td>
</tr>

</table>




<br>


<form action="javascript:processForm()">
<table>
<tr>
<td>Grab set</td>
<td><input id="getSet" type="text">&nbsp;<input type="submit" value="OK"></td>
</tr>
<tr><td><hr>Settings</td></tr>
<tr>
<td>&nbsp;</td>
<td><input id="getLocal" type="checkbox">Local path
<input id="getLocalDir" type="text" value=""></td>
</tr>

<tr>
<td>&nbsp;</td>
<td><input id="getGrabPic1" type="checkbox">Grab picture A</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input id="getGrabPic2" type="checkbox">Grab picture B</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input id="getGrabPic3" type="checkbox">Grab picture C</td>
</tr>
</table>
</form>


</body>
</html>



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR