mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Minor tweaks for #3157
This commit is contained in:
parent
033feda02d
commit
8e9330e484
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user