Advertisement
1vannn

Script (functions)

Nov 9th, 2015
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function isOnline() {
  2.         window.addEventListener('load', function(e) {
  3.         if (navigator.onLine) {
  4.                 return true;
  5.         } else {
  6.                 return false;
  7.         }
  8.         }, false);
  9. }
  10. function sayDate() {
  11.         var d = new Date();
  12.         var y = d.getFullYear(); // year
  13.         var m = d.getMonth();
  14.         var da = d.getDate();
  15.         var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
  16.         var curMon = months[m];
  17.         if (da == 1) {
  18.                 suffix = "st";
  19.         } else if (da == 2) {
  20.                 suffix = "nd";
  21.         } else if (da == 3) {
  22.                 suffix = "rd";
  23.         } else if (da == 4) {
  24.                 suffix = "th";
  25.         } else if (da == 5) {
  26.                 suffix = "th";
  27.         } else if (da == 6) {
  28.                 suffix = "th";
  29.         } else if (da == 7) {
  30.                 suffix = "th";
  31.         } else if (da == 8) {
  32.                 suffix = "th";
  33.         } else if (da == 9) {
  34.                 suffix = "th";
  35.         } else if (da == 10) {
  36.                 suffix = "th";
  37.         } else if (da == 11) {
  38.                 suffix = "th";
  39.         } else if (da == 12) {
  40.                 suffix = "th";
  41.         } else if (da == 13) {
  42.                 suffix = "th";
  43.         } else if (da == 14) {
  44.                 suffix = "th";
  45.         } else if (da == 15) {
  46.                 suffix = "th";
  47.         } else if (da == 16) {
  48.                 suffix = "th";
  49.         } else if (da == 17) {
  50.                 suffix = "th";
  51.         } else if (da == 18) {
  52.                 suffix = "th";
  53.         } else if (da == 19) {
  54.                 suffix = "th";
  55.         } else if (da == 20) {
  56.                 suffix = "th";
  57.         } else if (da == 21) {
  58.                 suffix = "st";
  59.         } else if (da == 22) {
  60.                 suffix = "nd";
  61.         } else if (da == 23) {
  62.                 suffix = "rd";
  63.         } else if (da == 24) {
  64.                 suffix = "th";
  65.         } else if (da == 25) {
  66.                 suffix = "th";
  67.         } else if (da == 26) {
  68.                 suffix = "th";
  69.         } else if (da == 28) {
  70.                 suffix = "th";
  71.         } else if (da == 29) {
  72.                 suffix = "th";
  73.         } else if (da == 30) {
  74.                 suffix = "th";
  75.         } else if (da == 31) {
  76.                 suffix = "st";
  77.         }
  78.         document.write(curMon + ', ' + da + '' + suffix + ', ' + y);
  79. }
  80. function getWeather() {
  81.         if (isOnline()) {
  82.  
  83.         } else {
  84.                 var d = new Date();
  85.                 hours = d.getHours;
  86.                 if (hours >= 5 && hours =< 9) {
  87.                         time = "morning";
  88.                 } else if (hours ) {
  89.  
  90.                 }
  91.                
  92.  
  93.                 if (!idiot) {
  94.                         document.write("Have a fantastic ")
  95.                 } else {
  96.                         document.write("Get to bed you idiot. You have to be up early tomorrow.");
  97.                 }
  98.         }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement