@@ -164,15 +164,13 @@ function main_page() {
164164 */
165165}
166166function class_page ( ) {
167- let regex = / (? = d o c u m e n t \. w r i t e ) .* / g
168167 let current_string = $ ( "table.linkDescList" ) . html ( ) ;
169- regex . exec ( current_string ) ;
170- current_string = regex . exec ( current_string ) [ 0 ] ;
171- regex = / [ 0 - 9 ] * \. [ 0 - 9 ] * / g
172- let temp = current_string . match ( regex ) ;
173- let number = temp [ temp . length - 1 ] ;
168+ current_string = current_string . match ( / (? = d o c u m e n t \. w r i t e ) .* / g) [ 1 ] ;
169+ current_string = / \[ .* \] / g. exec ( current_string ) [ 0 ] . slice ( 1 , - 1 ) ;
170+ let temp = current_string . split ( ";" ) ;
171+ let number = Math . max ( isNaN ( temp [ temp . length - 2 ] ) ?- Infinity :parseFloat ( temp [ temp . length - 2 ] ) , isNaN ( temp [ temp . length - 1 ] ) ?- Infinity :parseFloat ( temp [ temp . length - 1 ] ) ) ;
174172 //let number = $("table.linkDescList").html().match("(?=;\.;).*(?=])")[0].substring(3);
175- if ( isNaN ( number ) ) {
173+ if ( number === - Infinity ) {
176174 return ;
177175 }
178176 $ ( "table.linkDescList:first" ) . append ( `<tr><td><strong>Final Percent: </strong></td><td>` + parseFloat ( number ) . toFixed ( 2 ) + ` <div class="tooltip saspe">ⓘ<span class="tooltiptext saspe">85: A+ | 75: A <br />65: B+ | 55: B <br />45: C+ | 35: C <br/>25: D+ | 15: D</span></div></td></tr>` ) ;
@@ -203,19 +201,17 @@ function fill_percent($fill_location,url_link,percents, pos_in_arr) {
203201 $ . ajax ( {
204202 url : url_link
205203 } ) . done ( function ( data ) {
206- let regex = / (? = d o c u m e n t \. w r i t e ) .* / g
207204 let current_string = data ;
208- regex . exec ( current_string ) ;
209- current_string = regex . exec ( current_string ) [ 0 ] ;
210- regex = / [ 0 - 9 ] * \. [ 0 - 9 ] * / g
211- let temp = current_string . match ( regex ) ;
212- let final_percent = temp [ temp . length - 1 ] ;
213- if ( isNaN ( final_percent ) ) {
205+ current_string = current_string . match ( / (? = d o c u m e n t \. w r i t e ) .* / g) [ 1 ] ;
206+ current_string = / \[ .* \] / g. exec ( current_string ) [ 0 ] . slice ( 1 , - 1 ) ;
207+ let temp = current_string . split ( ";" ) ;
208+ let final_percent = Math . max ( isNaN ( temp [ temp . length - 2 ] ) ?- Infinity :parseFloat ( temp [ temp . length - 2 ] ) , isNaN ( temp [ temp . length - 1 ] ) ?- Infinity :parseFloat ( temp [ temp . length - 1 ] ) ) ;
209+ if ( final_percent === - Infinity ) {
214210 percents [ pos_in_arr ] = - 1 ;
215211 return ;
216212 }
217- $fill_location . append ( ` (${ parseFloat ( final_percent ) . toFixed ( 2 ) } )` ) ;
218- percents [ pos_in_arr ] = parseFloat ( final_percent ) . toFixed ( 2 ) ;
213+ $fill_location . append ( ` (${ final_percent . toFixed ( 2 ) } )` ) ;
214+ percents [ pos_in_arr ] = final_percent . toFixed ( 2 ) ;
219215 } ) . fail ( function ( ) {
220216 percents [ pos_in_arr ] = - 1 ;
221217 console . log ( `Ajax failed! Error on accessing: ${ url_link } .` ) ;
0 commit comments