Complete renaming popupper component to popup

print-window-tiddler
Jeremy Ruston 2012-07-14 15:52:35 +01:00
rodzic 10b7075c7a
commit 761ffa403d
3 zmienionych plików z 13 dodań i 13 usunięć

Wyświetl plik

@ -39,21 +39,21 @@ exports.triggerPopup = function(event,cancel) {
}
// Check for cancelling
if(cancel) {
$tw.popupper.cancel();
$tw.popup.cancel();
} else {
// Get the current popup state tiddler
var value = this.wiki.getTextReference(textRef,"",this.tiddlerTitle);
// Check if the popup is open by checking whether it matches "(<x>,<y>)"
var popupLocationRegExp = /^\((-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+)\)$/;
if(popupLocationRegExp.test(value)) {
$tw.popupper.cancel();
$tw.popup.cancel();
} else {
// Set the position if we're opening it
this.wiki.setTextReference(textRef,
"(" + this.child.domNode.offsetLeft + "," + this.child.domNode.offsetTop + "," +
this.child.domNode.offsetWidth + "," + this.child.domNode.offsetHeight + ")",
this.tiddlerTitle,true);
$tw.popupper.popup(textRef);
$tw.popup.popup(textRef);
}
}
};

Wyświetl plik

@ -1,9 +1,9 @@
/*\
title: $:/core/modules/popupper.js
title: $:/core/modules/popup.js
type: application/javascript
module-type: utils
Plugin that creates a $tw.utils.Popupper object prototype that manages popups in the browser
Plugin that creates a $tw.utils.Popup object prototype that manages popups in the browser
\*/
(function(){
@ -13,38 +13,38 @@ Plugin that creates a $tw.utils.Popupper object prototype that manages popups in
"use strict";
/*
Creates a Popupper object with these options:
Creates a Popup object with these options:
wiki: the wiki to use for resolving tiddler titles
rootElement: the DOM element to which the popup zapper should be attached
*/
var Popupper = function(options) {
var Popup = function(options) {
options = options || {};
this.wiki = options.wiki;
this.rootElement = options.rootElement || document.body;
this.popupTextRef = null;
};
Popupper.prototype.popup = function(stateTextRef) {
Popup.prototype.popup = function(stateTextRef) {
var popupState;
this.cancel();
this.popupTextRef = stateTextRef;
this.rootElement.addEventListener("click",this,true);
};
Popupper.prototype.handleEvent = function(event) {
Popup.prototype.handleEvent = function(event) {
if(event.type === "click") {
this.rootElement.removeEventListener("click",this,true);
this.cancel();
}
};
Popupper.prototype.cancel = function() {
Popup.prototype.cancel = function() {
if(this.popupTextRef) {
this.wiki.deleteTextReference(this.popupTextRef);
this.popupTextRef = null;
}
};
exports.Popupper = Popupper;
exports.Popup = Popup;
})();

Wyświetl plik

@ -56,8 +56,8 @@ exports.startup = function() {
$tw.Commander.initCommands();
// Host-specific startup
if($tw.browser) {
// Install the popupper
$tw.popupper = new $tw.utils.Popupper({
// Install the popup manage
$tw.popup = new $tw.utils.Popup({
wiki: $tw.wiki,
rootElement: document.body
});