Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Plugin support
  3. » smd_slimbox

#316 2007-11-06 13:11:30

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Bloke wrote:

Just chatted to wouaren. He suggested looking at this site which details the exact problem and suggests a workaround.

I think I’m missing something… If I have a youtube video code: <object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/JMQ21p93JZc&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/JMQ21p93JZc&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object> where should I put the defer=“defer” attribute?

And, for other flash movies, should I put it as an attribute into the <txp:kml_flashembed> tag, or directly inside the plugin, thus hacking it? I tried the first, but it didn’t work…

Last edited by vittorio (2007-11-06 13:12:43)


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#317 2007-11-06 13:40:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,498
Website GitHub

Re: smd_slimbox

vittorio wrote:

If I have a youtube video code: <object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/JMQ21p93JZc&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/JMQ21p93JZc&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object> where should I put the defer=“defer” attribute?

Ah, right, I see. Sorry to confuse you! You use defer=“defer” if you are using swfobject. It goes in the javascript tag like this:

<script type="text/javascript" defer="defer">
so = new SWFObject("mymovie.swf" ...);
so.addParam("blah", "moreblah");
so.write("flashcontent");
</script>

I recently found out that if you are just using the <object> tag, the nested <embed> tag is unnecessary. It’s a legacy hangover from the way older browsers abused the <object> tag but should now be safe to remove. wouaren seems to think you can get away without it, even on IE6. This is my experience too, having just tried it out; with embed = IE crash; without embed = IE fine. Now, there may be a reason for leaving it in that I don’t know of, but perhaps that is what is causing the problem in this case? It can’t hurt to try your page without it and see what happens.

should I put it as an attribute into the <txp:kml_flashembed> tag, or directly inside the plugin

Unfortunately, from my 3-minute glance over kimili’s code, it doesn’t appear that defer=“defer” can be added via the plugin :-( I may have missed something but the only way I can see of doing it is to hack the plugin: everywhere there’s a <script src="..."> tag, add the ‘defer’ bit inside it.

Long term, I wonder if it might be worth talking to kimili and sending any relevant links over. He can then decide if it is in his interests to either add a defer option to the plugin (or make it defer by default), and maybe remove the nested <embed> tag. Or perhaps offer a plugin option to have it taken out/added.

What do you think?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#318 2007-11-06 14:31:41

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Bloke wrote:

I recently found out that if you are just using the <object> tag, the nested <embed> tag is unnecessary. It’s a legacy hangover from the way older browsers abused the <object> tag but should now be safe to remove. wouaren seems to think you can get away without it, even on IE6. This is my experience too, having just tried it out; with embed = IE crash; without embed = IE fine. Now, there may be a reason for leaving it in that I don’t know of, but perhaps that is what is causing the problem in this case? It can’t hurt to try your page without it and see what happens.

So I tried to modify the code of an embedded video removing the <embed> and leving the rest, which now is <object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/JMQ21p93JZc&rel=1"></param><param name="wmode" value="transparent"></param></object>, but now the video isn’t shown anymore, either on IE or FF. Good news is: no more of that odd error :-)

everywhere there’s a <script src="..."> tag, add the ‘defer’ bit inside it.

Found it twice, and added. Again, no video shown (with IE, while on FF works), but at least no error :-)
Off course, this issue is still far from being solved…

Last edited by vittorio (2007-11-06 14:35:39)


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#319 2007-11-06 14:49:21

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,498
Website GitHub

Re: smd_slimbox

vittorio wrote:

<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/JMQ21p93JZc&rel=1"></param><param name="wmode" value="transparent"></param></object>, but now the video isn’t shown anymore

Yeah, you need the data attribute to tell the object tag where the file is located :-) The <param name="movie"> is just for IE’s benefit. Here are a lot of examples. Also see my entry in the random banner docs about it.

Last edited by Bloke (2007-11-06 14:51:33)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#320 2007-11-06 15:12:54

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Bloke wrote:

Yeah, you need the data attribute to tell the object tag where the file is located :-) The <param name="movie"> is just for IE’s benefit. Here are a lot of examples. Also see my entry in the random banner docs about it.

Let’s see… now I have <object width="425" height="355" data="http://www.youtube.com/v/JMQ21p93JZc&rel=1"><param name="movie" value="http://www.youtube.com/v/JMQ21p93JZc&rel=1"></param><param name="wmode" value="transparent"></param></object>. Result? It works on FF, but it doesn’t in IE, which shows an empy box sized with the values passed in the height and width attributes.

I’m sorry that I’m not such an expert, otherwise I would have fixed it myself. But, in my personal case, it is more important to fix the display of the youtube videos, as I make quite a big use of them on my site. I was indeed wondering about removing kimili’s plugin (and the swfobject.js call in the <head> section) once for all, as I have no more than two or three flash movies that make use of it… But this wouldn’t solve the problem with youtube videos… Maybe trying with another plugin?


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#321 2007-11-06 15:35:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,498
Website GitHub

