[Slogger] Trouble With Variable "$url"

Ken Schutte kschutte at mit.edu
Thu Feb 16 16:29:35 EST 2006


For now, to at least get that information stored, you could make a log 
file that maps filename to the url.  for example, set the saved page to 
be (like the default):
$year-$month-$day_$hour-$minute-$second-$millisecond.$typeext
and create log file with the content of:
$year-$month-$day_$hour-$minute-$second-$millisecond.$typeext $url


Or you can try entering something like this in the "Custom script" tab 
(I haven't tried this...),

var a = sloggerGetVar("url");
alert(a);
a.replace(/\:/g, "_");
a.replace(/\?/g, "_");
a.replace(/\//g, "_");
alert(a);
sloggerSetVar("url",a);

the alert() lines will let you know if it's running and if the character 
replacement works.  Remove them if it does.

Ken



mook at themook.net wrote:
> Hi Ken,
> 
> Thanks for the quick turnaround  : )
> 
> The pages I have archived in the past were saved along the 
> lines of:
> 
> Original Remote Site
> http://www.site.com/article.html?id=001
> http://www.site.com/article.html?id=002
> http://www.site.com/article.html?id=003
> 
> Local Files
> http _www.site.com_article.html id=001.html
> http _www.site.com_article.html id=002.html
> http _www.site.com_article.html id=003.html
> 
> Local Directories
> http _www.site.com__article.html id=001_files
> http _www.site.com__article.html id=002_files
> http _www.site.com__article.html id=003_files
> 
> It looks like "/" became "_", and "?" became " ", etc.  I'm afraid I 
> have no idea how to recreate that with a custom javascript 
> though - I have just enough knowledge to break things, but not 
> enough to actually be competent  : D
> 
> The part of the URL I'm really trying to retain is the "id=00X" 
> part - without that I have no idea what the article actually is (I 
> have a spreadsheet that lists the names of the articles and their 
> corresponding numbers).  If I archive only based on a time-date 
> stamp, it leaves me no way of knowing which article a particular 
> file refers to. Is there another variable I might be able to use for 
> that?  (I've tried "$filename" and "$path" with no luck).
> 
> Thanks!
> 
> Mook
> http://www.themook.net
> 
> On 16 Feb 2006 at 15:08, Ken Schutte wrote:
> 
>>Hi,
>>
>>I believe the problem is that it's generating invalid filenames.  The 
>>$url variable holds the full url, which could be 
>>"http://www.asdf.com/adsf?a=1;b=2" or something.  From saved pages in 
>>the past, what would the final filename be for something like this?  Did 
>>it escape some characters or just remove them?
>>
>>Some of the old Slogger code used to have a copy of some of Mozilla's 
>>code for saving pages.  In newer Slogger, some of these functions were 
>>implemented differently, but I can try to find this part that cleaned up 
>>the filename and put it back in there.
>>
>>In the meantime, it might be possible in the current version if you 
>>change $url variable in a custom javascript, although it's a bit 
>>complicated... somthing like:
>>
>>var a = sloggerGetVar("url");
>>// modify a, replacing bad chars
>>sloggerSetVar("url",a);
>>
>>Ken
> 
> 
> 
> _______________________________________________
> Slogger mailing list
> Slogger at mozdev.org
> http://mozdev.org/mailman/listinfo/slogger


More information about the Slogger mailing list