This commit is contained in:
David Ralph 2019-03-22 20:11:06 +00:00
parent 8d8831f64b
commit 9d2f4a6b4f
4 changed files with 21 additions and 21 deletions

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,7 @@ const quotes = require('./quote.js');
const message = require('./message.js');
const background = require('./background.js');
let nal = navigator.language;
const nal = navigator.language;
module.exports = class Function {
static setDaytimeMessage() {
@ -38,23 +38,23 @@ module.exports = class Function {
if (util.contains.call(codes.arcodes, nal)) message.arMessageSet(); //Arabic
if (util.contains.call(codes.svcodes, nal)) message.svMessageSet(); //Swedish
else message.engMessageSet(); //English
};
}
static setRandomBackground() {
document.body.classList.add(util.pickFromArray(background));
};
}
static setRandomQuote() {
let id = util.getRandIndex(quotes.authors);
const id = util.getRandIndex(quotes.authors);
if (util.contains.call(codes.itcodes, nal)) util.setHTMLContent('blockquote', `"${quotes.ita[id]}"`); //Italian
if (util.contains.call(codes.ptcodes, nal)) util.setHTMLContent('blockquote', `"${quotes.pt[id]}"` || `"${quotes.eng[id]}"`); //Portuguese
if (util.contains.call(codes.spcodes, nal)) util.setHTMLContent('blockquote', `"${quotes.spa[id]}"`); //Spanish
else util.setHTMLContent('blockquote', `"${quotes.eng[id]}"`); //English
util.setHTMLContent('cite', quotes.authors[id]);
};
}
static setTime() {
let date = new Date(),
const date = new Date(),
time = [
util.formatTimeUnit(date.getHours()),
util.formatTimeUnit(date.getMinutes()),

View File

@ -21,7 +21,7 @@ const { setHTMLContent } = require('./util.js');
module.exports = class Message {
// English
static engMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'Good evening'; // Set the default time string to "Good evening"
if (hour < 12) time = 'Good morning'; //If it's before 12am, set the time string to "Good morning"
else if (hour < 18) time = 'Good afternoon'; //If it's before 6pm, set the time string to "Good afternoon"
@ -31,7 +31,7 @@ module.exports = class Message {
// Italian
static itMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'Buongiorno';
if (hour > 18) time = 'Buonasera'; //In Italian there is just Buongiorno or Buonasera
setHTMLContent('.greeting', time); // Write the string contents to the HTML
@ -39,7 +39,7 @@ module.exports = class Message {
// Dutch
static nlMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'Goedemiddag'; // Set the default time string to "Good evening"
if (hour < 12) time = 'Goedemorgen'; //If it's before 12am, set the time string to "Good morning"
else if (hour > 18) time = 'Goedenavond'; //If it's before 6pm, set the time string to "Good afternoon"
@ -49,7 +49,7 @@ module.exports = class Message {
// French
static frMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'Bonsoir'; // Set the default time string to "Good evening"
if (hour < 12) time = 'Bonjour'; //If it's before 12am, set the time string to "Good morning"
else if (hour > 18) time = 'Bonne après-midi'; //If it's before 6pm, set the time string to "Good afternoon"
@ -58,7 +58,7 @@ module.exports = class Message {
// Spanish
static spMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'Buenas Tardes'; // Set the default time string to "Good evening"
if (hour < 12) time = 'Buenos Días'; // If it's before 12am, set the time string to "Good morning"
else if (hour > 18) time = 'Buenas Noches'; // If it's before 6pm, set the time string to "Good afternoon"
@ -68,7 +68,7 @@ module.exports = class Message {
// Finnish
static fiMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'Hyvää iltaa'; // Set the default time string to "Good evening"
if (hour < 12) time = 'Hyvää huomenta'; // If it's before 12am, set the time string to "Good morning"
else if (hour > 18) time = 'Hyvää iltapäivää'; // If it's before 6pm, set the time string to "Good afternoon"
@ -78,7 +78,7 @@ module.exports = class Message {
// German
static deMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'Guten Abend'; // Set the default time string to "Good evening"
if (hour < 12) time = 'Guten Morgen'; // If it's before 12am, set the time string to "Good morning"
else if (hour > 18) time = 'Guten Nachmittag'; // If it's before 6pm, set the time string to "Good afternoon"
@ -87,7 +87,7 @@ module.exports = class Message {
// Hebrew
static heMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'ערב טוב'; // Set the default time string to "Good evening"
if (hour < 12) time = 'בוקר טוב'; // If it's before 12am, set the time string to "Good morning"
else if (hour > 18) time = 'אחר הצהריים טובים'; // If it's before 6pm, set the time string to "Good afternoon"
@ -97,7 +97,7 @@ module.exports = class Message {
// Russian
static ruMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'Добрый Вечер'; // Set the default time string to "Good evening"
if (hour < 12) time = 'добрый утро'; // If it's before 12am, set the time string to "Good morning"
else if (hour > 18) time = 'добрый день'; // If it's before 6pm, set the time string to "Good afternoon"
@ -107,7 +107,7 @@ module.exports = class Message {
// Arabic
static arMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'مساء الخير'; // Set the default time string to "Good evening"
if (hour < 12) time = 'صباح الخير'; // If it's before 12am, set the time string to "Good morning"
else if (hour > 18) time = 'مساء الخير'; // If it's before 6pm, set the time string to "Good afternoon"
@ -117,7 +117,7 @@ module.exports = class Message {
// Swedish
static svMessageSet() {
let hour = new Date().getHours(); // Get the current hour
const hour = new Date().getHours(); // Get the current hour
let time = 'God kväll'; // Set the default time string to "Good evening"
if (hour < 12) time = 'God morgon'; // If it's before 12am, set the time string to "Good morning"
else if (hour > 18) time = 'Dod eftermiddag'; // If it's before 6pm, set the time string to "Good afternoon"

View File

@ -38,7 +38,7 @@ module.exports = class Util {
}
static contains(needle) {
let findNaN = needle !== needle;
const findNaN = needle !== needle;
let indexOf;
if (!findNaN && typeof Array.prototype.indexOf === 'function') indexOf = Array.prototype.indexOf;
else {
@ -46,14 +46,14 @@ module.exports = class Util {
let i = -1,
index = -1;
for (i = 0; i < this.length; i++) {
let item = this[i];
const item = this[i];
if ((findNaN && item !== item) || item === needle) {
index = i;
break;
}
}
return index;
}
};
}
return indexOf.call(this, needle) > -1;
}