Re: smd_slimbox

vittorio wrote:

now I have @<object width=“425” height=“355” data=“http://www.youtube.com/v/JMQ21p93JZc&rel=1”> Result? It works on FF, but it doesn’t in IE, which shows an empy box

You’re getting closer then! How about adding the mandatory type attribute to the object tag as well? (type="application/x-shockwave-flash" ?) and if IE still doesn’t play ball, look at adding a classid= attribute as well? Under more complicated cases it mentions how to embed a quicktime movie for IE using the clsid: syntax. I can only assume that for a YouTube .flv/flash player plugin there must be a specific activeX control with a given class id. I don’t know what it is, but google might be able to find one for you.

FYI:
  • mov is clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B
  • media player is clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6
and I think (but am not sure) that:
  • flash is clsid:D27CDB6E-AE6D-11cf-96B8-444553540000

I’m sorry that I’m not such an expert

Hehehe, nor am I! I’m just making it up as I go along and hacking stuff together until it (sort of) works :-) I think it’s the best we can hope for with these browsers all doing stuff in their own unique little way.

btw, you may also like to look up conditional comments for IE. You might be able to put a specific <object> tag for IE and one for “other browsers”. Look at the ‘get embed code’ links on this random page I found and see how they do it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#322 2007-11-06 16:05:08

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Bloke wrote:

How about adding the mandatory type attribute to the object tag as well? (type="application/x-shockwave-flash" ?)

Ok, now it works! But, if I understood correctly, from now on I will not be able just to catch the <embed> code from youtube pages and paste it right into my article… it was so quick… :-)


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#323 2007-11-06 16:21:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,498
Website GitHub

Re: smd_slimbox

vittorio wrote:

Ok, now it works!

Yay! Got there in the end :-p

But, if I understood correctly, from now on I will not be able just to catch the <embed> code from youtube pages and paste it right into my article…

I guess not. If it contains the <embed> tag you’ll have to remove it if you want your pages to play on IE.

What’s baffling about this is that it obviously works in IE because it works on YouTube’s pages and they use an embed wrapped in an object. So it must be something on our pages like mootools, slimbox, maybe the position of the object in the document flow? But I haven’t a scooby what it is.

If anyone has any insight into what it may be, please please let me know so I can see if it’s a plugin issue or if it needs to be raised with the appropriate authors of 3rd party libraries.

The good news is, our story so far has at last been documented so next time it happens, post #312 is the place to start!

Last edited by Bloke (2007-11-06 16:22:03)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#324 2007-11-06 19:23:18

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Bloke wrote:

The good news is, our story so far has at last been documented so next time it happens, post #312 is the place to start!

Yeah, I will wait some time before manually editing the code of every video i posted so far… let’s hope someone comes out with a better solution!


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#325 2007-11-08 16:03:06

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Just a quick followup.

Stef,
i digged in the mootools forum (since i’m quite sure it is that script which causes IE to crash), and found this thread which sounds interesting. Especially when it says, on post #6:

IE often crashes if you try to append something (especially scripts) to the dom before it’s ready. I suggest putting your code in a Window.onDOMReady block so that you don’t try and execute any code before the dom is ready. This will allow you to remove the javascript from the page entirely.

Then I found this other thread, solved by moving all the javascript code at the end of the html file. I tried this solution, putting the mootools js just before the closing </body> tag, but it doesn’t seem to work at all: on IE, the page which normally crashes is loaded, but the browser output some error, and the slimboxed gallery doesn’t work. There was also a possible explication suggested, again involving the DOMReady-thing.

Thought that maybe it could be the reason, and it looks similar to what you said about moving a script above or below another. The problem is that is sounds like chinese for me (sorry, I’m not so experienced in coding, especially in javascript), but maybe it can tell you something…


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#326 2007-11-08 16:43:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,498
Website GitHub

Re: smd_slimbox

vittorio wrote:

IE often crashes if you try to append something (especially scripts) to the dom before it’s ready… putting the mootools js just before the closing </body> tag, but it doesn’t seem to work at all

With Slimbox it shouldn’t matter where the code is placed, because it already executes on DomReady (quite why slimbox is refusing to work at all is weird though). The only time it could cause an issue would be if IE lied about the DOM being ready when it actually wasn’t!

The acknowledged problem with SWFObject (fixed in the current v2 beta), however is certainly a problem if you include swfobject.js on your page. Moving that to the end of the page might help, or adding defer="defer" to the tag. I don’t know if externally referenced scripts (using the src="" attribute of the script tag) take notice of the defer though.

Unfortunately, this bug probably affects kml_flashembed and, as far as I know, there’s no way to guarantee that a plugin is loaded last on the page. The best kimili can hope for right now is to put the defer="defer" attribute in the <script> tags and wait for v2 of swfobject to be released. Or add a domReady() call himself somehow.

