Code quality improvement(i guess) (#17)

* replace  divs with labels in dashboard textboxes

* convert weather settings block to form

* convert search engine block to form

* convert theme engine block to form

* dashboard buttons:replace onmouseup with .onclick()

* add hover event on buttons
This commit is contained in:
Gerome Matilla 2020-06-07 14:34:27 +08:00 committed by GitHub
parent c6d4387a65
commit 620f297f70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 195 additions and 154 deletions

View File

@ -60,7 +60,19 @@
}
#searchEngineSelect:hover {
outline: none !important;
cursor: pointer;
background: var(--base-hover-bg) !important;
}
#searchEngineSelect:focus {
outline: none !important;
background: var(--base-focus-bg) !important;
}
#searchEngineSelect:active {
outline: none !important;
background: var(--base-active-bg) !important;
}
#searchEngineSelect option {
@ -81,6 +93,7 @@ select::-ms-expand {
margin-top: 5px;
border-radius: 6px;
cursor: pointer;
border: none;
/*Center vertically*/
display: flex;
@ -96,6 +109,10 @@ select::-ms-expand {
background: var(--base-active-bg);
}
#searchEngineAsDefault:focus {
background: var(--base-focus-bg);
}
@media screen and (max-width: 580px) {
.searchEngine {
width: 96vw;

View File

@ -25,7 +25,8 @@
--base-color: #f2f2f2;
--base-container: #f2f2f220;
--base-hover-bg: #f2f2f240;
--base-hover-bg: #f2f2f230;
--base-focus-bg: #f2f2f245;
--base-active-bg: #fefefe60;
--blur-strength: 6px;

View File

@ -82,6 +82,7 @@ select::-ms-expand {
margin-top: 5px;
border-radius: 6px;
cursor: pointer;
border: none;
/*Center vertically*/
display: flex;
@ -99,6 +100,12 @@ select::-ms-expand {
background: var(--base-active-bg);
}
#themeEngineReset:focus,
#themeEngineAsDefault:focus {
outline: none;
background: var(--base-focus-bg);
}
.themeEngineGroups {
margin-top: 5px;
}

View File

@ -78,7 +78,19 @@
}
#weatherSelectUnits:hover {
outline: none !important;
cursor: pointer;
background: var(--base-hover-bg) !important;
}
#weatherSelectUnits:focus {
outline: none !important;
background: var(--base-focus-bg) !important;
}
#weatherSelectUnits:active {
outline: none !important;
background: var(--base-active-bg) !important;
}
#weatherSelectUnits option {
@ -86,8 +98,10 @@
border: none;
}
#weatherSettingsApply, #weatherSettingsReset {
#weatherSettingsApply,
#weatherSettingsReset {
margin-top: 0;
border: none;
background: var(--base-container) !important;
}
@ -100,14 +114,22 @@
}
#weatherSettingsApply:hover, #weatherSettingsReset:hover {
background: var(--base-hover-bg) !important;
outline: none;
cursor: pointer;
background: var(--base-hover-bg) !important;
}
#weatherSettingsApply:active, #weatherSettingsReset:active {
outline: none;
background: var(--base-active-bg) !important;
}
#weatherSettingsApply:focus, #weatherSettingsReset:focus {
outline: none;
background: var(--base-focus-bg) !important;
}
#weatherSettingsButtons {
display: flex;
flex-direction: row;

View File

