diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..753c3ae
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,128 @@
+
+# Created by https://www.gitignore.io/api/xcode,macos,appcode
+# Edit at https://www.gitignore.io/?templates=xcode,macos,appcode
+
+### AppCode ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+# JetBrains templates
+**___jb_tmp___
+
+### AppCode Patch ###
+# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
+
+# *.iml
+# modules.xml
+# .idea/misc.xml
+# *.ipr
+
+# Sonarlint plugin
+.idea/sonarlint
+
+### macOS ###
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### Xcode ###
+# Xcode
+#
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
+
+## User settings
+xcuserdata/
+
+## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
+*.xcscmblueprint
+*.xccheckout
+
+## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
+build/
+DerivedData/
+*.moved-aside
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+
+### Xcode Patch ###
+*.xcodeproj/*
+!*.xcodeproj/project.pbxproj
+!*.xcodeproj/xcshareddata/
+!*.xcworkspace/contents.xcworkspacedata
+/*.gcno
+**/xcshareddata/WorkspaceSettings.xcsettings
+
+# End of https://www.gitignore.io/api/xcode,macos,appcode
\ No newline at end of file
diff --git a/macOS/PiPifier macOS.xcodeproj/project.pbxproj b/macOS/PiPifier macOS.xcodeproj/project.pbxproj
index 82b85f1..ab07a2e 100644
--- a/macOS/PiPifier macOS.xcodeproj/project.pbxproj
+++ b/macOS/PiPifier macOS.xcodeproj/project.pbxproj
@@ -197,7 +197,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
- LastUpgradeCheck = 0820;
+ LastUpgradeCheck = 1020;
ORGANIZATIONNAME = APPenzeller;
TargetAttributes = {
11F1B4FD1D4EC0CC0041579B = {
@@ -229,7 +229,7 @@
};
buildConfigurationList = 11F1B4F91D4EC0CC0041579B /* Build configuration list for PBXProject "PiPifier macOS" */;
compatibilityVersion = "Xcode 3.2";
- developmentRegion = English;
+ developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
@@ -321,15 +321,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -370,15 +378,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -417,7 +433,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 4.0;
};
name = Debug;
};
@@ -436,7 +452,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 4.0;
};
name = Release;
};
@@ -454,7 +470,7 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 4.0;
};
name = Debug;
};
@@ -472,7 +488,7 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 4.0;
};
name = Release;
};
diff --git a/macOS/PiPifier macOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macOS/PiPifier macOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/macOS/PiPifier macOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/macOS/PiPifier-Safari-Extension/SafariExtensionHandler.swift b/macOS/PiPifier-Safari-Extension/SafariExtensionHandler.swift
index b1ce37e..8c80237 100644
--- a/macOS/PiPifier-Safari-Extension/SafariExtensionHandler.swift
+++ b/macOS/PiPifier-Safari-Extension/SafariExtensionHandler.swift
@@ -36,7 +36,7 @@ class SafariExtensionHandler: SFSafariExtensionHandler {
// Credits to espenbye for pointing out that this works in fullscreen as well
// See: https://github.com/arnoappenzeller/PiPifier/issues/4
getActivePage {
- $0?.dispatchMessageToScript(withName: "enablePiP", userInfo: nil)
+ $0?.dispatchMessageToScript(withName: "togglePiP", userInfo: nil)
}
}
diff --git a/macOS/PiPifier-Safari-Extension/script.js b/macOS/PiPifier-Safari-Extension/script.js
index 314cd63..e057f09 100644
--- a/macOS/PiPifier-Safari-Extension/script.js
+++ b/macOS/PiPifier-Safari-Extension/script.js
@@ -14,8 +14,8 @@ function dispatchMessage(messageName, parameters) {
}
function messageHandler(event) {
- if (event.name === "enablePiP" && getVideo() != null) {
- enablePiP();
+ if (event.name === "togglePiP" && getVideo() != null) {
+ togglePiP();
} else if (event.name === "addCustomPiPButtonToPlayer") {
window[event.message.callback]() //Calls the function specified as callback
}
@@ -42,8 +42,9 @@ function getVideo() {
return document.getElementsByTagName('video')[0];
}
-function enablePiP() {
- getVideo().webkitSetPresentationMode('picture-in-picture');
+function togglePiP() {
+ const video = getVideo();
+ video.webkitSetPresentationMode(video.webkitPresentationMode === 'picture-in-picture' ? 'inline' : 'picture-in-picture');
}
//----------------- Custom Button Methods -----------------
@@ -78,7 +79,7 @@ function addYouTubeButton() {
var button = document.createElement("button");
button.className = "ytp-button PiPifierButton";
button.title = "PiP (by PiPifier)";
- button.onclick = enablePiP;
+ button.onclick = togglePiP;
//TODO add style
//button.style.backgroundImage = 'url('+ whiteSVG_Icon + ')';
var buttonImage = document.createElement("img");
@@ -102,7 +103,7 @@ function addVideoJSButton() {
var button = document.createElement("button");
button.className = "PiPifierButton vjs-control vjs-button";
button.title = "PiP (by PiPifier)";
- button.onclick = enablePiP;
+ button.onclick = togglePiP;
var buttonImage = document.createElement("img");
buttonImage.src = whiteSVG_Icon;
buttonImage.width = 16;
@@ -123,7 +124,7 @@ function addWistiaButton() {
button.className = "PiPifierButton w-control w-control--fullscreen w-is-visible";
button.alt = "Picture in Picture";
button.title = "PiP (by PiPifier)";
- button.onclick = enablePiP;
+ button.onclick = togglePiP;
var buttonImage = document.createElement("img");
buttonImage.src = whiteSVG_Icon;
buttonImage.width = 28;
@@ -145,7 +146,7 @@ function addNetflixButton(timeOutCounter) {
var button = document.createElement("button");
button.className = "PiPifierButton";
button.title = "PiP (by PiPifier)";
- button.onclick = enablePiP;
+ button.onclick = togglePiP;
button.style.backgroundColor = "transparent";
button.style.border = "none";
button.style.maxHeight = "inherit";
diff --git a/macOS/PiPifier/Base.lproj/Main.storyboard b/macOS/PiPifier/Base.lproj/Main.storyboard
index 8e4ca8b..196e5c7 100644
--- a/macOS/PiPifier/Base.lproj/Main.storyboard
+++ b/macOS/PiPifier/Base.lproj/Main.storyboard
@@ -1,8 +1,8 @@
-
+
-
+
@@ -600,7 +600,7 @@