Food Seasons

Size
6,522 Kb
Views
30,360

How do I make an food seasons?

What is a food seasons? How do you make a food seasons? This script and codes were developed by Rafael Abensur on 12 September 2022, Monday.

Food Seasons Previews

Food Seasons - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Food Seasons</title> <meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/20221/api.ai.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="search"> <div class="search__left"> <input class="search__input search__input--disable" id="search" placeholder="nome ou tipo"/> <div class="suggestions" id="suggestions"> <div class="suggestions__inner" id="results"></div> </div> </div> <div class="search__right"> <div class="table" id="table"> <div class="table__months" data-month="Janeiro"></div> <div class="table__months" data-month="Fevereiro"></div> <div class="table__months" data-month="Março"></div> <div class="table__months" data-month="Abril"></div> <div class="table__months" data-month="Maio"></div> <div class="table__months" data-month="Junho"></div> <div class="table__months" data-month="Julho"></div> <div class="table__months" data-month="Agosto"></div> <div class="table__months" data-month="Setembro"></div> <div class="table__months" data-month="Outubro"></div> <div class="table__months" data-month="Novembro"></div> <div class="table__months" data-month="Dezembro"></div> </div> </div>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/fuse.js/2.5.0/fuse.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/annyang/2.5.0/annyang.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Food Seasons - Script Codes CSS Codes

html { height: 100%; box-sizing: border-box; background: #EFDEDE; background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/20221/pink_rice.png") repeat; font-size: 15px; font-weight: 300; color: #2c3e50; font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; text-rendering: optimizeLegibility;
}
html *, html *::after, html *::before { box-sizing: inherit;
}
body { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-flow: row wrap; flex-flow: row wrap; height: 100%;
}
.search { background: #fff; width: 100%; max-width: 560px; height: 300px; margin: auto; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); overflow: hidden; display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-flow: row wrap; flex-flow: row wrap; padding: 20px 10px;
}
.search__left { -webkit-box-flex: 0; -ms-flex: 0 180px; flex: 0 180px; width: 180px; margin: 10px; overflow: scroll;
}
.search__right { -webkit-box-flex: 1; -ms-flex: 1; flex: 1; padding: 10px; border-left: 1px solid #EFDEDE;
}
.search__input { border: 0px; border-bottom: 1px solid #EFDEDE; font-size: 15px; font-weight: 300; text-indent: 5px; font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; text-rendering: optimizeLegibility; line-height: 2; -webkit-transition: border 0.8s ease, opacity 0.5s ease; transition: border 0.8s ease, opacity 0.5s ease;
}
.search__input--disable { opacity: 0.5; pointer-events: none;
}
.search__input:focus, .search__input:active { outline: none; border-bottom: 1px solid #c58888;
}
.search__input::-webkit-input-placeholder { color: #999;
}
.suggestions { height: 0; opacity: 0;
}
.suggestions--visible { opacity: 1; height: auto;
}
.suggestions__inner div { padding: 10px 0; border-bottom: 1px solid #EFDEDE; color: #777; text-indent: 5px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; cursor: pointer; -webkit-transition: background 0.5s, color 0.1s; transition: background 0.5s, color 0.1s;
}
.suggestions__inner div:hover { background: rgba(204, 204, 204, 0.2); font-weight: bold;
}
.suggestions__inner div:active { color: #000;
}
.table { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-flow: row wrap; flex-flow: row wrap; width: 100%; height: 100%; opacity: 0; -webkit-transition: opacity 0.3s; transition: opacity 0.3s;
}
.table--visible { opacity: 1;
}
.table__months { position: relative; -webkit-box-flex: 0; -ms-flex: 0 25%; flex: 0 25%; width: 100% / 4; border: 1px solid white; -webkit-transition: background 0.3s; transition: background 0.3s; font-weight: bold;
}
.table__months::before { content: attr(data-month); position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); font-size: 13px;
}
.table__months--current { border: 1px solid #2c3e50; box-shadow: 0 4px 2px -2px #2c3e50;
}
.table__months--Forte { background: #2ecc71;
}
.table__months--Fraco { background: #e74c3c;
}
.table__months--Regular { background: #f39c12;
}

Food Seasons - Script Codes JS Codes

'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// console.clear();
var Amadurou = function () { function Amadurou() { _classCallCheck(this, Amadurou); this.url = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/20221/amadurou.json"; this.input = document.querySelector('#search'); this.suggestions = document.querySelector('#suggestions'); this.results = document.querySelector('#results'); this.table = document.querySelector('#table'); this.fuseOptions = { threshold: 0.5, location: 0, distance: 100, maxPatternLength: 32, keys: ['nome', 'tipo'] }; this.data; } Amadurou.prototype.setCurrentMonth = function setCurrentMonth() { var today = new Date(), month = today.getMonth(); this.table.querySelector('.table__months:nth-child(' + (month + 1) + ')').classList.add('table__months--current'); }; Amadurou.prototype.init = function init() { var _this = this; this.setCurrentMonth(); this.req = new XMLHttpRequest(); this.req.open('GET', this.url, true); this.req.onload = function () { _this.onLoad(); }; this.req.onerror = function () { _this.onError(); }; this.req.send(); }; Amadurou.prototype.onError = function onError() { console.log('error...'); }; Amadurou.prototype.onLoad = function onLoad() { if (this.req.status >= 200 && this.req.status < 400) { this.input.classList.remove('search__input--disable'); this.data = JSON.parse(this.req.responseText); this.fuse(); } else { console.log('no response...'); } }; Amadurou.prototype.fuse = function fuse() { var _this2 = this; var fuseSearch = new Fuse(this.data.alimentos, this.fuseOptions); this.input.addEventListener('input', function (event) { var query = event.target.value; var result = fuseSearch.search(query); if (result.length > 0) { _this2.suggestions.classList.add('suggestions--visible'); _this2.showSuggestions(result); } else { _this2.results.innerHTML = ''; _this2.suggestions.classList.remove('suggestions--visible'); _this2.table.classList.remove('table--visible'); } }); }; Amadurou.prototype.showSuggestions = function showSuggestions(results) { var _this3 = this; this.results.innerHTML = ''; results.map(function (obj) { var item = document.createElement('div'); item.innerHTML = obj.nome; item.addEventListener('click', function () { _this3.updateTable(obj); }); _this3.results.appendChild(item); }); }; Amadurou.prototype.updateTable = function updateTable(obj) { this.table.classList.add('table--visible'); var months = this.table.querySelectorAll('.table__months'); for (var i = 0; i < months.length; i++) { months[i].classList.remove('table__months--Fraco', 'table__months--Forte', 'table__months--Regular'); } for (var key in obj) { var el = this.table.querySelector('.table__months[data-month="' + key + '"]'); if (el) { el.classList.add('table__months--' + obj[key]); } } }; return Amadurou;
}();
var amadurou = new Amadurou();
amadurou.init();
Food Seasons - Script Codes
Food Seasons - Script Codes
Home Page Home
Developer Rafael Abensur
Username abensur
Uploaded September 12, 2022
Rating 3
Size 6,522 Kb
Views 30,360
Do you need developer help for Food Seasons?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Rafael Abensur (abensur) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!