Skip to content

Commit

Permalink
Upgrade to 3.1.1 (BETA)
Browse files Browse the repository at this point in the history
Please see #55, or the /change.log file for changes made.
  • Loading branch information
Ephellon committed Aug 27, 2018
1 parent 11a23e7 commit 1c182f0
Show file tree
Hide file tree
Showing 8 changed files with 289 additions and 41 deletions.
12 changes: 11 additions & 1 deletion change.log
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,19 @@
- variables, most notably `options.watcherURL` would persist after being removed
- Updated the manifest's description

## v3.1.0.0 / unreleased
## v3.1.0.0 / SpaceK33z@11a23e7f565981bbbcedc7037c840fbcbfeed2f6

- **Added Netflix support**
- Made changes to the `String..toCaps` method
- Made searches better via `/utils.js`
- replaced some non-latin characters (i.e. the curly apostrophe) with an acceptable counter-part (a "normal" apostrophe)

## v3.1.1.0 / unreleased

- **Added the "Use Loose" (RegExp) option (enabled by default)**
- this allows the plugin to use a RegExp of the title to find possible matches
- Removed some unimportant code (debugging)
- Fixed file naming for the "Save As..." feature
- Fixed searching error in `/utils.js`
- The strict matching for searches was incorrectly implemented
- Added more GUI elements
Binary file modified src.crx
Binary file not shown.
Binary file modified src.zip
Binary file not shown.
8 changes: 5 additions & 3 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function generateHeaders(auth) {
// Object{MovieOrShowID, MovieOrShowTitle, MovieOrShowType, MovieOrShowIDProvider, MovieOrShowYear, LinkURL, FileType} => undefined
function changeStatus({ id, tt, ty, pv, yr, ur = '', ft = '' }) {

let tl = tt.replace(/\-/g, ' ').replace(/[\s\:]{2,}/g, ' - '),
let tl = tt.replace(/\-/g, ' ').replace(/[\s\:]{2,}/g, ' - ').replace(/[^\w\s\-\']+/g, ''),
// File friendly title
st = tt.replace(/[\-\s]+/g, '-').replace(/[^\w\-]+/g, ''),
// Search friendly title
Expand Down Expand Up @@ -420,6 +420,8 @@ chrome.contextMenus.onClicked.addListener((item) => {
tl = external.T,
yr = external.Y,
tt = external.S,
lt = external.F,
ft = external.Z,
p = (s, r = '+') => s.replace(/-/g, r);

switch(db) {
Expand Down Expand Up @@ -455,7 +457,7 @@ chrome.contextMenus.onClicked.addListener((item) => {
else
chrome.downloads.download({
url,
filename: `${ external.F } (${ external.Y }).${ external.Z }`,
filename: `${ lt } (${ yr }).${ ft }`,
saveAs: true
});
});
Expand Down Expand Up @@ -517,7 +519,7 @@ parentItem = chrome.contextMenus.create({

saveItem = chrome.contextMenus.create({
id: 'W2P-DL',
title: 'Ready'
title: 'Nothing to Save'
});

// Standard search engines
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"homepage_url": "https://github.com/Ephellon/web-to-plex/",

"manifest_version": 2,
"version": "3.1.0.0",
"version": "3.1.1.0",
// Firefox Support =>
// "applications": {
// "gecko": {
Expand Down
138 changes: 136 additions & 2 deletions src/options/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
margin-bottom: 5px;
}

input, select {
input[type="text"], input[type="password"], select {
width: 30vw !important;
line-height: 1.5em !important;
transition: background 0.2s;
Expand Down Expand Up @@ -195,6 +195,121 @@
color: #999;
}

/* bbodine @CodePen - https://codepen.io/bbodine1/pen/novBm */
.checkbox {
width: 80px;
height: 26px;
background: #000;
margin: 15px 0;
position: relative;
border-radius: 50px;
box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2);
}

.checkbox:after {
content: 'OFF';
color: #666;
position: absolute;
right: 10px;
z-index: 0;
font: 12px/26px Arial, sans-serif;
font-weight: bold;
text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.15);
}

.checkbox:before {
content: 'ON';
color: #cc7b19;
position: absolute;
left: 10px;
z-index: 0;
font: 12px/26px Arial, sans-serif;
font-weight: bold;
}

.checkbox label {
display: block;
width: 34px;
height: 20px;
cursor: pointer;
position: absolute;
top: 3px;
left: 3px;
z-index: 1;
background: #cc7b19;
border-radius: 50px;
transition: all 0.4s ease;
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3);
}

.checkbox input[type=checkbox] {
visibility: hidden;
}

.checkbox input[type=checkbox]:checked + label {
left: 43px;
}

input[type="range"] {
appearance: none;
-webkit-appearance: none;

background: #0004;
outline: none;

height: 5px!important;
width: 83%!important;
}

input[type="range"] + output {
display: inline-block;
position: relative;
width: 7%!important;
color: #cc7b19;
line-height: 20px;
text-align: center;
border-radius: 3px;
background: #000;
padding: 5px 10px;
margin-left: 8px;
vertical-align: sub;
}

input[type="range"] + output:after {
position: absolute;
top: 8px;
left: -7px;
width: 0;
height: 0;
border-top: 7px solid transparent;
border-right: 7px solid #000;
border-bottom: 7px solid transparent;
content: '';
}

input[type="range"]::-webkit-slider-thumb {
appearance: none;
-webkit-appearance: none;

background: #cc7b19;
border: 1px solid #cc7b19;
border-radius: 100%;
cursor: pointer;

height: 32px;
width: 32px;
}

input[type="range"]::-moz-range-thumb {
background: #cc7b19;
border: 1px solid #cc7b19;
border-radius: 100%;
cursor: pointer;

height: 32px;
width: 32px;
}

#version {
color: #fff;

Expand Down Expand Up @@ -518,7 +633,26 @@ <h1>Other Settings</h1>

<article>
<details>
<summary>API Keys</summary>
<summary>Advance Settings</summary>

<h2>Search Options</h2>
<section>
<h3>Loose Searching</h3>
<div>
Allows the plugin to search for non-English titles using pattern matching (as a last resort).<br>
Higer sensitivity means more strict searches.
</div>
<br>
<label>Enable Feature</label>
<div class="checkbox">
<input id="use-loose" type="checkbox" data-option="UseLoose" checked="true"/>
<label for="use-loose"></label>
</div>
<label>Searching Sensitivity</label>
<br>
<input type="range" data-option="UseLooseScore" min="0" max="100" step="5" value="40"/>
<output type="text" value="40%"></output>
</section>

<h2>Extra API Keys</h2>
<section>
Expand Down
39 changes: 26 additions & 13 deletions src/options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ const storage = (chrome.storage.sync || chrome.storage.local),
'sonarrStoragePath',
'sonarrQualityProfileId',
'OMDbAPI',
'TMDbAPI'
'TMDbAPI',
'UseLoose',
'UseLooseScore'
];

let PlexServers = [],
Expand Down Expand Up @@ -196,7 +198,9 @@ function getOptionValues() {
`[data-option="${ option }"]`
);

if(element)
if(element.type == 'checkbox')
options[option] = element.checked;
else if(element)
options[option] = element.value;
});

Expand Down Expand Up @@ -444,10 +448,6 @@ function saveOptions() {
storage.set({ ClientID });
}

options.watcherURLRoot = null;
options['c2x1ZytyaW90KzIwMTg'] = null;
options['slug+riot+2018'] = null;

options.plexURL = options.plexURLRoot = (options.plexURL || "")
.replace(/([^\\\/])$/, endingSlash)
.replace(/^(?!^https?:\/\/)(.+)/, 'http://$1');
Expand All @@ -470,8 +470,6 @@ function saveOptions() {
options.sonarrStoragePath = options.sonarrStoragePath
.replace(/([^\\\/])$/, endingSlash);

terminal.log(options);

for(let index = 0, array = 'plex watcher radarr sonarr couchpotato'.split(' '), item = save('URLs', array); index < array.length; index++)
save(`${ item = array[index] }.url`, options[`${ item }URLRoot`]);

Expand Down Expand Up @@ -516,6 +514,7 @@ function saveOptions() {
terminal.error('Error with saving', chrome.runtime.lastError.message);
chrome.storage.local.set(data, showOptionsSaved);
} else {
terminal.log('Saved Options:', options);
showOptionsSaved();
}
});
Expand All @@ -530,18 +529,25 @@ function restoreOptions() {

if(!el) return;

el.value = items[option] || '';
if(el.type == 'checkbox')
el.checked = (items[option] + '') == 'true';
else
el.value = items[option] || '';

if(el.value !== '' && !el.disabled) {
if(/password$/i.test(option))
if(el.type == 'checkbox')
el.setAttribute('save', el.checked);
else if(el.type == 'range')
el.setAttribute('save', el.value),
el.oninput({ target: el });
else if(/password$/i.test(option))
el.setAttribute('type', el.type = 'password');
else
el.placeholder = `Last save: ${ el.value }`,
el.title = `Double-click to restore value ("${ el.value }")`,
el.setAttribute('save', el.value);
el.setAttribute('save', el.value),
el.ondblclick = event => el.value = el.getAttribute('save');
}

el.ondblclick = event => el.value = el.getAttribute('save');
});

if(items.plexToken)
Expand Down Expand Up @@ -589,3 +595,10 @@ document
document
.querySelector('#version')
.innerHTML = `Version ${ chrome.manifest.version }`;
document
.querySelectorAll('[type="range"]')
.forEach((element, index, array) => {
element.nextElementSibling.value = element.value + '%';

element.oninput = (event, self) => (self = event.target).nextElementSibling.value = self.value + '%';
});
Loading

0 comments on commit 1c182f0

Please sign in to comment.