1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Expose isMobile to browser info (#6675)

* feat: expose isMobile to info

* feat: allow access browser info from $tw.browser

* fix: adapt typo

* refactor: only export selected properties

 Jermolene 5 hours ago

The trouble is that the properties of bowser.browser are not under our direct control, and so subsequent updates to Bowser might overwrite important properties of our own. I'd rather explicitly import the properties that we choose to support.

* refactor: put things into `is`
This commit is contained in:
lin onetwo 2022-05-14 21:02:52 +08:00 committed by GitHub
parent e9405ac810
commit 95e0fac655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,8 +42,12 @@ exports.getInfoTiddlerFields = function() {
["is/sailfish","sailfish"], ["is/sailfish","sailfish"],
["is/android","android"], ["is/android","android"],
["is/windowsphone","windowsphone"], ["is/windowsphone","windowsphone"],
["is/firefoxos","firefoxos"] ["is/firefoxos","firefoxos"],
["is/mobile","mobile"]
]; ];
$tw.browser = $tw.utils.extend($tw.browser, {
is: bowser.browser,
});
$tw.utils.each(mappings,function(mapping) { $tw.utils.each(mappings,function(mapping) {
var value = bowser.browser[mapping[1]]; var value = bowser.browser[mapping[1]];
if(value === undefined) { if(value === undefined) {