1
1
function sanitizeValue ( value ) {
2
- return value . replace ( / \. / g, '\\\\ .' )
3
- . replace ( / \% / g, '\\ \\%' ) ;
2
+ return value . replace ( / \. / g, '\\.' )
3
+ . replace ( / \% / g, '\\%' ) ;
4
4
}
5
5
6
6
$ ( document ) . ready ( function ( ) {
@@ -33,6 +33,29 @@ function valueToVariable(value, variableName) {
33
33
return nextValue ( ) ;
34
34
}
35
35
36
+ // Converts all active instances of value to use variableName
37
+ // currently only update valueStats
38
+ function valueOfTypeToVariable ( value , variableName ) {
39
+ var highlighted = $ ( ".active-type.highlighted" ) ;
40
+ var changed = 0 ;
41
+ $ . each ( highlighted , function ( idx , occurance ) {
42
+ var currentValue = $ ( occurance ) . text ( ) ;
43
+ $ ( occurance )
44
+ . removeClass ( sanitizeValue ( currentValue ) )
45
+ . removeClass ( "highlighted" )
46
+ . addClass ( "variable" )
47
+ . text ( getMultiplier ( value , currentValue ) + "*" + variableName ) ;
48
+ valueStats [ currentValue ] -= 1 ;
49
+ if ( valueStats [ currentValue ] === 0 ) {
50
+ delete valueStats [ currentValue ] ;
51
+ }
52
+ } ) ;
53
+ $ ( ".active-type" ) . removeClass ( "active-type" ) ;
54
+
55
+ return nextValue ( ) ;
56
+ }
57
+
58
+
36
59
function highLightAllOfValue ( value ) {
37
60
$ ( "." + sanitizeValue ( value ) ) . addClass ( "active-type" ) . addClass ( "highlighted" ) ;
38
61
}
@@ -43,6 +66,7 @@ function unHighLightAllOfValue(value) {
43
66
44
67
function highLightAllOfType ( value ) {
45
68
$ ( "." + typeOfValue ( value ) ) . addClass ( "active-type" ) . addClass ( "highlighted" ) ;
69
+ unHighLightAllOfValue ( value ) ;
46
70
}
47
71
48
72
function unHighLightAllOfType ( value ) {
0 commit comments