diff --git a/.gitignore b/.gitignore index 14efab9..93374fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .envrc twit2blog twit2blog.db +bookmarklet.min.js diff --git a/README.md b/README.md index 3e70cd1..3a7ddb8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ### Twit2Blog -A simple tool to help make it easier to generate readable tweets you can browse. +A simple tool to help make it easier to archive readable tweets you can browse. No external server or proprietary SaaS solution needed. ### Building `nimble build` is all you'll need at this point. @@ -9,11 +9,11 @@ A simple tool to help make it easier to generate readable tweets you can browse. Requires `TWITTER_CONSUMER_KEY` and `TWITTER_CONSUMER_SECRET`, both of which you can only get if you have a registered developer account and an application created for twitter. -1. Start the server +1. Compile the server with `nimble build` and then start the server like so. ``` ./twit2blog ``` -2. Install the bookmarklet +2. Install the bookmarklet (run `nimble bookmark` to generate it and then create a bookmark in your browser with it as the location) -3. Go to a twitter thread, click the bookmarklet, it will open up a new page where your thread will eventually be. +3. Go to a twitter thread, click the bookmarklet, it will open up a new page where your thread will eventually be. Wait a bit and come back to your beautifully archived thread! diff --git a/minified_bookmarklet.js b/minified_bookmarklet.js deleted file mode 100644 index 39529d4..0000000 --- a/minified_bookmarklet.js +++ /dev/null @@ -1 +0,0 @@ -javascript:(function(){function getLastXPath(xpexp){var iterator=document.evaluate(xpexp,document,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);var result=iterator.iterateNext();var lastEl=result;while(result!=null){result=iterator.iterateNext();if(result==null){break}lastEl=result}return lastEl}function getLastTweet(){var author=window.location.pathname.split("/")[1];var xp="//a[contains(@href, '"+author+"/status')]";return getLastXPath(xp).pathname}function queueTweet(){var lastTweet=getLastTweet();var url="http://localhost:8080/thread"+lastTweet;window.open(url,"_blank")}queueTweet()})(); diff --git a/twit2blog.nimble b/twit2blog.nimble index 205c31b..569b6da 100644 --- a/twit2blog.nimble +++ b/twit2blog.nimble @@ -12,3 +12,8 @@ bin = @["twit2blog"] requires "nim >= 1.0.9" requires "https://github.com/dom96/jester" requires "https://github.com/pragmagic/karax" + +task bookmark, "Builds the minified bookmarklet": + "bookmarklet.min.js".rmFile + "echo -n 'javascript:' > ./bookmarklet.min.js".exec + "uglifyjs bookmarklet.js >> ./bookmarklet.min.js".exec