Play YouTube Getting Started Tutorials inside the JavaFX WebView (BETA)
This commit is contained in:
parent
020748e099
commit
1dbab0a68e
|
@ -56,7 +56,7 @@ public class GettingStartedStage {
|
|||
|
||||
private static GettingStartedStage create() {
|
||||
Stage stage = new Stage();
|
||||
stage.setResizable(false);
|
||||
stage.setResizable(true);
|
||||
|
||||
if (isWindowsApp()) {
|
||||
stage.getIcons().setAll(ResourceManager.getApplicationIconResources().map(URL::toString).map(Image::new).toArray(Image[]::new));
|
||||
|
@ -79,9 +79,6 @@ public class GettingStartedStage {
|
|||
webview.getEngine().load(getEmbeddedHelpURL());
|
||||
webview.setPrefSize(750, 490);
|
||||
|
||||
// intercept target _blank click events and open links in a new browser window
|
||||
webview.getEngine().setCreatePopupHandler((config) -> onPopup(webview));
|
||||
|
||||
webview.getEngine().getLoadWorker().stateProperty().addListener((v, o, n) -> {
|
||||
if (n == Worker.State.SUCCEEDED) {
|
||||
stage.setTitle(webview.getEngine().getTitle());
|
||||
|
@ -126,13 +123,4 @@ public class GettingStartedStage {
|
|||
}
|
||||
}
|
||||
|
||||
protected WebEngine onPopup(WebView webview) {
|
||||
// get currently select image via Galleria API
|
||||
Object uri = webview.getEngine().executeScript("$('.galleria').data('galleria').getData().link");
|
||||
openURI(uri.toString());
|
||||
|
||||
// prevent current web view from opening the link
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ function getData() {
|
|||
thumb: 'images/node.screenshot.thumb.png'
|
||||
}]
|
||||
|
||||
var links = location.hash.length > 0
|
||||
var links = false
|
||||
var youtube = !(/zh(.CN)?/i).test(navigator.locale ? navigator.locale : navigator.language) // YouTube is blocked in China (mainland)
|
||||
|
||||
if (links) {
|
||||
|
|
Loading…
Reference in New Issue