Advertisement
rdsedmundo

zecu

Aug 31st, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function do_the_bad_work() {
  2.         var $$$ = jQuery;
  3.         var _elms = $$$("#Table5 tbody tr:last-of-type ul:first-of-type table tbody tr");
  4.         var _vec  = _elms.toArray().slice(2);
  5.  
  6.         var _tot_faltas = 0;
  7.         var _tot_aulas  = 0;
  8.  
  9.         $$$.map(_vec, function (the_row) {
  10.     _tot_faltas += parseInt($$$(the_row).find("td").eq(13).find("font").html());
  11.     _tot_aulas  += parseInt($$$(the_row).find("td").eq(14).find("font").html());
  12.         });
  13.  
  14.         console.log("Frequência total: " + (100 - (((_tot_faltas*100.0)/_tot_aulas))) + "%");
  15. }
  16.  
  17. if (!("jQuery" in window)) {
  18.         console.info("jQuery ($) not defined");
  19.         var k = document,
  20.                 c = k.createElement('script'),
  21.                 ref = k.getElementsByTagName('script')[0];
  22.         c.type = "text/javascript";
  23.         c.src = "http://code.jquery.com/jquery-1.9.1.min.js";
  24.         c.onload = function () {
  25.                 console.warn("jQuery ($) defined");
  26.                 do_the_bad_work();
  27.         }
  28.         ref.parentNode.insertBefore(c, ref);
  29. }
  30. else
  31.         do_the_bad_work();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement