Fix problem with saving if URL contains #

print-window-tiddler
Jermolene 2014-05-05 13:30:31 +01:00
rodzic a0022a1cd6
commit 887e9d978b
2 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -17,7 +17,7 @@ var AndTidWiki = function(wiki) {
AndTidWiki.prototype.save = function(text,method,callback) { AndTidWiki.prototype.save = function(text,method,callback) {
// Get the pathname of this document // Get the pathname of this document
var pathname = decodeURIComponent(document.location.toString()); var pathname = decodeURIComponent(document.location.toString().split("#")[0]);
// Strip the file:// // Strip the file://
if(pathname.indexOf("file://") === 0) { if(pathname.indexOf("file://") === 0) {
pathname = pathname.substr(7); pathname = pathname.substr(7);

Wyświetl plik

@ -19,7 +19,7 @@ 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.toString(); var pathname = document.location.toString().split("#")[0];
// Replace file://localhost/ with file:/// // Replace file://localhost/ with file:///
if(pathname.indexOf("file://localhost/") == 0) { if(pathname.indexOf("file://localhost/") == 0) {
pathname = "file://" + pathname.substr(16); pathname = "file://" + pathname.substr(16);
@ -43,6 +43,7 @@ TiddlyFoxSaver.prototype.save = function(text,method,callback) {
} }
// 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");
console.log("Pathname",pathname);
message.setAttribute("data-tiddlyfox-path",decodeURIComponent(pathname)); message.setAttribute("data-tiddlyfox-path",decodeURIComponent(pathname));
message.setAttribute("data-tiddlyfox-content",text); message.setAttribute("data-tiddlyfox-content",text);
messageBox.appendChild(message); messageBox.appendChild(message);