Hi Angel,

2010/11/28 Angel HerrŠez <angel.herraez@uah.es>
Hello Nico

I have no strong opinion on this new way for the extension you are proposing, but I will share some thoughts. Anything that can put Jmol in Wikipedia will be a great achievement.

I am still thinking of how the extension should be done, and my ideas change quite frequently (I thought about the HTML templates yesterday). So any new idea is quite welcome to find a good solution for the extension and manage to have it used on Wikipedia.

1. The Chrome problem with jmolWikiPopupWindow().
As far as I can test (Windows only), this is something specific to Chrome. Even Safari works, despite being Webkit-based too.
My testing suggests that the applet tag is somehow not rendering when built on-the-fly into a new window in Chrome. The source code gets there fine, the square is there, but the applet does not render. I can only fix it by a combination of
a) instead of opening an empty window document, open an existing html page and then feed the new content into it (overwriting in fact whatever the html page has).
b) avoid the use of w.document.close()

I can put these changes into the current Extension in SVN. I don't feel very happy about (b) not using document.close() --sometimes the browsers remain "loading" the page forever--, but it seems not to be giving much trouble in this case in all my test browsers. As for (a), it's one more file but no big fuss. I've tried to avoid using document.write in favour of DOM methods, but cannot manage to do that from one window for the other.

I must say that the HTML/JavaScript part is clearly not the place where I am at ease.
I let you†decide and modify this part as you wish.
(a) seems good for me, especially if we decide to use HTML templates.
(b) seems a trick, not very clean, but if we†don't a find an other way for Chrome we may have to†do this. (Maybe†doing this only for Chrome ?)

Still, I find no way to have the window title set in Safari and Chrome (text showing in the window top bar should be matching what has been given in the jmolWikiPopupWindow call).

Yes, it's also a problem, but almost minor.

2. In view of #1, I've been doing some testing for an alternative: rather than opening a popup window, create a div floating over the page content. This solution may also be preferred by the WP people.One requisite, in my opinion, is that it can be resized to get a larger Jmol. For this, one has to resort to additional external code, like jQuery + jQueryUI
I have something working, but I'm not sure about the overload that jQuery means (both in terms of downloaded files, not much, and also of dependency on external code).
People may or not like the solution more than the popup.

I agree that the popup window may not be the best solution for WP.
WP people seems more in favor of a media handler than a tag extension (https://bugzilla.wikimedia.org/show_bug.cgi?id=16491)
I started with popup because it seems easier to implement.
The code won't be completely useless if we change for an other solution.
And I already plan to†do the media handler in the future (but it's clearly more work, needing to understand some inner parts of MediaWiki)

Using†div can be good, but I am not sure having too much†dependencies will be much appreciated.
Should they be floating over the page content or inserted into the page content ?
I am not sure if resizing is really required (if we let each user choose the size of the applet in its preferences)

I clearly†don't have a†definitive idea on the subject.
There's always the possibility to propose several solutions, selected by configuration, but that means work.

> With the reactions from Wikipedia people, I havedecided to make the Jmol extension much simpler to use
> by editors of Wikipedia contents.

3. Are you sure that the WP people will not object to popups? We must be sure of that before proceeding.

I think that it's not their preferred solution, it's just easier for me to start with this.
We can rather work on†div if you think it's a better solution.

Media handler would be the preferred solution at the end, but most of the code for popup or†div can be reused in it.
I will look into it when we have something working and good looking for the first step (popup,†div, ...)

> For example, I am currently designing basic tags instead of the <jmol> tag :<jmolFile> to open a popup
> window with a Jmol applet for a molecular file already uploaded into Wikipedia, ...
> With this simpler tags, I think the PHP / Javascript / HTML can also be simpler.

4. Using a single tag will certainly help. I've been testing on several occasions the possibility of including a Jmol popup in the ChemBox and a major problem are the nested tags needed with the current Jmol Extension. They are impossible to fit in a wiki template (or at least I've been unable to find the way). A single tag will probably overcome this problem.

Yes, I think simpler tags will help (and it's simple to add also the {{#...}} notation which can work better in templates).

> My idea for the moment :
> *†† Having a HTML template for the popup window, that is an HTML file with a few variable parts. If
>†††† we need to havedifferent kinds of popup window (one for crystallography, one for proteins, ...), we
>†††† can have several templates and even let other people create their own templates.

5. So your idea is to depend on premade html templates that will contain the popup content. That can be a solution, although in principle seems to complicate things, since the template files will go in the Extension set of files you are right. I can help with that part.

Yes, that's the idea : the complexity is to create the templates (and the code working with them), but at the end the WP editor will find that using the Jmol extension is really simple.
But, other solutions are welcome.

> *†† The JavaScript file has a function with only a few parameters (url of the molecular file, title, template
>†††† to use, ...) for creating a popup window : it reads the HTML template, replaces the variables parts
>†††† anddisplays it in a popup window.

There may be a bit of trouble passing the parameters to the opened window, but it should be possible using template documents.