mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-20 16:42:02 +00:00
Expose document location via $:/info/url/* info tiddlers
This commit is contained in:
@@ -18,6 +18,21 @@ exports.getInfoTiddlerFields = function() {
|
||||
// Basics
|
||||
infoTiddlerFields.push({title: "$:/info/browser", text: mapBoolean(!!$tw.browser)});
|
||||
infoTiddlerFields.push({title: "$:/info/node", text: mapBoolean(!!$tw.node)});
|
||||
// Document location
|
||||
if($tw.browser) {
|
||||
var setLocationProperty = function(name,value) {
|
||||
infoTiddlerFields.push({title: "$:/info/url/" + name, text: value});
|
||||
},
|
||||
location = document.location;
|
||||
setLocationProperty("full", (location.toString()).split("#")[0]);
|
||||
setLocationProperty("host", location.host);
|
||||
setLocationProperty("hostname", location.hostname);
|
||||
setLocationProperty("protocol", location.protocol);
|
||||
setLocationProperty("port", location.port);
|
||||
setLocationProperty("pathname", location.pathname);
|
||||
setLocationProperty("search", location.search);
|
||||
setLocationProperty("origin", location.origin);
|
||||
}
|
||||
return infoTiddlerFields;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user