So here's the new customization:
embedSWF: function(...) {
...
if (hasPlayerVersion(swfVersionStr)) {
...
}
else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion
("6.0.65") && (ua.win || ua.mac)) {
...
}
// XXX My customization.
//
else
{
addDomLoadEvent(function() {
var e = getElementById ( replaceElemIdStr );
var c = e.getElementsByTagName ( "noscript" );
if ( c.length > 0 && c [ 0 ].textContent != null && c
[ 0 ].textContent.length > 0 )
{
e.innerHTML = c [ 0 ].textContent;
}
else
{
var scan = e.firstChild;
while ( scan != null )
{
if ( scan.nodeType == 8 )
{
var value = scan.nodeValue;
value = value.replace ( new
RegExp ( "__escaped_end_comment__",
"g" ), "-->" );
e.innerHTML = value;
break;
}
scan = scan.nextSibling;
}
}
});
}
},
It's designed to work with alternate content formatted like so:
<div id="flashcontent">
<noscript>
<!-- Alternate content. -->
<a href="http://www.adobe.com/go/getflashplayer">
<img
src="http://www.adobe.com/images/shared/download_buttons/
get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<img src="massive_image.jpg" />
</noscript>
<!--
<!-- Alternate content. __escaped_end_comment__
<a href="http://www.adobe.com/go/getflashplayer">
<img
src="http://www.adobe.com/images/shared/download_buttons/
get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<img src="massive_image.jpg" />
-->
</div>
Note that the alternate content is listed twice - once in a noscript
tag and then again in an HTML comment. Also note that any HTML comment
end tags in the alternate content need to be escaped when in the HTML
comment. Here I've chosen the token "__escaped_end_comment__".
So then, considering this in the 4 scenarios I've laid out, we get
this:
For scenario 1, the visitor sees the alternate content because the
contents of "noscript" are rendered by the browser by the nature of
the "noscript" element. The alternate content in the comment tag is
ignored as a comment.
For scenario 2, the visitor is not shown the alternate content and is
shown the express installer. This is standard SWFObject behavior with
the exception that nothing in the alternate content element is loaded
because it's in a "noscript" element. The alternate content in the
comment tag is ignored as a comment.
For scenario 3, the customization pulls the contents of the first
"noscript" element out and uses it to populate the alternate content
element. In the case that no alternate content is found this way
(i.e., it's likely a WebKit browser), the contents of the first HTML
content are used after replacing "__escaped_end_comment__" with the
HTML comment end tag "-->". As a result, the visitor sees the
alternate content either from the noscript tag or the HTML comment.
For scenario 4, the visitor is shown the SWF. This is standard
SWFObject behavior with the exception that nothing in the alternate
content element is loaded because it's in a "noscript" element. The
alternate content in the comment tag is ignored as a comment.
So like I said, not very pretty but if you value the effect then I
suppose it's worth it.
-Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SWFObject" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/swfobject?hl=en
-~----------~----~----~----~------~----~------~--~---