youtubespeedchange

Dodaje speed change na youtube

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        youtubespeedchange
// @description Dodaje speed change na youtube
// @namespace   costam
// @include     *youtube.com*
// @version     1.02
// @grant       none
// ==/UserScript==

var changevideospeed = function(speed)
{
  var obj = document.getElementsByTagName('video');
  if(obj.length > 0)
  {
    obj[0].playbackRate = speed;
  }
}

var changevideospeed05 = function() { changevideospeed(0.5); }
var changevideospeed10 = function() { changevideospeed(1); }
var changevideospeed15 = function() { changevideospeed(1.5); }
var changevideospeed125 = function() { changevideospeed(1.25); }
var changevideospeed175 = function() { changevideospeed(1.75); }
var changevideospeed20 = function() { changevideospeed(2); }

var init_buttons = function()
{
  var obj = document.getElementsByTagName('video');
  if(obj.length > 0 && !document.getElementById('speedchange1'))
  {
    obj = obj[0];
    var elem = document.createElement('div');
    var style = 'border: 2px solid #777777; background: #eeeeee; color: black; padding: 7px 13px; font-size: 14px;';
    var text = '<div style="padding-bottom: 13px; text-align: left;">Speed: ';
    text += '<a href="javascript:void(0)" id="speedchange1" style="'+style+'">0.5x</a> ';
    text += '<a href="javascript:void(0)" id="speedchange2" style="'+style+'">1.0x</a> ';
    text += '<a href="javascript:void(0)" id="speedchange3" style="'+style+'">1.25x</a> ';
    text += '<a href="javascript:void(0)" id="speedchange4" style="'+style+'">1.5x</a> ';
    text += '<a href="javascript:void(0)" id="speedchange5" style="'+style+'">1.75x</a> ';
    text += '<a href="javascript:void(0)" id="speedchange6" style="'+style+'">2.0x</a> ';
    text += '</div>';
    elem.innerHTML = text;
    
    var toapp = document.getElementById('watch-header');
    
    toapp.insertBefore(elem, toapp.firstChild);
    
    document.getElementById('speedchange1').onclick = changevideospeed05;
    document.getElementById('speedchange2').onclick = changevideospeed10;
    document.getElementById('speedchange3').onclick = changevideospeed125;
    document.getElementById('speedchange4').onclick = changevideospeed15;
    document.getElementById('speedchange5').onclick = changevideospeed175;
    document.getElementById('speedchange6').onclick = changevideospeed20;
  }
}

setInterval(init_buttons, 5000);