🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/01/12 13:08:58
🔄 下次更新时间:2026/01/12 14:08:58
手动刷新缓存

Cda Speed Slider

Cda.pl Speed Slider

คุณจะต้องติดตั้งส่วนขยาย เช่น 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.

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         Cda Speed Slider
// @version      0.1.2
// @namespace    http://lukaszmical.pl/
// @description  Cda.pl Speed Slider
// @author       Łukasz
// @include      https://www.cda.pl/video/*
// @grant        none
// ==/UserScript==

var cda = {};
cda.el ={};

cda.init = function () {
    var menu_item =  cda.$('.pb-menu');
    if(menu_item){
        cda.el.menu = menu_item.lastChild;
        cda.el.player = cda.$('video');
        cda.menu();
    }
    else {
        setTimeout(cda.init, 1000);
    }
};

cda.menu = function () {
    var li = cda.$.new('li',{attr:{"item" : "6"}, style:{"background":"#F9F9F9"}});

    var box = cda.$.new('div');

    var initSpeed = cda.initSpeed();

    box.appendChild(cda.check(cda.data('cda_r')));
    box.appendChild(cda.slider(initSpeed));
    box.appendChild(cda.label(initSpeed));

    li.appendChild(box);

    cda.el.menu.appendChild(li);
    cda.duration(initSpeed);
};




cda.initSpeed = function () {
    if(cda.data('cda_r') && cda.data('cda_s')){
        return cda.data('cda_s');
    }
    return 1;
};

cda.check = function (isCheck) {
    var check = cda.$.new('input', {
        'type': 'checkbox',
        title: 'Remember Speed',
        style:{
            height: '20px',
            margin: '8px',
            width: '20px'
        },
        onchange: cda.remember
    });
    if(isCheck){
        cda.$.attr(check, 'checked', 'checked');
    }
    return check;

};
cda.label = function () {
    cda.el.label =  cda.$.new('div', {
        style:{
            height: '35px',
            width: '30px',
            float: 'right',
            color: "#000",
            'text-align': 'center',
            'margin-left': '5px',
            'font-size': '16px',
            'line-height': '35px'
        }
    });
    return cda.el.label;
};

cda.slider = function (initSpeed) {
    return cda.$.new('input', {
        'type': 'range',
        'min': 0.5,
        'max': 4,
        'step': 0.1,
        'value': initSpeed,
        style:{
            'width': '100px'
        },
        onchange : cda.change,
        oninput: cda.move,
        onwheel:cda.onwheel
    });
};


cda.move = function (event) {
    cda.updateLabel(event.target.value);
};

cda.onwheel = function (event) {
    var val = parseFloat(event.target.value) + (event.wheelDelta > 0 ? 0.1 : -0.1);
    val = val < 0.5 ? 0.5 : (val > 4 ? 4 : val);
    if(event.target.value != val){
        event.target.value = val;
        cda.duration(val);
    }
    return false;
};

cda.remember = function (event) {
    cda.data('cda_r', event.target.checked ? 1 :0);
};

cda.change = function (event) {
    cda.duration(event.target.value);
};


cda.duration = function(value){
    cda.updateLabel(value);
    cda.data('cda_s', value);
    cda.el.player.playbackRate = value;
};

cda.updateLabel = function(value){
    cda.el.label.innerHTML = parseFloat(value).toFixed(1);
};



cda.$ = function (tselector, all) {
    all = all || false;
    var type = tselector.substring(0, 1);
    var selector = tselector.substring(1);
    var elements;
    if (type == "#")return document.getElementById(selector);
    else if (type == ".") elements = document.getElementsByClassName(selector);
    else elements = document.querySelectorAll(tselector);
    if (all) return elements;
    else return elements.length ? elements[0] : null;
};

cda.$.new = function (tag, option) {
    var element = document.createElement(tag);
    for (var param in option) {
        if(param == 'data' || param == 'style'|| param == 'attr'){
            for(var data in option[param]){
                cda.$[param](element, data, option[param][data]);
            }
        }
        else{
            element[param] = option[param];
        }
    }
    return element;
};


cda.$.data = function (elem, key, val) {
    key = key.replace(/-(\w)/gi, function(x){return x.charAt(1).toUpperCase()});
    if(typeof val !== 'undefined'){
        elem.dataset[key] = val;
    }
    return elem.dataset[key];
};

cda.$.style = function (elem, key, val, priority) {
    priority = priority || '';
    if(typeof val !== 'undefined'){
        elem.style.setProperty(key, val, priority);
    }
    return elem.style.getPropertyValue(key);
};

cda.$.attr = function (elem, key, val) {
    if(typeof val !== 'undefined'){
        elem.setAttribute(key, val);
    }
    return elem.getAttribute(key);
};


cda.data = function (key, val) {
    if(typeof val !== 'undefined'){
        localStorage.setItem(key, val);
    }
    return localStorage.getItem(key);
};


cda.addCss = function(styles){
    var css = '';
    for(var elem in styles){
        css += elem + "{";
        var props = styles[elem];
        for(var prop in props){
            css += prop + ":" + props[prop] + ";";
        }
        css += "}";
    }
    var sheet = document.createElement('style');
    sheet.innerHTML = css;
    document.body.appendChild(sheet);
};

cda.init();