mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-07-01 01:33:16 +00:00
36 lines
804 B
JavaScript
36 lines
804 B
JavaScript
/*\
|
|
title: $:/plugins/tiddlywiki/share/rawmarkup.js
|
|
type: application/javascript
|
|
module-type: library
|
|
|
|
Read tiddlers from the browser location hash
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
// Get the hash
|
|
var rawHash = document.location.hash.substring(1);
|
|
if(rawHash.charAt(0) === "#") {
|
|
var hash = decodeURIComponent(rawHash.substring(1));
|
|
// Try to parse the hash as JSON
|
|
var tiddlers;
|
|
try {
|
|
tiddlers= JSON.parse(hash);
|
|
} catch(ex) {
|
|
}
|
|
if(tiddlers) {
|
|
// Need to initialise these because we run before bootprefix.js and boot.js
|
|
window.$tw = window.$tw || {};
|
|
$tw.boot = $tw.boot || {};
|
|
$tw.preloadTiddlers = $tw.preloadTiddlers || [];
|
|
// Load our tiddlers
|
|
$tw.preloadTiddlers = $tw.preloadTiddlers.concat(tiddlers);
|
|
}
|
|
}
|
|
|
|
})();
|