1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-29 17:42:25 +01:00

Don't run the YouTube URL shortner on non-video pages.

This commit is contained in:
Doug Kearns
2013-10-15 14:01:12 +11:00
parent b840612bb8
commit ecaa01d3b2

View File

@@ -2708,10 +2708,11 @@ Buffer.addPageInfoSection("s", "Security", function (verbose) {
});
// internal navigation doesn't currently update link[rel='shortlink']
Buffer.addURIShortener("youtube.com", (uri, doc) =>
util.newURI("http://youtu.be/" +
array.toObject(uri.query.split("&")
.map(p => p.split("="))).v));
Buffer.addURIShortener("youtube.com", (uri, doc) => {
let video = array.toObject(uri.query.split("&")
.map(p => p.split("="))).v;
return video ? util.newURI("http://youtu.be/" + video) : null;
});
// catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }