1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Changed $tw.isBrowser to $tw.browser

This makes available browser-specific CSS prefixes
This commit is contained in:
Jeremy Ruston 2012-05-19 11:29:51 +01:00
parent 070d919aa0
commit cbb813da9b
4 changed files with 18 additions and 9 deletions

View File

@ -32,7 +32,7 @@ In practice, each module is wrapped in a separate script block.
// Set up $tw global for the server
if(typeof(window) === "undefined" && !global.$tw) {
global.$tw = {isBrowser: false};
global.$tw = {}; // No ``browser`` member for the server
}
// Boot information
@ -419,7 +419,7 @@ $tw.wiki = new $tw.Wiki();
/////////////////////////// Browser definitions
if($tw.isBrowser) {
if($tw.browser) {
/*
Execute the module named 'moduleName'. The name can optionally be relative to the module named 'moduleRoot'
@ -526,12 +526,12 @@ $tw.wiki.shadows.addTiddlers(
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("shadowArea"))
);
// End of if($tw.isBrowser)
// End of if($tw.browser)
}
/////////////////////////// Server definitions
if(!$tw.isBrowser) {
if(!$tw.browser) {
var fs = require("fs"),
path = require("path"),
@ -640,7 +640,7 @@ $tw.plugins.loadPluginsFromFolder(path.resolve($tw.boot.wikiPath,"./shadows"));
// Load tiddlers from wiki tiddlers directory
$tw.plugins.loadPluginsFromFolder(path.resolve($tw.boot.wikiPath,"./tiddlers"),null,null,$tw.wiki);
// End of if(!$tw.isBrowser)
// End of if(!$tw.browser)
}
/////////////////////////// Final initialisation

View File

@ -14,7 +14,7 @@ See Boot.js for further details of the boot process.
// Set up $tw global for the browser
if(window && !window.$tw) {
window.$tw = {isBrowser: true};
window.$tw = {browser: {}};
}
$tw.modules = {titles: {}}; // hashmap by module name of {fn:, exports:, moduleType:}

View File

@ -14,6 +14,15 @@ This is the main application logic for both the client and server
exports.startup = function() {
var modules,n,m,f,commander;
// This should be somewhere else
if($tw.browser) {
$tw.browser.prefix = document.body.style.webkitTransform !== undefined ? "webkit" :
document.body.style.MozTransform !== undefined ? "Moz" :
document.body.style.OTransform !== undefined ? "O" : null;
$tw.browser.transition = $tw.browser.prefix + "Transition";
$tw.browser.transform = $tw.browser.prefix + "Transform";
$tw.browser.transformorigin = $tw.browser.prefix + "TransformOrigin";
}
// Set up additional global objects
$tw.plugins.applyMethods("global",$tw);
// Wire up plugin modules
@ -30,7 +39,7 @@ exports.startup = function() {
// Get version information
$tw.version = $tw.utils.extractVersionInfo();
// Load up the tiddlers in the root of the core directory (we couldn't do before because we didn't have the serializers installed)
if(!$tw.isBrowser) {
if(!$tw.browser) {
$tw.plugins.loadPluginsFromFolder($tw.boot.bootPath,"$:/core",/^\.DS_Store$|.meta$|^modules$/);
}
// Set up the wiki store
@ -41,7 +50,7 @@ exports.startup = function() {
// Set up the command plugins
$tw.Commander.initCommands();
// Host-specific startup
if($tw.isBrowser) {
if($tw.browser) {
// Display the PageTemplate
var renderer = $tw.wiki.parseTiddler("PageTemplate");
renderer.execute([],"PageTemplate");

View File

@ -335,7 +335,7 @@ exports.getVersionString = function() {
Extract the version number from the meta tag or from the boot file
*/
if($tw.isBrowser) {
if($tw.browser) {
// Browser version
exports.extractVersionInfo = function() {