Skip to content

Commit

Permalink
Merge pull request #15 from pmario/addon-signed
Browse files Browse the repository at this point in the history
make TWclassic work again
  • Loading branch information
pmario authored Dec 11, 2017
2 parents d8231a7 ebea7de commit 0296d72
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,7 @@ For an overview of this add on please see the introduction video: https://youtu.

## Installation

To install, **click this link: [file_backups-0.3.0-an.fx.xpi](https://github.com/pmario/file-backups/releases/download/V0.3.0/file_backups-0.3.0-an.fx.xpi)** or download and install from the [releases page](https://github.com/pmario/file-backups/releases/)
To install, **click this link: [file_backups-0.3.1-an.fx.xpi](https://github.com/pmario/file-backups/releases/download/V0.3.1/file_backups-0.3.1-an.fx.xpi)** or download and install from the [releases page](https://github.com/pmario/file-backups/releases/)

## File Storage Locations

Expand Down
72 changes: 72 additions & 0 deletions addon/classic/inject.js
Original file line number Diff line number Diff line change
@@ -0,0 1,72 @@
/*
The JavaScript in this file is injected into each TiddlyWiki Classic page that loads
*/

(function () {

"use strict";

/*
Returns true if successful, false if failed, null if not available
*/
var injectedSaveFile = function(path,content) {
// check for windows or unix paths
/* var slash = "\\";
var dirPathPos = path.lastIndexOf("\\");
if(dirPathPos == -1) {
dirPathPos = path.lastIndexOf("/");
slash = "/";
}
var splitPos = path.lastIndexOf("." slash);
if (splitPos !== -1) path = path.substr(splitPos 2);
*/

// TODO At the moment we deactivate the backups.
// In a future version it shoudl be activated again.
config.options.chkSaveBackups = false;
// Find the message box element
var messageBox = document.getElementById("tiddlyfox-message-box");
if(messageBox) {
// Create the message element and put it in the message box
var message = document.createElement("div");
message.setAttribute("data-tiddlyfox-path",path);
message.setAttribute("data-tiddlyfox-content",content);
messageBox.appendChild(message);
// Create and dispatch the custom event to the extension
var event = document.createEvent("Events");
event.initEvent("tiddlyfox-save-file",true,false);
message.dispatchEvent(event);
}
return true;
};

/*
Returns text if successful, false if failed, null if not available
*/
var injectedLoadFile = function(path) {
try {
// Just read the file synchronously
var xhReq = new XMLHttpRequest();
xhReq.open("GET", "file:///" escape(path), false);
xhReq.send(null);
return xhReq.responseText;
} catch(ex) {
return false;
}
};

var injectedConvertUriToUTF8 = function(path) {
return path;
}

var injectedConvertUnicodeToFileFormat = function(s) {
return s;
}

window.mozillaSaveFile = injectedSaveFile;
window.mozillaLoadFile = injectedLoadFile;
window.convertUriToUTF8 = injectedConvertUriToUTF8;
window.convertUnicodeToFileFormat = injectedConvertUnicodeToFileFormat;

})();
2 changes: 1 addition & 1 deletion addon/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
{
"manifest_version": 2,
"name": "File Backups",
"version": "0.3.0",
"version": "0.3.1",
"description": "TiddlyWiki saving and backup, using a Tower of Hanoi strategy!",
"icons": {
"32": "icons/diamond-32.png",
Expand Down
2 changes: 1 addition & 1 deletion assets/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
{
"manifest_version": 2,
"name": "File Backups",
"version": "0.3.0",
"version": "0.3.1",
"description": "TiddlyWiki saving and backup, using a Tower of Hanoi strategy!",
"icons": {
"32": "icons/diamond-32.png",
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,7 @@ For an overview of this add on please see the introduction video: https://youtu.

## Installation

To install, **click this link: [file_backups-0.3.0-an.fx.xpi](https://github.com/pmario/file-backups/releases/download/V0.3.0/file_backups-0.3.0-an.fx.xpi)** or download and install from the [releases page](https://github.com/pmario/file-backups/releases/)
To install, **click this link: [file_backups-0.3.1-an.fx.xpi](https://github.com/pmario/file-backups/releases/download/V0.3.1/file_backups-0.3.1-an.fx.xpi)** or download and install from the [releases page](https://github.com/pmario/file-backups/releases/)

## File Storage Locations

Expand Down
Binary file added docs/file_backups-0.3.1-an fx.xpi
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
{
"name": "file-backups",
"version": "0.3.0",
"version": "0.3.1",
"description": "This browser add on is designed to let you easily save and backup TiddlyWikis.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 35,7 @@ module.exports = {
ignore: [
// Doesn't copy any files with a txt extension
// .js files will be compressed
'*.js',
//'*.js',

// Doesn't copy any file, even if they start with a dot
// '**/*',
Expand Down

0 comments on commit 0296d72

Please sign in to comment.