-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapple_daily_html5_video_hk.user.js
34 lines (31 loc) · 1.14 KB
/
apple_daily_html5_video_hk.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ==UserScript==
// @name Apple Daily HTML5 video HK
// @namespace https://github.com/soem/greasemonkey-scripts
// @description Apple Daily HTML5 video HK
// @match http://hk.apple.nextmedia.com/realtime/*
// @match http://hk.apple.nextmedia.com/enews/realtime/*
// @grant none
// ==/UserScript==
var video_div, flash_script, parrent_div;
if ( document.location.href == '' ) {
// need something for http://hk.dv.nextmedia.com/actionnews/
} else {
video_div = document.getElementById('video_player');
flash_script = video_div.getElementsByTagName('script')[0].firstChild;
parrent_div = document.getElementById('InSkinContainer_myInSkin1')
}
var video_src = flash_script.wholeText.match(/http.*mp4/g)[0];
video = document.createElement("video");
video.src = video_src;
video.autoPlay = false;
video.type = "video/mp4";
video.preload = true;
video.controls = true;
if (parrent_div) {
video.height = parseInt(parrent_div.style.height);
video.width = parseInt(parrent_div.style.width);
}
while (video_div.hasChildNodes()) {
video_div.removeChild(video_div.firstChild);
}
video_div.appendChild(video);