Quality control (#27)

* fix paddings on screen

* fix  test Variable Assigned to Object Injection Sink

* fix parse int missing base

* fix security issues(regex not included)

* fix missing base

* fixes padding

* minor fixes

* regex

* cleanup

* minor cleanup in webmenu

* cleanups

* cleanups spaces to tab

* cleanups

* spacing tabs fixes test

* cleanup

* cleanup

* multitransition new line

* cleanup

* cleanup

* cleanup

* cleanup

* readme

* comments

* cleanup

* Avoid assignments in operands

* cleanup
This commit is contained in:
Gerome Matilla 2020-06-16 20:07:54 +08:00 committed by GitHub
parent f484e86e09
commit ae6e1254ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 900 additions and 910 deletions

View File

@ -1,6 +1,6 @@
## A bloated and modern-looking startpage
[![maintained](https://img.shields.io/maintenance/yes/2020?label=maintained&style=flat-square)](https://github.com/manilarome/the-glorious-startpage/commits/master) [![contributions](https://img.shields.io/badge/contribution-welcome-brightgreen&?style=flat-square)](https://github.com/manilarome/the-glorious-startpage/pulls) [![HitCount](http://hits.dwyl.com/manilarome/the-glorious-startpage.svg)](http://hits.dwyl.com/manilarome/the-glorious-startpage)
[![maintained](https://img.shields.io/maintenance/yes/2020?label=maintained&style=flat-square)](https://github.com/manilarome/the-glorious-startpage/commits/master) [![contributions](https://img.shields.io/badge/contribution-welcome-brightgreen&?style=flat-square)](https://github.com/manilarome/the-glorious-startpage/pulls) [![HitCount](http://hits.dwyl.com/manilarome/the-glorious-startpage.svg)](http://hits.dwyl.com/manilarome/the-glorious-startpage) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/d942895baf48442d8c9df54306887aa0)](https://www.codacy.com/manual/manilarome/the-glorious-startpage?utm_source=github.com&utm_medium=referral&utm_content=manilarome/the-glorious-startpage&utm_campaign=Badge_Grade)
## [Live Preview](https://manilarome.github.io/the-glorious-startpage/)

View File

@ -9,7 +9,7 @@
padding: 5px;
border: none;
cursor: pointer;
transition: transform .2s;
transition: transform 0.2s;
}
/* The a href container/main dock button container */
@ -25,7 +25,6 @@
/* Disable dragging */
user-select: none;
user-drag: none;
-webkit-user-drag: none;
}
@ -41,12 +40,12 @@
top: 0;
bottom: 0;
margin: auto;
max-width: 100%;
max-height: 100%;
overflow: auto;
}
/* Dock button hover */
.dockButton:hover {
background: var(--base-hover-bg);
@ -55,6 +54,7 @@
transform: scale(1.25);
}
/* Dock button active */
.dockButton:active {
background: var(--base-active-bg);
@ -63,6 +63,7 @@
transform: scale(1);
}
/* Dock button image */
.dockButtonImage {
background-size: cover;
}

View File

@ -32,7 +32,6 @@
/* Translate dock to left side if width <= 470 and height >= 540 */
@media screen and (max-width: 470px) and (min-height: 490px) {
.dockContainer {
display: inline-block;
opacity: 1;
@ -54,15 +53,13 @@
width: auto;
height: auto;
margin: 5px;
transform: scale(0.90);
transform: scale(0.9);
transition: transform var(--transition-speed);
}
}
/* Decrease scale to 0.85 if width is less than 470px */
@media screen and (max-width: 469px) and (max-height: 489px) {
.dockContainer {
position: absolute;
background: transparent;
@ -87,13 +84,10 @@
transform: scale(0.85);
transition: transform var(--transition-speed);
}
}
/* Decrease scale to 0.75 if width is less than 380px */
@media screen and (max-width: 380px) and (max-height: 489px) {
.dockContainer {
position: absolute;
background: transparent;
@ -118,12 +112,10 @@
transform: scale(0.75);
transition: transform var(--transition-speed);
}
}
/* Decrease scale to 0.70 if width is less than or equal to 374px and greater than or equal to 320px */
@media screen and (max-width: 350px) and (min-width: 320px) and (max-height: 489px) {
.dockContainer {
position: absolute;
background: transparent;
@ -145,15 +137,13 @@
width: auto;
height: auto;
margin: 5px;
transform: scale(0.70);
transform: scale(0.7);
transition: transform var(--transition-speed);
}
}
/* Scale to 0 if less than 320px */
@media screen and (max-width: 319px) and (max-height: 489px) {
.dockContainer {
position: absolute;
background: transparent;
@ -176,9 +166,9 @@
height: auto;
opacity: 0;
margin: 5px;
transform: scale(0.0);
transition: transform var(--transition-speed),
transform: scale(0);
transition:
transform var(--transition-speed),
opacity var(--transition-speed);
}
}

View File

@ -1,65 +1,5 @@
:root {
/* Colors */
--base-body-bg: #1A1A1AFF;
--base-bg: #00000060;
--base-color: #FEFEFEFF;
--base-container: #F2F2F220;
--base-hover-bg: #F2F2F230;
--base-focus-bg: #F2F2F245;
--base-active-bg: #FEFEFE60;
--blur-strength: 6px;
--panel-bg: var(--base-bg);
--panel-color: var(--base-color);
--transition-speed: 300ms;
--rounded-radius: 12px;
}
* {
box-sizing: border-box;
/*Font rendering*/
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
font-variant-ligatures: none;
/*Disable tap hightlight color on mobile devices*/
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
top: 0;
left: 0;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
background: var(--base-body-bg);
color: var(--foreground);
}
html, body {
font-family: roboto, sans-serif;
height: 100%;
position: fixed;
}
/*Placeholder*/
::placeholder {
color: var(--base-color);
opacity: 0.65;
}
/* Scrollbar */
/* width */
/* Width */
::-webkit-scrollbar {
width: 10px;
}
@ -74,11 +14,71 @@ html, body {
background: var(--base-active-bg);
}
:root {
/* Colors */
--base-body-bg: #1a1a1aff;
--base-bg: #00000060;
--base-color: #fefefeff;
--base-container: #f2f2f220;
--base-hover-bg: #f2f2f230;
--base-focus-bg: #f2f2f245;
--base-active-bg: #fefefe60;
--blur-strength: 6px;
--panel-bg: var(--base-bg);
--panel-color: var(--base-color);
--transition-speed: 300ms;
--rounded-radius: 12px;
}
/* Placeholder */
::placeholder {
color: var(--base-color);
opacity: 0.65;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: var(--base-hover-bg);
}
* {
box-sizing: border-box;
/* Font rendering */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
font-variant-ligatures: none;
/* Disable tap hightlight color on mobile devices */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
top: 0;
left: 0;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
background: var(--base-body-bg);
color: var(--foreground);
}
html,
body {
font-family: roboto, sans-serif;
height: 100%;
position: fixed;
}
/* Select */
select {
text-align: center;
text-align-last: center;
}
/* Hide focus elements outline */
input:focus,
textarea:focus,
@ -90,12 +90,6 @@ select::-ms-expand {
display: none;
}
/*Select*/
select {
text-align: center;
text-align-last: center;
}
option {
text-align: left;
}

View File

@ -1,3 +1,4 @@
/* Fantasque Sans */
@font-face {
font-family: 'fantasque-sans-mono';
font-style: normal;
@ -10,7 +11,9 @@
font-style: normal;
font-weight: 300;
src: url('../../fonts/roboto-v20-latin-300.eot'); /* IE9 Compat Modes */
src: local('Roboto Light'), local('Roboto-Light'),
src:
local('Roboto Light'),
local('Roboto-Light'),
url('../../fonts/roboto-v20-latin-300.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../../fonts/roboto-v20-latin-300.woff2') format('woff2'), /* Super Modern Browsers */
url('../../fonts/roboto-v20-latin-300.woff') format('woff'), /* Modern Browsers */
@ -24,7 +27,9 @@
font-style: normal;
font-weight: 400;
src: url('../../fonts/roboto-v20-latin-regular.eot'); /* IE9 Compat Modes */
src: local('Roboto'), local('Roboto-Regular'),
src:
local('Roboto'),
local('Roboto-Regular'),
url('../../fonts/roboto-v20-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../../fonts/roboto-v20-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('../../fonts/roboto-v20-latin-regular.woff') format('woff'), /* Modern Browsers */
@ -38,7 +43,9 @@
font-style: normal;
font-weight: 700;
src: url('../../fonts/roboto-v20-latin-700.eot'); /* IE9 Compat Modes */
src: local('Roboto Bold'), local('Roboto-Bold'),
src:
local('Roboto Bold'),
local('Roboto-Bold'),
url('../../fonts/roboto-v20-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../../fonts/roboto-v20-latin-700.woff2') format('woff2'), /* Super Modern Browsers */
url('../../fonts/roboto-v20-latin-700.woff') format('woff'), /* Modern Browsers */

View File

@ -62,7 +62,7 @@ hr {
*/
pre {
font-family: monospace, monospace; /* 1 */
font-family: monospace; /* 1 */
font-size: 1em; /* 2 */
}
@ -105,7 +105,7 @@ strong {
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-family: monospace; /* 1 */
font-size: 1em; /* 2 */
}

View File

@ -25,7 +25,7 @@
opacity: 1;
}
/*ul*/
/* UL */
#suggestions {
height: auto;
@ -44,7 +44,7 @@
table-layout: fixed;
}
/*li*/
/* LI */
#phrase {
/* Align list horizontally */
justify-content: center;
@ -62,7 +62,7 @@
text-align: center;
}
/*The li's child*/
/* LI's Child */
.phraseButton {
background: transparent;
@ -71,25 +71,26 @@
color: var(--base-color);
font-size: 12pt;
font-family: roboto-bold;
font-family: roboto-bold, sans-serif;
font-weight: 700;
text-align: center;
border-radius: 6px;
vertical-align: middle;
padding: 10px;
}
/* Focus */
.phraseButton:focus {
background: var(--base-bg);
}
/* Active */
.phraseButton:active {
background: var(--base-active-bg);
}
@media screen and (max-height: 539px) and (min-height: 341px) {
#suggestions {
height: auto;
width: 100vw;
@ -99,7 +100,6 @@
#phrase {
/* Always stack and center horizontally */
display: table-cell;
width: auto;
text-align: center;
justify-content: space-between;
@ -110,9 +110,8 @@
}
@media screen and (max-height: 340px) {
/* Hide */
#suggestionsContainer.phrasesContainer {
opacity: 0;
}
}

View File

@ -12,7 +12,8 @@
margin: 0;
padding: 0;
z-index: -1;
transition: opacity var(--transition-speed),
transition:
opacity var(--transition-speed),
z-index var(--transition-speed),
backdrop-filter var(--transition-speed);
}

