Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- var re = /(\S+) of (\S+)/;
- $("td:contains(' of ')").each(function() {
- var matches = re.exec($(this).text());
- var x = parseInt(matches[1].replace(',',''));
- var y = parseInt(matches[2].replace(',',''));
- var p = Math.round((y-x)/y*100);
- if(x==1){
- $(this).append('<br>(<font color="green">first</font>)');
- } else {
- if(x==y){
- $(this).append('<br>(<font color="red">last</font>)');
- } else if(p<50){
- $(this).append('<br>(<font color="red">bottom ' + p + '%</font>)');
- } else if(p>=50 && p<90){
- p = 100 - p;
- $(this).append('<br>(<font color="orange">top ' + p + '%</font>)');
- } else {
- p = 100 - p;
- $(this).append('<br>(<font color="green">top ' + p + '%</font>)');
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement