mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Share plugin: decode the URI component before checking for the leading hash sign
Should compensate for the mangling we get from Discourse – see https://talk.tiddlywiki.org/t/revived-share-plugin/5887
This commit is contained in:
parent
02d28c100b
commit
c39ef398bf
@ -13,19 +13,17 @@ Read tiddlers from the browser location hash
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Get the hash
|
// Get the hash
|
||||||
var rawHash = document.location.hash.substring(1);
|
|
||||||
if(rawHash.charAt(0) === "#") {
|
|
||||||
var hash;
|
var hash;
|
||||||
try {
|
try {
|
||||||
hash = decodeURIComponent(rawHash.substring(1));
|
hash = decodeURIComponent(document.location.hash.substring(1));
|
||||||
} catch(ex) {
|
} catch(e) {
|
||||||
console.log("Share plugin: Error decoding location hash",ex);
|
|
||||||
}
|
}
|
||||||
|
if(hash && hash.charAt(0) === "#") {
|
||||||
// Try to parse the hash as JSON
|
// Try to parse the hash as JSON
|
||||||
if(hash) {
|
if(hash) {
|
||||||
var tiddlers;
|
var tiddlers;
|
||||||
try {
|
try {
|
||||||
tiddlers= JSON.parse(hash);
|
tiddlers= JSON.parse(hash.substr(1));
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
console.log("Share plugin: Error parsing JSON from location hash",ex);
|
console.log("Share plugin: Error parsing JSON from location hash",ex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user