@ -1,33 +1,33 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<meta charset='utf-8'>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="robots" content="noindex">
<link rel="stylesheet" href="css/style.css" class="style">
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no'>
<meta name='robots' content='noindex'>
<link rel='stylesheet' href='css/style.css' class='style'>
<!-- Favicons -->
<link rel="shortcut icon" href="assets/favicon/favicon.ico">
<link rel="icon" sizes="16x16 32x32 64x64" href="assets/favicon/favicon.ico">
<link rel="icon" type="image/png" sizes="196x196" href="assets/favicon/favicon-192.png">
<link rel="icon" type="image/png" sizes="160x160" href="assets/favicon/favicon-160.png">
<link rel="icon" type="image/png" sizes="96x96" href="assets/favicon/favicon-96.png">
<link rel="icon" type="image/png" sizes="64x64" href="assets/favicon/favicon-64.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/favicon/favicon-32.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/favicon/favicon-16.png">
<link rel="apple-touch-icon" href="assets/favicon/favicon-57.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/favicon/favicon-114.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/favicon/favicon-72.png">
<link rel="apple-touch-icon" sizes="144x144" href="assets/favicon/favicon-144.png">
<link rel="apple-touch-icon" sizes="60x60" href="assets/favicon/favicon-60.png">
<link rel="apple-touch-icon" sizes="120x120" href="assets/favicon/favicon-120.png">
<link rel="apple-touch-icon" sizes="76x76" href="assets/favicon/favicon-76.png">
<link rel="apple-touch-icon" sizes="152x152" href="assets/favicon/favicon-152.png">
<link rel="apple-touch-icon" sizes="180x180" href="assets/favicon/favicon-180.png">
<meta name="msapplication-TileColor" content="#FFFFFF">
<meta name="msapplication-TileImage" content="assets/favicon/favicon-144.png">
<meta name="msapplication-config" content="assets/favicon/browserconfig.xml">
<link rel='shortcut icon' href='assets/favicon/favicon.ico'>
<link rel='icon' sizes='16x16 32x32 64x64' href='assets/favicon/favicon.ico'>
<link rel='icon' type='image/png' sizes='196x196' href='assets/favicon/favicon-192.png'>
<link rel='icon' type='image/png' sizes='160x160' href='assets/favicon/favicon-160.png'>
<link rel='icon' type='image/png' sizes='96x96' href='assets/favicon/favicon-96.png'>
<link rel='icon' type='image/png' sizes='64x64' href='assets/favicon/favicon-64.png'>
<link rel='icon' type='image/png' sizes='32x32' href='assets/favicon/favicon-32.png'>
<link rel='icon' type='image/png' sizes='16x16' href='assets/favicon/favicon-16.png'>
<link rel='apple-touch-icon' href='assets/favicon/favicon-57.png'>
<link rel='apple-touch-icon' sizes='114x114' href='assets/favicon/favicon-114.png'>
<link rel='apple-touch-icon' sizes='72x72' href='assets/favicon/favicon-72.png'>
<link rel='apple-touch-icon' sizes='144x144' href='assets/favicon/favicon-144.png'>
<link rel='apple-touch-icon' sizes='60x60' href='assets/favicon/favicon-60.png'>
<link rel='apple-touch-icon' sizes='120x120' href='assets/favicon/favicon-120.png'>
<link rel='apple-touch-icon' sizes='76x76' href='assets/favicon/favicon-76.png'>
<link rel='apple-touch-icon' sizes='152x152' href='assets/favicon/favicon-152.png'>
<link rel='apple-touch-icon' sizes='180x180' href='assets/favicon/favicon-180.png'>
<meta name='msapplication-TileColor' content='#FFFFFF'>
<meta name='msapplication-TileImage' content='assets/favicon/favicon-144.png'>
<meta name='msapplication-config' content='assets/favicon/browserconfig.xml'>
<title>Home</title>
</head>
@ -46,13 +46,13 @@
</div>
</div>
<div id="centeredBoxOverlay"></div>
<div id='centeredBoxOverlay'></div>
<div class='centeredBar' id='centeredBox'>
<div id='profileImageContainer'>
<div id='profileImage'></div>
</div>
<div id='searchBoxContainer'>
<input type="text" id="searchBox" autocomplete="off" autofocus="off" placeholder=" Search with HiddenWiki"/>
<input type='text' id='searchBox' autocomplete='off' autofocus='off' placeholder=' Search with HiddenWiki'/>
<div id='suggestionsContainer'>
<ul id='suggestions'>
<li id='phrase'>
@ -74,143 +74,137 @@
</div>
<div class="dashboard" id="rightDashboard">
<div class="rightDashboardBody">
<div id="greeterMessage"></div>
<div id="dateMessage"></div>
<div class='dashboard' id='rightDashboard'>
<div class='rightDashboardBody'>
<div id='greeterMessage'></div>
<div id='dateMessage'></div>
<!-- Weather Settings -->
<div class="weatherSettings">
<div id="weatherSettingsPadding">
<form class='weatherSettings'>
<div id='weatherSettingsPadding'>
<div class="header" id="weatherSettingsHeader">
<div class="headerIcon" id="weatherSettingsHeaderIcon"></div>
<div class="headerLabel" id="weatherSettingsHeaderLabel">Weather Settings</div>
<div class='header' id='weatherSettingsHeader'>
<div class='headerIcon' id='weatherSettingsHeaderIcon'></div>
<label for='apiBox' class='headerLabel' id='weatherSettingsHeaderLabel'>Weather Settings</label>
</div>
<div id="weatherSettingsContainer">
<div class="weatherSettingsGroups">
<div class="weatherSettingsLabels">
API Key
</div>
<input type="text" class="weatherSettingsInputs" id="apiBox" autocomplete="off" placeholder="API KEY"/>
<div id='weatherSettingsContainer'>
<div class='weatherSettingsGroups'>
<label for='apiBox' class='weatherSettingsLabels'>API Key</label>
<input type='text' class='weatherSettingsInputs' id='apiBox' autocomplete='off' placeholder='API KEY'/>
</div>
<div class="weatherSettingsGroups">
<div class="weatherSettingsLabels">
City ID
</div>
<input type="text" class="weatherSettingsInputs" id="cityBox" autocomplete="off" placeholder="City ID"/>
<div class='weatherSettingsGroups'>
<label for='cityBox' class='weatherSettingsLabels'>City ID</label>
<input type='text' class='weatherSettingsInputs' id='cityBox' autocomplete='off' placeholder='City ID'/>
</div>
<div class="weatherSettingsGroups">
<div class="weatherSettingsLabels">
Units
</div>
<select class="weatherSettingsInputs" id="weatherSelectUnits">
<option value="metric">Metric</option>
<option value="imperial">Imperial</option>
<div class='weatherSettingsGroups'>
<label for='weatherSelectUnits' class='weatherSettingsLabels'>Units</label>
<select class='weatherSettingsInputs' id='weatherSelectUnits'>
<option value='metric'>Metric</option>
<option value='imperial'>Imperial</option>
</select>
</div>
<div class="weatherSettingsGroups" id="weatherSettingsButtons">
<div class="weatherSettingsInputs" id="weatherSettingsReset">Clear Credentials</div>
<div class="weatherSettingsInputs" id="weatherSettingsApply">Apply</div>
<div class='weatherSettingsGroups' id='weatherSettingsButtons'>
<button type='button' class='weatherSettingsInputs' id='weatherSettingsReset'>Clear Credentials</button>
<button type='button' class='weatherSettingsInputs' id='weatherSettingsApply'>Apply</button>
</div>
</div>
</div>
</div>
</form>
<!-- Select search engine -->
<div class="searchEngine">
<div id="searchEnginePadding">
<div class="header" id="searchEngineHeader">
<div class="headerIcon" id="searchEngineHeaderIcon"></div>
<div class="headerLabel" id="searchEngineHeaderLabel">Search Engine</div>
<form class='searchEngine'>
<div id='searchEnginePadding'>
<div class='header' id='searchEngineHeader'>
<div class='headerIcon' id='searchEngineHeaderIcon'></div>
<label for='searchEngineSelect' class='headerLabel' id='searchEngineHeaderLabel'>Search Engine</label>
</div>
<div id="searchEngineContainer">
<select id="searchEngineSelect">
<option value="google">Google</option>
<option value="duckduckgo">Duckduckgo</option>
<option value="ecosia">Ecosia</option>
<option value="yahoo">Yahoo</option>
<option value="bing">Bing</option>
<div id='searchEngineContainer'>
<select id='searchEngineSelect'>
<option value='google'>Google</option>
<option value='duckduckgo'>Duckduckgo</option>
<option value='ecosia'>Ecosia</option>
<option value='yahoo'>Yahoo</option>
<option value='bing'>Bing</option>
</select>
<div id="searchEngineAsDefault">Set as default</div>
<button type='button' id='searchEngineAsDefault'>Set as Default</button>
</div>
</div>
</div>
</form>
<!-- Theme engine -->
<div class="themeEngine">
<div id="themeEnginePadding">
<div class="header" id="themeEngineHeader">
<div class="headerIcon" id="themeEngineHeaderIcon"></div>
<div class="headerLabel" id="themeEngineHeaderLabel">Theme Engine</div>
<form class='themeEngine'>
<div id='themeEnginePadding'>
<div class='header' id='themeEngineHeader'>
<div class='headerIcon' id='themeEngineHeaderIcon'></div>
<label for='backgroundSet' class='headerLabel' id='themeEngineHeaderLabel'>Theme Engine</label>
</div>
<div id="themeEngineContainer">
<div class="themeEngineGroups">
<div class="themeEngineLabels">
Background Color and Opacity
</div>
<div class="backgroundColorSetter">
<input type="text" maxlength="7" class="themeEngineInputs" id="backgroundSet" autocomplete="off" placeholder="000000"/>
<input type="text" maxlength="2" class="themeEngineInputs" id="backgroundOpacitySet" autocomplete="off" placeholder="FF"/>
<div id='themeEngineContainer'>
<div class='themeEngineGroups'>
<label for='backgroundSet' class='themeEngineLabels'>Background Color and Opacity</label>
<div class='backgroundColorSetter'>
<input type='text' maxlength='7' class='themeEngineInputs' id='backgroundSet' autocomplete='off' placeholder='000000'/>
<input type='text' maxlength='2' class='themeEngineInputs' id='backgroundOpacitySet' autocomplete='off' placeholder='FF'/>
</div>
</div>
<div class="themeEngineGroups">
<div class="themeEngineLabels">
Foreground Color and Opacity
</div>
<div class="foregroundColorSetter">
<input type="text" maxlength="7" class="themeEngineInputs" id="foregroundSet" autocomplete="off" placeholder="000000"/>
<input type="text" maxlength="2" class="themeEngineInputs" id="foregroundOpacitySet" autocomplete="off" placeholder="FF"/>
<div class='themeEngineGroups'>
<label for='foregroundSet' class='themeEngineLabels'>Foreground Color and Opacity</label>
<div class='foregroundColorSetter'>
<input type='text' maxlength='7' class='themeEngineInputs' id='foregroundSet' autocomplete='off' placeholder='000000'/>
<input type='text' maxlength='2' class='themeEngineInputs' id='foregroundOpacitySet' autocomplete='off' placeholder='FF'/>
</div>
</div>
<div class="themeEngineGroups">
<div class="themeEngineLabels">
Blur Strength in Pixels
</div>
<div class="blurSetter">
<input type="text" class="themeEngineInputs" id="blurSet" autocomplete="off" placeholder="10"/>
<div class='themeEngineGroups'>
<label for='blurSet' class='themeEngineLabels'>Blur Strength in Pixels</label>
<div class='blurSetter'>
<input type='text' class='themeEngineInputs' id='blurSet' autocomplete='off' placeholder='10'/>
</div>
</div>
<div id="themeEngineReset">Reset</div>
<div id="themeEngineAsDefault">Apply</div>
<button type='button' id='themeEngineReset'>Reset</button>
<button type='button' id='themeEngineAsDefault'>Apply</button>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="dashboardOverlay" id="dashboardOverlay"></div>
<div class='dashboardOverlay' id='dashboardOverlay'></div>
<!-- Weather screen -->
<div id="weatherScreen">
<div id="weatherScreenContainer">
<div id="weatherTodayIcon"></div>
<div id="weatherTodayLocation">
<div id='weatherScreen'>
<div id='weatherScreenContainer'>
<div id='weatherTodayIcon'></div>
<div id='weatherTodayLocation'>
Earth, Milky Way
</div>
<div id="weatherTodayDescription">
<div id='weatherTodayDescription'>
dust & clouds, -1000°C
</div>
<div id="weatherHourDataTodayContainer">
<div class="weatherDataHour" id="weatherTodaySunrise">
<div class="hourDataIcon" id="sunriseHourDataIcon"></div>
<div class="hourDataLabel" id="sunriseTodayHour">00:00</div>
<div id='weatherHourDataTodayContainer'>
<div class='weatherDataHour' id='weatherTodaySunrise'>
<div class='hourDataIcon' id='sunriseHourDataIcon'></div>
<div class='hourDataLabel' id='sunriseTodayHour'>00:00</div>
</div>
<div class="weatherDataHour" id="weatherTodaySunset">
<div class="hourDataIcon" id="sunsetHourDataIcon"></div>
<div class="hourDataLabel" id="sunsetTodayHour">00:00</div>
<div class='weatherDataHour' id='weatherTodaySunset'>
<div class='hourDataIcon' id='sunsetHourDataIcon'></div>
<div class='hourDataLabel' id='sunsetTodayHour'>00:00</div>
</div>
<div class="weatherDataHour" id="weatherTodayUpdate">
<div class="hourDataIcon" id="updateHourDataIcon"></div>
<div class="hourDataLabel" id="updateTodayHour">00:00</div>
<div class='weatherDataHour' id='weatherTodayUpdate'>
<div class='hourDataIcon' id='updateHourDataIcon'></div>
<div class='hourDataLabel' id='updateTodayHour'>00:00</div>
</div>
</div>
<div class="weatherForecast" id="forecastContainer">
<div class='weatherForecast' id='forecastContainer'>
<!-- Javascript will generate a list here -->
@ -220,14 +214,14 @@
<!-- Web menu panel -->
<div id="webMenu">
<div id="webMenuContainer">
<div id="webMenuSearchBoxContainer">
<input type="text" id="webMenuSearchBox" autocomplete="off" placeholder=" Type to search">
<div id='webMenu'>
<div id='webMenuContainer'>
<div id='webMenuSearchBoxContainer'>
<input type='text' id='webMenuSearchBox' autocomplete='off' placeholder=' Type to search'>
</div>
<div id="webMenuListContainer">
<div id='webMenuListContainer'>
<ul id="webMenuList">
<ul id='webMenuList'>
<!-- Javascript will generate a list here -->
</ul>
@ -236,24 +230,24 @@
</div>
<script src="js/body-background-set.js"></script>
<script src="js/clock.js"></script>
<script src="js/sites-list.js"></script>
<script src="js/dock-buttons.js"></script>
<script src="js/keybindings.js"></script>
<script src="js/auto-suggest.js"></script>
<script src="js/animate-profile-image.js"></script>
<script src="js/show-search-box.js"></script>
<script src="js/animate-dashboard.js"></script>
<script src="js/greeter-date-message.js"></script>
<script src="js/search-engine-settings.js"></script>
<script src="js/search-query-send.js"></script>
<script src="js/theme-engine.js"></script>
<script src="js/weather-screen.js"></script>
<script src="js/weather-settings.js"></script>
<script src="js/web-menu.js"></script>
<script src="js/centered-box.js"></script>
<script src="js/mobile-swipe-event.js"></script>
<script src="js/mobile-swipe-callback.js"></script>
<script src='js/body-background-set.js'></script>
<script src='js/clock.js'></script>
<script src='js/sites-list.js'></script>
<script src='js/dock-buttons.js'></script>
<script src='js/keybindings.js'></script>
<script src='js/auto-suggest.js'></script>
<script src='js/animate-profile-image.js'></script>
<script src='js/show-search-box.js'></script>
<script src='js/animate-dashboard.js'></script>
<script src='js/greeter-date-message.js'></script>
<script src='js/search-engine-settings.js'></script>
<script src='js/search-query-send.js'></script>
<script src='js/theme-engine.js'></script>
<script src='js/weather-screen.js'></script>
<script src='js/weather-settings.js'></script>
<script src='js/web-menu.js'></script>
<script src='js/centered-box.js'></script>
<script src='js/mobile-swipe-event.js'></script>
<script src='js/mobile-swipe-callback.js'></script>
</body>
</html>

