Files
TiddlyWiki5/plugins/tiddlywiki/tahoelafs/saver.js
Mario Pietsch 8aa558eb2c Remove module function wrapper and add matching configurations for dprint and eslint (#7596)
* remove blks first try

* dprint.json seems to be OK, some forgotten functions

* add some more space-after-keyword settings

* server remove blks

* add **/files to dprint exclude

* dprint.js fixes a typo

* add boot.js and bootprefix.js to dprint exclude

* dprint change dprint.json

* add dprint fmt as script

* remove jslint comments

* fix whitespace

* fix whitespace

* remove function-wrapper from geospatial plugin

* fix whitespace

* add function wrapper to dyannotate-startup

* remove dpring.json
2025-03-21 17:22:57 +00:00

53 lines
1.0 KiB
JavaScript

/*\
title: $:/plugins/tiddlywiki/tahoelafs/saver.js
type: application/javascript
module-type: saver
A bare bones saver for Tahoe-LAFS. It just PUTs the new HTML file back to the server at the same URL.
\*/
"use strict";
/*
Select the appropriate saver module and set it up
*/
var TahoeSaver = function(wiki) {
this.wiki = wiki;
};
TahoeSaver.prototype.save = function(text) {
// Do the HTTP post
var http = new XMLHttpRequest();
http.open("PUT",document.location.toString(),true);
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
window.alert("Saved to Tahoe-LAFS: " + http.responseText);
}
};
http.send(text);
return true;
};
/*
Information about this saver
*/
TahoeSaver.prototype.info = {
name: "tahoelafs",
priority: 1000
};
/*
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 TahoeSaver(wiki);
};