Support selectedClass properly in the button widget

This commit is contained in:
Jeremy Ruston
2013-10-14 16:56:13 +01:00
parent fe6c1ae2dd
commit 94c2eacdc9
2 changed files with 25 additions and 5 deletions
+13 -2
View File
@@ -54,8 +54,7 @@ Popup.prototype.triggerPopup = function(options) {
// Get the current popup state tiddler
var value = options.wiki.getTextReference(options.title,"");
// 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]+)\)$/,
state = !popupLocationRegExp.test(value);
var state = !this.readPopupState(options.title,value);
if("force" in options) {
state = options.force;
}
@@ -71,6 +70,18 @@ Popup.prototype.triggerPopup = function(options) {
}
};
/*
Returns true if the specified title and text identifies an active popup
*/
Popup.prototype.readPopupState = function(title,text) {
var popupLocationRegExp = /^\((-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+)\)$/,
result = false;
if(this.title === title) {
result = popupLocationRegExp.test(text);
}
return result;
};
exports.Popup = Popup;
})();