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

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/01/02 20:26:54
🔄 下次更新时间:2026/01/02 21:26:54
手动刷新缓存

sound link fix

Prevents the default action for linked .wav/.mp3 files. Inplace playback using HTML5 instead.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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        sound link fix
// @namespace   gnblizz
// @description Prevents the default action for linked .wav/.mp3 files. Inplace playback using HTML5 instead.
// @include     *
// @version     1.02
// @grant       none
// @icon        data:image/gif;base64,R0lGODlhEAAQAKECAAAAAAD//////////yH5BAEKAAIALAAAAAAQABAAAAItlI+pi+GcXIAGCEmBxXfpiz2IZoHSQ5LHKaXfegpu2Uyyq9jjS1V0z+vJhIkCADs=
// ==/UserScript==
// sample page  http://japanese.about.com/od/japanesevocabulary/a/expression.htm
var i = document.links.length;
if(i) do {
  var link = document.links[--i];
  if(/\.(mp3|ogg|wav)$/i.test(link.href))
    link.addEventListener('click', WavFixOnClickHandler);
} while(i);
function WavFixOnClickHandler(event) {
  function CleanUp() { wrp.parentNode.removeChild(wrp); wrp = ctrl = null; };
  event.preventDefault();
  var node = event.currentTarget, wrp = document.createElement('span'), ref = node.getAttribute('href');
  wrp.setAttribute('style', 'position:relative;');
  wrp.innerHTML = '<audio controls autoplay><source src="' + ref + '" type="audio/' + ref.slice(-3).replace('mp3','mpeg') + '"></audio>';
  var ctrl = wrp.firstChild;
  ctrl.style.display = 'none';
  ctrl.onended = CleanUp;
  ctrl.lastChild.onerror = function() { alert('There was a technical problem.\n\nPlease try an option from the\ncontext menu of this link instead'); CleanUp(); };
  ctrl.onloadedmetadata = function(event) {
    if(ctrl.duration > 15) {
      var btn = document.createElement('BUTTON');
      btn.type = 'button';
      btn.textContent = 'stop this noise';
      btn.style = 'position:absolute;top:-8px;left:8px';
      wrp.appendChild(btn);
      btn.onclick = function() { ctrl.pause(); CleanUp(); };
    }
  }
  node.parentNode.insertBefore(wrp, node);
  return false;
}
// public domain by gnblizz
// contact me with my username + '@web.de'