View File

@ -16,7 +16,8 @@
#centeredBox {
opacity: 1;
z-index: 2;
transition: opacity var(--transition-speed),
transition:
opacity var(--transition-speed),
z-index var(--transition-speed);
}

View File

@ -37,6 +37,11 @@
}
@keyframes rotate {
from { -webkit-transform: rotate(0deg) }
to { -webkit-transform: rotate(360deg) }
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View File

@ -8,7 +8,8 @@
pointer-events: none;
transition: opacity var(--transition-speed),
transition:
opacity var(--transition-speed),
top var(--transition-speed),
pointer-events var(--transition-speed);
}
@ -63,4 +64,3 @@
pointer-events: initial;
}
}

View File

@ -58,7 +58,8 @@
z-index: -2;
filter: blur(var(--blur-strength)) brightness(70%);
transition: visibility var(--transition-speed),
transition:
visibility var(--transition-speed),
z-index var(--transition-speed);
}

View File

@ -3,7 +3,7 @@
font-weight: 400;
width: 100%;
height: auto;
position: relative;;
position: relative;
border-radius: 6px;
color: var(--base-color);
background: var(--base-container);

View File

@ -1,9 +1,10 @@
.themeEngine {
font-family: roboto, sans-serif;
font-weight: 400;
width: 100%;
height: auto;
position: relative;;
position: relative;
border-radius: 6px;
color: var(--base-color);
background: var(--base-container);

View File

@ -3,7 +3,7 @@
font-weight: 400;
width: 100%;
height: auto;
position: relative;;
position: relative;
border-radius: 6px;
color: var(--base-color);
background: var(--base-container);
@ -48,7 +48,8 @@
height: 0;
opacity: 0;
pointer-events: none;
transition: height var(--transition-speed),
transition:
height var(--transition-speed),
opacity var(--transition-speed);
}
@ -123,23 +124,25 @@
margin-right: 2.5px;
}
#weatherSettingsApply:hover, #weatherSettingsReset:hover {
#weatherSettingsApply:hover,
#weatherSettingsReset:hover {
outline: none;
cursor: pointer;
background: var(--base-hover-bg);
}
#weatherSettingsApply:active, #weatherSettingsReset:active {
#weatherSettingsApply:active,
#weatherSettingsReset:active {
outline: none;
background: var(--base-active-bg);
}
#weatherSettingsApply:focus, #weatherSettingsReset:focus {
#weatherSettingsApply:focus,
#weatherSettingsReset:focus {
outline: none;
background: var(--base-focus-bg);
}
#weatherSettingsButtons {
display: flex;
flex-direction: row;

