Commit 7c349c4bbe1301bbf91d9086c9ec96ea9cc2f0ac
1 parent
1e5b4384
Exists in
master
and in
5 other branches
fix overlay iframe/video problem on IE (fix #324
Showing
1 changed file
with
41 additions
and
2 deletions
Show diff stats
js/main.js
| ... | ... | @@ -1225,10 +1225,49 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun |
| 1225 | 1225 | e.preventDefault(); |
| 1226 | 1226 | }); |
| 1227 | 1227 | |
| 1228 | + // hack-fix to support z-index over video/iframe | |
| 1229 | + function checkIframes () { | |
| 1230 | + | |
| 1231 | + $('iframe').each(function(){ | |
| 1232 | + var $iframe = $(this); | |
| 1233 | + var url = $iframe.attr('src'); | |
| 1234 | + var c = '?'; | |
| 1235 | + | |
| 1236 | + // console.log('url', url); | |
| 1237 | + // console.log('url.indexOf("youtube")', url.indexOf("youtube")); | |
| 1238 | + if(url.indexOf("youtube") === -1){ | |
| 1239 | + // is not a iframe of youtube | |
| 1240 | + // console.debug('is not a iframe of youtube'); | |
| 1241 | + return; | |
| 1242 | + } | |
| 1243 | + | |
| 1244 | + if(url.indexOf("wmode=opaque") !== -1){ | |
| 1245 | + // already in opaque mode | |
| 1246 | + // console.debug('already in opaque mode'); | |
| 1247 | + return; | |
| 1248 | + } | |
| 1249 | + | |
| 1250 | + if(url.indexOf('?') !== -1){ | |
| 1251 | + c = '&'; | |
| 1252 | + } | |
| 1253 | + | |
| 1254 | + $iframe.attr("src",url+c+"wmode=opaque"); | |
| 1255 | + // console.debug('iframe changed to opaque mode'); | |
| 1256 | + }); | |
| 1257 | + | |
| 1258 | + setTimeout(checkIframes, 500); | |
| 1259 | + } | |
| 1260 | + checkIframes(); | |
| 1261 | + // $(document).bind('DOMSubtreeModified', function(e){ | |
| 1262 | + // console.log('this', this); | |
| 1263 | + // console.log('e', e); | |
| 1264 | + | |
| 1265 | + // }); | |
| 1266 | + | |
| 1228 | 1267 | }); |
| 1229 | 1268 | |
| 1230 | - window.addEventListener("message", function(ev) { | |
| 1231 | - if (ev.data.message === "oauthClientPluginResult") { | |
| 1269 | + window.addEventListener('message', function(ev) { | |
| 1270 | + if (ev.data.message === 'oauthClientPluginResult') { | |
| 1232 | 1271 | Main.loginCallback(ev.data.logged_in, ev.data.private_token, ev.data.user); |
| 1233 | 1272 | ev.source.close(); |
| 1234 | 1273 | } | ... | ... |