1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-02 08:50:46 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/system/dropbox-url-macro.tid
Devin Weaver 8bcf38b0ae Add ability to auto generate Dropbox URL
I felt the conversion from the Dropbox share URL to the "secret" URL was
complicated enough to have the tiddler do it for the user. And so I
wrote a widget to do that. The user enters in the shared URL given by
Dropbox and the widget outputs the secret URL that they can copy / paste
with.

See if it is worth having on the TW5.com site.
2015-06-14 19:17:17 -04:00

40 lines
792 B
Plaintext

created: 20150607235625799
modified: 20150608032345215
module-type: macro
tags: $:/tags/Macro
title: $:/edition/tw5.com/dropbox-url.js
type: application/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>";
};
})();