これが私のFacebook広告の無効化です:
マニフェスト.json
{
"name": "Facebook Ads Disabler",
"version": "0.0.1",
"description": "Disable side ads on facebook! By Alexander Piechowski.",
"content_scripts": [
{
"matches": [
"http://*.facebook.com/*","https://*.facebook.com/*"],
"js": ["main.js"],
"run_at": "document_end",
"all_frames": true
}
]
}
main.js
function remove(){
try
{
document.getElementById('pagelet_ego_pane_w').innerHTML = '';
}
catch(err)
{
//Skip if "pagelet_ego_pane_w" div tag isn't on this page
}
try
{
document.getElementById('pagelet_ego_pane').innerHTML = '';
}
catch(err)
{
//Skip if "pagelet_ego_pane" div tag isn't on this page
}
try
{
document.getElementById('pagelet_side_ads').innerHTML = '';
}
catch(err)
{
//Skip if "pagelet_side_ads" div tag isn't on this page
}
try
{
document.getElementById('fbPhotoSnowliftAdsSide').innerHTML = '';
}
catch(err)
{
//Skip if "fbPhotoSnowliftAdsSide" div tag isn't on this page
}
console.log('All ads have been removed.');
setTimeout(function(){remove();},2000);
}
remove();
これにより、ID の内部がすべて完全に空白になり、Facebook 内の新しいページに移動したときに 2 秒ごとに再実行されます。