.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Scenarios, Maps and Mods (http://forum.shrapnelgames.com/forumdisplay.php?f=146)
-   -   Spell Guide Beta-0 (http://forum.shrapnelgames.com/showthread.php?t=36617)

Edi November 14th, 2007 03:23 AM

Re: Spell Guide Beta-0
 
Burnsaber, actually I've had nothing to do with this. The reason you're seeing the true/false values in Finnish is that you're using a Finnish language version of Excel, it translates the formula and the output. Nifty little tool, this one. I couldn't have done that, since I'm not current on the intricacies of spell modding.

Snoddasmannen November 14th, 2007 03:26 AM

Re: Spell Guide Beta-0
 
Quote:

lch said:
First thing to do, serve the right content type. Currently the xmlspells.php script returns the Content-Type: text/html, while it should be text/xml. You can set the right content-type via header()

Ah, nice one lch! Fixed that, so now it ... kinda ... works in firefox. For some reason, firefox doesn't pick up on the fact that the replacement div has the 'spelldiv' id, so it isn't styled properly. And even worse, when it tries to replace spelldiv the next time, it simply fails since it can't find it http://forum.shrapnelgames.com/images/smilies/happy.gif But you can get a list now in firefox, though it doesn't look like much of a list, and you have to reload the page to do a second search.

Any ideas on what I could do to fix that would, yet again, be much appreciated.

jimkehn and DrPraetorious, are you having problems in Opera or are you using some other web browser? Obviously, for the 99% of the world who are not yet using Opera, the page has some problems for now http://forum.shrapnelgames.com/images/smilies/frown.gif

lch November 14th, 2007 06:42 AM

Re: Spell Guide Beta-0
 
Quote:

Snoddasmannen said:
jimkehn and DrPraetorious, are you having problems in Opera or are you using some other web browser? Obviously, for the 99% of the world who are not yet using Opera, the page has some problems for now http://forum.shrapnelgames.com/images/smilies/frown.gif

If you care about your visitors at all you should either use a cross-browser solution like the last two mentioned in http://ajaxpatterns.org/Browser-Side...World_Examples or better yet change to server-side XSLT and a form.

DrPraetorious November 14th, 2007 09:20 AM

Re: Spell Guide Beta-0
 
"Exception while loading: SpellDiv has no properties."

IE just sits there slackjawed and drools, but that's not a surprise http://forum.shrapnelgames.com/images/smilies/happy.gif

Snoddasmannen November 14th, 2007 01:42 PM

Re: Spell Guide Beta-0
 
Quote:

lch said:
If you care about your visitors at all you should either use a cross-browser solution like the last two mentioned in http://ajaxpatterns.org/Browser-Side...World_Examples or better yet change to server-side XSLT and a form.

Hihi, that's a fair point!

My priority right now is learning and exploring some interesting web technologies. Using a pre-packaged framework is not very interesting for me since I wanted to start with the basics. Using server side XSLT is indeed something I have considered as a fallback, and I'll probably end up there if I find time/interest to finalize this thing.

Quote:


"Exception while loading: SpellDiv has no properties."


Yeah that's from firefox right? It's weird. Using the firefox dom inspector, I can clearly see the spell div, spell table and all the spells nicely tucked in there with the images and everything. But visually it still looks like it's just dumped the whole xml document in there without any xslt transformation. And getElementById('spelldiv') returns null ...

lch November 14th, 2007 02:28 PM

Re: Spell Guide Beta-0
 
Quote:

Snoddasmannen said:
Yeah that's from firefox right? It's weird. Using the firefox dom inspector, I can clearly see the spell div, spell table and all the spells nicely tucked in there with the images and everything. But visually it still looks like it's just dumped the whole xml document in there without any xslt transformation.

I guess that's because you are overwriting the element in <font class="small">Code:</font><hr /><pre>parent.replaceChild(result.firstChild,spellD iv);</pre><hr /> instead of overwriting the innerHTML element or something like that. Usually Mozilla is the closest to implement the specifications, so I guess that you're doing it wrong.

Here's what the element looks like before the replace:
http://i10.tinypic.com/81qyqed.png
and here's what it looks like afterwards:
http://i7.tinypic.com/6ocxbnl.png

Snoddasmannen November 14th, 2007 06:45 PM

Re: Spell Guide Beta-0
 
Hihi, actually you can make it look fine in firefox by opening firebug and having a look at the BODY tag's innerhtml attribute. Just doubleclick on it and leave the field without changing anything. I assume this forces an update of some internal structure and voila the table appears nicely. So obviously some FF quirk involved here.

There's probably an easy workaround to force it to do that without using firebug.

Apparently no support in FF2 yet for the nth-child-of css pseudoclass, so all the lines are white http://forum.shrapnelgames.com/images/smilies/frown.gif

By the way, it's quite likely that I'm doing some kind of corner case here which is poorly defined in the specs. Or at least working in a way which is not well explored or commonly used. Obviously firefox has excellent support for this kind of stuff in general.

EDIT: Added this line:
<font class="small">Code:</font><hr /><pre>document.firstChild.innerHTML += "";</pre><hr />
So now it actually works in firefox as well http://forum.shrapnelgames.com/images/smilies/happy.gif

lch November 14th, 2007 07:30 PM

Re: Spell Guide Beta-0
 
This workaround resets the whole formular, though, all the values are reset to zero. Don't use workarounds as solution.

If you want to have it working in Mozilla, then you should have read how Mozilla handles these things first. http://forum.shrapnelgames.com/image...ies/tongue.gif Your first problem is already mentioned in there:
Quote:

Mozilla requires that you send the XML and XSLT files with an XML mimetype (text/xml or application/xml). This is the most common reason why XSLT won't run in Mozilla but will in Internet Explorer. Mozilla is strict in that way.

The second problem is that you're replacing a DOM node by something of a different type. If I am reading the last paragraph in that article right then you can probably use transformToFragment() to have it working correctly. You are trying to put a DOM document into another one, not good.

jimkehn November 14th, 2007 09:24 PM

Re: Spell Guide Beta-0
 
snoddasmannen, I get:

Exception while loading: [object error]

Snoddasmannen November 15th, 2007 03:17 AM

Re: Spell Guide Beta-0
 
Quote:

lch said:
The second problem is that you're replacing a DOM node by something of a different type. If I am reading the last paragraph in that article right then you can probably use transformToFragment() to have it working correctly. You are trying to put a DOM document into another one, not good.

Actually I'm putting the firstChild of a dom document, ie the spelldiv, into another document. The resulting dom tree is obviously correct, but Mozilla isn't updating it correctly for some reason.

Doesn't make any sense to me why I would need to specify the destination document of a node at the time of creation, but on the other hand XSLTProcessor is a mozilla invention so they can do whatever they want with it.

But enough whining, I switched to transformToFragment() and yay it seems to work even without the ugly workaround! http://forum.shrapnelgames.com/images/smilies/happy.gif Thanks lhc!

jimkehn, which browser are you using?


All times are GMT -4. The time now is 04:31 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.