mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
4fda3ba828
Instead of assigning the URI for the video to elinks.location, instead create a <meta> tag to automatically load the video. This way, the video will still be automatically loaded when the document is loaded from cache.
18 lines
655 B
JavaScript
18 lines
655 B
JavaScript
/* Play videos at video.google.com with minimal niggling. Just follow the link
|
|
* from the front page or the search page, and the video will automatically
|
|
* be loaded. */
|
|
function load_google_video(cached) {
|
|
if (!cached.uri.match(/^http:\/\/video.google.com\/videoplay/))
|
|
return true;
|
|
|
|
var re = /(<object data="\/googleplayer.swf\?videoUrl=)(.*?)(\&.*?<\/object>)/;
|
|
var match = cached.content.match(re);
|
|
var url = unescape(match[2]);
|
|
var meta = '<meta http-equiv="refresh" content="1; url=' + url + '" />';
|
|
|
|
cached.content = cached.content.replace(/<head>/, "<head>" + meta);
|
|
|
|
return true;
|
|
}
|
|
elinks.preformat_html_hooks.push(load_google_video);
|