Need to modify a scrap of javascript

I do not know how to write Javascript and I’m not trying.

I am working with a program called Jalbum that creates web galleries. It has a bazillion “skins” written by users working from basic files they provide. I want to tweak a basic starter template to do one particular thing differently, and I’m not sure how to do it.

There are settings in the Jalbum program itself for whether to link to Jpeg images or to generated HTML pages. I specifically chose this skin, “simplicity” because rather than creating some fancy Flash/lightbox/dancing fairies photo show, it generates simple HTML pages that are named after the name of the image: stoid_pic1.html, stoidvacation.html, etc.

However, the TITLE of the page, the part at the top of the page that appears in the code <title>…</title> is currently set to simply be the same name as the ALBUM title, ie Stoids Picture Album. So it’s Stoids Picture Album on every image page of every individual album and I do not want that.

I want the individual page titles to be taken from the image title, the same way the HTML document name is taken from the image title.

In other words, I want stoids_vacation.html to have a title of stoids_vacation. It would be even better if it was title Stoids Vacation, but I realize that’s hoping for a bit much.

So, here is code that I believe is needed.

This is the entire head section from the slide template file in the Simplicity skin (is this the sort of thing I should put CODE tags around?):

And of course, out of all that it appears the key part is in blue:

and to my clueless but reasonably intelligent eyes it appears that something about the albumTitle, “|” is key… it looks to me that somehow it’s asking if there is a file title and if there isn’t, default to the album title. So, if I’m right, the question becomes where does it look for fileTitle?

As always, any help is always appreciated.

Ookay, I have more information, but I’m still kinda stumped.

This page explains the variables. But I’m not sure how to tweak the template to use what I want:
[ul]
[li] label Base name (without extension) of file or folder[/li][li] fileName Full name of image/movie or folder[/li][li] title Alternative name for this file or folder, or if not set, same as label[/li][li] folderTitle Alternative name for this folder[/li][li] fileTitle Alternative name for this file (v8.0)[/li][li] currentFile File object representing the currently processed file. A more convenient shorthand for files[imageNum-1] (File)[/li][/ul]
If I could suss out where and how it tells the program to name the html files the same as the image files, it seems I could put together how to change the title as well… hmmm…

FYI, none of what you’ve posted is javascript. It IS a script language of sorts, but it appears to be something proprietary to jalbum.

It looks like what that’s curently coded to do is to write out the album title, then the filetitle unless that’s blank for that particular file. I’m betting that there’s no title defined for any of your images so you’re just getting the album title on each page.

Try changing this:


<title><%= writeTitle(albumTitle, "|") %><ja:if exists="fileTitle"> | ${**fileTitle**}</ja:if></title>


to


<title><%= writeTitle(albumTitle, "|") %><ja:if exists="**label**"> | ${**label**}</ja:if></title>


And see what you get. Also try changing that same two fileTitle entries to be either “title” or “fileName”. One of those 3 ought to work for you.

Almost there!

I think the program has been upgraded, and the code I have above is more complex, but the documentation gave the option of just putting in

<title>${Title}</title>

And said it would pick up the image title. It does, but it actually picks up the file title, with the .html. And now I’m puzzling over how to apply the “stripHTML” code that I see all over. Not having a lot of luck so far.

Hmmm…

Still plugging…

Ah! A reply! Thank you! I will work on what you have here.

By the way, I looked up “stripHTML” online in Javascript, and what’s on this page seems related to that:


var StrippedString = OriginalString.replace(/(<([^>]+)>)/ig,"");

Dude… you are kinda awesome. How much do I love you!