Skip to content

Commit

Permalink
Upgrade to 3.1.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 29, 2018
1 parent 58327c9 commit a0161c2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
8 changes: 7 additions & 1 deletion change.log
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
- 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
## v3.1.1.0 / SpaceK33z@1c182f0f37ad357d3c9160f7bfc86a006914a4a9

- **Added the "Use Loose" (RegExp) option (enabled by default)**
- this allows the plugin to use a RegExp of the title to find possible matches
Expand All @@ -245,3 +245,9 @@
- Fixed searching error in `/utils.js`
- The strict matching for searches was incorrectly implemented
- Added more GUI elements

## v3.1.1.1 / unreleased

- Fixed `String..toCaps` in `/utils.js`
- Added `/people` to Trakt's "Watch Now" link feature
- v3.0.0.0
Binary file modified src.crx
Binary file not shown.
Binary file modified src.zip
Binary file not shown.
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.1.0",
"version": "3.1.2.0",
// Firefox Support =>
// "applications": {
// "gecko": {
Expand Down
2 changes: 1 addition & 1 deletion src/sites/trakt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function isShowPage() {
}

function isDash() {
return /^\/(dashboard|calendars|search|(?:movies|shows)\/(?:trending|popular|watched|collected|anticipated|boxoffice)|$)/i.test(window.location.pathname);
return /^\/(dashboard|calendars|people|search|(?:movies|shows)\/(?:trending|popular|watched|collected|anticipated|boxoffice)|$)/i.test(window.location.pathname);
}

function getIMDbID() {
Expand Down
16 changes: 10 additions & 6 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ async function getIDs({ title, year, type, IMDbID, TMDbID, TVDbID, APIType, APII
k = (s = "") => {

let r = [
[/\s*\b(show|series|a([st]|nd?|cross|fter|lthough)?|b(e(cause|fore|tween)|ut|y)|during|from|in(to)?|[io][fn]|[fn]?or|the|[st]o|through|under|with(out)?|yet)\b\s*/gi, ''],
[/(?!^\s*)\b(show|series|a([st]|nd?|cross|fter|lthough)?|b(e(cause|fore|tween)|ut|y)|during|from|in(to)?|[io][fn]|[fn]?or|the|[st]o|through|under|with(out)?|yet)\b\s*/gi, ''],
// try replacing common words, e.g. Conjunctions, "Show," "Series," etc.
[/\s+/g, '|']
];
Expand Down Expand Up @@ -356,7 +356,7 @@ async function getIDs({ title, year, type, IMDbID, TMDbID, TVDbID, APIType, APII
// terminal.log(`Title Matching: ${ !!found }`, !!found? found: null);
}

// Find an OK match: Title ~ Title
// Find an OK match (Loose Searching): Title ~ Title
// The examples below are correct
// GOOD, found: VRV's "Bakemonogatari" vs. TVDb's "Monogatari Series"
// /\b(monogatari)\b/i.test('bakemonogatari') === true
Expand Down Expand Up @@ -938,15 +938,16 @@ function getPlexMediaURL(PlexUIID, key) {
return `${ config.plexURL.replace(config.server.id, PlexUIID) }details?key=${encodeURIComponent( key )}`;
}

String.prototype.toCaps = String.prototype.toCaps || function toCaps(all) {
String.prototype.toCaps = function toCaps(all) {
/** Titling Caplitalization
* Articles: a, an, & the
* Conjunctions: and, but, for, nor, or, so, & yet
* Prepositions: across, after, although, at, because, before, between, by, during, from, if, in, into, of, on, to, through, under, with, & without
*/
let array = this.toLowerCase(),
titles = /(?!^|an?|the)\b(a([st]|nd?|cross|fter|lthough)?|b(e(cause|fore|tween)|ut|y)|during|from|in(to)?|[io][fn]|[fn]?or|the|[st]o|through|under|with(out)?|yet)(?!\s*$)\b/gi,
exceptions = /([\:\|\.\!\?\"\(]\s*[a-z]|(?![\'\-\+])\b[^aeiouy\d\W]+\b)/gi;
titles = /(?!^|(?:an?|the)\s+)\b(a([st]|nd?|cross|fter|lthough)?|b(e(cause|fore|tween)|ut|y)|during|from|in(to)?|[io][fn]|[fn]?or|the|[st]o|through|under|with(out)?|yet)(?!\s*$)\b/gi,
cap_exceptions = /([\|\"\(]\s*[a-z]|[\:\.\!\?]\s+[a-z]|(?:[^\'\-\+]\b)[^aeiouy\d\W]+\b)/gi,
all_exceptions = /\b((?:ww)?(?:m+[dclxvi]*|d+[clxvi]*|c+[lxvi]*|l+[xvi]*|x+[vi]*|v+i*|i+))\b/gi;

array = array.split(/\s+/);

Expand All @@ -961,7 +962,10 @@ String.prototype.toCaps = String.prototype.toCaps || function toCaps(all) {
string = string.join(' ');

if(!all)
string = string.replace(titles, ($0, $1, $$, $_) => $1.toLowerCase()).replace(exceptions, ($0, $1, $$, $_) => $1.toUpperCase());
string = string
.replace(titles, ($0, $1, $$, $_) => $1.toLowerCase())
.replace(cap_exceptions, ($0, $1, $$, $_) => $1.toUpperCase())
.replace(all_exceptions, ($0, $1, $$, $_) => $1.toUpperCase());

return string;
};

0 comments on commit a0161c2

Please sign in to comment.