Skip to content

Instantly share code, notes, and snippets.

@hyuki
Created January 26, 2019 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki/0c46554ad6a2aad9a20c97621261d852 to your computer and use it in GitHub Desktop.
Save hyuki/0c46554ad6a2aad9a20c97621261d852 to your computer and use it in GitHub Desktop.
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
Copy link
Author

hyuki commented Jan 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment