fix wrongly embedded links with dummy types
This commit is contained in:
parent
4f260137f1
commit
9193c3e0f1
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.4.1 - 2014-03-25
|
||||
* 4chan X - Version 1.4.1 - 2014-03-31
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.4.1 - 2014-03-25
|
||||
* 4chan X - Version 1.4.1 - 2014-03-31
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||
@ -8251,6 +8251,9 @@
|
||||
if (!(match = type.regExp.exec(href))) {
|
||||
continue;
|
||||
}
|
||||
if (type.dummy) {
|
||||
break;
|
||||
}
|
||||
return [type.key, match[1], match[2], link];
|
||||
}
|
||||
},
|
||||
@ -8620,6 +8623,14 @@
|
||||
return data.entry.title.$t;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'Loopvid',
|
||||
regExp: /.*loopvid.appspot.com\/.*/,
|
||||
dummy: true
|
||||
}, {
|
||||
key: 'MediaFire',
|
||||
regExp: /.*mediafire.com\/.*/,
|
||||
dummy: true
|
||||
}, {
|
||||
key: 'video',
|
||||
regExp: /(.*\.(ogv|webm|mp4))$/,
|
||||
@ -8795,6 +8806,9 @@
|
||||
if (!(match = type.regExp.exec(href))) {
|
||||
continue;
|
||||
}
|
||||
if (type.dummy) {
|
||||
return;
|
||||
}
|
||||
return [type.key, match[1], match[2], link];
|
||||
}
|
||||
},
|
||||
@ -8916,6 +8930,16 @@
|
||||
},
|
||||
ordered_types: [
|
||||
{
|
||||
key: 'audio',
|
||||
regExp: /(.*\.(mp3|ogg|wav))$/,
|
||||
el: function(a) {
|
||||
return $.el('audio', {
|
||||
controls: 'controls',
|
||||
preload: 'auto',
|
||||
src: a.dataset.uid
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'gist',
|
||||
regExp: /.*(?:gist.github.com.*\/)([^\/][^\/]*)$/,
|
||||
el: function(a) {
|
||||
@ -8938,16 +8962,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'audio',
|
||||
regExp: /(.*\.(mp3|ogg|wav))$/,
|
||||
el: function(a) {
|
||||
return $.el('audio', {
|
||||
controls: 'controls',
|
||||
preload: 'auto',
|
||||
src: a.dataset.uid
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'image',
|
||||
regExp: /(http|www).*\.(gif|png|jpg|jpeg|bmp)$/,
|
||||
@ -9164,6 +9178,14 @@
|
||||
return data.entry.title.$t;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'Loopvid',
|
||||
regExp: /.*loopvid.appspot.com\/.*/,
|
||||
dummy: true
|
||||
}, {
|
||||
key: 'MediaFire',
|
||||
regExp: /.*mediafire.com\/.*/,
|
||||
dummy: true
|
||||
}, {
|
||||
key: 'video',
|
||||
regExp: /(.*\.(ogv|webm|mp4))$/,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript
|
||||
/*
|
||||
* 4chan X - Version 1.4.1 - 2014-03-25
|
||||
* 4chan X - Version 1.4.1 - 2014-03-31
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||
@ -8248,6 +8248,9 @@
|
||||
if (!(match = type.regExp.exec(href))) {
|
||||
continue;
|
||||
}
|
||||
if (type.dummy) {
|
||||
break;
|
||||
}
|
||||
return [type.key, match[1], match[2], link];
|
||||
}
|
||||
},
|
||||
@ -8617,6 +8620,14 @@
|
||||
return data.entry.title.$t;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'Loopvid',
|
||||
regExp: /.*loopvid.appspot.com\/.*/,
|
||||
dummy: true
|
||||
}, {
|
||||
key: 'MediaFire',
|
||||
regExp: /.*mediafire.com\/.*/,
|
||||
dummy: true
|
||||
}, {
|
||||
key: 'video',
|
||||
regExp: /(.*\.(ogv|webm|mp4))$/,
|
||||
@ -8792,6 +8803,9 @@
|
||||
if (!(match = type.regExp.exec(href))) {
|
||||
continue;
|
||||
}
|
||||
if (type.dummy) {
|
||||
return;
|
||||
}
|
||||
return [type.key, match[1], match[2], link];
|
||||
}
|
||||
},
|
||||
@ -8913,6 +8927,16 @@
|
||||
},
|
||||
ordered_types: [
|
||||
{
|
||||
key: 'audio',
|
||||
regExp: /(.*\.(mp3|ogg|wav))$/,
|
||||
el: function(a) {
|
||||
return $.el('audio', {
|
||||
controls: 'controls',
|
||||
preload: 'auto',
|
||||
src: a.dataset.uid
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'gist',
|
||||
regExp: /.*(?:gist.github.com.*\/)([^\/][^\/]*)$/,
|
||||
el: function(a) {
|
||||
@ -8935,16 +8959,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'audio',
|
||||
regExp: /(.*\.(mp3|ogg|wav))$/,
|
||||
el: function(a) {
|
||||
return $.el('audio', {
|
||||
controls: 'controls',
|
||||
preload: 'auto',
|
||||
src: a.dataset.uid
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'image',
|
||||
regExp: /(http|www).*\.(gif|png|jpg|jpeg|bmp)$/,
|
||||
@ -9161,6 +9175,14 @@
|
||||
return data.entry.title.$t;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'Loopvid',
|
||||
regExp: /.*loopvid.appspot.com\/.*/,
|
||||
dummy: true
|
||||
}, {
|
||||
key: 'MediaFire',
|
||||
regExp: /.*mediafire.com\/.*/,
|
||||
dummy: true
|
||||
}, {
|
||||
key: 'video',
|
||||
regExp: /(.*\.(ogv|webm|mp4))$/,
|
||||
|
||||
@ -151,6 +151,7 @@ Linkify =
|
||||
|
||||
for type in Linkify.ordered_types
|
||||
continue unless match = type.regExp.exec href
|
||||
break if type.dummy
|
||||
return [type.key, match[1], match[2], link]
|
||||
|
||||
return
|
||||
@ -433,6 +434,15 @@ Linkify =
|
||||
title:
|
||||
api: (uid) -> "https://gdata.youtube.com/feeds/api/videos/#{uid}?alt=json&fields=title/text(),yt:noembed,app:control/yt:state/@reasonCode"
|
||||
text: (data) -> data.entry.title.$t
|
||||
,
|
||||
# dummy entries: not implemented yet but included to prevent them being wrongly embedded as a subsequent type
|
||||
key: 'Loopvid'
|
||||
regExp: /.*loopvid.appspot.com\/.*/
|
||||
dummy: true
|
||||
,
|
||||
key: 'MediaFire'
|
||||
regExp: /.*mediafire.com\/.*/
|
||||
dummy: true
|
||||
,
|
||||
key: 'video'
|
||||
regExp: /(.*\.(ogv|webm|mp4))$/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user