-
-
Save am1t/c1a1d37af7cd33aedc9e1263888a70e0 to your computer and use it in GitHub Desktop.
Get the URL for the selected node in Drummer
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
var created = op.attributes.getOne("created"); | |
var baseurl = opml.getHeaders().urlBlogWebsite; | |
if(typeof(baseurl) == "undefined"){ | |
baseurl = "http://oldschool.scripting.com/" + opml.getHeaders().ownerTwitterScreenName + "/"; | |
} | |
var dt = new Date(created) | |
var day = (dt.getUTCDate() < 10 ? '0' : '') + dt.getUTCDate(); | |
var month = ((dt.getUTCMonth() +1) < 10 ? '0' : '') + (dt.getUTCMonth() + 1); | |
var year = dt.getUTCFullYear(); | |
var hour = (dt.getUTCHours() < 10 ? '0' : '') + dt.getUTCHours(); | |
var minutes = (dt.getUTCMinutes() < 10 ? '0' : '') + dt.getUTCMinutes() | |
var seconds = (dt.getUTCSeconds() < 10 ? '0' : '') + dt.getUTCSeconds() | |
var post = opml.parse(op.getCursorOpml()); | |
var isTitledPost = typeof(post.opml.body.subs[0].subs) != "undefined"; | |
var postUrl = ""; | |
if(isTitledPost) { | |
postUrl = baseurl + year + "/" + month + "/" + day + "/" + hour + minutes + seconds + ".html"; | |
postUrl = postUrl + "?title=" + op.getLineText(); | |
} else { | |
postUrl = baseurl + year + "/" + month + "/" + day + ".html#a" + hour + minutes + seconds; | |
} | |
dialog.ask("This is the URL for the selected post:", postUrl); |
Yeah, absolutely. I have changed the script I have.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With the new verb added, an alternative to this script could be: