我正在制作我的第一个GM脚本,以便用HTML 5音频标签替换http://www.freesound.org上的Flash预览,并为搜索结果添加下载链接。我有后者工作正常,但我不能让音频标签显示在Firefox 3.5.9。这是我的脚本:GreaseMonkey中未显示HTML 5音频标签
// ==UserScript==
// @name FreeSound HTML 5 Preview
// @namespace http://thewordnerd.info
// @description Replace Flash-based sound previews on freesound.org with audio tags and add quick download links
// @include http://freesound.org/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
// ==/UserScript==
$(document).ready(function() {
$("embed").remove();
$(".samplelist").each(function(index) {
sampleNo = $(this).find("a:first").attr("href").split("?")[1].split("=")[1];
userName = $(this).find("a:eq(1)").html();
title = $(this).find("a:first").html().replace(/ /g, "_");
url = "/download/"+sampleNo+"/"+sampleNo+"_"+userName+"_"+title;
$(this).find("script").replaceWith("<audio src='"+url+"' controls='controls' type='audio/wave'/>");
//$(this).find("audio").removeAttr("tabindex");
$(this).append("<a href='"+url+"'>Download</a>");
});
});
我可以看到在Firebug中的元素,它似乎很好。
有关我在这里可能会做错的想法?由于下载链接确实下载了所需的文件,因为这是一个浪潮,因为我认为我已经设置了正确的类型,所以我不知道为什么这不显示。