Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the ability for popups to show on the main webview and for the … #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Helium/Helium/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Application-->
Expand Down Expand Up @@ -43,7 +45,7 @@
<action selector="openFilePress:" target="Voe-Tx-rLC" id="0N6-YY-4Wb"/>
</connections>
</menuItem>
<menuItem title="Actions" hidden="YES" id="dMs-cI-mzQ">
<menuItem title="Actions" id="dMs-cI-mzQ">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Actions" id="bib-Uj-vzu">
<items>
Expand Down Expand Up @@ -200,6 +202,9 @@
<windowPositionMask key="initialPositionMask" rightStrut="YES" topStrut="YES"/>
<rect key="contentRect" x="1101" y="707" width="480" height="275"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<connections>
<outlet property="delegate" destination="B8D-0N-5wS" id="0GO-6d-m3m"/>
</connections>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
Expand Down
22 changes: 19 additions & 3 deletions Helium/Helium/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class WebViewController: NSViewController, WKNavigationDelegate {
view.addSubview(webView)
webView.frame = view.bounds
webView.autoresizingMask = [NSView.AutoresizingMask.height, NSView.AutoresizingMask.width]

webView.configuration.preferences.javaScriptEnabled = true
webView.configuration.preferences.javaEnabled = true
webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true
// Allow plug-ins such as silverlight
webView.configuration.preferences.plugInsEnabled = true

Expand All @@ -31,7 +33,8 @@ class WebViewController: NSViewController, WKNavigationDelegate {

// Setup magic URLs
webView.navigationDelegate = self

webView.uiDelegate = self as! WKUIDelegate

// Allow zooming
webView.allowsMagnification = true

Expand All @@ -40,7 +43,7 @@ class WebViewController: NSViewController, WKNavigationDelegate {

// Listen for load progress
webView.addObserver(self, forKeyPath: "estimatedProgress", options: NSKeyValueObservingOptions.new, context: nil)

clear()
}

Expand Down Expand Up @@ -166,6 +169,7 @@ class WebViewController: NSViewController, WKNavigationDelegate {
}

func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {

}

// Redirect Hulu and YouTube to pop-out videos
Expand Down Expand Up @@ -338,3 +342,15 @@ extension String {
}
}
}

extension WebViewController: WKUIDelegate {

public func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {

webView.url
webView.load(navigationAction.request)

return nil;
}

}