Skip to content

Instantly share code, notes, and snippets.

@nghiahsgs
Created April 24, 2020 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nghiahsgs/3c3135db526239d6002a809857078f43 to your computer and use it in GitHub Desktop.
Save nghiahsgs/3c3135db526239d6002a809857078f43 to your computer and use it in GitHub Desktop.
javascript:var style=document.createElement('style');style.type='text/css';style.innerHTML='.j2_down,.j2_up{cursor:pointer;line-height:0;font-weight:700}.j2_down,.j2_show_text,.j2_up{font-weight:700}.j2team{overflow: hidden;width:137px;border:1px solid #000;height:42px;border-radius:5px;position:fixed;z-index:9999;bottom:10px;left:10px;background-color:#64B448;color:#fff}.j2_down,.j2_show{width:42px;height:40px;display:inline-block;float:left;text-align:center;width:45px;overflow:hidden;}.j2_down{font-size:40px;padding-top:17px}.j2_show{padding-top:0;padding-bottom:0;}.j2_show_text{width:44px;height:100%;font-size:20px;text-align:center;background-color:#fff;color:#000;}.j2_up{width:42px;height:40px;display:inline-block;float:left;text-align:center;font-size:40px;padding-top:18px}';document.getElementsByTagName('head')[0].appendChild(style);document.getElementsByTagName('body')[0].appendChild(setInnerHTML(document.createElement("div"),'<div class="j2team"> <div class="j2_down" onclick="down()"> - </div><div class="j2_show"> <input id="j2_show_text" class="j2_show_text" value="1"/> </div><div class="j2_up" onclick="up()"> + </div></div>'));var current_speed=document.querySelector('video').playbackRate;document.querySelector('video').playbackRate=current_speed;function setInnerHTML(element,content){element.className='j2team';element.innerHTML=content;return element} function up(){var current_speed=document.querySelector('video').playbackRate;if(current_speed<2) document.querySelector('video').playbackRate=current_speed+0.1;document.getElementById("j2_show_text").value=current_speed+0.1} function down(){var current_speed=document.querySelector('video').playbackRate;if(current_speed>-0.5) document.querySelector('video').playbackRate=current_speed-0.1;document.getElementById("j2_show_text").value=current_speed-0.1} function reset(){document.querySelector('video').playbackRate=1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment