Skip to content

Commit 114ceea

Browse files
committed
Merge pull request #26 from Klap-in/improved
Improved
2 parents c85f17e + 9945c44 commit 114ceea

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
if(window.toolbar != undefined){
66
toolbar[toolbar.length] = {"type": "pluginvshare",
77
"title": LANG['plugins']['vshare']['button'],
8-
"icon": DOKU_BASE+"lib/plugins/vshare/button.png",
8+
"icon": "../../plugins/vshare/button.png",
99
"key": ""};
1010
}
1111

sites.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ metacafe flash http://www.metacafe.com/fplayer/@VIDEO@/foo.swf
1717
myspacetv flash http://lads.myspace.com/videos/vplayer.swf?m=@VIDEO@&v=2&type=video
1818
rcmovie flash http://www.rcmovie.de/embed/@VIDEO@
1919
scivee flash //www.scivee.tv/flash/embedPlayer.swf?id=@VIDEO@&type=3
20+
twitchtv flash http://www.twitch.tv/widgets/live_embed_player.swf?channel=@VIDEO@&auto_play=false&start_volume=25
2021
veoh flash //www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId=@VIDEO@&id=anonymous
2122

2223

sites.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var sites = {
1919
'myspacetv': 'vids\\.myspace\\.com\\/.*videoid=(\\d+)',
2020
'rcmovie': 'rcmovie\\.de\\/video\\/([a-f0-9]+)\\/',
2121
'scivee': 'scivee\\.tv\\/node\\/(\\d+)',
22+
'twitchtv': 'twitch\\.tv\\/([a-z0-9_\\-]+)',
2223
'veoh': 'veoh\\.com\\/.*watch[^v]*(v[a-z0-9]+)'
2324
};
2425

syntax.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,44 @@ function handle($match, $state, $pos, &$handler){
7878
$height = 350;
7979
}
8080

81+
$paramm = array();
82+
parse_str($param, $paramm);
83+
$urlparam = array();
84+
foreach($paramm as $key => $value) {
85+
switch($key) {
86+
case 'rel':
87+
case 'autoplay':
88+
if($paramm[$key] === '1' || $paramm[$key] === '0') {
89+
$urlparam[] = $key . '=' . $paramm[$key];
90+
}
91+
break;
92+
case 'start':
93+
case 'end':
94+
case 'chapter_id': //for twitch.tv
95+
case 'initial_time':
96+
$number = (int) $paramm[$key];
97+
if($number > 0) {
98+
$urlparam[] = $key . '=' . $number;
99+
}
100+
break;
101+
}
102+
}
103+
81104
list($type, $url) = explode(' ', $this->sites[$site], 2);
82105
$url = trim($url);
83106
$type = trim($type);
84107
$url = str_replace('@VIDEO@',rawurlencode($vid),$url);
85108
$url = str_replace('@WIDTH@',$width,$url);
86109
$url = str_replace('@HEIGHT@',$height,$url);
110+
if(count($urlparam)) {
111+
if(strpos($url, '?') !== false) {
112+
$sepchar = '&';
113+
} else {
114+
$sepchar = '?';
115+
}
116+
$url .= $sepchar . implode('&', $urlparam);
117+
}
118+
87119
list(,$vars) = explode('?',$url,2);
88120
$varr = array();
89121
parse_str($vars,$varr);

0 commit comments

Comments
 (0)