Skip to content

Commit e223154

Browse files
committed
Pro/Dem Shanaproject/Metacritic. Updated colors: options, permissions.
1 parent 0d17147 commit e223154

Some content is hidden

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

68 files changed

+914
-500
lines changed

moz.xpi

1.19 KB
Binary file not shown.

moz.zip

1.2 KB
Binary file not shown.

moz/common.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@
150150

151151
.web-to-plex-prompt-body {
152152
background: #282828;
153+
border: 0 !important;
154+
border-radius: 3px !important;
153155
box-shadow: 0 5px 15px #0008 !important;
154156
display: block !important;
155157

@@ -278,6 +280,25 @@
278280
margin-top: 5px !important;
279281
}
280282

283+
.web-to-plex-permission:after {
284+
background: #0000;
285+
border-radius: 3px;
286+
border: 0;
287+
color: #cc7b19;
288+
content: "\29eb";
289+
display: inline-block;
290+
font-size: 150%;
291+
padding: 0;
292+
text-align: center;
293+
294+
margin: 0;
295+
position: absolute;
296+
right: 3%;
297+
298+
height: 2em;
299+
width: 2em;
300+
}
301+
281302
.web-to-plex-prompt-footer {
282303
text-align: right !important;
283304
border-bottom-left-radius: 3px !important;
@@ -505,6 +526,10 @@
505526
margin-top: 0 !important;
506527
}
507528

529+
.web-to-plex-button.hide.closed li:not(:first-child) {
530+
display: none !important;
531+
}
532+
508533
*:not(#plexit-bookmarklet-frame) + .web-to-plex-button.closed .list-item {
509534
float: left !important;
510535
opacity: 0;

moz/compare.js

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
1-
/** GitHub@alexey-bass
2-
* Simply compares two string version values.
1+
/** function compareVer({String|Number} L, {String|Number} R) => {Integer|Boolean};
2+
* Simply compares two version values.
33
*
4-
* Example:
4+
* Examples:
55
* compareVer('1.1', '1.2') => -1
66
* compareVer('1.1', '1.1') => 0
7-
* compareVer('1.2', '1.1') => 1
8-
* compareVer('2.23.3', '2.22.3') => 1
7+
* compareVer('1.2', '1.1') => +1
8+
* compareVer('2.23.3', '2.22.3') => +1
99
*
1010
* Returns:
11-
* -1 = left is LOWER = right is GREATER
12-
* 0 = they are equal
13-
* 1 = left is GREATER = right is LOWER
14-
* And FALSE if one of input versions are not valid
11+
* -1 => L < R: L is LOWER <-> R is HIGHER
12+
* 0 => L = R: L and R are EQUAL
13+
* +1 => L > R: L is HIGHER <-> R is LOWER
14+
* false => one of the versions is invalid
1515
*
1616
* @function
17-
* @param {String} left Version #1
18-
* @param {String} right Version #2
17+
* @param {String|Number} L Version #1
18+
* @param {String|Number} R Version #2
1919
* @return {Integer|Boolean}
20-
* @author Alexey Bass (albass)
21-
* @since 2011-07-14
20+
* @author Alexey Bass (GitHub@alexey-bass)
21+
* @since 2011-07-14
2222
*/
23-
function compareVer(left, right) {
24-
if(typeof left + typeof right != 'stringstring')
23+
function compareVer(L, R) {
24+
if(!/^(string|number)(string|number)$/i.test(typeof L + typeof R))
2525
return false;
2626

27-
for(let a = left.split('.'), b = right.split('.'), i = 0, l = Math.max(a.length, b.length); i < l; i++) {
28-
if((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i])))
27+
L += '';
28+
R += '';
29+
30+
let pI = Number.parseInt || parseInt || (string => +string.replace(/^\s*(-?\d+)[^]*$/, '$1')),
31+
mx = Math.max || ((...numbers) => numbers.sort((a, b) => +a < +b? +1: -1)[0]);
32+
33+
for(let a = L.split('.'), b = R.split('.'), i = 0, l = mx(a.length, b.length), p = pI; i < l; i++) {
34+
if((a[i] && !b[i] && p(a[i]) > 0) || (p(a[i]) > p(b[i])))
2935
return +1
30-
/* left is higher */;
31-
else if((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i])))
36+
/* L > R */;
37+
else if((b[i] && !a[i] && p(b[i]) > 0) || (p(a[i]) < p(b[i])))
3238
return -1
33-
/* right is higher */;
39+
/* L < R */;
3440
}
3541

