mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 11:37:20 +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";
|
||||
|
||||
// Get the hash
|
||||
var rawHash = document.location.hash.substring(1);
|
||||
if(rawHash.charAt(0) === "#") {
|
||||
var hash;
|
||||
try{
|
||||
hash = decodeURIComponent(rawHash.substring(1));
|
||||
} catch(ex) {
|
||||
console.log("Share plugin: Error decoding location hash",ex);
|
||||
}
|
||||
var hash;
|
||||
try {
|
||||
hash = decodeURIComponent(document.location.hash.substring(1));
|
||||
} catch(e) {
|
||||
}
|
||||
if(hash && hash.charAt(0) === "#") {
|
||||
// Try to parse the hash as JSON
|
||||
if(hash) {
|
||||
var tiddlers;
|
||||
try {
|
||||
tiddlers= JSON.parse(hash);
|
||||
tiddlers= JSON.parse(hash.substr(1));
|
||||
} catch(ex) {
|
||||
console.log("Share plugin: Error parsing JSON from location hash",ex);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user