1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +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 // Set up $tw global for the server
if(typeof(window) === "undefined" && !global.$tw) { if(typeof(window) === "undefined" && !global.$tw) {
global.$tw = {isBrowser: false}; global.$tw = {}; // No ``browser`` member for the server
} }
// Boot information // Boot information
@ -419,7 +419,7 @@ $tw.wiki = new $tw.Wiki();
/////////////////////////// Browser definitions /////////////////////////// Browser definitions
if($tw.isBrowser) { if($tw.browser) {
/* /*
Execute the module named 'moduleName'. The name can optionally be relative to the module named 'moduleRoot' 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")) $tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("shadowArea"))
); );
// End of if($tw.isBrowser) // End of if($tw.browser)
} }
/////////////////////////// Server definitions /////////////////////////// Server definitions
if(!$tw.isBrowser) { if(!$tw.browser) {
var fs = require("fs"), var fs = require("fs"),
path = require("path"), path = require("path"),
@ -640,7 +640,7 @@ $tw.plugins.loadPluginsFromFolder(path.resolve($tw.boot.wikiPath,"./shadows"));
// Load tiddlers from wiki tiddlers directory // Load tiddlers from wiki tiddlers directory
$tw.plugins.loadPluginsFromFolder(path.resolve($tw.boot.wikiPath,"./tiddlers"),null,null,$tw.wiki); $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 /////////////////////////// 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 // Set up $tw global for the browser
if(window && !window.$tw) { if(window && !window.$tw) {
window.$tw = {isBrowser: true}; window.$tw = {browser: {}};
} }
$tw.modules = {titles: {}}; // hashmap by module name of {fn:, exports:, moduleType:} $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() { exports.startup = function() {
var modules,n,m,f,commander; 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 // Set up additional global objects
$tw.plugins.applyMethods("global",$tw); $tw.plugins.applyMethods("global",$tw);
// Wire up plugin modules // Wire up plugin modules
@ -30,7 +39,7 @@ exports.startup = function() {
// Get version information // Get version information
$tw.version = $tw.utils.extractVersionInfo(); $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) // 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$/); $tw.plugins.loadPluginsFromFolder($tw.boot.bootPath,"$:/core",/^\.DS_Store$|.meta$|^modules$/);
} }
// Set up the wiki store // Set up the wiki store
@ -41,7 +50,7 @@ exports.startup = function() {
// Set up the command plugins // Set up the command plugins
$tw.Commander.initCommands(); $tw.Commander.initCommands();
// Host-specific startup // Host-specific startup
if($tw.isBrowser) { if($tw.browser) {
// Display the PageTemplate // Display the PageTemplate
var renderer = $tw.wiki.parseTiddler("PageTemplate"); var renderer = $tw.wiki.parseTiddler("PageTemplate");
renderer.execute([],"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 Extract the version number from the meta tag or from the boot file
*/ */
if($tw.isBrowser) { if($tw.browser) {
// Browser version // Browser version
exports.extractVersionInfo = function() { exports.extractVersionInfo = function() {