3642
return 0
37-
/* equal */;
43+
/* L = R */;
3844
}

moz/manifest.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage_url": "https://webtoplex.github.io/",
55

66
"manifest_version": 2,
7-
"version": "4.1.1.10",
7+
"version": "4.1.1.11",
88
"browser_specific_settings": {
99
"gecko": {
1010
@@ -103,8 +103,8 @@
103103
"matches": ["*://itunes.apple.com/*"],
104104
"js": ["utils.js", "itunes$.js"]
105105
},{
106-
"matches": ["*://*.metacritic.com/*"],
107-
"js": ["utils.js", "metacritic$.js"]
106+
"matches": ["*://*.shanaproject.com/*"],
107+
"js": ["utils.js", "shanaproject$.js"]
108108
},{
109109
"matches": ["*://*.fandango.com/*"],
110110
"js": ["utils.js", "fandango$.js"]
@@ -154,10 +154,7 @@
154154
"matches": ["*://*.tubitv.com/*"],
155155
"js": ["utils.js", "tubi$.js"]
156156
},{
157-
"matches": [
158-
"*://webtoplex.github.io/web/?*", "*://webtoplex.github.io/web/index.html?*", "*://webtoplex.github.io/web/login.html?*",
159-
"*://ephellon.github.io/web.to.plex/?*", "*://ephellon.github.io/web.to.plex/index.html?*", "*://ephellon.github.io/web.to.plex/login.html?*"
160-
],
157+
"matches": ["*://webtoplex.github.io/web/*", "*://ephellon.github.io/web.to.plex/*"],
161158
"js": ["utils.js", "webtoplex$.js"]
162159
},{
163160
"matches": ["*://app.plex.tv/desktop/*"],

moz/metacritic$.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

moz/metacritic.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ let script = {
2727

2828
case 'list':
2929
/* Not yet implemented */
30+
return -1;
3031
break;
3132

3233
default:
@@ -52,9 +53,10 @@ let script = {
5253

5354
if(!top.WaitingOnAbsoluteReady) {
5455
top.addEventListener('load', event => {
55-
top.AbsoluteReady = true;
56-
57-
$('.web-to-plex-button a.list-action').first.onclick = event => event;
56+
/* Fix event override? */
57+
setInterval(() => {
58+
top.AbsoluteReady = $('.web-to-plex-button').first.classList.contains('show');
59+
}, 1000);
5860
});
5961

6062
top.WaitingOnAbsoluteReady = true;

moz/options.css

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -692,20 +692,26 @@ code[new], [code][new], [type^="code"i][new] {
692692

693693
/* Release is higher than GitHub */
694694
#version[status="high"] {
695-
border-color: #6cc644 !important;
696-
color: #6cc644 !important;
695+
/* Blue */
696+
border-color: #197bcc !important;
697+
color: #197bcc !important;
697698
}
698699

699700
/* Release is same as GitHub */
700701
#version[status="same"] {
701-
border-color: #197bcc !important;
702-
color: #197bcc !important;
702+
/* Green */
703+
border-color: #6cc644 !important;
704+
color: #6cc644 !important;
703705
}
704706

705707
/* Release is lower than GitHub */
706708
#version[status="low"] {
709+
/* Orange/Red (#f3582c) */
707710
border-color: #f66a0a !important;
708-
color: #f3582c !important;
711+
color: #f66a0a !important;
712+
/* Grey */
713+
/* border-color: #949494 !important;
714+
color: #949494 !important; */
709715
}
710716

711717
/* notifications */

moz/options.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -573,19 +573,17 @@ <h3>Login <em>(saved)</em></h3>
573573
<summary>Theme Settings</summary>
574574

575575
<h2>The Button</h2>
576-
<!--
577576
<section>
578577
What shape should the button be?
579578
<br>
580579
<span class="checkbox" prompt-size="large" prompt-yes="&#9723;" prompt-no="&#9675;">
581-
<!-- When true (checked), will be accessed in CSS (/sites/theme.css) as ".button-shape-box { ... }" --/>
580+
<!-- When true (checked), will be accessed in CSS (/sites/theme.css) as ".button-shape-box { ... }" -->
582581
<input data-option="theme:button-shape" theme="true:box" type="checkbox"/>
583582
<label for="theme:button-shape"></label>
584583
</span>
585584
</section>
586-
-->
587585
<section>
588-
Which direction should the button open (<span orange>&#9711;</span> only)?
586+
Which direction should the button open (&#9711; only)?
589587
<br>
590588
<span class="checkbox" prompt-size="large" prompt-yes="&#8672;" prompt-no="&#8674;">
591589
<!-- When true (checked), will be accessed in CSS (/sites/theme.css) as ".button-location-right { ... }" -->
@@ -700,8 +698,8 @@ <h3>
700698
<div>
701699
When the user presses the Grab button, the extension should:
702700
<ul>
703-
<li>Grab <em>ALL</em>: Find items not on Plex, and grab them</li>
704-
<li><em>ASK</em> user: Find items not on Plex, and grab what the user approves</li>
701+
<li>Grab <em>ALL</em> &mdash; Find items not on Plex, and grab them</li>
702+
<li><em>ASK</em> user &mdash; Find items not on Plex, and grab what the user approves</li>
705703
</ul>
706704
</div>
707705
<h3>Maximum Auto Grabs</h3>
@@ -816,8 +814,8 @@ <h3>
816814
</span>
817815
</h3>
818816
<ul>
819-
<li><em>MIN</em>: when a page is loaded, the extension will keep a small number of IDs on hand to speed up the process of finding media</li>
820-
<li><em>ALL</em>: when a page is loaded, the extension will ask for every single ID from your Manager(s)</li>
817+
<li><em>MIN</em> &mdash; when a page is loaded, the extension will keep a small number of IDs on hand to speed up the process of finding media</li>
818+
<li><em>ALL</em> &mdash; when a page is loaded, the extension will ask for every single ID from your Manager(s)</li>
821819
</ul>
822820
</section>
823821
</details>
@@ -853,7 +851,7 @@ <h3 x-mode>Data Compression</h3>
853851
<label for="use-lzw"></label>
854852
</div>
855853
<div>
856-
<em>WARNING</em>: may cause data loss.<br>
854+
<em>WARNING</em> &mdash; may cause data loss.<br>
857855
Enabling this option will compress your cached search data using the <a href="https://wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transform" target="_blank">BWT (transform)</a> and <a href="https://wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch" target="_blank">LZW Compression Algorithm</a>.
858856
</div>
859857
</section>
@@ -893,7 +891,7 @@ <h3>
893891
</span>
894892
</h3>
895893
<div>
896-
<em>WARNING</em>: may cause data loss.<br>
894+
<em>WARNING</em> &mdash; may cause data loss.<br>
897895
Enables developer (debugging) mode, showing advance errors and logging to the console when possible.
898896
</div>
899897
</section>

moz/options.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ const storage = (chrome.storage.sync || chrome.storage.local),
120120
// Advance Settings
121121
'OMDbAPI',
122122
'TMDbAPI',
123+
'UseLZW',
123124
'DeveloperMode',
124125

125126
// Hidden values
@@ -157,7 +158,7 @@ const storage = (chrome.storage.sync || chrome.storage.local),
157158
'builtin_imdb',
158159
'builtin_justwatch',
159160
'builtin_letterboxd',
160-
'builtin_metacritic',
161+
// 'builtin_metacritic', // demoted - 01.18.2020 15:10 MST
161162
'builtin_moviemeter',
162163
'builtin_movieo',
163164
'builtin_netflix',
@@ -178,10 +179,11 @@ const storage = (chrome.storage.sync || chrome.storage.local),
178179
'builtin_gostream',
179180
'builtin_tubi',
180181
'builtin_webtoplex',
182+
'builtin_shanaproject',
181183

182184
// Plugins - End of file, "let plugins ="
183185
'plugin_toloka',
184-
'plugin_shanaproject',
186+
// 'plugin_shanaproject', // promoted - 01.18.2020 15:10 MST
185187
'plugin_myanimelist',
186188
'plugin_myshows',
187189
'plugin_indomovie',
@@ -191,6 +193,7 @@ const storage = (chrome.storage.sync || chrome.storage.local),
191193
'plugin_snagfilms',
192194
'plugin_freemoviescinema',
193195
'plugin_foxsearchlight',
196+
'plugin_metacritic',
194197

195198
// Theme Settings
196199
...(() => [...$('[data-option^="theme:"i]', true)].map(e => e.dataset.option))()
@@ -1934,7 +1937,6 @@ let builtins = {
19341937
"Hulu": "https://hulu.com/",
19351938
"Flickmetrix": "https://flickmetrix.com/",
19361939
"TVDb": "https://thetvdb.com/",
1937-
"Metacritic": "https://www.metacritic.com/",
19381940
"ShowRSS": "https://showrss.info/",
19391941
"Vudu": "https://vudu.com/",
19401942
"Movieo": "https://movieo.me/",
@@ -1950,6 +1952,7 @@ let builtins = {
19501952
"Web to Plex": ["https://webtoplex.github.io/web/", "https://ephellon.github.io/web.to.plex/"],
19511953
"Allocine": "https://allocine.fr/",
19521954
"Plex": "https://app.plex.tv/",
1955+
"Shana Project": "https://www.shanaproject.com/",
19531956

19541957
// Dont' forget to add to the __options__ array!
19551958
}, builtin_array = [], builtin_sites = {}, builtinElement = $('#builtin');
@@ -2056,7 +2059,6 @@ addListener($('#all-builtin'), 'click', event => {
20562059
let plugins = {
20572060
'Indomovie': ['https://indomovietv.club/', 'https://indomovietv.org/', 'https://indomovietv.net/'],
20582061
'Toloka': 'https://toloka.to/',
2059-
'Shana Project': 'https://www.shanaproject.com/',
20602062
'My Anime List': 'https://myanimelist.net/',
20612063
'My Shows': 'https://myshows.me/',
20622064
'Redbox': 'https://www.redbox.com/',
@@ -2065,6 +2067,7 @@ let plugins = {
20652067
'SnagFilms': 'http://snagfilms.com/',
20662068
'Free Movies Cinema': 'https://freemoviescinema.com/',
20672069
'Fox Searchlight': 'http://foxsearchlight.com/',
2070+
'Metacritic': 'https://www.metacritic.com/',
20682071

20692072
// Don't forget to add to the __options__ array!
20702073
}, plugin_array = [], plugin_sites = {}, pluginElement = $('#plugins');
@@ -2544,24 +2547,30 @@ Recall['@0sec'].SetVersionInfo = async() => {
25442547
status;
25452548

25462549
switch(compareVer(remote, local)) {
2547-
case 0:
2548-
status = 'same';
2549-
verEl.setAttribute('title', `The installed version is the most recent. No update required`);
2550-
break;
2551-
25522550
case -1:
25532551
status = 'high';
2554-
verEl.setAttribute('title', `The installed version is ahead of GitHub. No update required`);
2552+
verEl.setAttribute('title', `The installed version (v${ local }) is ahead of GitHub. No update required`);
2553+
break;
2554+
2555+
case 0:
2556+
status = 'same';
2557+
verEl.setAttribute('title', `The installed version (v${ local }) is the most recent. No update required`);
25552558
break;
25562559

25572560
case 1:
25582561
status = 'low';
25592562
verEl.href += (DM? '': '/latest');
2560-
verEl.setAttribute('title', `The installed version is behind GitHub. Update available`);
2563+
verEl.setAttribute('title', `The installed version (v${ local }) is behind GitHub. Update to v${ remote } available`);
25612564
break;
2565+
2566+
default:
2567+
verEl.setAttribute('title', `An error has occured comparing Web to Plex versions ([v${ local }] \u2194 [v${ remote }])`);
2568+
verEl.setAttribute('status', 'low');
2569+
verEl.innerHTML = 'ERROR';
2570+
return;
25622571
}
25632572

2564-
verEl.innerHTML = `v${ manifest.version }`;
2573+
verEl.innerHTML = `v${ local }`;
25652574
verEl.setAttribute('status', status);
25662575
}
25672576

0 commit comments

Comments
 (0)