diff --git a/README.md b/README.md
index 16072ba..9a28370 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,8 @@
## Contents
- [Features](#features)
- [Installation](#installation)
+ * [Safari](#safari)
+ * [Chrome](#chrome)
- [Supported sites](#supported-sites)
- [Changelog](#changelog)
- [Development](#development)
@@ -34,13 +36,18 @@
## Features
* Adds a dedicated Picture in Picture button to the video player of [supported sites](#supported-sites)
* Button integrates seamlessly with the player including hover effects and tooltips
-* Supports closed captions in Picture and Picture mode
+* Supports closed captions in Picture and Picture mode (Safari only)
+* Supports Safari and Chrome
* Free and open source
## Installation
-Get the latest release from the [Safari Extension Gallery](https://safari-extensions.apple.com/details/?id=com.amarcus.safari.piper-BQ6Q24MF9X)
-
-...or live life on the edge with the latest [development build](https://rawgit.com/amarcu5/PiPer/develop/out/PiPer-safari-legacy.safariextz) (IMPORTANT: these builds do not update automatically!)
+### Safari
+Install from the [Mac App Store](https://itunes.apple.com/app/1421915518?mt=12&ls=1) by clicking "Get"
+(The [Safari Extension Gallery](https://safari-extensions.apple.com/details/?id=com.amarcus.safari.piper-BQ6Q24MF9X) is now [deprecated](https://developer.apple.com/documentation/safariextensions))
+### Chrome
+Install from the [Chrome Web Store](https://chrome.google.com/webstore/detail/piper/jbjleapidaddpbncgofepljddfeoghkc) by clicking "Add to Chrome"
+
+...or live life on the edge with the latest [development build](https://github.com/amarcu5/PiPer/tree/develop/out) (IMPORTANT: these builds do not update automatically!)
## Supported sites
* [Amazon Video](http://www.amazon.com/PrimeVideo)
@@ -86,8 +93,14 @@ You can find information about releases [here](https://github.com/amarcu5/PiPer/
### Building
#### Prerequisites
-* Mac running macOS 10.12 Sierra or later
-* [Node.js](https://nodejs.org)
+* Operating system
+ * macOS: 10.12 Sierra or newer (required to build Safari extension)
+ * Windows: Vista or newer using [Cygwin](https://cygwin.com/install.html)
+ * Linux: 64-bit Ubuntu 14.04+, Debian 8+, openSUSE 13.3+, or Fedora Linux 24+
+* Software
+ * [Node.js](https://nodejs.org)
+ * [Java](https://www.java.com/en/download/) (Windows only)
+
#### Build tools
The following build tools are used to build the extension:
@@ -107,8 +120,11 @@ npm install -g google-closure-compiler-js
#### Steps
1. Clone the repository
2. Run `make.sh`
- 1. By default this builds the unoptimized and unpackaged development version into the `./out/` directory that can then be installed using Safari's Extension Builder
- 2. Alternatively run `./make.sh -p release` to build the optimized and packaged release version (note that packaging requires a private key)
+ 1. By default this builds the unoptimized and unpackaged development version for all targets into the `./out/` directory
+ 2. Alternatively:
+ * `./make.sh -p release` to build the optimized release versions for all targets
+ * `./make.sh -p release -t chrome` to build the optimized release version for the Chrome browser
+ * `./make.sh -h` to see the full list of options
### Supporting a new site
If we wanted to support `example.com` with the source:
diff --git a/make.sh b/make.sh
index b891196..3a8e8df 100755
--- a/make.sh
+++ b/make.sh
@@ -4,7 +4,7 @@
EXTENSION_NAME="PiPer"
-SOURCE_FILES=("main.js" "fix.js" "localization_bridge.js")
+SOURCE_FILES=("main.js" "fix.js" "background.js" "install.js" "localization_bridge.js")
# Certifcate paths
LEAF_CERT_PATH="../certs/cert.pem"
@@ -20,7 +20,7 @@ Usage: make.sh [options]
Options:
-h -? --help Show this screen
- -t --target (all|safari|safari-legacy) Make extension for target browser [default: all]
+ -t --target (all|safari|safari-legacy|chrome) Make extension for target browser [default: all]
-p --profile (release|debug|distribute) Set settings according to profile [default: debug]
-c --compress-css Compress CSS
-j --compress-js Compress JavaScript
@@ -116,9 +116,13 @@ echo "Setting '${profile}' profile"
case $targets in
safari) targets=("safari") ;;
safari-legacy) targets=("safari-legacy") ;;
- *) targets=("safari" "safari-legacy")
+ chrome) targets=("chrome") ;;
+ *) targets=("safari" "safari-legacy" "chrome")
esac
+# Validate logging level
+logging_level="${logging_level//[!0-9]/}"
+[[ -z "$logging_level" ]] && logging_level=0
# Helper checks for build tool dependency and falls back to 'npx' if possible
function get_node_command() {
@@ -301,6 +305,7 @@ EOF
} >"out/${EXTENSION_NAME}/scripts/resources/index.js"
+
for target in "${targets[@]}"; do
echo "Building '${target}' extension"
@@ -317,6 +322,11 @@ for target in "${targets[@]}"; do
target_extension=".safariextension"
common_file_path=""
;;
+ chrome)
+ browser=2
+ target_extension=""
+ common_file_path=""
+ ;;
*) exit 1
esac
@@ -397,15 +407,16 @@ for target in "${targets[@]}"; do
extern_path=$(fix_absolute_path "${scripts_path}/externs.js")
defines_processed_path=$(echo "${defines_path%.*}" | sed -E 's|[/@\]|$|g' | sed -E 's/[-. ]/_/g' | sed -e 's/\[/%5B/g' -e 's/]/%5D/g' -e 's/>/%3E/g' -e 's/%3C/g')
+ browser_flag="BROWSER$\$module${defines_processed_path}=${browser}"
logging_flag="LOGGING_LEVEL$\$module${defines_processed_path}=${logging_level}"
for entry in "${SOURCE_FILES[@]}"; do
files=()
-
+
absolute_entry="${scripts_path}/${entry}"
[[ ! -f "$absolute_entry" ]] && continue
-
+
add_element "$absolute_entry"
process_file "$absolute_entry"
@@ -419,10 +430,11 @@ for target in "${targets[@]}"; do
if [[ "$path" = "$defines_path" ]]; then
defines=(
"--define" "$logging_flag"
+ "--define" "$browser_flag"
)
fi
done
-
+
if [[ "$debug_js" -eq 0 ]]; then
source_map_options=()
else
@@ -454,7 +466,7 @@ for target in "${targets[@]}"; do
"${defines[@]}" \
)
fi
-
+
${CCJS_PATH} \
"${compression_options[@]}" \
--warning_level VERBOSE \
@@ -587,6 +599,20 @@ for target in "${targets[@]}"; do
rm -rf "out/${EXTENSION_NAME}-${target}${target_extension}"
fi
+ elif [[ "${target}" == "chrome" ]]; then
+
+ # Update manifest version information
+ if [[ "${update_version}" -eq 1 ]]; then
+ sed -i.bak -E "s|\"version\": *\"[^\"]+\"|\"version\": \"${git_release_version}\"|g" "out/${EXTENSION_NAME}-${target}/manifest.json"
+ rm -rf "out/${EXTENSION_NAME}-${target}/manifest.json.bak"
+ fi
+
+ # Package chrome extension
+ if [[ "${package_ext}" -eq 1 ]]; then
+ (cd "out/${EXTENSION_NAME}-${target}${target_extension}" && zip -rq "${EXTENSION_NAME}-${target}${target_extension}.zip" *)
+ mv "out/${EXTENSION_NAME}-${target}${target_extension}/${EXTENSION_NAME}-${target}${target_extension}.zip" "out/"
+ rm -rf "out/${EXTENSION_NAME}-${target}${target_extension}"
+ fi
fi
done
diff --git a/out/PiPer-chrome.zip b/out/PiPer-chrome.zip
new file mode 100644
index 0000000..a2b6e79
Binary files /dev/null and b/out/PiPer-chrome.zip differ
diff --git a/out/PiPer-safari-legacy.safariextz b/out/PiPer-safari-legacy.safariextz
index a210606..6b3d990 100644
Binary files a/out/PiPer-safari-legacy.safariextz and b/out/PiPer-safari-legacy.safariextz differ
diff --git a/out/PiPer-safari.pkg b/out/PiPer-safari.pkg
index 7b05480..452190d 100644
Binary files a/out/PiPer-safari.pkg and b/out/PiPer-safari.pkg differ
diff --git a/src/chrome/install.html b/src/chrome/install.html
new file mode 100644
index 0000000..2771f9f
--- /dev/null
+++ b/src/chrome/install.html
@@ -0,0 +1,115 @@
+
+
+