所以我正在制作一个供我个人使用的 Safari 扩展程序,但它根本不起作用。我正在尝试跳过 adf.ly 并直接访问该网站。但它根本没有做任何事情。我已经尝试提醒当前 URL 和假定的新 URL,但它们甚至都没有显示。
全球.html
<!DOCTYPE html>
<script type='application/javascript'>
// Skip Adf.ly
// Made by Austen Patterson
// For Safari
//(C) Copyright 2013 Austen Patterson.
safari.application.addEventListener("start", performCommand, true);
safari.application.addEventListener("validate", validateCommand, true);
// Function to perform when event is received
function performCommand(event) {
// Make sure event comes from the button
if (event.command == "skip") {
var url = this.activeBrowserWindow.activeTab.url;
var newurl = url.replace(/http:\/\/adf\.ly\/(\d+)\//, '');
location.href(newurl);
window.open(newurl,"_self");
return;
}
}
</script>
这是我的扩展生成器设置。