Skip to content

Commit

Permalink
Version 3.1.0 (#59)
Browse files Browse the repository at this point in the history
## New Features

- Tabbed Layout for Options Page (closes #58)
- Auto Save Options (closes #54)

## Updates

- Request `tabs` Permission Only When Needed (closes #55)
  • Loading branch information
rthaut authored Feb 21, 2019
1 parent 496f229 commit aebe19e
Show file tree
Hide file tree
Showing 21 changed files with 495 additions and 364 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[<img align="right" src="https://badges.greenkeeper.io/rthaut/YouTubePopoutPlayer.svg" alt="Greenkeeper badge"/>](https://greenkeeper.io/)
[<img align="right" src="https://img.shields.io/badge/all_contributors-2-orange.svg" alt="All Contributors"/>](#contributors)

# YouTube Popout Player v3.0.0
# YouTube Popout Player v3.1.0

> This browser extension provides a simple way to open any YouTube video or playlist (including videos and playlists embedded in other sites/pages) in a configurable "popout" window which you can freely position and resize.
Expand Down
13 changes: 8 additions & 5 deletions docs/pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ <h4 class="hide">Popout Player Size</h4>
</tr>
</tbody>
</table>

<p><strong>Note</strong>: You must click the "Save Custom Dimensions" button after setting custom dimensions for your changes to take effect.</p>
</dd>
</dl>
</div>
Expand All @@ -143,6 +145,7 @@ <h4 class="hide">Advanced Settings</h4>
<dt>Close Original Window/Tab</dt>
<dd>
<p>Enabling this will cause the original YouTube window/tab to be closed when the popout player is opened. This does NOT apply to videos embedded in other pages/sites. <strong>The default for this setting is disabled.</strong></p>
<p><strong>Note</strong>: Enabling this setting will prompt you to allow the use of an <a class="red-text" href="{{ '/permissions#optional' | relative_url }}">additional permission</a>. If you deny the request, this setting will be disabled automatically. You can re-toggle this setting to receive the permission request again.</p>
</dd>

<dt>Window Title Text (Preface) - <em>Firefox Only</em></dt>
Expand Down Expand Up @@ -186,7 +189,7 @@ <h4 class="hide">Keyboard Shortcuts</h4>
<div id="modal-behavior-screenshot" class="modal">
<div class="modal-content center">
<img class="responsive-img" src="{{ '/screenshots/Options-Cropped-Behavior.png' | relative_url }}" alt="Popout Player Behavior Options Cropped Screenshot"/>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.0.0</strong> and may not accurately represent current functionality.</em></p>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.1.0</strong> and may not accurately represent current functionality.</em></p>
</div>
<div class="modal-footer">
<button class="btn red modal-close"><i class="material-icons left">close</i> Close</button>
Expand All @@ -196,7 +199,7 @@ <h4 class="hide">Keyboard Shortcuts</h4>
<div id="modal-size-original-screenshot" class="modal">
<div class="modal-content center">
<img class="responsive-img" src="{{ '/screenshots/Options-Cropped-Size-Original.png' | relative_url }}" alt="Popout Player Size (Original Size) Options Cropped Screenshot"/>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.0.0</strong> and may not accurately represent current functionality.</em></p>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.1.0</strong> and may not accurately represent current functionality.</em></p>
</div>
<div class="modal-footer">
<button class="btn red modal-close"><i class="material-icons left">close</i> Close</button>
Expand All @@ -206,7 +209,7 @@ <h4 class="hide">Keyboard Shortcuts</h4>
<div id="modal-size-custom-screenshot" class="modal">
<div class="modal-content center">
<img class="responsive-img" src="{{ '/screenshots/Options-Cropped-Size-Custom.png' | relative_url }}" alt="Popout Player Size (Custom Dimensions) Options Cropped Screenshot"/>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.0.0</strong> and may not accurately represent current functionality.</em></p>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.1.0</strong> and may not accurately represent current functionality.</em></p>
</div>
<div class="modal-footer">
<button class="btn red modal-close"><i class="material-icons left">close</i> Close</button>
Expand All @@ -216,7 +219,7 @@ <h4 class="hide">Keyboard Shortcuts</h4>
<div id="modal-advanced-screenshot" class="modal">
<div class="modal-content center">
<img class="responsive-img" src="{{ '/screenshots/Options-Cropped-Advanced.png' | relative_url }}" alt="Popout Player Advanced Options Cropped Screenshot"/>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.0.0</strong> and may not accurately represent current functionality.</em></p>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.1.0</strong> and may not accurately represent current functionality.</em></p>
</div>
<div class="modal-footer">
<button class="btn red modal-close"><i class="material-icons left">close</i> Close</button>
Expand All @@ -226,7 +229,7 @@ <h4 class="hide">Keyboard Shortcuts</h4>
<div id="modal-keyboard-screenshot" class="modal">
<div class="modal-content center">
<img class="responsive-img" src="{{ '/screenshots/Options-Cropped-Keyboard-Shortcuts.png' | relative_url }}" alt="Keyboard Shortcuts Options Cropped Screenshot"/>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.0.0</strong> and may not accurately represent current functionality.</em></p>
<p class="text-left"><em>Screenshots are taken from <strong>Version 3.1.0</strong> and may not accurately represent current functionality.</em></p>
</div>
<div class="modal-footer">
<button class="btn red modal-close"><i class="material-icons left">close</i> Close</button>
Expand Down
40 changes: 37 additions & 3 deletions docs/pages/permissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h4>Permissions Overview</h4>
<p>Please <a class="red-text" href="https://github.com/rthaut/YouTubePopoutPlayer/issues/new" rel="nofollow">submit a new issue</a> if you are still concerned about the use of any of the following permissions so the information provided below can be updated to cover common concerns and answer common questions.</p>
</section>

<section id="overview" class="section scrollspy">
<section id="required" class="section scrollspy">
<h4 class="hide">Required Permissions</h4>

<div class="card white">
Expand All @@ -26,14 +26,14 @@ <h4 class="hide">Required Permissions</h4>
<div class="row">
<div class="col s12 xl6">
<h6>Permission Request in Google Chrome</h6>
<img class="responsive-img z-depth-1" src="{{ '/screenshots/Permissions-Chrome-Cropped.png' | relative_url }}" alt="Popout Player Permissions Request (in Chrome) Cropped Screenshot"/>
<img class="responsive-img z-depth-1" src="{{ '/screenshots/Permissions-Chrome-Cropped.png' | relative_url }}" alt="Popout Player Required Permissions Request (in Chrome) Cropped Screenshot"/>
</div>
<div class="col s12 hide-on-extra-large-only">
<p class="divider"></p>
</div>
<div class="col s12 xl6">
<h6>Permission Request in Mozilla Firefox</h6>
<img class="responsive-img z-depth-1" src="{{ '/screenshots/Permissions-Firefox-Cropped.png' | relative_url }}" alt="Popout Player Permissions Request (in Firefox) Cropped Screenshot"/>
<img class="responsive-img z-depth-1" src="{{ '/screenshots/Permissions-Firefox-Cropped.png' | relative_url }}" alt="Popout Player Required Permissions Request (in Firefox) Cropped Screenshot"/>
</div>
</div>
</div>
Expand All @@ -48,13 +48,47 @@ <h6>Permission Request in Mozilla Firefox</h6>
<p><strong>This extensions does not read (or collect) or modify any of your data at all.</strong></p>
<p>This permission is used to add the controls (button and context menu) and listen for the keyboard shortcut, which are used to open the popout player, on YouTube videos. This permission is requested for both the primary <code class="red-text">youtube.com</code> domain and the alternate <code class="red-text">youtube-nocookie.com</code> domain (which some sites use to embed YouTube videos), as these are the domains where YouTube videos are hosted.</p>
</dd>
</dl>
</div>
</div>

</section>


<section id="optional" class="section scrollspy">
<h4 class="hide">Optional Permissions</h4>

<div class="card white">
<div class="card-content">
<span class="card-title red-text"><strong>Optional Permissions</strong></span>
<p>These are the additional optional browser permissions for YouTube Popout Player. These permissions are requested when needed, and the requests can be denied if you prefer not to grant the requested permissions. Note that denying requests for these permissions will disable the corresponding functionality (as listed below).</p>
</div>

<div class="card-body center">
<div class="row">
<div class="col s12 xl6">
<h6>Permission Request in Google Chrome</h6>
<img class="responsive-img z-depth-1" src="https://dummyimage.com/430x200/f5f5f5/616161.png&text=%3C+Chrome+Screenshot+Coming+Soon+%3E" alt="Chrome Screenshot Coming Soon"/>
</div>
<div class="col s12 hide-on-extra-large-only">
<p class="divider"></p>
</div>
<div class="col s12 xl6">
<h6>Permission Request in Mozilla Firefox</h6>
<img class="responsive-img z-depth-1" src="{{ '/screenshots/Optional-Permissions-Request-Tabs-Firefox.png' | relative_url }}" alt="Popout Player Optional Permissions Request (in Firefox) Cropped Screenshot"/>
</div>
</div>
</div>

<div class="card-body">
<dl>
<dt>Read your browsing history (<em>in Chrome</em>)</dt>
<span>&mdash; OR &mdash;</span>
<dt>Access browser tabs (<em>in Firefox</em>)</dt>
<dd>
<p><strong>This extension does not read (or collect) your browsing history at all.</strong></p>
<p>The Tabs permission is used to close the original window/tab (when configured via the "Close Original Window/Tab" option) after opening the popout player.</p>
<p><strong>Denying this permission</strong> will disable the use of the <a class="red-text" href="{{ '/options#advanced' | relative_url }}">"Close Original Window/Tab" setting</a>.</p>
</dd>
</dl>
</div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/Options-Cropped-Advanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/Options-Cropped-Behavior.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/Options-Cropped-Keyboard-Shortcuts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/Options-Cropped-Size-Custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/Options-Cropped-Size-Original.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/screenshots/Options-Custom-Dimensions.png
Binary file not shown.
Binary file removed docs/screenshots/Options-Defaults.png
Binary file not shown.
Binary file removed docs/screenshots/PSDs/Options-Custom-Dimensions.psd
Binary file not shown.
Binary file removed docs/screenshots/PSDs/Options-Defaults.psd
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "youtube-popout-player",
"title": "YouTube Popout Player",
"version": "3.0.3",
"version": "3.1.0",
"description": "This browser extension provides a simple way to open any YouTube video or playlist (including videos and playlists embedded in other sites/pages) in a configurable \"popout\" window which you can freely position and resize.",
"author": "Ryan Thaut <[email protected]> (http://ryanthaut.com)",
"homepage": "http://rthaut.github.io/YouTubePopoutPlayer/",
Expand Down
53 changes: 34 additions & 19 deletions src/_locales/en/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,42 @@
"message": "<strong>Note</strong>: All settings are per-device. If you have YouTube Popout Player installed on multiple devices, you can configure settings differently for each device."
},

"OptionsBehaviorTabWarning": {
"message": "<strong>Warning</strong>: This setting does not apply when the popout player is configured to open in a new tab in the current browser window."
"OptionsSettingNotAvailableForTab": {
"message": "<strong>Note</strong>: This setting does not apply when the popout player is configured to open in a new tab in the current browser window."
},

"OptionsSaveSettingsReminder": {
"message": "Remember to save your changes using the \"$SAVE$\" button below",
"placeholders": {
"save": {
"content": "Save Settings"
}
}
"OptionsSettingsNotAvailableForTab": {
"message": "These settings do not apply when the popout player is configured to open in a new tab in the current browser window."
},

"OptionsCorrectErrorsWarning": {
"message": "You must correct all error(s) before you can save your settings."
},

"OptionsAdvancedHeading": {
"OptionsHeadingBehavior": {
"message": "Popout Player Behavior"
},

"OptionsHeadingSize": {
"message": "Popout Player Size"
},

"OptionsHeadingAdvanced": {
"message": "Advanced Settings"
},

"OptionsTabNameBehavior": {
"message": "Behavior"
},

"OptionsTabNameSize": {
"message": "Size"
},

"OptionsTabNameAdvanced": {
"message": "Advanced"
},

"OptionsAdvancedCloseLabel": {
"message": "Close Original Window/Tab"
},
Expand All @@ -47,10 +62,6 @@
"message": "Specify text to be automatically inserted into the title of the popout player window. This can be used for window manipulation scripting. <strong>This text does NOT replace the standard title text.</strong>"
},

"OptionsBehaviorHeading": {
"message": "Popout Player Behavior"
},

"OptionsBehaviorTargetWindowLabel": {
"message": "Open in a Popup Window"
},
Expand Down Expand Up @@ -102,10 +113,6 @@
"message": "Extended"
},

"OptionsSizeHeading": {
"message": "Popout Player Size"
},

"OptionsSizeModeCurrentLabel": {
"message": "Use Original Player Size"
},
Expand Down Expand Up @@ -181,11 +188,19 @@
}
},

"FieldRequiredPermissionsNotGrantedMessage": {
"message": "You must grant the requested additional permission(s) when prompted to enable this setting."
},

"ButtonSaveCustomDimensionsLabel": {
"message": "Save Custom Dimensions"
},

"ButtonSaveLabel": {
"message": "Save Settings"
},
"ButtonResetLabel": {
"message": "Reset to Defaults"
"message": "Reset All Settings to Defaults"
},

"ConfirmSettingsResetHeading": {
Expand Down
23 changes: 16 additions & 7 deletions src/helpers/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@ import { OPTION_DEFAULTS } from '../helpers/constants';

const Options = (() => {

const Options = {
/**
* @param {string} type the type of writable storage (`sync`, `local`, or `managed`)
* @param {boolean} [defaults=true] indicates if the default value(s) should be returned for missing key(s)
* @return {Promise<object>}
*/
const GetAllFromStorage = async function (type = 'local', defaults = true) {
const options = Options.ConvertForStorage(OPTION_DEFAULTS);
const keys = defaults ? options : Object.keys(options);
return browser.storage[type].get(keys);
};

const Options = {
/**
* Resets all options in local storage to their default values
* @param {boolean} [reset=false] indicates if local storage should be reset
Expand All @@ -20,7 +30,7 @@ const Options = (() => {
return browser.storage.local.set(defaults);
});
} else {
return browser.storage.local.get().then((options) => {
return GetAllFromStorage('local', false).then(options => {
const promises = [];
Object.keys(defaults).forEach(option => {
if (options[option] === undefined || options[option] === null) {
Expand Down Expand Up @@ -115,11 +125,10 @@ const Options = (() => {
'GetLocalOption': async function (domain, name) {
console.log('Options.GetLocalOption()', domain, name);

const key = `${domain}.${name}`;
const option = await browser.storage.local.get(key);
const options = await this.GetLocalOptionsForDomain(domain);

console.log('Options.GetLocalOption() :: Return', option[key]);
return option[key];
console.log('Options.GetLocalOption() :: Return', options[name]);
return options[name];
},

/**
Expand All @@ -132,7 +141,7 @@ const Options = (() => {

let options;

options = await browser.storage.local.get();
options = await GetAllFromStorage('local');
options = Object.assign({}, this.ConvertFromStorage(options));
options = Object.assign({}, options[domain]);

Expand Down
5 changes: 4 additions & 1 deletion src/manifests/manifest.shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
"*://*.youtube.com/*",
"*://*.youtube-nocookie.com/*",
"storage",
"tabs",
"webRequest",
"webRequestBlocking"
],

"optional_permissions": [
"tabs"
],

"content_scripts": [
{
"all_frames": true,
Expand Down
Loading

0 comments on commit aebe19e

Please sign in to comment.