diff --git a/plugins/paste/paste.js b/plugins/paste/paste.js index afeebeac..2d54155b 100644 --- a/plugins/paste/paste.js +++ b/plugins/paste/paste.js @@ -90,15 +90,54 @@ pasteTool.callbacks = { twitter : new RegExp("http?.+twitter.com?.+\/"), facebook : /https?.+facebook.+\/\d+\?/, vk : /https?.+vk?.com\/feed\?w=wall\d+_\d+/, - youtube : /https?.+youtube.com\/watch\?v=.{11}/ + video : { + vimeo: { + regex: /(?:http[s]?:\/\/)?(?:www.)?vimeo\.co(?:.+\/([^\/]\d+)(?:#t=[\d]+)?s?$)/, + html: "" + }, + youtube: { + regex: /^.*(?:(?:youtu\.be\/)|(?:youtube\.com)\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*)(?:[\?\&]t\=(\d*)|)/, + html: "", + timestamp: '?t=' + }, + coub: { + regex: /https?:\/\/coub\.com\/view\/([^\/\?\&]+)/, + html: "" + }, + vine: { + regex: /https?:\/\/vine\.co\/v\/([^\/\?\&]+)/, + html: "" + }, + vk: { + regex: /https?:\/\/vk\.com\/.*(?:video)([-_0-9]+)/, + html: "" + }, + imgur: { + regex: /https?:\/\/(?:i\.)?imgur\.com.*\/([a-zA-Z0-9]+)(?:\.gifv)?/, + html: "
\" data-context=\"false\">
",
+ square: true
+ },
+ gfycat: {
+ regex: /https?:\/\/gfycat\.com(?:\/detail)?\/([a-zA-Z]+)/,
+ html: "",
+ square: true
+ }
+ }
},
image = regexTemplates.image.test(string),
instagram = regexTemplates.instagram.exec(string),
twitter = regexTemplates.twitter.exec(string),
facebook = regexTemplates.facebook.test(string),
- vk = regexTemplates.vk.test(string),
- youtube = regexTemplates.youtube.test(string);
+ vk = regexTemplates.vk.test(string);
+
+ /**
+ * Video testing
+ */
+ var youtube = regexTemplates.video.youtube.regex.test(string);
+ var vimeo = regexTemplates.video.vimeo.regex.test(string);
+ var coub = regexTemplates.video.coub.regex.test(string);
+ var vine = regexTemplates.video.vine.regex.test(string);
if (image) {
@@ -124,6 +163,15 @@ pasteTool.callbacks = {
pasteTool.callbacks.youtubeMedia(string);
+ } else if (vimeo) {
+
+
+ } else if (vine) {
+
+
+ } else if (coub) {
+
+
}
},