1
0
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:
Jermolene 2014-07-21 13:17:16 +01:00
parent 80e5c65681
commit 3d8626dafa
6 changed files with 34 additions and 5 deletions

View 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;
};
})();

View File

@ -4,7 +4,8 @@
"tiddlywiki/fullscreen",
"tiddlywiki/googleanalytics",
"tiddlywiki/nodewebkitsaver",
"tiddlywiki/github-fork-ribbon"
"tiddlywiki/github-fork-ribbon",
"tiddlywiki/browser-sniff"
],
"themes": [
"tiddlywiki/vanilla",

View File

@ -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"
}
}

View File

@ -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"],

View File

@ -0,0 +1,6 @@
{
"title": "$:/plugins/tiddlywiki/browser-sniff",
"description": "Browser sniffing for TiddlyWiki",
"author": "JeremyRuston",
"core-version": ">=5.0.0"
}