mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 13:29:56 +00:00
Add screen width/height to platform information exposed at startup
This commit is contained in:
parent
1b31004941
commit
28e713caac
@ -18,8 +18,8 @@ exports.getInfoTiddlerFields = function() {
|
|||||||
// Basics
|
// Basics
|
||||||
infoTiddlerFields.push({title: "$:/info/browser", text: mapBoolean(!!$tw.browser)});
|
infoTiddlerFields.push({title: "$:/info/browser", text: mapBoolean(!!$tw.browser)});
|
||||||
infoTiddlerFields.push({title: "$:/info/node", text: mapBoolean(!!$tw.node)});
|
infoTiddlerFields.push({title: "$:/info/node", text: mapBoolean(!!$tw.node)});
|
||||||
// Document location
|
|
||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
|
// Document location
|
||||||
var setLocationProperty = function(name,value) {
|
var setLocationProperty = function(name,value) {
|
||||||
infoTiddlerFields.push({title: "$:/info/url/" + name, text: value});
|
infoTiddlerFields.push({title: "$:/info/url/" + name, text: value});
|
||||||
},
|
},
|
||||||
@ -32,6 +32,9 @@ exports.getInfoTiddlerFields = function() {
|
|||||||
setLocationProperty("pathname", location.pathname);
|
setLocationProperty("pathname", location.pathname);
|
||||||
setLocationProperty("search", location.search);
|
setLocationProperty("search", location.search);
|
||||||
setLocationProperty("origin", location.origin);
|
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;
|
return infoTiddlerFields;
|
||||||
};
|
};
|
||||||
|
@ -14,6 +14,8 @@ System tiddlers in the namespace `$:/info/` are used to expose information about
|
|||||||
|
|
||||||
|!Title |!Description |
|
|!Title |!Description |
|
||||||
|[[$:/info/browser]] |Running in the browser? ("yes" or "no") |
|
|[[$:/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/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/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>>'') |
|
|[[$:/info/url/host]] |<<.from-version "5.1.14">> Host portion of URL of wiki (eg, ''<<example host>>'') |
|
||||||
|
Loading…
Reference in New Issue
Block a user