From bae06d1832382114bdfe4d7dc135925cdb408ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Hangst=C3=B6rfer?= Date: Wed, 11 Mar 2015 01:21:17 +0100 Subject: [PATCH] Added .create tests, resolves #4 Removed a leftover .format Removed www. from links --- .jshintrc | 11 +- bower.json | 2 +- dist/jsVideoUrlParser.js | 12 +- dist/jsVideoUrlParser.min.js | 2 +- package.json | 2 +- src/plugins/provider/Dailymotion.js | 4 +- src/plugins/provider/YouTube.js | 8 +- tests/src/assertPair.js | 10 - tests/src/assertUrlTest.js | 38 +++ tests/src/plugins/provider/Dailymotion.js | 39 +-- tests/src/plugins/provider/Twitch.js | 35 +-- tests/src/plugins/provider/Vimeo.js | 50 ++-- tests/src/plugins/provider/YouTube.js | 161 +++++------ tests/test.js | 325 ++++++++++++---------- 14 files changed, 387 insertions(+), 312 deletions(-) delete mode 100644 tests/src/assertPair.js create mode 100644 tests/src/assertUrlTest.js diff --git a/.jshintrc b/.jshintrc index 6308c85..df914bc 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,14 +1,15 @@ { "globals": { - "urlParser": true, - "getTime": true, - "assertURLTestPairs": true, - "QUnit": true + "urlParser": true, + "getTime": true, + "assertUrlTest": true, + "QUnit": true, + "cloneObject": true }, + "newcap": false, "boss": true, "node": true, "strict": true, - "newcap": false, "undef": true, "unused": true, "onecase": true, diff --git a/bower.json b/bower.json index 23d768a..e2dbf34 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jsVideoUrlParser", - "version": "0.1.0", + "version": "0.1.1", "homepage": "https://github.com/Zod-/jsVideoUrlParser", "authors": [{ "name": "Julian Hangstörfer", diff --git a/dist/jsVideoUrlParser.js b/dist/jsVideoUrlParser.js index 95cd80f..b843521 100644 --- a/dist/jsVideoUrlParser.js +++ b/dist/jsVideoUrlParser.js @@ -101,14 +101,14 @@ urlParser.bind({ "use strict"; var vi = op.videoInfo; if (vi.startTime) { - return 'https://www.dailymotion.com/video/' + vi.id + '?start=' + vi.startTime; + return 'https://dailymotion.com/video/' + vi.id + '?start=' + vi.startTime; } if (op.format === 'short') { return 'https://dai.ly/' + vi.id; } - return 'https://www.dailymotion.com/video/' + vi.id; + return 'https://dailymotion.com/video/' + vi.id; } }); @@ -228,19 +228,19 @@ urlParser.bind({ var url, vi = op.videoInfo; if (vi.mediaType === 'playlist') { - return 'https://www.youtube.com/playlist?feature=share&list=' + vi.playlistId; + return 'https://youtube.com/playlist?feature=share&list=' + vi.playlistId; } if (vi.playlistId) { - url = 'https://www.youtube.com/watch?v=' + vi.id + '&list=' + vi.playlistId; + url = 'https://youtube.com/watch?v=' + vi.id + '&list=' + vi.playlistId; if (vi.playlistIndex) { - url += '&index={0}'.format(vi.playlistIndex); + url += '&index=' + vi.playlistIndex; } } else { if (op.format === 'short') { url = 'https://youtu.be/' + vi.id; } else { - url = 'https://www.youtube.com/watch?v=' + vi.id; + url = 'https://youtube.com/watch?v=' + vi.id; } } diff --git a/dist/jsVideoUrlParser.min.js b/dist/jsVideoUrlParser.min.js index 32cf5d7..7715223 100644 --- a/dist/jsVideoUrlParser.min.js +++ b/dist/jsVideoUrlParser.min.js @@ -1 +1 @@ -function URLParser(){"use strict";this.plugins={}}function getTime(a){"use strict";var b,c=0,d={s:1,m:60,h:3600,d:86400,w:604800};if(!a.match(/^(\d+[smhdw]?)+$/))return 0;a=a.replace(/([smhdw])/g," $1 ").trim(),b=a.split(" ");for(var e=0;e