| author | veltr |
| Tue, 22 May 2012 16:49:48 +0200 | |
| branch | new-model |
| changeset 906 | 4b6e154ae8de |
| parent 882 | 61c384dda19e |
| child 910 | b9f1bd52df9a |
| permissions | -rw-r--r-- |
| 589 | 1 |
/* This piece of code is directly requested by the page the player is embedded |
2 |
on. It creates the iframe the player is embedded in and it reflects changes |
|
3 |
to the iframe url in the page url. |
|
4 |
*/ |
|
5 |
||
| 906 | 6 |
if (typeof IriSP === "undefined") { |
7 |
IriSP = {}; |
|
8 |
} |
|
9 |
||
10 |
IriSP.iFrameUpdater = function(_frameId) { |
|
| 882 | 11 |
|
| 906 | 12 |
var _frame = document.getElementById(_frameId), |
13 |
_blocked = false, |
|
14 |
_updater = function() { |
|
15 |
_blocked = true; |
|
16 |
window.setTimeout(function() { |
|
17 |
_blocked = false; |
|
18 |
}, 1000); |
|
19 |
_frame.contentWindow.postMessage(document.location.hash, "*"); |
|
20 |
}; |
|
21 |
|
|
22 |
window.onhashchange = _updater; |
|
23 |
|
|
| 882 | 24 |
window.addEventListener('message', function(_e) { |
| 906 | 25 |
if (/^#/.test(_e.data) && !_blocked) { |
26 |
document.location.hash = _e.data; |
|
|
809
1997dae651c6
added some code to handle embedding in an iframe and mediafragment.
hamidouk
parents:
589
diff
changeset
|
27 |
} |
| 882 | 28 |
}); |
29 |
|
|
| 906 | 30 |
window.setTimeout(_updater, 2000); |
31 |
|
|
32 |
}; |