diff --git a/core/modules/widgets/reveal.js b/core/modules/widgets/reveal.js index 4eec55ad3..66942d62e 100755 --- a/core/modules/widgets/reveal.js +++ b/core/modules/widgets/reveal.js @@ -127,13 +127,36 @@ RevealWidget.prototype.readState = function() { this.readMatchState(state); this.isOpen = !this.isOpen; break; + case "lt": + this.readMatchStatelt(state); + break; + case "gt": + this.readMatchStategt(state); + break; + case "lteq": + this.readMatchStategt(state); + this.isOpen = !this.isOpen; + break; + case "gteq": + this.readMatchStatelt(state); + this.isOpen = !this.isOpen; + break; } }; -RevealWidget.prototype.readMatchState = function(state) { - this.isOpen = state === this.text; +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; }; - 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 912adb43e..f3d7826fc 100644 --- a/editions/tw5.com/tiddlers/widgets/RevealWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/RevealWidget.tid @@ -13,6 +13,11 @@ 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 + ! Content and Attributes