From 5c6a966e6ff26f6e2db8b76601d8227b892f27af Mon Sep 17 00:00:00 2001 From: Xaekai Date: Mon, 16 Feb 2015 22:40:18 -0800 Subject: [PATCH] Use a generic matcher for the shorthand URIs. --- www/js/util.js | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/www/js/util.js b/www/js/util.js index ff5f365b..95afc6ca 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -1316,38 +1316,25 @@ function parseMediaLink(url) { } /* Shorthand URIs */ + // To catch Google Plus by ID alone if ((m = url.match(/(?:gp:)?(\d{21}_\d{19}_\d{19})/))) { return { id: m[1], type: "gp" }; } - - if ((m = url.match(/gd:([^\/]{28})/))) { - return { - id: m[1], - type: "gd" - }; - } - - if((m = url.match(/yt:([^\?&#]+)/))) { - return { - id: m[1], - type: "yt" - }; - } - + // So we still trim DailyMotion URLs if((m = url.match(/dm:([^\?&#_]+)/))) { return { id: m[1], type: "dm" }; } - - if((m = url.match(/vi:([^\?&#]+)/))) { + // Generic for the rest. + if ((m = url.match(/([a-z]{2}):([^\?&#]+)/)) { return { - id: m[1], - type: "vi" + id: m[2], + type: m[1] }; }