Skip to content

Instantly share code, notes, and snippets.

@YungSang
Last active December 28, 2015 23:49
Show Gist options
  • Save YungSang/7581180 to your computer and use it in GitHub Desktop.
Save YungSang/7581180 to your computer and use it in GitHub Desktop.
Taberareloo パッチ: Tumblr の ”Terms of Service, Privacy Policy, and Community Guidelines” アラートのダイアログを強制的に消す。
// ==Taberareloo==
// {
// "name" : "Remove Tumblr TOS Alert message"
// , "description" : "Remove Tumblr TOS Alert message"
// , "include" : ["content"]
// , "match" : ["*://www.tumblr.com/*"]
// , "version" : "0.8.4"
// , "downloadURL" : "https://gist.github.com/YungSang/7581180/raw/userscript.remove.tumblr.tos.alert.tbrl.js"
// }
// ==/Taberareloo==
(function() {
// var ui_dialog_pos = $X('id("dialog_0")')[0];
var ui_dialog_pos = $X('//div[contains(@class,"ui_dialog_pos")]')[0];
if (!ui_dialog_pos) {
return;
}
ui_dialog_pos.parentNode.removeChild(ui_dialog_pos);
var ui_dialog_lock = $X('//div[contains(@class,"ui_dialog_lock")]')[0];
if (!ui_dialog_lock) {
return;
}
ui_dialog_lock.style.display = 'none';
var html = $X('/html')[0];
if (html && html.classList.contains('dialog_lock')) {
html.classList.remove('dialog_lock');
}
if (!location.href.match(/\/reblog\//)) {
$X('//div[@class="radar_controls"]//a[@title="Reblog"]')[0].dispatchEvent(new MouseEvent('click', {
bubbles : true,
cancelable : true
}));
var timer = setInterval(function () {
var cancel = $X('id("post_form")[contains(@class,"active")]//button[text()="Cancel"]')[0];
if (cancel) {
clearInterval(timer);
cancel.dispatchEvent(new MouseEvent('click', {
bubbles : true,
cancelable : true
}));
}
}, 500);
var timer2 = setInterval(function () {
if (!location.href.match(/\/reblog\//)) {
var scrollverlay = $X('//div[@data-token="body-scrollverlay"]')[0];
if (scrollverlay && scrollverlay.classList.contains('active')) {
scrollverlay.classList.remove('active');
}
}
}, 1000);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment