diff --git a/core/modules/widgets/reveal.js b/core/modules/widgets/reveal.js index 66942d62e..dddfee06c 100755 --- a/core/modules/widgets/reveal.js +++ b/core/modules/widgets/reveal.js @@ -121,42 +121,30 @@ RevealWidget.prototype.readState = function() { this.readPopupState(state); break; case "match": - this.readMatchState(state); + this.isOpen = !!(this.compareStateText(state) == 0); break; case "nomatch": - this.readMatchState(state); - this.isOpen = !this.isOpen; + this.isOpen = !(this.compareStateText(state) == 0); break; case "lt": - this.readMatchStatelt(state); + this.isOpen = !!(this.compareStateText(state) < 0); break; case "gt": - this.readMatchStategt(state); + this.isOpen = !!(this.compareStateText(state) > 0); break; case "lteq": - this.readMatchStategt(state); - this.isOpen = !this.isOpen; + this.isOpen = !(this.compareStateText(state) > 0); break; case "gteq": - this.readMatchStatelt(state); - this.isOpen = !this.isOpen; + this.isOpen = !(this.compareStateText(state) < 0); break; } }; RevealWidget.prototype.compareStateText = function(state) { - var result = state.localeCompare(this.text, undefined, {numeric: true, sensitivity: 'case'}); - return result; -}; -RevealWidget.prototype.readMatchState = function(state) { - this.isOpen = (this.compareStateText(state) == 0) ? true : false; -}; -RevealWidget.prototype.readMatchStatelt = function(state) { - this.isOpen = (this.compareStateText(state) < 0) ? true : false; -}; -RevealWidget.prototype.readMatchStategt = function(state) { - this.isOpen = (this.compareStateText(state) > 0) ? true : false; + return state.localeCompare(this.text,undefined,{numeric: true,sensitivity: "case"}); }; + RevealWidget.prototype.readPopupState = function(state) { var popupLocationRegExp = /^\((-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+)\)$/, match = popupLocationRegExp.exec(state); diff --git a/editions/tw5.com/tiddlers/widgets/RevealWidget.tid b/editions/tw5.com/tiddlers/widgets/RevealWidget.tid index f3d7826fc..006b09417 100644 --- a/editions/tw5.com/tiddlers/widgets/RevealWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/RevealWidget.tid @@ -13,10 +13,10 @@ The reveal widget hides or shows its content depending upon the value of a [[sta * type=''match'': the content is displayed if the state tiddler matches a specified value * type=''nomatch'': the content is displayed if the state tiddler doesn't match a specified value * type=''popup'': the content is displayed as a popup as described in the PopupMechanism -* type=''lt'': the content is displayed if the state tiddler has an integer with a value ''less than'' a specified value -* type=''gt'': the content is displayed if the state tiddler has an integer with a value ''greater than'' a specified value -* type=''lteq'': the content is displayed if the state tiddler has an integer with a value ''less than or equal to'' a specified value -* type=''gteq'': the content is displayed if the state tiddler has an integer with a value ''greater than or equal to'' a specified value +* type=''lt'': the content is displayed if the state tiddler contains an integer with a value ''less than'' a specified value +* type=''gt'': the content is displayed if the state tiddler contains an integer with a value ''greater than'' a specified value +* type=''lteq'': the content is displayed if the state tiddler contains an integer with a value ''less than or equal to'' a specified value +* type=''gteq'': the content is displayed if the state tiddler contains an integer with a value ''greater than or equal to'' a specified value ! Content and Attributes