Play YouTube Getting Started Tutorials inside the JavaFX WebView (BETA)

This commit is contained in:
Reinhard Pointner 2017-06-03 03:27:09 +08:00
parent 1dbab0a68e
commit c7f8920ce0
1 changed files with 7 additions and 8 deletions

View File

@ -48,10 +48,10 @@ function getData() {
thumb: 'images/node.screenshot.thumb.png'
}]
var links = false
var embed = location.hash.length > 0
var youtube = !(/zh(.CN)?/i).test(navigator.locale ? navigator.locale : navigator.language) // YouTube is blocked in China (mainland)
if (links) {
if (embed) {
data = data.slice(0, 5) // use only tutorial images
if (location.hash == '#mas') {
@ -66,14 +66,13 @@ function getData() {
}
}
if (!links) {
data.forEach(function(it) {
it.video = it[youtube ? 'link' : 'video']
})
}
data.forEach(function(it) {
it.video = it[youtube ? 'link' : 'video']
})
if (!youtube) {
data.forEach(function(it) {
it[links ? 'link' : 'iframe'] = it.video
it['iframe'] = it.video
delete it.video
})
}