Now, if your page is crashing and you’re not loading swfobject/kml_flashembed anywhere and you’re not using <embed> then it’s a problem elsewhere and we’ll need to look deeper into your page code to work out why.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#327 2007-11-08 17:00:36

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Bloke wrote:

Now, if your page is crashing and you’re not loading swfobject/kml_flashembed anywhere and you’re not using <embed> then it’s a problem elsewhere and we’ll need to look deeper into your page code to work out why.

Sorry Stef, maybe I wasn’t clear enough. I disabled kimili’s plugin, and deleted the call for the swfobject js, so it isn’t a problem anymore. The issue is with the <embed> tag, and I am still trying to find a solution to avoid the manual editing of every video I posted so far.

What I don’t yet understand is: why my video pages load correctly on IE with no mootools script being called (even though we know that the code provided by youtube and such sites isn’t good), but they don’t when mootools is present? If I’m not wrong, this should be a common issue for everyone who uses mootools AND posts videos from youtube-like sites. So, when I read those post in the mootools forum, I thought I could have a chance of solution…

Edit: What about this thread which concerns IE’s weird “operation aborted” error and Slimbox in particular?

Last edited by vittorio (2007-11-08 17:34:45)


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#328 2007-11-08 21:03:10

raveoli
Member
From: Copenhagen
Registered: 2004-03-06
Posts: 205
Website

Re: smd_slimbox

I can install smd_lib 0.3, but the main slimbox plugin returns a “Badly formed or empty plugin code.” message.

I notice the slimbox plugin has strange linebreaks?! Every other plugin I’ve installed is one big massive chunk of code. Maybe you’ve saved it differently Stef?

Or can it be something else?

Last edited by raveoli (2007-11-08 21:11:53)

Offline

#329 2007-11-09 09:44:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,498
Website GitHub

Re: smd_slimbox

vittorio wrote:

I disabled kimili’s plugin, and deleted the call for the swfobject js, so it isn’t a problem anymore.

Right, cool. Thanks for researching this by the way, it’s much appreciated.

I looked at that link you sent. As you found out, Christophe says:

I think the problem is caused by the use of the onDomReady function of mootools in combination with document.write() in IE, in another conflicting Javascript. The quick fix is to either remove the document.write() or the other conflicting javascript or use window.addEvent(‘load’, Lightbox.init.bind(Lightbox)); in the last line of the Slimbox script instead of onDomReady.

Some people complain the ‘load’ method doesn’t work, but feel free to modify the last line of slimbox.js to try it. Just swap the ‘domready’ for ‘load’. The downside is that your lightbox won’t be available until the entire page has fully loaded. Incidentally, I found the reason your page does not show a lightbox: you moved mootools.js to the bottom of the document. The mootools library must appear before slimbox.js on the page. Try moving slimbox.js to the bottom of the page instead.

Having said that, looking at your page you have a lot of other javascript functions on there. Google Syndication, Technorati, and Feedburner to name three, plus some weird EO library (I have no idea what it does!)

Any one of those could be doing a document.write() at a time that IE (or mootools) thinks is inappropriate. It certainly looks like Technorati does a document.write() without waiting for the DOM, perhaps that’s the culprit? Maybe add a defer=“defer” to that <script> tag?

It may well be mootools itself, in which case we’re stuck with it until they release an update. But I’m leaning towards it being IE itself since Micro$oft claim it’s a bug in IE6 (and 7 which is inexcusable given it was in development along with Vista for, like, 6 years!) that is triggered if a piece of javascript attempts to modify an element that is not fully loaded. What it should do is trigger a javacript error not “operation aborted”, but that’s M$ devs for ya :-p

If at all possible, try moving the call to technorati a bit lower down the page or add the defer=“defer” to the tag. I know having to move things around on the page is silly and annoying but if it means you can use <embed> and save yourself a load of hassle then it’s worth it. What’s slightly baffling still is that it goes away if you remove <embed>. Perhaps Micro$oft’s implementation of the the embed tag itself modifies the DOM behind the scenes. Now that would be ironic :-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#330 2007-11-09 10:00:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,498
Website GitHub

Re: smd_slimbox

raveoli wrote:

the main slimbox plugin returns a “Badly formed or empty plugin code.” message. I notice the slimbox plugin has strange linebreaks?!

Hmm, not saved it any differently to usual. Straight out of the awesome ied_plugin_composer. But I know some people do have difficulty (no ideas why it works for some and not others, perhaps the text editor or browser the code was copied out of?) because the plugin’s so big now (mostly documentation).

For that reason I’ve now put all the docs online, I distribute the docs as a standalone file in the zip with the plugin and I’m going to start encoding the plugin with only a contents page that links back to my web site for the full docs.

You can be the first person to try it out. Let me know if that fixes it.

Last edited by Bloke (2007-11-09 10:01:41)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

  1. Index
  2. » Plugin support
  3. » smd_slimbox

Board footer

Powered by FluxBB