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
print-window-tiddler
Jermolene 2014-05-03 17:49:20 +01:00
rodzic 749582ede0
commit 78ba57d55d
11 zmienionych plików z 34 dodań i 34 usunięć

Wyświetl plik

@ -1773,9 +1773,20 @@ $tw.boot.executeNextStartupTask = function() {
};
$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;
if(after) {
for(var t=0; t<after.length; t++) {
for(t=0; t<after.length; t++) {
if(!$tw.boot.executedStartupModules[after[t]]) {
return false;
}

Wyświetl plik

@ -1,7 +1,6 @@
title: $:/language/Docs/ModuleTypes/
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.
config: Data to be inserted into `$tw.config`.
filteroperator: Individual filter operator methods.

Wyświetl plik

@ -220,12 +220,6 @@ exports.startup = function() {
param: "$:/language/Modals/SaveInstructions"
});
}
// Call browser startup modules
$tw.modules.forEachModuleOfType("browser-startup",function(title,module) {
if(module.startup) {
module.startup();
}
});
} else {
// On the server, start a commander with the command line arguments
commander = new $tw.Commander(

Wyświetl plik

@ -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)`
* 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 `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

Wyświetl plik

@ -1,7 +1,6 @@
title: $:/language/Docs/ModuleTypes/
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.
config: Daten, die in `$tw.config` eingefügt werden.
filteroperator: Individuelle Filter Operator Funktionen.

Wyświetl plik

@ -1,7 +1,6 @@
title: $:/language/Docs/ModuleTypes/
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.
config: Données à inclure dans `$tw.config`.
filteroperator: Méthodes d'opérateurs pour les filtres.

Wyświetl plik

@ -1,7 +1,6 @@
title: $:/language/Docs/ModuleTypes/
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.
config: Data da inserire nel `$tw.config`.
filteroperator: I singoli metodi degli operatori di filtro.

Wyświetl plik

@ -1,7 +1,6 @@
title: $:/language/Docs/ModuleTypes/
animation: アニメーション。通常は RevealWidget で使用されるモジュール。
browser-startup: ブラウザから開いたときにのみ、初回に実行されるファンクションモジュール。
command: Node.js で実行できるコマンド。
config: `$tw.config` に格納されるデータ。
filteroperator: 個々のフィルタ操作用メソッドモジュール。

Wyświetl plik

@ -1,7 +1,6 @@
title: $:/language/Docs/ModuleTypes/
animation: 动画模块包含可用于 RevealWidget 的动画。
browser-startup: 仅可于浏览器中执行的启动功能函数。
command: 可于 Node.js 执行的指令。
config: 加入 `$tw.config` 的数据。
filteroperator: 个别筛选器算子方法。

Wyświetl plik

@ -1,7 +1,6 @@
title: $:/language/Docs/ModuleTypes/
animation: 動畫模組包含可用於 RevealWidget 的動畫。
browser-startup: 僅可於瀏覽器中執行的啟動功能函數。
command: 可於 Node.js 執行的指令。
config: 加入 `$tw.config` 的資料。
filteroperator: 個別篩選器運算元方法。

Wyświetl plik

@ -1,7 +1,7 @@
/*\
title: $:/plugins/tiddlywiki/fullscreen/init.js
type: application/javascript
module-type: browser-startup
module-type: startup
Message handler for full screen mode
@ -12,34 +12,35 @@ Message handler for full screen mode
/*global $tw: false, Element: false */
"use strict";
var d = document,
db = d.body,
_requestFullscreen = db.webkitRequestFullscreen !== undefined ? "webkitRequestFullscreen" :
db.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
db.msRequestFullscreen !== undefined ? "msRequestFullscreen" :
db.requestFullscreen !== undefined ? "requestFullscreen" : "",
_exitFullscreen = d.webkitExitFullscreen !== undefined ? "webkitExitFullscreen" :
// 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,
_requestFullscreen = db.webkitRequestFullscreen !== undefined ? "webkitRequestFullscreen" :
db.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
db.msRequestFullscreen !== undefined ? "msRequestFullscreen" :
db.requestFullscreen !== undefined ? "requestFullscreen" : "",
_exitFullscreen = d.webkitExitFullscreen !== undefined ? "webkitExitFullscreen" :
d.mozCancelFullScreen !== undefined ? "mozCancelFullScreen" :
d.msExitFullscreen !== undefined ? "msExitFullscreen" :
d.exitFullscreen !== undefined ? "exitFullscreen" : "",
_fullscreenElement = d.webkitFullscreenElement !== undefined ? "webkitFullscreenElement" :
_fullscreenElement = d.webkitFullscreenElement !== undefined ? "webkitFullscreenElement" :
d.mozFullScreenElement !== undefined ? "mozFullScreenElement" :
d.msFullscreenElement !== undefined ? "msFullscreenElement" :
d.fullscreenElement !== undefined ? "fullscreenElement" : "";
var toggleFullscreen = function() {
if(document[_fullscreenElement]) {
document[_exitFullscreen]();
} else {
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();
if(document[_fullscreenElement]) {
document[_exitFullscreen]();
} else {
document.documentElement[_requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
}
});
}
};