View File

@ -56,7 +56,7 @@ selectEngine.onchange = () => {
selectTheEngine()
}
searchEngineAsDefault.onmouseup = () => {
searchEngineAsDefault.onclick = () => {
var selectCurrentIndex = selectEngine.options[selectEngine.selectedIndex]
alert('Success! ' + selectCurrentIndex.text +
' is now your default search engine!');

View File

@ -182,13 +182,13 @@ const updateOnStartUp = () => {
}
// Apply button event handler
applyTheme.onmouseup = () => {
applyTheme.onclick = () => {
updateCSSVariables();
alert('Success!');
}
// Reset button event handler
resetTheme.onmouseup = () => {
resetTheme.onclick = () => {
localStorage.removeItem('baseBG');
localStorage.removeItem('baseColor');
localStorage.removeItem('blurStrength');

View File

@ -57,7 +57,7 @@ const updateWeatherSettings = () => {
}
// Reset button was pressed
weatherSettingsReset.onmouseup = () => {
weatherSettingsReset.onclick = () => {
// Reset keys
resetWeatherSettings();
updateWeatherSettings();
@ -65,7 +65,7 @@ weatherSettingsReset.onmouseup = () => {
}
// Apply settings
weatherSettingsApply.onmouseup = () => {
weatherSettingsApply.onclick = () => {
applyWeatherSettings(
apiBox.value || apiBox.placeholder,
cityBox.value || cityBox.placeholder,