Last active
December 20, 2015 15:09
-
-
Save bsoist/6152295 to your computer and use it in GitHub Desktop.
My own verbs to load into Fargo.io.
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
| /* | |
| Heavily inspired by | |
| Jeffrey Kishner [ http://blog.jeffreykishner.com/ ] | |
| Ken Smith [ http://smith.smallpict.com/ ] | |
| and | |
| Dave Winer [ http://scripting.com ] | |
| I'm working on posts to give proper credit. | |
| */ | |
| var bsoistVerbs = { | |
| goSummit: function(n) { | |
| op.firstSummit(); | |
| op.go(down,n); | |
| }, | |
| postUnderDate: function(n) { | |
| bsoistVerbs.goSummit(n); | |
| op.go(right); | |
| op.go(down); | |
| var date = clock.now(); | |
| op.insert("Posted: " + date, up); | |
| }, | |
| goTweet: function(text,link) { | |
| bsoistVerbs.postUnderDate(3); | |
| op.attributes.setOne("icon","twitter-sign"); | |
| op.insert(text,down); | |
| op.attributes.setOne("isFeedItem","true"); | |
| op.reorg(right); | |
| tweetlink = "https://twitter.com/share?text=" + text; | |
| if (link) {tweetlink = tweetlink + "&url=" + link;}; | |
| window.open(tweetlink, "_blank"); | |
| }, | |
| addLink: function() { | |
| var link = prompt("Paste here ","").split('==='); | |
| var url = link[0]; | |
| var title = link[1]; | |
| bsoistVerbs.postUnderDate(2); | |
| op.insert(title,down); | |
| op.attributes.setOne("type","link"); | |
| op.attributes.setOne("url",url); | |
| op.attributes.setOne("icon","link"); | |
| op.attributes.setOne("isFeedItem","true"); | |
| op.reorg(right); | |
| }, | |
| tweetThis: function() { | |
| var text = op.getLineText(); | |
| bsoistVerbs.goTweet(text,null); | |
| }, | |
| tweetBlog: function() { | |
| var text = op.getLineText(); | |
| var link = op.getCursorUrl(); | |
| bsoistVerbs.goTweet(text,link); | |
| }, | |
| tweetLink: function() { | |
| var text = op.getLineText(); | |
| var link = op.attributes.getOne("url"); | |
| bsoistVerbs.goTweet(text,link); | |
| }, | |
| taskThis: function(filename) { | |
| var bsoist_ext = '.todo'; | |
| if (! filename ) { | |
| filename = file.getCurrentFilePath().split('.')[0] + bsoist_ext; | |
| } | |
| var taskdata = ""; | |
| var bsoist_prefix = ""; | |
| var bsoist_suffix = ":\r\n"; | |
| op.visitSubs( | |
| function(headline,levelnum) { | |
| taskdata += bsoist_prefix + headline.getLineText() + bsoist_suffix; | |
| }, | |
| function(levelnum) { | |
| bsoist_prefix = "- "; | |
| bsoist_suffix = "\r\n"; | |
| }, | |
| function(levelnum) { | |
| bsoist_prefix = ""; | |
| bsoist_suffix = ":\r\n"; | |
| } | |
| ); | |
| file.writeWholeFile(filename,taskdata); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment