mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-27 14:48:19 +00:00
Fixes for running TiddlyWiki on node-webkit
See Jermolene/TiddlyWiki5NodeWebkit
This commit is contained in:
parent
285ab41ccf
commit
e676156b24
21
boot/boot.js
21
boot/boot.js
@ -131,7 +131,7 @@ $tw.utils.error = function(err) {
|
|||||||
promptMsg = "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser";
|
promptMsg = "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser";
|
||||||
// Log the error to the console
|
// Log the error to the console
|
||||||
console.error(err);
|
console.error(err);
|
||||||
if($tw.browser) {
|
if($tw.browser && !$tw.node) {
|
||||||
// Display an error message to the user
|
// Display an error message to the user
|
||||||
var dm = $tw.utils.domMaker,
|
var dm = $tw.utils.domMaker,
|
||||||
heading = dm("h1",{text: errHeading}),
|
heading = dm("h1",{text: errHeading}),
|
||||||
@ -146,7 +146,7 @@ $tw.utils.error = function(err) {
|
|||||||
return false;
|
return false;
|
||||||
},true);
|
},true);
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else if(!$tw.browser) {
|
||||||
// Exit if we're under node.js
|
// Exit if we're under node.js
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ $tw.utils.error = function(err) {
|
|||||||
/*
|
/*
|
||||||
Use our custom error handler if we're in the browser
|
Use our custom error handler if we're in the browser
|
||||||
*/
|
*/
|
||||||
if($tw.browser) {
|
if($tw.browser && !$tw.node) {
|
||||||
window.onerror = function(errorMsg,url,lineNumber) {
|
window.onerror = function(errorMsg,url,lineNumber) {
|
||||||
$tw.utils.error(errorMsg);
|
$tw.utils.error(errorMsg);
|
||||||
return false;
|
return false;
|
||||||
@ -1222,7 +1222,7 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
|
|||||||
|
|
||||||
/////////////////////////// Browser definitions
|
/////////////////////////// Browser definitions
|
||||||
|
|
||||||
if($tw.browser) {
|
if($tw.browser && !$tw.node) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Decrypt any tiddlers stored within the element with the ID "encryptedArea". The function is asynchronous to allow the user to be prompted for a password
|
Decrypt any tiddlers stored within the element with the ID "encryptedArea". The function is asynchronous to allow the user to be prompted for a password
|
||||||
@ -1341,13 +1341,10 @@ $tw.loadTiddlersBrowser = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// End of if($tw.browser)
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////// Server definitions
|
/////////////////////////// Server definitions
|
||||||
|
|
||||||
if(!$tw.browser) {
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get any encrypted tiddlers
|
Get any encrypted tiddlers
|
||||||
*/
|
*/
|
||||||
@ -1356,7 +1353,7 @@ $tw.boot.decryptEncryptedTiddlers = function(callback) {
|
|||||||
callback();
|
callback();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // End of if($tw.browser && !$tw.node)
|
||||||
|
|
||||||
/////////////////////////// Node definitions
|
/////////////////////////// Node definitions
|
||||||
|
|
||||||
@ -1631,7 +1628,7 @@ $tw.boot.startup = function(options) {
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
// Get the URL hash and check for safe mode
|
// Get the URL hash and check for safe mode
|
||||||
$tw.locationHash = "#";
|
$tw.locationHash = "#";
|
||||||
if($tw.browser) {
|
if($tw.browser && !$tw.node) {
|
||||||
if(location.hash === "#:safe") {
|
if(location.hash === "#:safe") {
|
||||||
$tw.safeMode = true;
|
$tw.safeMode = true;
|
||||||
} else {
|
} else {
|
||||||
@ -1843,14 +1840,14 @@ $tw.boot.boot = function() {
|
|||||||
// Initialise crypto object
|
// Initialise crypto object
|
||||||
$tw.crypto = new $tw.utils.Crypto();
|
$tw.crypto = new $tw.utils.Crypto();
|
||||||
// Initialise password prompter
|
// Initialise password prompter
|
||||||
if($tw.browser) {
|
if($tw.browser && !$tw.node) {
|
||||||
$tw.passwordPrompt = new $tw.utils.PasswordPrompt();
|
$tw.passwordPrompt = new $tw.utils.PasswordPrompt();
|
||||||
}
|
}
|
||||||
// Preload any encrypted tiddlers
|
// Preload any encrypted tiddlers
|
||||||
$tw.boot.decryptEncryptedTiddlers(function() {
|
$tw.boot.decryptEncryptedTiddlers(function() {
|
||||||
// Startup
|
// Startup
|
||||||
$tw.boot.startup({
|
$tw.boot.startup({
|
||||||
readBrowserTiddlers: !!$tw.browser
|
readBrowserTiddlers: !!($tw.browser && !$tw.node)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ exports.synchronous = true;
|
|||||||
exports.startup = function() {
|
exports.startup = function() {
|
||||||
// Load modules
|
// Load modules
|
||||||
$tw.modules.applyMethods("utils",$tw.utils);
|
$tw.modules.applyMethods("utils",$tw.utils);
|
||||||
if($tw.node) {
|
if($tw.node && !$tw.browser) {
|
||||||
$tw.modules.applyMethods("utils-node",$tw.utils);
|
$tw.modules.applyMethods("utils-node",$tw.utils);
|
||||||
}
|
}
|
||||||
$tw.modules.applyMethods("global",$tw);
|
$tw.modules.applyMethods("global",$tw);
|
||||||
|
Loading…
Reference in New Issue
Block a user