Rename "tw-*" messages to "tm-*"

This commit is contained in:
Jermolene
2014-08-28 21:43:44 +01:00
parent db40ac85c2
commit 2f69ea362c
106 changed files with 211 additions and 211 deletions
+2 -2
View File
@@ -62,13 +62,13 @@ function SaverHandler(options) {
}
// Install the save action handlers
if($tw.browser) {
$tw.rootWidget.addEventListener("tw-save-wiki",function(event) {
$tw.rootWidget.addEventListener("tm-save-wiki",function(event) {
self.saveWiki({
template: event.param,
downloadType: "text/plain"
});
});
$tw.rootWidget.addEventListener("tw-download-file",function(event) {
$tw.rootWidget.addEventListener("tm-download-file",function(event) {
self.saveWiki({
method: "download",
template: event.param,
+2 -2
View File
@@ -19,7 +19,7 @@ exports.after = ["startup"];
exports.synchronous = true;
exports.startup = function() {
$tw.rootWidget.addEventListener("tw-set-password",function(event) {
$tw.rootWidget.addEventListener("tm-set-password",function(event) {
$tw.passwordPrompt.createPrompt({
serviceName: "Set a new password for this TiddlyWiki",
noUserName: true,
@@ -33,7 +33,7 @@ exports.startup = function() {
}
});
});
$tw.rootWidget.addEventListener("tw-clear-password",function(event) {
$tw.rootWidget.addEventListener("tm-clear-password",function(event) {
$tw.crypto.setPassword(null);
});
// Ensure that $:/isEncrypted is maintained properly
+5 -5
View File
@@ -22,22 +22,22 @@ exports.synchronous = true;
exports.startup = function() {
// Install the modal message mechanism
$tw.modal = new $tw.utils.Modal($tw.wiki);
$tw.rootWidget.addEventListener("tw-modal",function(event) {
$tw.rootWidget.addEventListener("tm-modal",function(event) {
$tw.modal.display(event.param);
});
// Install the notification mechanism
$tw.notifier = new $tw.utils.Notifier($tw.wiki);
$tw.rootWidget.addEventListener("tw-notify",function(event) {
$tw.rootWidget.addEventListener("tm-notify",function(event) {
$tw.notifier.display(event.param);
});
// Install the scroller
$tw.pageScroller = new $tw.utils.PageScroller();
$tw.rootWidget.addEventListener("tw-scroll",function(event) {
$tw.rootWidget.addEventListener("tm-scroll",function(event) {
$tw.pageScroller.handleEvent(event);
});
var fullscreen = $tw.utils.getFullScreenApis();
if(fullscreen) {
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {
$tw.rootWidget.addEventListener("tm-full-screen",function(event) {
if(document[fullscreen._fullscreenElement]) {
document[fullscreen._exitFullscreen]();
} else {
@@ -48,7 +48,7 @@ exports.startup = function() {
// If we're being viewed on a data: URI then give instructions for how to save
if(document.location.protocol === "data:") {
$tw.rootWidget.dispatchEvent({
type: "tw-modal",
type: "tm-modal",
param: "$:/language/Modals/SaveInstructions"
});
}
+8 -8
View File
@@ -49,27 +49,27 @@ exports.startup = function() {
openStartupTiddlers({defaultToCurrentStory: true});
}
},false)
// Listen for the tw-browser-refresh message
$tw.rootWidget.addEventListener("tw-browser-refresh",function(event) {
// Listen for the tm-browser-refresh message
$tw.rootWidget.addEventListener("tm-browser-refresh",function(event) {
window.location.reload(true);
});
// Listen for the tw-home message
$tw.rootWidget.addEventListener("tw-home",function(event) {
// Listen for the tm-home message
$tw.rootWidget.addEventListener("tm-home",function(event) {
window.location.hash = "";
var storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE),
storyList = $tw.wiki.filterTiddlers(storyFilter);
$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields());
});
// Listen for the tw-permalink message
$tw.rootWidget.addEventListener("tw-permalink",function(event) {
// Listen for the tm-permalink message
$tw.rootWidget.addEventListener("tm-permalink",function(event) {
updateLocationHash({
updateAddressBar: "permalink",
updateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,"no").trim(),
targetTiddler: event.param || event.tiddlerTitle
});
});
// Listen for the tw-permaview message
$tw.rootWidget.addEventListener("tw-permaview",function(event) {
// Listen for the tm-permaview message
$tw.rootWidget.addEventListener("tm-permaview",function(event) {
updateLocationHash({
updateAddressBar: "permaview",
updateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,"no").trim(),
+1 -1
View File
@@ -26,7 +26,7 @@ ClassicStoryView.prototype.navigateTo = function(historyInfo) {
var listItemWidget = this.listWidget.children[listElementIndex],
targetElement = listItemWidget.findFirstDomNode();
// Scroll the node into view
this.listWidget.dispatchEvent({type: "tw-scroll", target: targetElement});
this.listWidget.dispatchEvent({type: "tm-scroll", target: targetElement});
};
ClassicStoryView.prototype.insert = function(widget) {
+1 -1
View File
@@ -24,7 +24,7 @@ PopStoryView.prototype.navigateTo = function(historyInfo) {
var listItemWidget = this.listWidget.children[listElementIndex],
targetElement = listItemWidget.findFirstDomNode();
// Scroll the node into view
this.listWidget.dispatchEvent({type: "tw-scroll", target: targetElement});
this.listWidget.dispatchEvent({type: "tm-scroll", target: targetElement});
};
PopStoryView.prototype.insert = function(widget) {
+3 -3
View File
@@ -48,13 +48,13 @@ function Syncer(options) {
return confirmationMessage;
});
// Listen out for login/logout/refresh events in the browser
$tw.rootWidget.addEventListener("tw-login",function() {
$tw.rootWidget.addEventListener("tm-login",function() {
self.handleLoginEvent();
});
$tw.rootWidget.addEventListener("tw-logout",function() {
$tw.rootWidget.addEventListener("tm-logout",function() {
self.handleLogoutEvent();
});
$tw.rootWidget.addEventListener("tw-server-refresh",function() {
$tw.rootWidget.addEventListener("tm-server-refresh",function() {
self.handleRefreshEvent();
});
}
+5 -5
View File
@@ -113,7 +113,7 @@ Modal.prototype.display = function(title,options) {
attributes: {
message: {
type: "string",
value: "tw-close-tiddler"
value: "tm-close-tiddler"
}
},
children: [{
@@ -152,12 +152,12 @@ Modal.prototype.display = function(title,options) {
document.body.removeChild(wrapper);
}
},duration);
// Don't let anyone else handle the tw-close-tiddler message
// Don't let anyone else handle the tm-close-tiddler message
return false;
};
headerWidgetNode.addEventListener("tw-close-tiddler",closeHandler,false);
bodyWidgetNode.addEventListener("tw-close-tiddler",closeHandler,false);
footerWidgetNode.addEventListener("tw-close-tiddler",closeHandler,false);
headerWidgetNode.addEventListener("tm-close-tiddler",closeHandler,false);
bodyWidgetNode.addEventListener("tm-close-tiddler",closeHandler,false);
footerWidgetNode.addEventListener("tm-close-tiddler",closeHandler,false);
// Set the initial styles for the message
$tw.utils.setStyle(modalBackdrop,[
{opacity: "0"}
+2 -2
View File
@@ -13,7 +13,7 @@ Module that creates a $tw.utils.Scroller object prototype that manages scrolling
"use strict";
/*
Event handler for when the `tw-scroll` event hits the document body
Event handler for when the `tm-scroll` event hits the document body
*/
var PageScroller = function() {
this.idRequestFrame = null;
@@ -44,7 +44,7 @@ PageScroller.prototype.cancelScroll = function() {
Handle an event
*/
PageScroller.prototype.handleEvent = function(event) {
if(event.type === "tw-scroll") {
if(event.type === "tm-scroll") {
return this.scrollIntoView(event.target);
}
return true;
+1 -1
View File
@@ -40,7 +40,7 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
// Add a click event handler
domNode.addEventListener("change",function (event) {
self.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
});
return false;
},false);
+1 -1
View File
@@ -101,7 +101,7 @@ ButtonWidget.prototype.isPoppedUp = function() {
ButtonWidget.prototype.navigateTo = function(event) {
var bounds = this.domNodes[0].getBoundingClientRect();
this.dispatchEvent({
type: "tw-navigate",
type: "tm-navigate",
navigateTo: this.to,
navigateFromTitle: this.getVariable("storyTiddler"),
navigateFromNode: this,
+4 -4
View File
@@ -97,7 +97,7 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
$tw.utils.removeClass(this.domNodes[0],"tc-dragover");
// Import any files in the drop
var numFiles = this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) {
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
});
// Try to import the various data types we understand
if(numFiles === 0) {
@@ -122,7 +122,7 @@ DropZoneWidget.prototype.importData = function(dataTransfer) {
if(!tiddlerFields.title) {
tiddlerFields.title = this.wiki.generateNewTitle("Untitled");
}
this.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])});
this.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields])});
return;
}
}
@@ -188,7 +188,7 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
if(item.kind === "file") {
// Import any files
this.wiki.readFile(item.getAsFile(),function(tiddlerFieldsArray) {
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
});
} else if(item.kind === "string") {
// Create tiddlers from string items
@@ -199,7 +199,7 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
text: str,
type: type
};
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])});
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields])});
});
}
}
+4 -4
View File
@@ -17,10 +17,10 @@ var Widget = require("$:/core/modules/widgets/widget.js").widget;
var FieldManglerWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
this.addEventListeners([
{type: "tw-remove-field", handler: "handleRemoveFieldEvent"},
{type: "tw-add-field", handler: "handleAddFieldEvent"},
{type: "tw-remove-tag", handler: "handleRemoveTagEvent"},
{type: "tw-add-tag", handler: "handleAddTagEvent"}
{type: "tm-remove-field", handler: "handleRemoveFieldEvent"},
{type: "tm-add-field", handler: "handleAddFieldEvent"},
{type: "tm-remove-tag", handler: "handleRemoveTagEvent"},
{type: "tm-add-tag", handler: "handleAddTagEvent"}
]);
};
+1 -1
View File
@@ -110,7 +110,7 @@ LinkWidget.prototype.handleClickEvent = function (event) {
// Send the click on it's way as a navigate event
var bounds = this.domNodes[0].getBoundingClientRect();
this.dispatchEvent({
type: "tw-navigate",
type: "tm-navigate",
navigateTo: this.to,
navigateFromTitle: this.getVariable("storyTiddler"),
navigateFromNode: this,
+2 -2
View File
@@ -17,7 +17,7 @@ var Widget = require("$:/core/modules/widgets/widget.js").widget;
var LinkCatcherWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
this.addEventListeners([
{type: "tw-navigate", handler: "handleNavigateEvent"}
{type: "tm-navigate", handler: "handleNavigateEvent"}
]);
};
@@ -63,7 +63,7 @@ LinkCatcherWidget.prototype.refresh = function(changedTiddlers) {
};
/*
Handle a tw-navigate event
Handle a tm-navigate event
*/
LinkCatcherWidget.prototype.handleNavigateEvent = function(event) {
if(this.catchTo) {
+13 -13
View File
@@ -19,17 +19,17 @@ var Widget = require("$:/core/modules/widgets/widget.js").widget;
var NavigatorWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
this.addEventListeners([
{type: "tw-navigate", handler: "handleNavigateEvent"},
{type: "tw-edit-tiddler", handler: "handleEditTiddlerEvent"},
{type: "tw-delete-tiddler", handler: "handleDeleteTiddlerEvent"},
{type: "tw-save-tiddler", handler: "handleSaveTiddlerEvent"},
{type: "tw-cancel-tiddler", handler: "handleCancelTiddlerEvent"},
{type: "tw-close-tiddler", handler: "handleCloseTiddlerEvent"},
{type: "tw-close-all-tiddlers", handler: "handleCloseAllTiddlersEvent"},
{type: "tw-close-other-tiddlers", handler: "handleCloseOtherTiddlersEvent"},
{type: "tw-new-tiddler", handler: "handleNewTiddlerEvent"},
{type: "tw-import-tiddlers", handler: "handleImportTiddlersEvent"},
{type: "tw-perform-import", handler: "handlePerformImportEvent"}
{type: "tm-navigate", handler: "handleNavigateEvent"},
{type: "tm-edit-tiddler", handler: "handleEditTiddlerEvent"},
{type: "tm-delete-tiddler", handler: "handleDeleteTiddlerEvent"},
{type: "tm-save-tiddler", handler: "handleSaveTiddlerEvent"},
{type: "tm-cancel-tiddler", handler: "handleCancelTiddlerEvent"},
{type: "tm-close-tiddler", handler: "handleCloseTiddlerEvent"},
{type: "tm-close-all-tiddlers", handler: "handleCloseAllTiddlersEvent"},
{type: "tm-close-other-tiddlers", handler: "handleCloseOtherTiddlersEvent"},
{type: "tm-new-tiddler", handler: "handleNewTiddlerEvent"},
{type: "tm-import-tiddlers", handler: "handleImportTiddlersEvent"},
{type: "tm-perform-import", handler: "handlePerformImportEvent"}
]);
};
@@ -140,7 +140,7 @@ NavigatorWidget.prototype.addToHistory = function(title,fromPageRect) {
};
/*
Handle a tw-navigate event
Handle a tm-navigate event
*/
NavigatorWidget.prototype.handleNavigateEvent = function(event) {
this.addToStory(event.navigateTo,event.navigateFromTitle);
@@ -310,7 +310,7 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {
));
}
if(!isRename && !this.wiki.isDraftModified(title)) {
event.type = "tw-cancel-tiddler";
event.type = "tm-cancel-tiddler";
this.dispatchEvent(event);
} else if(isConfirmed) {
// Save the draft tiddler as the real tiddler
+1 -1
View File
@@ -18,7 +18,7 @@ var ScrollableWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
this.scaleFactor = 1;
this.addEventListeners([
{type: "tw-scroll", handler: "handleScrollEvent"}
{type: "tm-scroll", handler: "handleScrollEvent"}
]);
if($tw.browser) {
this.requestAnimationFrame = window.requestAnimationFrame ||