2015-06-08 03:32:29 +00:00
|
|
|
/*\
|
|
|
|
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) {
|
2015-06-15 09:07:19 +00:00
|
|
|
url = url.replace("www.dropbox.com","dl.dropboxusercontent.com");
|
2015-06-08 03:32:29 +00:00
|
|
|
return "`" + url + "` <small>([[open|" + url + "]])</small>";
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|