This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1228929 - [TV] Seperate the Send-to-TV offline content from the i…
…frame. r=rexboy, a=jocheng
- Loading branch information
1 parent
44ddb12
commit 2d54c29
Showing
8 changed files
with
83 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,50 @@ | ||
/* global FTEWizard */ | ||
(function (exports) { | ||
'use strict'; | ||
|
||
window.addEventListener('load', function() { | ||
var src = !navigator.onLine ? | ||
'offline_content/index.html' : | ||
'https://casttv.services.mozilla.com'; | ||
|
||
var mozIframe = document.querySelector('#mozIframe[mozbrowser]'); | ||
mozIframe.src = src; | ||
|
||
mozIframe.addEventListener('mozbrowserloadend', () => { | ||
mozIframe.focus(); | ||
}); | ||
|
||
// The call of window.close by content inside iframe(even with mozbrowser) | ||
// is not allowed and does't not trigger the mozbrowserclose event. | ||
// As a result, we use the mozbrowserlocationchange event to observe | ||
// when user finishes the tutorial. | ||
mozIframe.addEventListener('mozbrowserlocationchange', (e) => { | ||
if (e.detail === mozIframe.src + '#finished') { | ||
var offlineContent = document.querySelector('#offline-content'); | ||
var mozIframe = document.querySelector('#moz-iframe[mozbrowser]'); | ||
|
||
if (navigator.onLine) { | ||
mozIframe.classList.remove('hidden'); | ||
|
||
mozIframe.addEventListener('mozbrowserloadend', () => { | ||
mozIframe.focus(); | ||
}); | ||
|
||
// The call of window.close by content inside iframe(even with mozbrowser) | ||
// is not allowed and does't not trigger the mozbrowserclose event. | ||
// As a result, we use the mozbrowserlocationchange event to observe | ||
// when user finishes the tutorial. | ||
mozIframe.addEventListener('mozbrowserlocationchange', (e) => { | ||
if (e.detail === mozIframe.src + '#finished') { | ||
window.close(); | ||
} | ||
}); | ||
|
||
// The mozbrowserclose event would be trrigered when content inside iframe | ||
// is crashed. When crashed, let's just leave this app. | ||
mozIframe.addEventListener('mozbrowserclose', () => { | ||
window.close(); | ||
} | ||
}); | ||
|
||
// The mozbrowserclose event would be trrigered when content inside iframe | ||
// is crashed. When crashed, let's just leave this app. | ||
mozIframe.addEventListener('mozbrowserclose', () => { | ||
window.close(); | ||
}); | ||
}); | ||
|
||
mozIframe.src = 'https://casttv.services.mozilla.com'; | ||
} else { | ||
|
||
offlineContent.classList.remove('hidden'); | ||
|
||
var tutorial = new FTEWizard('flingTutorial'); | ||
tutorial.init({ | ||
container: offlineContent, | ||
pageClass: 'slide', | ||
buttonsClass: 'slide-button', | ||
launchEveryTime: true, | ||
onfinish: function () { | ||
window.close(); | ||
}.bind(tutorial) | ||
}); | ||
} | ||
}); | ||
|
||
})(window); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 2 additions & 20 deletions
22
...-tutorial/style/offline_content/index.css → .../fling-tutorial/style/offline_content.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters