1 /* This piece of code is directly requested by the page the player is embedded |
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 |
2 on. It creates the iframe the player is embedded in and it reflects changes |
3 to the iframe url in the page url. |
3 to the iframe url in the page url. |
4 */ |
4 */ |
5 |
5 |
6 (function(_frameId) { |
6 if (typeof IriSP === "undefined") { |
7 var _frame = document.getElementById(_frameId); |
7 IriSP = {}; |
|
8 } |
|
9 |
|
10 IriSP.iFrameUpdater = function(_frameId) { |
8 |
11 |
9 window.onhashchange = function() { |
12 var _frame = document.getElementById(_frameId), |
10 frame.contentWindow.postMessage({type: "hashchange", hash: hashvalue}, "*"); |
13 _blocked = false, |
11 }; |
14 _updater = function() { |
12 |
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 |
13 window.addEventListener('message', function(_e) { |
24 window.addEventListener('message', function(_e) { |
14 if (e.data.type === "hashchange") { |
25 if (/^#/.test(_e.data) && !_blocked) { |
15 document.location.hash = e.data.hash; |
26 document.location.hash = _e.data; |
16 } |
27 } |
17 }); |
28 }); |
18 |
29 |
19 })("metadataplayer_embed"); |
30 window.setTimeout(_updater, 2000); |
|
31 |
|
32 }; |