leetcod AC music feedback

LeetCode AC play music 《Good luck》

20.11.2021 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         leetcod AC music feedback
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  LeetCode AC play music 《Good luck》
// @author       WangXiaowu
// @match        https://leetcode.com/*
// @icon         https://www.google.com/s2/favicons?domain=leetcode.com
// @require      http://code.jquery.com/jquery-latest.js
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    let netease_src = "https://m704.music.126.net/20211120101235/597d909fe47e4e1336d43ea96eda127e/jdyyaac/obj/w5rDlsOJwrLDjj7CmsOj/8837130090/e64d/e6e0/76ad/4b9e06388e5bf007db0a99c0170a662c.m4a?authSecret=0000017d3b07043f05c80aaba3b00328";
    let qq_src = "https://dl.stream.qqmusic.qq.com/C400000491MM0CyBv8.m4a?guid=3154030324&vkey=3159164EDCFFAD356C35F3258E781F1FEEB4AB9F2E9A942787D6AA4BC686CE5E239F09722BB8992203AD3DE25D44A80791EB877E0866C1F8&uin=&fromtag=66";
    var player = document.createElement('audio');
    player.src = qq_src;
    var observer = new MutationObserver(function (mutations, me) {
        // `mutations` is an array of mutations that occurred
        // `me` is the MutationObserver instance
        var button =  $("a[data-question-title-slug]").length;
        if (button) {
            if(!player.paused || player.currentTime){
                player.pause();
            }else{
                player.play();
            }
            //me.disconnect(); // stop observing
            return;
        }
    });

    // start observing
    observer.observe(document, {
        childList: true,
        subtree: true
    });


    // Your code here...
})();