Open spotify keyboard controls

control open spotify with the keyboard

当前为 2017-05-14 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Open spotify keyboard controls
// @namespace    http://digfish.org/
// @version      0.1
// @description  control open spotify with the keyboard
// @author       digfish
// @match        *.spotify.*
// @grant        none
// @include    https://*.spotify.*/*
// @match      http://*.spotify.*/*
// @match      https:/*.spotify.*/*
// @copyright  digfish, based on  ${4:Gustavo Keener}
// @debugger
// @require   http://code.jquery.com/jquery-1.8.0.min.js
// ==/UserScript==

// Add jQuery, unless it already exists

if(typeof jQuery === 'undefined'|| !jQuery){
    (function(){
        var s=document.createElement('script');
        s.setAttribute('src','https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js');
        if(typeof jQuery=='undefined'){
            document.getElementsByTagName('head')[0].appendChild(s);
            console.log('jQuery inject userscript: LOADED jQuery via userscript');
        } else {
            console.log('jQuery inject userscript: jQuery WAS NOT LOADED via userscript');

        }
    })();
}

(function() {
    //    'use strict';

    console.log('Loading Script Open Spotify keyboard controls!');
    $('body').keyup(function(evt) {

        console.log('Pressed on key:', evt.which);
         // fast forward is not reacting... and to catch volume keys impossible, unless you use 
        // the usual Fx key functions...
        if (evt.which == 179 ) { // F7 Play-Pause
            $('button.control-button.spoticon-pause-16').click();
            $('button.control-button.spoticon-play-16').click();
        } else if (evt.which == 177) { // F6 rewind
            $('.spoticon-skip-forward-16').click();
        }
    });
    





})();