1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-17 01:16:16 -04:00
elinks/contrib/smjs/google_video.js
Miciah Dashiel Butler Masters b9d5bcee1c SMJS: Give user scripts access to the view_state
Introduce the view_state object to ECMAScript with properties .uri and
.plain and pass the current view_state to preformat hooks.
2006-01-29 12:02:08 +01:00

18 lines
659 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, vs) {
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);