View File

@ -2,16 +2,13 @@
display: flex;
justify-content: center;
align-items: center;
padding-top: 6vh;
padding-bottom: 6vh;
padding-left: 12vw;
padding-right: 12vw;
padding: 6vh 12vw;
transform: scale(0);
opacity: 0;
z-index: 0;
transition: transform var(--transition-speed),
transition:
transform var(--transition-speed),
opacity var(--transition-speed),
z-index var(--transition-speed);
}
@ -24,7 +21,6 @@
#weatherScreenContainer {
overflow: hidden;
position: relative;
/* Align vertically center */
margin: 0;
@ -89,31 +85,28 @@
}
#sunriseHourDataIcon {
background: url("../../assets/weather-icons/sunrise.svg");
background-image: url("../../assets/weather-icons/sunrise.svg");
background-size: cover;
}
#sunsetHourDataIcon {
background: url("../../assets/weather-icons/sunset.svg");
background-image: url("../../assets/weather-icons/sunset.svg");
background-size: cover;
margin-left: 5px
margin-left: 5px;
}
#updateHourDataIcon {
background: url("../../assets/weather-icons/refresh.svg");
background-image: url("../../assets/weather-icons/refresh.svg");
background-size: cover;
margin-left: 5px
margin-left: 5px;
}
.weatherForecast {
display: flex;
flex-direction: row;
justify-content: center;
}
/* Forecast Container */
.weatherForecastDay {
text-align: center;
@ -148,7 +141,6 @@
/* Center */
.weatherForecastDayDetails {
clear: both;
}
@ -174,10 +166,7 @@
@media screen and (max-width: 470px) {
#weatherScreen {
padding-top: 6vh;
padding-bottom: 0vh;
padding-left: 18vw;
padding-right: 18vw;
padding: 6vh 18vw 0 18vw;
}
}
@ -188,7 +177,6 @@
}
@media screen and (max-width: 470px) {
.weatherForecast {
display: inline-block;
flex-direction: row;
@ -202,7 +190,7 @@
float: none;
clear: none;
margin-left : 0px;
margin-left: 0;
}
/* Add fixed geometry to weatherForecastDay children */
@ -233,5 +221,4 @@
float: right;
clear: none;
}
}

