Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
scrapbox-diary.html
<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>
@hyuki

This comment has been minimized.

Copy link
Owner Author

@hyuki hyuki commented Jan 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.