summaryrefslogtreecommitdiff
path: root/functions.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-06-22 16:50:17 +0400
committerAndrew Dolgov <[email protected]>2009-06-22 16:50:17 +0400
commit9324c2c24f4b3ee7e5e26e577775985d7bd84f99 (patch)
treeaf8469c7b225fde650aac130e4aa64fbe74aa35d /functions.js
parent99ea1043da1e1a737031ed873bbd05d175b3e1a6 (diff)
rework appearance of audio/video tags patch
Diffstat (limited to 'functions.js')
-rw-r--r--functions.js42
1 files changed, 23 insertions, 19 deletions
diff --git a/functions.js b/functions.js
index 5c1b26a59..81cadfe08 100644
--- a/functions.js
+++ b/functions.js
@@ -2134,25 +2134,29 @@ function truncate_string(s, length) {
return tmp;
}
function switchToFlash(e) {
- var targ = e;
- if (!e) var e = window.event;
- if (e.target) targ = e.target;
- else if (e.srcElement) targ = e.srcElement;
- if (targ.nodeType == 3) // defeat Safari bug
- targ = targ.parentNode;
-
- //targ is the link that was clicked
- var audioTag=targ;
- do {
- audioTag=audioTag.previousSibling;
- } while(audioTag && audioTag.nodeType != 1)
-
- var flashPlayer = audioTag.getElementsByTagName('div')[0];
- targ.parentNode.insertBefore(flashPlayer,targ);
- targ.parentNode.removeChild(targ);
- audioTag.parentNode.removeChild(audioTag);
-
- return false;
+ try {
+ var targ = e;
+ if (!e) var e = window.event;
+ if (e.target) targ = e.target;
+ else if (e.srcElement) targ = e.srcElement;
+ if (targ.nodeType == 3) // defeat Safari bug
+ targ = targ.parentNode;
+
+ //targ is the link that was clicked
+ var audioTag=targ;
+ do {
+ audioTag=audioTag.previousSibling;
+ } while(audioTag && audioTag.nodeType != 1)
+
+ var flashPlayer = audioTag.getElementsByTagName('span')[0];
+ targ.parentNode.insertBefore(flashPlayer,targ);
+ targ.parentNode.removeChild(targ);
+ audioTag.parentNode.removeChild(audioTag);
+
+ return false;
+ } catch (e) {
+ exception_error("switchToFlash", e);
+ }
}
function html5AudioOrFlash(type) {
var audioTag = document.createElement('audio');