Introduce new manualdownload saver

This saver pops up a modal dialogue giving the user an opportunity to
right click and save the wiki
print-window-tiddler
Jeremy Ruston 2012-11-16 19:31:18 +00:00
rodzic b96bcfdca4
commit 80bd198908
2 zmienionych plików z 65 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,13 @@
title: $:/messages/Download
type: text/x-tiddlywiki
subtitle: Download changes
footer: <<button close class:"btn btn-primary"><Close>>
help: http://five.tiddlywiki.com/#help:DownloadingChanges
Your browser only supports manual saving.
To save your modified wiki, right click on the download link below and select "Download file" or "Save file", and then choose the folder and filename.
//You can marginally speed things up by clicking the link with the control key (Windows) or the options/alt key (Mac OS X). You will not be prompted for the folder or filename, but your browser is likely to give it an unrecognisable name -- you may need to rename the file to include an `.html` extension before you can do anything useful with it.//
On smartphones that do not allow files to be downloaded you can instead bookmark the link, and then sync your bookmarks to a desktop computer from where the wiki can be saved normally.

Wyświetl plik

@ -0,0 +1,52 @@
/*\
title: $:/core/modules/savers/manualdownload.js
type: application/javascript
module-type: saver
Handles saving changes via HTML5's download APIs
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var downloadInstructionsTitle = "$:/messages/Download"
/*
Select the appropriate saver module and set it up
*/
var ManualDownloadSaver = function(wiki) {
};
ManualDownloadSaver.prototype.save = function(text) {
$tw.modal.display(downloadInstructionsTitle,{
downloadLink: "data:text/html," + encodeURIComponent(text)
});
return true;
};
/*
Information about this saver
*/
ManualDownloadSaver.prototype.info = {
name: "manualdownload",
priority: 0
};
/*
Static method that returns true if this saver is capable of working
*/
exports.canSave = function(wiki) {
return true;
};
/*
Create an instance of this saver
*/
exports.create = function(wiki) {
return new ManualDownloadSaver(wiki);
};
})();