1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Add screen width/height to platform information exposed at startup

This commit is contained in:
Jermolene 2018-03-23 09:13:45 +00:00
parent 1b31004941
commit 28e713caac
2 changed files with 6 additions and 1 deletions

View File

@ -18,8 +18,8 @@ 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) {
// Document location
var setLocationProperty = function(name,value) {
infoTiddlerFields.push({title: "$:/info/url/" + name, text: value});
},
@ -32,6 +32,9 @@ exports.getInfoTiddlerFields = function() {
setLocationProperty("pathname", location.pathname);
setLocationProperty("search", location.search);
setLocationProperty("origin", location.origin);
// Screen size
infoTiddlerFields.push({title: "$:/info/browser/screen/width", text: window.screen.width.toString()});
infoTiddlerFields.push({title: "$:/info/browser/screen/height", text: window.screen.height.toString()});
}
return infoTiddlerFields;
};

View File

@ -14,6 +14,8 @@ System tiddlers in the namespace `$:/info/` are used to expose information about
|!Title |!Description |
|[[$:/info/browser]] |Running in the browser? ("yes" or "no") |
|[[$:/info/browser/screen/width]] |Screen width in pixels |
|[[$:/info/browser/screen/height]] |Screen height in pixels |
|[[$:/info/node]] |Running under [[Node.js]]? ("yes" or "no") |
|[[$:/info/url/full]] |<<.from-version "5.1.14">> Full URL of wiki (eg, ''<<example full>>'') |
|[[$:/info/url/host]] |<<.from-version "5.1.14">> Host portion of URL of wiki (eg, ''<<example host>>'') |