mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
Remove support for browser-startup modules
Instead support startup modules that stipulate which platform they require. Also include docs updates and fixes to fullscreen plugin
This commit is contained in:
parent
749582ede0
commit
78ba57d55d
13
boot/boot.js
13
boot/boot.js
@ -1773,9 +1773,20 @@ $tw.boot.executeNextStartupTask = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$tw.boot.isStartupTaskEligible = function(taskModule) {
|
$tw.boot.isStartupTaskEligible = function(taskModule) {
|
||||||
|
var t;
|
||||||
|
// Check that the platform is correct
|
||||||
|
var platforms = taskModule.platforms;
|
||||||
|
if(platforms) {
|
||||||
|
for(t=0; t<platforms.length; t++) {
|
||||||
|
if((platforms[t] === "browser" && !$tw.browser) || (platforms[t] === "node" && !$tw.node)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Check that all of the tasks that we must be performed after has been done
|
||||||
var after = taskModule.after;
|
var after = taskModule.after;
|
||||||
if(after) {
|
if(after) {
|
||||||
for(var t=0; t<after.length; t++) {
|
for(t=0; t<after.length; t++) {
|
||||||
if(!$tw.boot.executedStartupModules[after[t]]) {
|
if(!$tw.boot.executedStartupModules[after[t]]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
title: $:/language/Docs/ModuleTypes/
|
title: $:/language/Docs/ModuleTypes/
|
||||||
|
|
||||||
animation: Animations that may be used with the RevealWidget.
|
animation: Animations that may be used with the RevealWidget.
|
||||||
browser-startup: Startup functions that are only executed in the browser.
|
|
||||||
command: Commands that can be executed under Node.js.
|
command: Commands that can be executed under Node.js.
|
||||||
config: Data to be inserted into `$tw.config`.
|
config: Data to be inserted into `$tw.config`.
|
||||||
filteroperator: Individual filter operator methods.
|
filteroperator: Individual filter operator methods.
|
||||||
|
@ -220,12 +220,6 @@ exports.startup = function() {
|
|||||||
param: "$:/language/Modals/SaveInstructions"
|
param: "$:/language/Modals/SaveInstructions"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Call browser startup modules
|
|
||||||
$tw.modules.forEachModuleOfType("browser-startup",function(title,module) {
|
|
||||||
if(module.startup) {
|
|
||||||
module.startup();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// On the server, start a commander with the command line arguments
|
// On the server, start a commander with the command line arguments
|
||||||
commander = new $tw.Commander(
|
commander = new $tw.Commander(
|
||||||
|
@ -14,6 +14,7 @@ Modules with their ''module-type'' field set to `startup`:
|
|||||||
** For synchronous startup modules the startup function is called as `startup()`, asynchronous modules are passed a callback they must invoke on completion: `startup(callback)`
|
** For synchronous startup modules the startup function is called as `startup()`, asynchronous modules are passed a callback they must invoke on completion: `startup(callback)`
|
||||||
* May expose a `name` property that is used to identify the task
|
* May expose a `name` property that is used to identify the task
|
||||||
* May expose a `after` property containing an array of names of dependent tasks that must be run before this one
|
* May expose a `after` property containing an array of names of dependent tasks that must be run before this one
|
||||||
|
* May expose a `platforms` property containing an array of names of platforms that are required in order for the startup module to be executed. The defined platforms are ''node'' and ''browser''
|
||||||
|
|
||||||
! Startup Processing
|
! Startup Processing
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
title: $:/language/Docs/ModuleTypes/
|
title: $:/language/Docs/ModuleTypes/
|
||||||
|
|
||||||
animation: Animationen, die vom RevealWidget verwendet werden.
|
animation: Animationen, die vom RevealWidget verwendet werden.
|
||||||
browser-startup: Funktionen, die einmalig beim Browser start ausgeführt werden.
|
|
||||||
command: Kommandozeilen Parameter, die mit node.js ausgeführt werden können.
|
command: Kommandozeilen Parameter, die mit node.js ausgeführt werden können.
|
||||||
config: Daten, die in `$tw.config` eingefügt werden.
|
config: Daten, die in `$tw.config` eingefügt werden.
|
||||||
filteroperator: Individuelle Filter Operator Funktionen.
|
filteroperator: Individuelle Filter Operator Funktionen.
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
title: $:/language/Docs/ModuleTypes/
|
title: $:/language/Docs/ModuleTypes/
|
||||||
|
|
||||||
animation: Animations pouvant être utilisées par le RevealWidget.
|
animation: Animations pouvant être utilisées par le RevealWidget.
|
||||||
browser-startup: Fonctions de démarrage exécutées dans le navigateur uniquement.
|
|
||||||
command: Commandes qui peuvent être exécutées en mode Node.js.
|
command: Commandes qui peuvent être exécutées en mode Node.js.
|
||||||
config: Données à inclure dans `$tw.config`.
|
config: Données à inclure dans `$tw.config`.
|
||||||
filteroperator: Méthodes d'opérateurs pour les filtres.
|
filteroperator: Méthodes d'opérateurs pour les filtres.
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
title: $:/language/Docs/ModuleTypes/
|
title: $:/language/Docs/ModuleTypes/
|
||||||
|
|
||||||
animation: Animazioni che possono essere utilizzate con RevealWidget.
|
animation: Animazioni che possono essere utilizzate con RevealWidget.
|
||||||
browser-startup: Funzioni di avvio che vengono eseguite solo nel browser.
|
|
||||||
command: Comandi che possono essere eseguiti sotto Node.js.
|
command: Comandi che possono essere eseguiti sotto Node.js.
|
||||||
config: Data da inserire nel `$tw.config`.
|
config: Data da inserire nel `$tw.config`.
|
||||||
filteroperator: I singoli metodi degli operatori di filtro.
|
filteroperator: I singoli metodi degli operatori di filtro.
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
title: $:/language/Docs/ModuleTypes/
|
title: $:/language/Docs/ModuleTypes/
|
||||||
|
|
||||||
animation: アニメーション。通常は RevealWidget で使用されるモジュール。
|
animation: アニメーション。通常は RevealWidget で使用されるモジュール。
|
||||||
browser-startup: ブラウザから開いたときにのみ、初回に実行されるファンクションモジュール。
|
|
||||||
command: Node.js で実行できるコマンド。
|
command: Node.js で実行できるコマンド。
|
||||||
config: `$tw.config` に格納されるデータ。
|
config: `$tw.config` に格納されるデータ。
|
||||||
filteroperator: 個々のフィルタ操作用メソッドモジュール。
|
filteroperator: 個々のフィルタ操作用メソッドモジュール。
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
title: $:/language/Docs/ModuleTypes/
|
title: $:/language/Docs/ModuleTypes/
|
||||||
|
|
||||||
animation: 动画模块包含可用于 RevealWidget 的动画。
|
animation: 动画模块包含可用于 RevealWidget 的动画。
|
||||||
browser-startup: 仅可于浏览器中执行的启动功能函数。
|
|
||||||
command: 可于 Node.js 执行的指令。
|
command: 可于 Node.js 执行的指令。
|
||||||
config: 加入 `$tw.config` 的数据。
|
config: 加入 `$tw.config` 的数据。
|
||||||
filteroperator: 个别筛选器算子方法。
|
filteroperator: 个别筛选器算子方法。
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
title: $:/language/Docs/ModuleTypes/
|
title: $:/language/Docs/ModuleTypes/
|
||||||
|
|
||||||
animation: 動畫模組包含可用於 RevealWidget 的動畫。
|
animation: 動畫模組包含可用於 RevealWidget 的動畫。
|
||||||
browser-startup: 僅可於瀏覽器中執行的啟動功能函數。
|
|
||||||
command: 可於 Node.js 執行的指令。
|
command: 可於 Node.js 執行的指令。
|
||||||
config: 加入 `$tw.config` 的資料。
|
config: 加入 `$tw.config` 的資料。
|
||||||
filteroperator: 個別篩選器運算元方法。
|
filteroperator: 個別篩選器運算元方法。
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/plugins/tiddlywiki/fullscreen/init.js
|
title: $:/plugins/tiddlywiki/fullscreen/init.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: browser-startup
|
module-type: startup
|
||||||
|
|
||||||
Message handler for full screen mode
|
Message handler for full screen mode
|
||||||
|
|
||||||
@ -12,7 +12,14 @@ Message handler for full screen mode
|
|||||||
/*global $tw: false, Element: false */
|
/*global $tw: false, Element: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var d = document,
|
// Export name and synchronous status
|
||||||
|
exports.name = "full-screen-startup";
|
||||||
|
exports.platforms = ["browser"];
|
||||||
|
exports.after = ["startup"];
|
||||||
|
exports.synchronous = true;
|
||||||
|
|
||||||
|
exports.startup = function() {
|
||||||
|
var d = document,
|
||||||
db = d.body,
|
db = d.body,
|
||||||
_requestFullscreen = db.webkitRequestFullscreen !== undefined ? "webkitRequestFullscreen" :
|
_requestFullscreen = db.webkitRequestFullscreen !== undefined ? "webkitRequestFullscreen" :
|
||||||
db.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
|
db.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
|
||||||
@ -26,20 +33,14 @@ var d = document,
|
|||||||
d.mozFullScreenElement !== undefined ? "mozFullScreenElement" :
|
d.mozFullScreenElement !== undefined ? "mozFullScreenElement" :
|
||||||
d.msFullscreenElement !== undefined ? "msFullscreenElement" :
|
d.msFullscreenElement !== undefined ? "msFullscreenElement" :
|
||||||
d.fullscreenElement !== undefined ? "fullscreenElement" : "";
|
d.fullscreenElement !== undefined ? "fullscreenElement" : "";
|
||||||
|
// Install the full screen handler
|
||||||
var toggleFullscreen = function() {
|
if(_requestFullscreen) {
|
||||||
|
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {
|
||||||
if(document[_fullscreenElement]) {
|
if(document[_fullscreenElement]) {
|
||||||
document[_exitFullscreen]();
|
document[_exitFullscreen]();
|
||||||
} else {
|
} else {
|
||||||
document.documentElement[_requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
|
document.documentElement[_requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
exports.startup = function() {
|
|
||||||
// Install the full screen handler
|
|
||||||
if(_requestFullscreen) {
|
|
||||||
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {
|
|
||||||
toggleFullscreen();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user