Created
April 17, 2013 13:49
-
-
Save co3k/5404468 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Non scheduled blogger posting preventer | |
// @namespace http://co3k.org/ | |
// @version 0.1 | |
// @description This script alerts when you try to post without scheduling | |
// @match http://www.blogger.com/blogger.g?* | |
// @copyright CC0 | |
// ==/UserScript== | |
window.addEventListener ("load", (function(){ | |
var button = document.querySelectorAll("button.blogg-primary")[0]; | |
if (!button) { | |
return true; | |
} | |
if (button.innerText == "更新") { | |
return true; | |
} | |
button.style.display = "none"; | |
var newButton = document.createElement("button"); | |
newButton.innerText = "(^_^)/ 投稿する"; | |
newButton.onclick = function () { | |
var schedule = document.querySelectorAll(".GIL3GQOBGWB p")[0]; | |
var message = ""; | |
if (schedule.innerText == "") { | |
message = "投稿予約日時が設定されていません。投稿してもよろしいですか?"; | |
} else if ((new Date()).getTime() >= (new Date(schedule.innerText).getTime())) { | |
message = schedule.innerText + "は現在時刻よりも以前なので、予約なしで公開されます。投稿してもよろしいですか?"; | |
} else { | |
message = schedule.innerText + "に投稿が予約されます。投稿してもよろしいですか?"; | |
} | |
if (window.confirm(message)) { | |
button.click(); | |
} | |
return false; | |
} | |
button.parentNode.appendChild(newButton); | |
}), false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment