mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 00:50:28 +00:00
Move browser sniffing into a plugin
This commit is contained in:
parent
80e5c65681
commit
3d8626dafa
23
core/modules/info/platform.js
Normal file
23
core/modules/info/platform.js
Normal file
@ -0,0 +1,23 @@
|
||||
/*\
|
||||
title: $:/core/modules/info/platform.js
|
||||
type: application/javascript
|
||||
module-type: info
|
||||
|
||||
Initialise basic platform $:/info/ tiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.getInfoTiddlerFields = function() {
|
||||
var mapBoolean = function(value) {return value ? "yes" : "no"},
|
||||
infoTiddlerFields = [];
|
||||
// Basics
|
||||
infoTiddlerFields.push({title: "$:/info/browser", text: mapBoolean(!!$tw.browser)});
|
||||
return infoTiddlerFields;
|
||||
};
|
||||
|
||||
})();
|
@ -4,7 +4,8 @@
|
||||
"tiddlywiki/fullscreen",
|
||||
"tiddlywiki/googleanalytics",
|
||||
"tiddlywiki/nodewebkitsaver",
|
||||
"tiddlywiki/github-fork-ribbon"
|
||||
"tiddlywiki/github-fork-ribbon",
|
||||
"tiddlywiki/browser-sniff"
|
||||
],
|
||||
"themes": [
|
||||
"tiddlywiki/vanilla",
|
||||
|
@ -4,7 +4,7 @@
|
||||
"file": "bowser.js",
|
||||
"fields": {
|
||||
"type": "application/javascript",
|
||||
"title": "$:/core/modules/info/bowser/bowser.js",
|
||||
"title": "$:/plugins/tiddlywiki/browser-sniff/bowser/bowser.js",
|
||||
"module-type": "library"
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/core/modules/info/browser.js
|
||||
title: $:/plugins/tiddlywiki/browser-sniff/sniff.js
|
||||
type: application/javascript
|
||||
module-type: info
|
||||
|
||||
@ -16,10 +16,9 @@ exports.getInfoTiddlerFields = function() {
|
||||
var mapBoolean = function(value) {return value ? "yes" : "no"},
|
||||
infoTiddlerFields = [];
|
||||
// Basics
|
||||
infoTiddlerFields.push({title: "$:/info/browser", text: mapBoolean(!!$tw.browser)});
|
||||
if($tw.browser) {
|
||||
// Mappings from tiddler titles (prefixed with "$:/info/browser/") to bowser.browser property name
|
||||
var bowser = require("$:/core/modules/info/bowser/bowser.js"),
|
||||
var bowser = require("$:/plugins/tiddlywiki/browser-sniff/bowser/bowser.js"),
|
||||
mappings = [
|
||||
["name","name","unknown"],
|
||||
["version","version"],
|
6
plugins/tiddlywiki/browser-sniff/plugin.info
Normal file
6
plugins/tiddlywiki/browser-sniff/plugin.info
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/browser-sniff",
|
||||
"description": "Browser sniffing for TiddlyWiki",
|
||||
"author": "JeremyRuston",
|
||||
"core-version": ">=5.0.0"
|
||||
}
|
Loading…
Reference in New Issue
Block a user