View File

@ -1,25 +1,18 @@
#webMenuScreen {
z-index: 0;
padding: 40px 12vw 6vh 12vw;
padding-top: 40px;
padding-bottom: 6vh;
padding-left: 12vw;
padding-right: 12vw;
/*Transitions*/
opacity: 0;
transform: scale(0);
transition: transform var(--transition-speed),
transition:
transform var(--transition-speed),
opacity var(--transition-speed),
z-index var(--transition-speed);
}
@media screen and (max-width: 470px) {
#webMenuScreen {
padding-top: 6vh;
padding-bottom: 0vh;
padding-left: 18vw;
padding-right: 18vw;
padding: 6vh 18vw 0 18vw;
}
}
@ -171,6 +164,7 @@
height: 64px;
width: 64px;
margin-bottom: 0;
background-size: cover;
}
/* Web label/name */
@ -181,7 +175,6 @@
font-weight: 400;
word-wrap: break-word;
color: var(--base-color);
}
#webMenuListContainer {
@ -241,6 +234,5 @@
/*Disable dragging*/
user-select: none;
user-drag: none;
-webkit-user-drag: none;
}

View File

@ -40,7 +40,7 @@ class AutoSuggestion {
const phraseButtons = Array.prototype.slice.call(document.querySelectorAll('button'));
const phraseIndex = (phraseButtons.indexOf(document.activeElement) + 1) % phraseButtons.length;
const phraseButton = phraseButtons[phraseIndex];
const phraseButton = phraseButtons[parseInt(phraseIndex, 10)];
phraseButton.focus();
} else if ((e.key === 'ArrowUp') || e.key === 'ArrowLeft') {
@ -48,23 +48,23 @@ class AutoSuggestion {
e.preventDefault();
const phraseButtons = Array.prototype.slice.call(document.querySelectorAll('button'));
const phraseIndex = (phraseButtons.indexOf(document.activeElement) - 1) % phraseButtons.length;
let phraseIndex = (phraseButtons.indexOf(document.activeElement) - 1) % phraseButtons.length;
if (phraseIndex < 0) {
phraseIndex = phraseButtons.length - 1;
};
}
const phraseButton = phraseButtons[phraseIndex];
const phraseButton = phraseButtons[parseInt(phraseIndex, 10)];
phraseButton.focus();
}
}
};
// Onmouseup event
button.onmouseup = e => {
this._searchBox.value = button.innerText;
this._searchBox.focus();
}
};
}
// Generate and parse suggestions
@ -105,12 +105,12 @@ class AutoSuggestion {
_fetchSuggestion = () => {
const endpoint = 'https://duckduckgo.com/ac/';
const callback = 'autocompleteCallback'
const callback = 'autocompleteCallback';
const searchQuery = String(this._searchBox.value);
window[callback] = res => {
window[String(callback)] = res => {
// Passed the suggestion object to process it
this._autocompleteCallback(res);
}
};
// Fetch from duckduckgo
const script = document.createElement('script');

View File

@ -46,8 +46,8 @@ class DummyBodyBackground {
},
3000
)
}
);
};
// Add a delay when to fetch the hq background
setTimeout (

View File

@ -29,7 +29,7 @@ class Config {
name: 'Bing',
prefix: 'https://www.bing.com/search?q='
}
}
};
return searchEngines;
}

