Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var totalWorkedTime = 0;
  2. var hoursInMinutes = 0;
  3. var tminutes = 0;
  4.  
  5. var daysYouHaveToWork = 0;
  6. var timeForMoreWork = 0;
  7.  
  8. var theDoorsTableBro = $('.table-striped');
  9.  
  10. var TalkToTheHandAboutTime = function()
  11. {
  12.     $(theDoorsTableBro[0].children[1].children).each(function(index, element){
  13.         var time = element.childNodes[1].childNodes[0];
  14.        
  15.         if(time != undefined && time.length == 5){
  16.                 daysYouHaveToWork++;
  17.                 var hours = time.data.substr(0,2);
  18.                 var minutes = time.data.substr(3,5);
  19.                
  20.                 hoursInMinutes += hours * 60;
  21.                 tminutes += minutes * 1;
  22.                 console.log(element.childNodes[1].childNodes[0]);
  23.         }
  24. });
  25.        
  26.         totalWorkedTime = hoursInMinutes + tminutes;
  27.         timeForMoreWork = totalWorkedTime - (450 * daysYouHaveToWork);
  28.         showTimesNow();            
  29. }
  30.  
  31. var showTimesNow = function(){
  32.         console.log('Number of days that you have attended at the office without forgotten chip is ' + daysYouHaveToWork);
  33.         console.log('Your worked total time is ' + totalWorkedTime + ' minutes' );
  34.         var mess = timeForMoreWork >= 0 ? ("You have worked " + timeForMoreWork+ " minutes more than needed") : ("You have worked " + timeForMoreWork+ " minutes less than needed :( . You have to overwork " + Math.abs(timeForMoreWork)+" more minutes to fix it.");
  35.         console.log(mess);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement