Skip to content

Commit 73299ed

Browse files
authored
Merge pull request #63 from amarcu5/develop-1.0.0
v1.0.0
2 parents 0a7cc74 + 7d6d419 commit 73299ed

File tree

116 files changed

+6392
-1549
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+6392
-1549
lines changed

README.md

+80-77
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1-
# PiPer
2-
Adds Picture in Picture functionality to Safari for YouTube, Netflix, Amazon Video, Twitch, and more!
1+
<p align="center">
2+
<img src="/promo/Icon-512.png" alt="PiPer logo" width="200" />
3+
</p>
34

4-
<img src="/promo/Promo-shot.png" alt="Screenshot of PiPer in action" width="512" />
5+
<h1 align="center">
6+
PiPer
7+
</h1>
8+
9+
<p align="center">
10+
PiPer is the browser extension to watch video Picture in Picture.
11+
</p>
12+
13+
<p align="center">
14+
<a href="#installation">Install</a> ·
15+
<a href="https://paypal.me/adampmarcus">Donate</a> ·
16+
<a href="https://github.com/amarcu5/PiPer/issues">Report an issue</a>
17+
</p>
18+
19+
***
520

621
## Contents
722
- [Features](#features)
823
- [Installation](#installation)
24+
* [Safari](#safari)
25+
* [Chrome](#chrome)
926
- [Supported sites](#supported-sites)
1027
- [Changelog](#changelog)
1128
- [Development](#development)
@@ -19,13 +36,18 @@ Adds Picture in Picture functionality to Safari for YouTube, Netflix, Amazon Vid
1936
## Features
2037
* Adds a dedicated Picture in Picture button to the video player of [supported sites](#supported-sites)
2138
* Button integrates seamlessly with the player including hover effects and tooltips
22-
* Supports closed captions in Picture and Picture mode
39+
* Supports closed captions in Picture and Picture mode (Safari only)
40+
* Supports Safari and Chrome
2341
* Free and open source
2442

2543
## Installation
26-
Get the latest release from the [Safari Extension Gallery](https://safari-extensions.apple.com/details/?id=com.amarcus.safari.piper-BQ6Q24MF9X)
27-
28-
<sub>...or live life on the edge with the latest [development build](https://rawgit.com/amarcu5/PiPer/develop/out/PiPer.safariextz) (IMPORTANT: these builds do not update automatically!)</sub>
44+
### Safari
45+
Install from the [Mac App Store](https://itunes.apple.com/app/id1421915518?mt=12&ls=1) by clicking "Get"
46+
<sub>(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))</sub>
47+
### Chrome
48+
Install from the [Chrome Web Store](https://chrome.google.com/webstore/detail/piper/jbjleapidaddpbncgofepljddfeoghkc) by clicking "Add to Chrome"
49+
50+
<sub>...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!)</sub>
2951

3052
## Supported sites
3153
* [Amazon Video](http://www.amazon.com/PrimeVideo)
@@ -71,30 +93,38 @@ You can find information about releases [here](https://github.com/amarcu5/PiPer/
7193
### Building
7294

7395
#### Prerequisites
74-
* Mac running macOS 10.12 Sierra or later
96+
* Operating system
97+
* macOS: 10.12 Sierra or newer (required to build Safari extension)
98+
* Windows: Vista or newer using [Cygwin](https://cygwin.com/install.html)
99+
* Linux: 64-bit Ubuntu 14.04+, Debian 8+, openSUSE 13.3+, or Fedora Linux 24+
100+
* Software
101+
* [Node.js](https://nodejs.org)
102+
* [Java](https://www.java.com/en/download/) (Windows only)
103+
75104

76105
#### Build tools
77-
For convenience the following Node.js tools have been packaged with [nexe](https://github.com/nexe/nexe) and included in this repository:
78-
* [csso](https://github.com/css/csso) (3.1.1) for compressing CSS
79-
* [svgo](https://github.com/svg/svgo) (0.7.2) for compressing SVG images
80-
* [xarjs](https://github.com/robertknight/xar-js) (0.2.0) for packaging Safari extension
81-
* [google-closure-compiler-js](https://github.com/google/closure-compiler-js) (20170806.0.0) for compiling JavaScript
106+
The following build tools are used to build the extension:
107+
* [csso](https://github.com/css/csso) for compressing CSS
108+
* [svgo](https://github.com/svg/svgo) for compressing SVG images
109+
* [xarjs](https://github.com/robertknight/xar-js) for packaging Safari legacy extension
110+
* [google-closure-compiler](https://github.com/google/closure-compiler) for compiling JavaScript
82111

83-
However it is recommended to install the latest versions with [Node.js](https://nodejs.org):
112+
These can be installed by executing the following command:
84113
```Shell
85114
npm install -g csso-cli
86115
npm install -g svgo
87116
npm install -g xar-js
88-
npm install -g google-closure-compiler-js
117+
npm install -g google-closure-compiler
89118
```
90119

91-
Additionally a reimplementation of the utility PlistBuddy used for automated build numbering is [provided](https://github.com/amarcu5/PiPer/tree/master/build-tools/) but it is advisable to download the original as part of [Xcode](https://itunes.apple.com/gb/app/xcode/id497799835?mt=12) or from [Apple's Command Line Tools](https://developer.apple.com/download/)
92-
93120
#### Steps
94121
1. Clone the repository
95122
2. Run `make.sh`
96-
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
97-
2. Alternatively run `./make.sh -p release` to build the optimized and packaged release version (note that packaging requires a private key)
123+
1. By default this builds the unoptimized and unpackaged development version for all targets into the `./out/` directory
124+
2. Alternatively:
125+
* `./make.sh -p release` to build the optimized release versions for all targets
126+
* `./make.sh -p release -t chrome` to build the optimized release version for the Chrome browser
127+
* `./make.sh -h` to see the full list of options
98128

99129
### Supporting a new site
100130
If we wanted to support `example.com` with the source:
@@ -110,73 +140,46 @@ If we wanted to support `example.com` with the source:
110140
</div>
111141
</div>
112142
```
113-
We would start by adding a new entry in the `resources` object in `main.js`:
143+
We would start by adding a new file `example.js` in the [resources directory](https://github.com/amarcu5/PiPer/tree/master/src/common/scripts/resources):
114144
```JavaScript
115-
const resources = {
116-
...
117-
'example' : {
118-
buttonParent: function() {
119-
// Returns the element that will contain the button
120-
return document.querySelector('.video-controls');
121-
},
122-
videoElement: function() {
123-
// Returns the video element
124-
return document.querySelector('.video-container video');
125-
},
126-
127-
// Optional
128-
captionElement: function() {
129-
// Returns the element that contains the video captions
130-
return document.querySelector('.video-captions');
131-
},
145+
export const domain = 'example';
146+
147+
export const resource = {
148+
buttonParent: function() {
149+
// Returns the element that will contain the button
150+
return document.querySelector('.video-controls');
151+
},
152+
videoElement: function() {
153+
// Returns the video element
154+
return document.querySelector('.video-container video');
155+
},
156+
157+
// Optional
158+
captionElement: function() {
159+
// Returns the element that contains the video captions
160+
return document.querySelector('.video-captions');
132161
},
133162
};
134163
```
135-
We also need to update the extension permissions to support the new site by editing `./src/Info.plist`:
136-
```XML
137-
<?xml version="1.0" encoding="UTF-8"?>
138-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://apple.com/DTDs/PropertyList-1.0.dtd">
139-
<plist version="1.0">
140-
<dict>
141-
<key>Permissions</key>
142-
<dict>
143-
<key>Website Access</key>
144-
<dict>
145-
...
146-
<key>Allowed Domains</key>
147-
<array>
148-
...
149-
<string>example.com</string>
150-
<string>*.example.com</string>
151-
</array>
152-
</dict>
153-
</dict>
154-
</dict>
155-
</plist>
156-
```
157164
We might want to style the button so that it integrates with the page better:
158165
```JavaScript
159-
const resources = {
166+
export const resource = {
160167
...
161-
'example' : {
162-
...
163-
// Assign a CSS class
164-
buttonClassName: 'control',
165-
// Scale the button
166-
buttonScale: 0.5,
167-
// Apply custom CSS styles
168-
buttonStyle: /** CSS */ (`
169-
/* Declaring CSS this way ensures it gets optimized when the extension is built */
170-
cursor: pointer;
171-
opacity: 0.5;
172-
`),
173-
// Apply a custom CSS hover style
174-
buttonHoverStyle: /** CSS */ (`opacity: 1 !important`),
175-
},
168+
// Assign a CSS class
169+
buttonClassName: 'control',
170+
// Scale the button
171+
buttonScale: 0.5,
172+
// Apply custom CSS styles
173+
buttonStyle: /** CSS */ (`
174+
/* Declaring CSS this way ensures it gets optimized when the extension is built */
175+
cursor: pointer;
176+
opacity: 0.5;
177+
`),
178+
// Apply a custom CSS hover style
179+
buttonHoverStyle: /** CSS */ (`opacity: 1 !important`),
176180
};
177181
```
178-
For more examples, please see the [source](https://github.com/amarcu5/PiPer/tree/master/src/scripts)
182+
For more examples, please see the [source](https://github.com/amarcu5/PiPer/tree/master/src/)
179183

180184
## Acknowledgements
181185
* [Pied PíPer](https://github.com/JoeKuhns/PiedPiPer.safariextension) for the original inspiration and the Netflix icon
182-
* [Google](https://github.com/google/material-design-icons) for the Picture in Picture icon

build-tools/csso

-5.92 MB
Binary file not shown.
-6.39 MB
Binary file not shown.

build-tools/plistbuddy

-12.6 KB
Binary file not shown.

build-tools/svgo

-5.73 MB
Binary file not shown.

build-tools/xarjs

-5.71 MB
Binary file not shown.

0 commit comments

Comments
 (0)