kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Add path conversions from TiddlyWiki Classic
TiddlyWiki Classic converts local file URIs to various local native formats. The same conversions are now performed by the TiddlyFox adaptor for TW5.print-window-tiddler
rodzic
0153fd2a30
commit
4758874d13
|
@ -19,13 +19,27 @@ TiddlyFoxSaver.prototype.save = function(text,method,callback) {
|
||||||
var messageBox = document.getElementById("tiddlyfox-message-box");
|
var messageBox = document.getElementById("tiddlyfox-message-box");
|
||||||
if(messageBox) {
|
if(messageBox) {
|
||||||
// Get the pathname of this document
|
// Get the pathname of this document
|
||||||
var pathname = document.location.pathname;
|
var pathname = document.location.toString();
|
||||||
// Test for a Windows path of the form /x:/blah/blah
|
// Replace file://localhost/ with file:///
|
||||||
if(/^\/[A-Z]\:\//i.test(pathname)) {
|
if(pathname.indexOf("file://localhost/") == 0) {
|
||||||
// Remove the leading slash
|
pathname = "file://" + pathname.substr(16);
|
||||||
pathname = pathname.substr(1);
|
}
|
||||||
// Convert slashes to backslashes
|
// Windows path file:///x:/blah/blah --> x:\blah\blah
|
||||||
pathname = pathname.replace(/\//g,"\\");
|
if(/^file\:\/\/\/[A-Z]\:\//i.test(pathname)) {
|
||||||
|
// Remove the leading slash and convert slashes to backslashes
|
||||||
|
pathname = pathname.substr(8).replace(/\//g,"\\");
|
||||||
|
// Firefox Windows network path file://///server/share/blah/blah --> //server/share/blah/blah
|
||||||
|
} else if(pathname.indexOf("file://///") === 0) {
|
||||||
|
pathname = "\\\\" + unescape(pathname.substr(10)).replace(/\//g,"\\");
|
||||||
|
// Mac/Unix local path file:///path/path --> /path/path
|
||||||
|
} else if(pathname.indexOf("file:///") == 0) {
|
||||||
|
pathname = unescape(pathname.substr(7));
|
||||||
|
// Mac/Unix local path file:/path/path --> /path/path
|
||||||
|
} else if(pathname.indexOf("file:/") == 0) {
|
||||||
|
pathname = unescape(pathname.substr(5));
|
||||||
|
// Otherwise Windows networth path file://server/share/path/path --> \\server\share\path\path
|
||||||
|
} else {
|
||||||
|
pathname = "\\\\" + unescape(pathname.substr(7)).replace(new RegExp("/","g"),"\\");
|
||||||
}
|
}
|
||||||
// Create the message element and put it in the message box
|
// Create the message element and put it in the message box
|
||||||
var message = document.createElement("div");
|
var message = document.createElement("div");
|
||||||
|
|
Ładowanie…
Reference in New Issue