Created
January 26, 2019 07:46
-
-
Save hyuki/0c46554ad6a2aad9a20c97621261d852 to your computer and use it in GitHub Desktop.
scrapbox-diary.html
This file contains 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
<html> | |
<textarea id="SCRAPBOX-TEXT"></textarea> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> | |
<!-- Using https://thdoan.github.io/strftime/ --> | |
<script src="js/strftime.js"></script> | |
<script> | |
$(function() { | |
const project = 'https://scrapbox.io/YOURPROJECT/'; | |
$("#SCRAPBOX-TEXT").keydown(function(e) { | |
if (e.metaKey && e.keyCode == 13) { | |
if (confirm('Scrapbox日報に追記します。')) { | |
const text = $('#SCRAPBOX-TEXT').val(); | |
const date = new Date(); | |
const title = strftime("%Y%m%d", date); | |
window.open(project + encodeURIComponent(title) + '?body=' + encodeURIComponent(text)); | |
} | |
return false; | |
} | |
return true; | |
}); | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cf. https://snap.textfile.org/20190126164902/