Index: trunk/phase3/js2/mwEmbed/libTimedText/mvTimeTextEdit.js |
— | — | @@ -11,7 +11,8 @@ |
12 | 12 | loadGM({ |
13 | 13 | "mwe-add-subs-file" : "Add/Replace Subtitle", |
14 | 14 | "mwe-add-subs-file-title": "Select Subtitle to upload", |
15 | | - "mwe-error-only-srt" : "Only srt files can be uploaded right now." |
| 15 | + "mwe-error-only-srt" : "Only srt files can be uploaded right now.", |
| 16 | + "mwe-watch-video" : "Watch video" |
16 | 17 | }) |
17 | 18 | |
18 | 19 | |
— | — | @@ -22,6 +23,13 @@ |
23 | 24 | srtData = srtData.replace('\r\n', '\n'); |
24 | 25 | return srtData; |
25 | 26 | } |
| 27 | + function getVideoTitle() { |
| 28 | + var videoTitle = wgTitle.split('.'); |
| 29 | + videoTitle.pop(); |
| 30 | + videoTitle.pop(); |
| 31 | + videoTitle = videoTitle.join('.').replace('TimedText:', 'File:'); |
| 32 | + return videoTitle; |
| 33 | + } |
26 | 34 | function uploadSubtitles() { |
27 | 35 | do_api_req({ |
28 | 36 | 'data': { |
— | — | @@ -105,5 +113,14 @@ |
106 | 114 | button.click(uploadSubtitles) |
107 | 115 | button.text(gM("mwe-add-subs-file")); |
108 | 116 | ttoolbar.append(button); |
| 117 | + ttoolbar.append(' '); |
| 118 | + |
| 119 | + var button = $j('<button>'); |
| 120 | + button.click(function() { document.location.href = wgArticlePath.replace('$1', getVideoTitle()); }) |
| 121 | + button.text(gM("mwe-watch-video")); |
| 122 | + ttoolbar.append(button); |
| 123 | + |
| 124 | + alert(); |
| 125 | + |
109 | 126 | }); |
110 | 127 | |