Skip to content

Commit

Permalink
Making P.R. Ready / Updated to version 2.0
Browse files Browse the repository at this point in the history
Getting the repo ready for a pull request.

Also updated `String..toCaps` to include the "on" word.
Also updated the options to include the new "Plex | Server URL" feature.
  • Loading branch information
Ephellon committed Aug 7, 2018
1 parent fd104f2 commit b28951d
Show file tree
Hide file tree
Showing 48 changed files with 505 additions and 467 deletions.
Binary file modified hhkmjeeccipbolailpomhjhmccnnjhkj.crx
Binary file not shown.
Binary file modified hhkmjeeccipbolailpomhjhmccnnjhkj.zip
Binary file not shown.
39 changes: 21 additions & 18 deletions src/background.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* global chrome */
var external = {},
parentItem;
let external = {},
parentItem,
terminal =
// { error: m => m, info: m => m, log: m => m, warn: m => m } ||
console;

function generateHeaders(auth) {
let headers = { Accept: 'application/json' };
Expand Down Expand Up @@ -34,7 +37,7 @@ function changeStatus({ id, tt, ty, tv, pv, tl, yr }) {
title: `"${ tl } (${ yr || 'N/A' })"`
});

for(var array = 'IM TM TV'.split(' '), length = array.length, index = 0, item; index < length; index++)
for(let array = 'IM TM TV'.split(' '), length = array.length, index = 0, item; index < length; index++)
chrome.contextMenus.update('W2P-' + (item = array[index]), {
title: (
((pv == (item += 'Db')) && id)?
Expand Down Expand Up @@ -88,7 +91,7 @@ function addRadarr(request, sendResponse) {
fetch(debug.url = `${ request.url }lookup/${ query }=${ id }&apikey=${ request.token }`)
.then(response => response.json())
.then(data => {
var body,
let body,
props = {
monitored: true,
minimumAvailability: 'preDB',
Expand All @@ -113,11 +116,11 @@ function addRadarr(request, sendResponse) {
};
}

// console.group('Generated URL');
// console.log('URL', request.url);
// console.log('Head', headers);
// console.log('Body', body);
// console.groupEnd();
terminal.group('Generated URL');
terminal.log('URL', request.url);
terminal.log('Head', headers);
terminal.log('Body', body);
terminal.groupEnd();

return debug.body = body;
})
Expand Down Expand Up @@ -189,11 +192,11 @@ function addSonarr(request, sendResponse) {
}
};

// console.group('Generated URL');
// console.log('URL', request.url);
// console.log('Head', headers);
// console.log('Body', body);
// console.groupEnd();
terminal.group('Generated URL');
terminal.log('URL', request.url);
terminal.log('Head', headers);
terminal.log('Body', body);
terminal.groupEnd();

return debug.body = body;
})
Expand Down Expand Up @@ -258,7 +261,7 @@ function promiseRace(promises) {
// The promise has rejected, remove it from the list of promises and just continue the race.
let promise = promises.splice(index, 1)[0];

promise.catch(error => console.log(`Plex request #${ index } failed:`, error));
promise.catch(error => terminal.log(`Plex request #${ index } failed:`, error));
return promiseRace(promises);
});
}
Expand Down Expand Up @@ -376,7 +379,7 @@ chrome.contextMenus.onClicked.addListener((item) => {
});

chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
console.log('From:', sender);
terminal.log('From:', sender);