View File

@ -26,7 +26,7 @@ class Dashboard {
const len = elems.length;
for (let i = 0; i < len; i++) {
elems[i].disabled = status;
elems[parseInt(i, 10)].disabled = status;
}
}
@ -61,7 +61,7 @@ class Dashboard {
toggleDashboard = () => {
console.log('toggle dashboard');
// console.log('toggle dashboard');
if (this._rightDashboardVisibility) {
@ -76,7 +76,7 @@ class Dashboard {
// If centered box is hidden, open it
if (this._centeredBox.classList.contains('hiddenBox')) {
console.log('centered box is hidden, reopening...');
// console.log('centered box is hidden, reopening...');
// Rotate profile container
profileImage.rotateProfile();
@ -88,16 +88,16 @@ class Dashboard {
// Check if any of these are open, if yes, close it
if (this._searchBoxContainer.classList.contains('showSearchBox')) {
console.log('searchbox is open, closing...');
// console.log('searchbox is open, closing...');
searchBoxShow.hideSearchBox();
} else if (this._webMenu.classList.contains('showWebMenu')) {
console.log('web menu is open, closing...');
// console.log('web menu is open, closing...');
webMenu.hideWebMenu();
return;
} else if (this._weatherScreen.classList.contains('showWeatherScreen')) {
console.log('weather screen is open, closing...');
// console.log('weather screen is open, closing...');
weatherScreen.hideWeatherScreen();
return;
@ -109,7 +109,7 @@ class Dashboard {
if (this._rightDashboardVisibility) {
this.toggleDashboard();
}
console.log('dashboard overlay clicked...');
// console.log('dashboard overlay clicked...');
}
_registerOverlayMouseUpEvent = () => {

View File

@ -53,9 +53,9 @@ class DockButtons {
for (let i = 0; i < (this.dockSites.length); i++) {
const site = this.dockSites[i].site;
const icon = this.dockSites[i].icon;
const url = this.dockSites[i].url;
const site = this.dockSites[parseInt(i, 10)].site;
const icon = this.dockSites[parseInt(i, 10)].icon;
const url = this.dockSites[parseInt(i, 10)].url;
// Create a href
const aDock = document.createElement('a');
@ -81,7 +81,7 @@ class DockButtons {
aDock.appendChild(dockButton);
this._dock.appendChild(aDock);
};
}
}
_populateDock = () => {

View File

@ -53,8 +53,8 @@ class GreeterDateMessage {
greeterSuffix = 'Evening';
}
this._greeterMessage.innerHTML = `Good<br>${greeterSuffix}!`;
this._dateMessage.innerHTML = `Today's the ${this._getDayOrdinal(date.getDate())} of ` +
this._greeterMessage.innerText = `Good\n${greeterSuffix}!`;
this._dateMessage.innerText = `Today's the ${this._getDayOrdinal(date.getDate())} of ` +
`${this._monthsArr[date.getMonth()]}, and it's ${this._daysArr[date.getDay()]}.`;
}

View File

@ -94,7 +94,7 @@ class KeyBinding {
// Backspacing while there's no search query will hide searhbox
// Will also hide if you hit enter
if ((e.key === 'Backspace' || e.key === 'Enter') &&
this._searchBox.value < 1) { searchBoxShow.toggleSearchBox(); return; };
this._searchBox.value < 1) { searchBoxShow.toggleSearchBox(); return; }
}
}

View File

@ -14,7 +14,7 @@ class SwipeEventManager {
el.addEventListener(
'touchstart',
(event) => {
event => {
// event.preventDefault();
this._xDown = event.touches[0].clientX;
this._yDown = event.touches[0].clientY;
@ -24,7 +24,7 @@ class SwipeEventManager {
el.addEventListener(
'touchmove',
(event) => {
event => {
// event.preventDefault();
if ( ! this._xDown || ! this._yDown ) {
return;
@ -38,7 +38,7 @@ class SwipeEventManager {
if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {
if ( xDiff > 0 ) {
// Left Swipe
dir = 'left'
dir = 'left';
} else {
// Right Swipe
dir = 'right';

View File

@ -1,7 +1,7 @@
class ProfileImage {
constructor() {
this._profileContainer = document.querySelector('#profileImageContainer')
this._profileContainer = document.querySelector('#profileImageContainer');
this._profileAnimRunning = false;

View File

@ -42,7 +42,7 @@ class SearchEngineSettings {
Object.keys(this._searchEngines)
.forEach(key => {
const seValue = key;
const seData = this._searchEngines[key];
const seData = this._searchEngines[String(key)];
const seOption = document.createElement('option');
// Generate search engine suggestions
@ -51,8 +51,8 @@ class SearchEngineSettings {
`
<option value='${seValue}'>${seData.name}</option>
`
)
})
);
});
// Call to update query string and placeholder
this._updateSearchEngineElements();

View File

@ -48,8 +48,8 @@ class SearchQuerySend {
}
// Search the web
this._sendQuery()
};
this._sendQuery();
}
}
_registerKeyUpEvent = () => {

View File

@ -61,7 +61,7 @@ class SearchBoxShow {
this.showSearchBox();
}
console.log('toggle searchbox');
// console.log('toggle searchbox');
}

View File

@ -53,13 +53,13 @@ class ThemeEngine {
if (!colorRGBA) {
// If RGB - (#RRGGBB)
if (/^#([0-9A-F]{3}){1,2}$/i.test(colorStr)) {
if (/^#[0-9A-F]{3}$/i.test(colorStr)) {
// Add completely opaque alpha
return colorStr + 'FF';
// If three-charactered HEX color - (#RGB)
} else if (/^#([0-9A-F]{3}){1,2}$/i.test(colorStr)) {
} else if (/^#[0-9A-F]{3}$/i.test(colorStr)) {
// Convert it to RRGGBB
return colorStr.replace(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/, '#$1$1$2$2$3$3');
@ -74,6 +74,7 @@ class ThemeEngine {
} else {
alert('Invalid color');
return false;
}
}
@ -158,7 +159,7 @@ class ThemeEngine {
foregroundOpacity,
blurStrength,
animSpeed
)
);
}
_updateCSSconstiables = () => {

View File

@ -42,7 +42,7 @@ class WeatherScreen {
}
_getWeatherIcon = code => {
const icon_tbl = {
const iconTbl = {
'01d': 'sun_icon.svg',
'01n': 'moon_icon.svg',
'02d': 'dfew_clouds.svg',
@ -63,7 +63,7 @@ class WeatherScreen {
'50n': 'nmist.svg'
};
return icon_tbl[code];
return iconTbl[String(code)];
}
_updateWeatherDockButton = icon => {
@ -73,15 +73,15 @@ class WeatherScreen {
_setWeatherValue = (loc, desc, icon, sunr, suns, updt) => {
this._weatherLocation.innerHTML = loc;
this._weatherDescription.innerHTML = desc + this._tempSymbol;
this._weatherLocation.innerText = loc;
this._weatherDescription.innerText = desc + this._tempSymbol;
this._weatherIcon.style.background = `url('assets/weather-icons/${icon}')`;
this._weatherIcon.style.backgroundSize = 'cover';
this._sunriseHour.innerHTML = sunr;
this._sunsetHour.innerHTML = suns;
this._updateHour.innerHTML = updt;
this._sunriseHour.innerText = sunr;
this._sunsetHour.innerText = suns;
this._updateHour.innerText = updt;
// Update weather button on dock
this._updateWeatherDockButton(icon);
@ -107,7 +107,7 @@ class WeatherScreen {
</div>
</div>
`
)
);
}
@ -136,7 +136,7 @@ class WeatherScreen {
const wLoc = cityName + ', ' + countryName;
let wDesc = weatherDescription + ', ' + weatherTemp;
wDesc = wDesc && wDesc[0].toUpperCase() + wDesc.slice(1)
wDesc = wDesc && wDesc[0].toUpperCase() + wDesc.slice(1);
const wIcon = this._getWeatherIcon(weatherIcon);
const rise = this._formatUnixTime(sunRise);
@ -158,7 +158,7 @@ class WeatherScreen {
callback(JSON.parse(request.response));
} else {
this._setErrValue();
};
}
};
request.send();
}
@ -204,17 +204,17 @@ class WeatherScreen {
_processForecastData = data => {
// Empty forecast container to avoid duplication
this._forecastContainer.innerHTML = '';
this._forecastContainer.innerText = '';
const forecast = data.list;
for (let i = 8; i < forecast.length; i+=8) {
const foreIcon = forecast[i].weather[0].icon;
const minimumTemp = forecast[i].main.temp_min;
const maximumTemp = forecast[i].main.temp_max;
const foreDescription = forecast[i].weather[0].description;
const dateTime = forecast[i].dt_txt;
const foreIcon = forecast[parseInt(i, 10)].weather[0].icon;
const minimumTemp = forecast[parseInt(i, 10)].main.temp_min;
const maximumTemp = forecast[parseInt(i, 10)].main.temp_max;
const foreDescription = forecast[parseInt(i, 10)].weather[0].description;
const dateTime = forecast[parseInt(i, 10)].dt_txt;
const fIcon = this._getWeatherIcon(foreIcon);
const minTemp = Math.floor(minimumTemp);
@ -243,7 +243,7 @@ class WeatherScreen {
toggleWeatherScreen = () => {
console.log('toggle weather screen');
// console.log('toggle weather screen');
// If profile anim is still running,
// Return to avoid spam
@ -263,16 +263,16 @@ class WeatherScreen {
// Check if any of these are open, if yes, close it
if (this._webMenu.classList.contains('showWebMenu')) {
console.log('web menu is open, closing...');
// console.log('web menu is open, closing...');
webMenu.hideWebMenu();
return;
} else if (this._searchBoxContainer.classList.contains('showSearchBox')) {
console.log('searchbox is open, closing...');
// console.log('searchbox is open, closing...');
searchBoxShow.hideSearchBox();
} else if (this._dashboard.classList.contains('showRightDashboard')) {
console.log('dashboard is open, closing...');
// console.log('dashboard is open, closing...');
dashboard.hideDashboard();
}

View File

@ -105,7 +105,7 @@ class WeatherSettings {
_deniedGeolocation = () => {
alert(`Location access denied! If you're on mobile, make sure to`+
` enable your GPS and allow the location permission on your browser's settings.`)
` enable your GPS and allow the location permission on your browser's settings.`);
}
@ -116,7 +116,7 @@ class WeatherSettings {
if ((this._origLongitude !== currentCoord.longitude) || (this._origLatitude !== currentCoord.latitude)) {
console.log('update current position');
// console.log('update current position');
// Update origPositions
this._origLongitude = currentCoord.longitude;
@ -131,9 +131,9 @@ class WeatherSettings {
// Error
_watchGeoError = err => {
console.warn('ERROR(' + err.code + '): ' + err.message);
// console.warn('ERROR(' + err.code + '): ' + err.message);
if (err.code == err.PERMISSION_DENIED) {
if (err.code === err.PERMISSION_DENIED) {
this._deniedGeolocation();
@ -150,7 +150,7 @@ class WeatherSettings {
navigator.permissions.query({name:'geolocation'}).then(result => {
if ((result.state === 'prompt') || (result.state == 'granted')) {
if ((result.state === 'prompt') || (result.state === 'granted')) {
this._watchGeoPosition();
@ -170,13 +170,13 @@ class WeatherSettings {
if (this._locatorMode === 'geolocation') {
console.log('geolocation');
// console.log('geolocation');
this._weatherSettingsCityIDGroup.classList.add('hideWeatherSettings');
} else if (this._locatorMode === 'city') {
console.log('city');
// console.log('city');
this._weatherSettingsCityIDGroup.classList.remove('hideWeatherSettings');

View File

@ -41,7 +41,7 @@ class WebMenu {
const len = elems.length;
for (let i = 0; i < len; i++) {
elems[i].disabled = status;
elems[parseInt(i, 10)].disabled = status;
}
}
@ -50,7 +50,7 @@ class WebMenu {
// Create a callback property for the passed li
li.callback = () => {
window.location.href = encodeURI(url);
}
};
}
// Sort list alphabetically
@ -81,7 +81,7 @@ class WebMenu {
<div class='webItemContainer'>
<div class='webItemBody'>
<div class='webItemIconContainer'>
<div class='webItemIcon' style='background: url("assets/webcons/${icon}.svg"); background-size: cover;'></div>
<div class='webItemIcon' style='background-image: url("assets/webcons/${icon}.svg");'></div>
</div>
<div class='webItemName'>${site}</div>
</div>
@ -89,7 +89,7 @@ class WebMenu {
</div>
</a>
`
)
);
// Create callback property
this._createWebItemCallback(li, url);
@ -103,6 +103,8 @@ class WebMenu {
// Allow fuzzy searching in web menu
_fuzzySearch = () => {
// eslint-disable-next-line no-extend-native
String.prototype.fuzzy = function(term, ratio) {
const string = this.toLowerCase();
const compare = term.toLowerCase();
@ -112,7 +114,12 @@ class WebMenu {
if (string.indexOf(compare) > -1) return true;
for (let i = 0; i < compare.length; i++) {
string.indexOf(compare[i]) > -1 ? matches += 1 : matches -=1;
const ind = string.indexOf(compare[parseInt(i, 10)]);
if (ind > -1) {
matches += 1;
} else {
matches -=1;
}
}
return ((matches / this.length) >= ratio || term === '');
};
@ -131,7 +138,7 @@ class WebMenu {
// Loop through all list items, and focus if matches the search query
for (let i = 0; i < li.length; i++) {
a = li[i].getElementsByClassName('webItemName')[0];
a = li[parseInt(i, 10)].getElementsByClassName('webItemName')[0];
txtValue = a.innerHTML || a.textContent || a.innerText;
// If an item match, hightlight it and focus
@ -144,7 +151,7 @@ class WebMenu {
oldWebItemFocusChild.classList.remove('webItemFocus');
// Update webItemFocus
this._webItemFocus = li[i];
this._webItemFocus = li[parseInt(i, 10)];
// Update weblistindex
this._webListIndex = i;
@ -229,7 +236,7 @@ class WebMenu {
// Toggle web menu screen
toggleWebMenu = () => {
console.log('toggle web menu');
// console.log('toggle web menu');
// If profile anim is still running,
// Return to avoid spam
@ -249,15 +256,15 @@ class WebMenu {
// Check if any of these are open, if yes, close it
if (searchBoxContainer.classList.contains('showSearchBox')) {
console.log('searchbox is open, closing...');
// console.log('searchbox is open, closing...');
searchBoxShow.hideSearchBox();
} else if (this._dashboard.classList.contains('showRightDashboard')) {
console.log('dashboard is open, closing...');
// console.log('dashboard is open, closing...');
dashboard.hideDashboard();
} else if (this._weatherScreen.classList.contains('showWeatherScreen')) {
console.log('weather screen is open, closing...');
// console.log('weather screen is open, closing...');
weatherScreen.hideWeatherScreen();
return;
@ -304,7 +311,7 @@ class WebMenu {
const containerWindow = ((window.innerWidth - (menuItemWidth / 2) - scrollBarWidth - vw(24)) / menuItemWidth);
// Get rounded result
return Math.round(containerWindow);
}
};
// Determine the index position by key
const changeWebListIndex = () => {
@ -330,24 +337,24 @@ class WebMenu {
this._webMenuSearchBox.value = '';
break;
}
}
};
const changeItemFocus = (condition, overFlowIndex) => {
const next = this._webMenuList.getElementsByTagName('li')[this._webListIndex];
if(typeof next !== undefined && condition) {
if(typeof next !== 'undefined' && condition) {
this._webItemFocus = next;
} else {
this._webListIndex = overFlowIndex;
this._webItemFocus = this._webMenuList.getElementsByTagName('li')[overFlowIndex];
}
this._webItemFocus = this._webMenuList.getElementsByTagName('li')[parseInt(overFlowIndex, 10)];
}
};
const changeItemFocusByKey = () => {
if (key === right) { return changeItemFocus((this._webListIndex <= len), 0) }
if (key === left) { return changeItemFocus((this._webListIndex >= 0), len) }
if (key === up) { return changeItemFocus((this._webListIndex >= 0), len) }
if (key === down) { return changeItemFocus((this._webListIndex <= len), 0) }
}
if (key === right) { return changeItemFocus((this._webListIndex <= len), 0); }
if (key === left) { return changeItemFocus((this._webListIndex >= 0), len); }
if (key === up) { return changeItemFocus((this._webListIndex >= 0), len); }
if (key === down) { return changeItemFocus((this._webListIndex <= len), 0); }
};
changeWebListIndex();