function script_name()
{
return "NoWeiboAd";
}
function debug_flag()
{
return true;
}
function xpath(query)
{
return document.evaluate(query, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
}
function remove_nodes(allNode)
{
var remove_num = 0;
for (var i=0; i<allNode.snapshotLength; ++i)
{
var thisNode = allNode.snapshotItem(i);
if (thisNode)
{
thisNode.parentNode.removeChild(thisNode);
remove_num++;
}
}
return remove_num;
}
function remove_xpath(node_path)
{
var remove_num = remove_nodes(xpath(node_path));
console.log('Remove xpath = ' + node_path + ' num = ' + remove_num);
}
function remove_ad()
{
remove_xpath('//div[@feedtype="ad"]');
remove_xpath('//div[@ad-data]');
}
function remove_other()
{
var id_list = ["trustPagelet_checkin_lotteryv5", "trustPagelet_indexright_recom", "pl_rightmod_ads36", "trustPagelet_recom_memberv5", "pl_leftnav_app" ];
for (var i in id_list) {
remove_xpath('//div[@id="' + id_list[i] + '"]');
}
}
function remove_feed_spread()
{
remove_xpath('//div[@node-type="feed_spread"]');
}
function main()
{
if (debug_flag())
{
console.log('Starting ' + script_name());
}
remove_ad();
remove_feed_spread();
remove_other();
return 0;
}
window.setTimeout(main, 1000);