我正在尝试让下面的书签充当一个Greasemonkey脚本,以解决stackexchange站点的可访问性错误。
javascript:(function(){$('a,%20.vote-up-off,%20.vote-down-off,%20.star-off').attr({role:'link',tabindex:'0'});})()当我删除函数()并将其放入下面的Greasemonkey脚本中时,它不起作用。
// ==UserScript==
// @name StackExchange access
// @description Enables y-aria stuff on stackoverflow
// @include *
// ==/UserScript==
$('a,%20.vote-up-off,%20.vote-down-off,%20.star-off').attr({role:'link',tabindex:'0'});
alert("worldzz");我猜我需要以某种方式从Greasemonkey访问document对象,但不确定如何操作。
发布于 2011-07-25 23:54:27
window.wrappedJSObject%20替换为空格字符代码:
// ==UserScript==
// @name StackExchange access
// @description Enables y-aria stuff on stackoverflow
// @include *
// ==/UserScript==
( function( global )
{
var $;
if( global.jQuery )
{
$ = global.jQuery;
$( function()
{
$( 'a, .vote-up-off, .vote-down-off, .star-off' )
.attr( {
role:'link',
tabindex:'0'
} );
} );
}
}( window.wrappedJSObject ) );https://stackoverflow.com/questions/6818697
复制相似问题