您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Small script for a request https://greasyfork.org/uk/forum/discussion/6631/change-facebook-notification-sound-convert-chrome-extension-to-userscript
当前为
- // ==UserScript==
- // @name Change Facebook Notification Sound
- // @namespace cfs
- // @description Small script for a request https://greasyfork.org/uk/forum/discussion/6631/change-facebook-notification-sound-convert-chrome-extension-to-userscript
- // @include https://facebook.com/*
- // @include https://www.facebook.com/*
- // @version 0.1.3
- // @grant none
- // @noframes
- // @run-at document-end
- // @author Dexmaster
- // @date 2015-10-25
- // ==/UserScript==
- (function () {
- "use strict";
- var counter = 0,
- soundUri = 'https://instaud.io/_/djS.mp3', // input sound link here
- interval = 5, // number of seconds between checks
- audio;
- var ready = function (fn) {
- if (document.readyState !== 'loading') {
- fn();
- } else {
- document.addEventListener('DOMContentLoaded', fn);
- }
- };
- var countUnread = function () {
- var els = document.querySelectorAll("._51jx"),
- sum = Array.prototype.map.call(els, function (el) {
- return parseInt(el.innerHTML) || 0;
- }).reduce(function (a, b) {
- return a + b;
- }, 0);
- return sum;
- };
- var numberChange = function () {
- var num = countUnread();
- if (counter !== num) {
- counter = num;
- audio.play();
- }
- };
- var init = function () {
- audio = document.createElement('audio');
- audio.setAttribute('src', soundUri);
- // audio.setAttribute('autoplay', 'autoplay');
- setInterval(numberChange, interval*1000);
- };
- ready(init);
- }());