| @@ 92-140 (lines=49) @@ | ||
| 89 | } |
|
| 90 | ||
| 91 | // chagneRagne = [start | end] |
|
| 92 | function RangeStringChange(changeRange, ctrlModel){ |
|
| 93 | var isLocaleCompareSupport = localeCompareSupportsLocales(); |
|
| 94 | ||
| 95 | var strStart = ctrlModel.start; |
|
| 96 | var strEnd = ctrlModel.end; |
|
| 97 | var stringDifference = 0; |
|
| 98 | ||
| 99 | // if user change the start value |
|
| 100 | if(strStart != "ALL"){ |
|
| 101 | $ctrl.ngModel.isAll = false; |
|
| 102 | } |
|
| 103 | ||
| 104 | // string comparison, find the strStart position of strEnd |
|
| 105 | if(isLocaleCompareSupport){ |
|
| 106 | stringDifference = strStart.localeCompare(strEnd); |
|
| 107 | }else{ |
|
| 108 | if(strStart < strEnd) |
|
| 109 | stringDifference = -1; |
|
| 110 | if(strEnd < strStart) |
|
| 111 | stringDifference = 1; |
|
| 112 | if(strStart == strEnd) |
|
| 113 | stringDifference = 0; |
|
| 114 | } |
|
| 115 | ||
| 116 | if(changeRange == "start"){ |
|
| 117 | ||
| 118 | if(stringDifference > 0) |
|
| 119 | { |
|
| 120 | strEnd = strStart |
|
| 121 | } |
|
| 122 | if(stringDifference < 0) |
|
| 123 | { |
|
| 124 | ||
| 125 | } |
|
| 126 | }else if(changeRange == "end"){ |
|
| 127 | if(stringDifference > 0) |
|
| 128 | { |
|
| 129 | strStart = strEnd |
|
| 130 | } |
|
| 131 | if(stringDifference < 0) |
|
| 132 | { |
|
| 133 | if(strStart == "") |
|
| 134 | strStart = strEnd |
|
| 135 | } |
|
| 136 | } |
|
| 137 | ||
| 138 | ctrlModel.start = strStart; |
|
| 139 | ctrlModel.end = strEnd; |
|
| 140 | } |
|
| 141 | ||
| 142 | function localeCompareSupportsLocales() { |
|
| 143 | try { |
|
| @@ 87-135 (lines=49) @@ | ||
| 84 | } |
|
| 85 | ||
| 86 | // chagneRagne = [start | end] |
|
| 87 | function RangeStringChange(changeRange, ctrlModel){ |
|
| 88 | var isLocaleCompareSupport = localeCompareSupportsLocales(); |
|
| 89 | ||
| 90 | var strStart = ctrlModel.start; |
|
| 91 | var strEnd = ctrlModel.end; |
|
| 92 | var stringDifference = 0; |
|
| 93 | ||
| 94 | // if user change the start value |
|
| 95 | if(strStart != "ALL"){ |
|
| 96 | $ctrl.ngModel.isAll = false; |
|
| 97 | } |
|
| 98 | ||
| 99 | // string comparison, find the strStart position of strEnd |
|
| 100 | if(isLocaleCompareSupport){ |
|
| 101 | stringDifference = strStart.localeCompare(strEnd); |
|
| 102 | }else{ |
|
| 103 | if(strStart < strEnd) |
|
| 104 | stringDifference = -1; |
|
| 105 | if(strEnd < strStart) |
|
| 106 | stringDifference = 1; |
|
| 107 | if(strStart == strEnd) |
|
| 108 | stringDifference = 0; |
|
| 109 | } |
|
| 110 | ||
| 111 | if(changeRange == "start"){ |
|
| 112 | ||
| 113 | if(stringDifference > 0) |
|
| 114 | { |
|
| 115 | strEnd = strStart |
|
| 116 | } |
|
| 117 | if(stringDifference < 0) |
|
| 118 | { |
|
| 119 | ||
| 120 | } |
|
| 121 | }else if(changeRange == "end"){ |
|
| 122 | if(stringDifference > 0) |
|
| 123 | { |
|
| 124 | strStart = strEnd |
|
| 125 | } |
|
| 126 | if(stringDifference < 0) |
|
| 127 | { |
|
| 128 | if(strStart == "") |
|
| 129 | strStart = strEnd |
|
| 130 | } |
|
| 131 | } |
|
| 132 | ||
| 133 | ctrlModel.start = strStart; |
|
| 134 | ctrlModel.end = strEnd; |
|
| 135 | } |
|
| 136 | ||
| 137 | function localeCompareSupportsLocales() { |
|
| 138 | try { |
|