Skip to content

Commit

Permalink
Shift キーを押しながらキャプチャすると字幕を表示しているときでも字幕を入れずにキャプチャできるようにした
Browse files Browse the repository at this point in the history
キーボードショートカットからも同様に利用できます(Alt + Shift + 1・Alt + Shift + 2)
  • Loading branch information
tsukumijima committed Oct 19, 2020
1 parent 49333f1 commit 462d95d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions htdocs/files/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,12 @@
}
});

// Shift キー
window.isShiftKey = false;
$(document).on('keydown keyup', function(event) {
window.isShiftKey = event.shiftKey;
});

// 現在変換中か
window.isComposing = false;
$('#tweet').on('compositionstart', function() {
Expand Down Expand Up @@ -1409,8 +1415,8 @@
var video = document.getElementsByClassName('dplayer-video-current')[0];
var subtitles = video.textTracks[1].activeCues;

// 字幕オンなら
if (video.textTracks[1].mode == 'showing' && video.textTracks[1].cues.length){
// 字幕オン & Shift キーが押されていないなら
if (video.textTracks[1].mode == 'showing' && video.textTracks[1].cues.length && (!event.shiftKey || !window.isShiftKey)){

var subtitle_html = '<div class="video-subtitle-box">\n';
for(var i = (subtitles.length - 1); i >= 0; i--){
Expand Down Expand Up @@ -1477,8 +1483,8 @@
html = html.replace(/transform: translateX\(.*?\)\;/, 'left: ' + position + 'px;');
}

// 字幕オンなら
if (video.textTracks[1].mode == 'showing' && video.textTracks[1].cues.length){
// 字幕オン & Shift キーが押されていないなら
if (video.textTracks[1].mode == 'showing' && video.textTracks[1].cues.length && !event.shiftKey){

var subtitle_html = '<div class="video-subtitle-box">\n';
for(var i = (subtitles.length - 1); i >= 0; i--){
Expand Down

0 comments on commit 462d95d

Please sign in to comment.