let id = (request? request.options || request: {}),
tt = id.title,
Expand Down Expand Up @@ -414,10 +417,10 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {

parentItem = chrome.contextMenus.create({
id: 'W2P',
title: 'Web to Plex+'
title: 'Web to Plex'
});

for(var array = 'IM TM TV'.split(' '), DL = {}, length = array.length, index = 0, item; index < length; index++)
for(let array = 'IM TM TV'.split(' '), DL = {}, length = array.length, index = 0, item; index < length; index++)
chrome.contextMenus.create({
id: 'W2P-' + (item = array[index]),
parentId: parentItem,
Expand Down
82 changes: 41 additions & 41 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"update_url": "https://github.com/Ephellon/web-to-plex/raw/master/hhkmjeeccipbolailpomhjhmccnnjhkj.crx",

"name": "Web to Plex+",
"name": "Web to Plex",
"description": "Adds a button on various movie & TV show sites to open it in Plex.",
"homepage_url": "https://github.com/Ephellon/web-to-plex/",

"manifest_version": 2,
"version": "1.3.0.1",
"version": "2.0.0.0",
// Firefox Support =>
// "applications": {
// "gecko": {
Expand All @@ -25,80 +25,80 @@
"content_scripts": [
{
"matches": ["*://*.movieo.me/*"],
"js": ["history-hack.js", "utils.js", "deps/movieo/cs.js"],
"css": ["deps/movieo/cs.css", "deps/common.css"]
"js": ["history-hack.js", "utils.js", "sites/movieo/index.js"],
"css": ["sites/movieo/index.css", "sites/common.css"]
},{
"matches": ["*://*.imdb.com/*"],
"js": ["utils.js", "deps/imdb/cs.js"],
"css": ["deps/imdb/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/imdb/index.js"],
"css": ["sites/imdb/index.css", "sites/common.css"]
},{
"matches": ["*://*.trakt.tv/*"],
"js": ["history-hack.js", "utils.js", "deps/trakt/cs.js"],
"css": ["deps/trakt/cs.css", "deps/common.css"]
"js": ["history-hack.js", "utils.js", "sites/trakt/index.js"],
"css": ["sites/trakt/index.css", "sites/common.css"]
},{
"matches": ["*://*.letterboxd.com/film/*"],
"js": ["utils.js", "deps/letterboxd/cs.js"],
"css": ["deps/letterboxd/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/letterboxd/index.js"],
"css": ["sites/letterboxd/index.css", "sites/common.css"]
},{
"matches": ["*://*.flenix.co/*/*", "*://*.flenix.cc/*/*", "*://*.flenix.net/*/*", "*://*.flenix.tv/*/*"],
"js": ["utils.js", "deps/flenix/cs.js"],
"css": ["deps/flenix/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/flenix/index.js"],
"css": ["sites/flenix/index.css", "sites/common.css"]
},{
"matches": ["*://*.tvmaze.com/shows/*"],
"js": ["utils.js", "deps/tvmaze/cs.js"],
"css": ["deps/tvmaze/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/tvmaze/index.js"],
"css": ["sites/tvmaze/index.css", "sites/common.css"]
},{
"matches": ["*://*.thetvdb.com/series/*"],
"js": ["utils.js", "deps/tvdb/cs.js"],
"css": ["deps/tvdb/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/tvdb/index.js"],
"css": ["sites/tvdb/index.css", "sites/common.css"]
},{
"matches": ["*://*.themoviedb.org/movie/*", "https://*.themoviedb.org/tv/*"],
"js": ["utils.js", "deps/tmdb/cs.js"],
"css": ["deps/tmdb/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/tmdb/index.js"],
"css": ["sites/tmdb/index.css", "sites/common.css"]
},{
"matches": ["*://*.vrv.co/*"],
"js": ["utils.js", "deps/vrv/cs.js"],
"css": ["deps/vrv/cs.css"]
"js": ["utils.js", "sites/vrv/index.js"],
"css": ["sites/vrv/index.css"]
},{
"matches": ["*://*.hulu.com/*"],
"js": ["utils.js", "deps/hulu/cs.js"],
"css": ["deps/hulu/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/hulu/index.js"],
"css": ["sites/hulu/index.css", "sites/common.css"]
},{
"matches": ["*://*.google.com/store/*"],
"js": ["utils.js", "deps/google/cs.js"],
"css": ["deps/google/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/google/index.js"],
"css": ["sites/google/index.css", "sites/common.css"]
},{
"matches": ["*://*.apple.com/*"],
"js": ["utils.js", "deps/itunes/cs.js"],
"css": ["deps/itunes/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/itunes/index.js"],
"css": ["sites/itunes/index.css", "sites/common.css"]
},{
"matches": ["*://*.metacritic.com/*"],
"js": ["utils.js", "deps/metacritic/cs.js"],
"css": ["deps/metacritic/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/metacritic/index.js"],
"css": ["sites/metacritic/index.css", "sites/common.css"]
},{
"matches": ["*://*.fandango.com/*"],
"js": ["utils.js", "deps/fandango/cs.js"],
"css": ["deps/fandango/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/fandango/index.js"],
"css": ["sites/fandango/index.css", "sites/common.css"]
},{
"matches": ["*://*.amazon.com/*"],
"js": ["utils.js", "deps/amazon/cs.js"],
"css": ["deps/amazon/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/amazon/index.js"],
"css": ["sites/amazon/index.css", "sites/common.css"]
},{
"matches": ["*://*.vudu.com/*"],
"js": ["utils.js", "deps/vudu/cs.js"],
"css": ["deps/vudu/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/vudu/index.js"],
"css": ["sites/vudu/index.css", "sites/common.css"]
},{
"matches": ["*://*.verizon.com/*"],
"js": ["utils.js", "deps/verizon/cs.js"],
"css": ["deps/verizon/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/verizon/index.js"],
"css": ["sites/verizon/index.css", "sites/common.css"]
},{
"matches": ["*://*.couchpotato.life/*/*"],
"js": ["utils.js", "deps/couchpotato/cs.js"],
"css": ["deps/couchpotato/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/couchpotato/index.js"],
"css": ["sites/couchpotato/index.css", "sites/common.css"]
},{
"matches": ["*://*.rottentomatoes.com/*/*"],
"js": ["utils.js", "deps/rottentomatoes/cs.js"],
"css": ["deps/rottentomatoes/cs.css", "deps/common.css"]
"js": ["utils.js", "sites/rottentomatoes/index.js"],
"css": ["sites/rottentomatoes/index.css", "sites/common.css"]
}
],

Expand All @@ -118,7 +118,7 @@
"16": "img/16.png",
"48": "img/48.png"
},
"default_title": "Web to Plex+",
"default_title": "Web to Plex",
"default_popup": "popup/index.html"
},

Expand Down
34 changes: 33 additions & 1 deletion src/options/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Web To Plex+ Options</title>
<title>Web To Plex Options</title>
<style>
html, body {
height: 100%;
Expand Down Expand Up @@ -216,6 +216,24 @@
</head>

<body>
<!--
Layout of code (Jade/Pug)
div
article
details
summary
| Title
h2
| Sub-Title
section
label
| Description
div
| Help text
-->
<div>
<h1>Plex Settings</h1>

Expand Down Expand Up @@ -253,6 +271,20 @@ <h3 style="width: 35%; text-align: center;"><em>&mdash; OR &mdash;</em></h3>
</select>
</section>
</details>

<details>
<summary>Advance</summary>

<h2>Server Options</h2>
<section>
<label>Server URL</label>
<input type="text" data-option="plexURL" placeholder="Enter your Plex URL (for direct access)"/>
<div>
Use this to communicate directly with your Plex server.<br/>
Such as <em>http://localhost:32400</em> or <em>http://192.168.1.100:32400</em>
</div>
</section>
</details>
</article>
</div>
<div>
Expand Down

0 comments on commit b28951d

Please sign in to comment.