1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-18 06:00:29 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/system/dropbox-url-macro.js
Jermolene 98f78e50b8 Convert Dropbox macro to naked js file
@sukima - this avoids duplicating the metadata
2015-06-15 10:07:19 +01:00

33 lines
625 B
JavaScript

/*\
title: $:/edition/tw5.com/dropbox-url.js
type: application/javascript
tags: $:/tags/Macro
module-type: macro
Implements the Dropbox URL converter macro.
```
<$macrocall $name="dropbox-url" url={{$:/temp/dropbox}}/>
```
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "dropbox-url";
exports.params = [
{name: "url", default: "https://www.dropbox.com/s/<gobbledegook>/mywiki.html"}
];
exports.run = function(url) {
url = url.replace("www.dropbox.com","dl.dropboxusercontent.com");
return "`" + url + "` <small>([[open|" + url + "]])</small>";
};
})();