123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <html>
- <head>
- <title>Better Than Very</title>
- <link rel="icon" type="image/png" href="betterthanvery_icon.png" />
- <link rel="stylesheet" media="all" type="text/css" href="style.css" />
- <meta property="og:title" content="Better Than Very" />
- <meta property="og:description" content="Ever find yourself stuck trying to describe something and 'very' isn't cutting it? This site can suggest better words to use!" />
- <meta name="description" content="Ever find yourself stuck trying to describe something and 'very' isn't cutting it? This site can suggest better words to use!" />
- <meta property="og:image" content="betterthanvery_logo.png" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- </head>
- <body>
- <div id="wrap">
- <div id="main">
- <div id="header">
- <img src="betterthanvery_logo.png" />
- <h2>Using <em>very</em> as an adjective is the mark of a limited vocabulary. Instead, search the word you're looking for to get a replacement.</h2>
- </div>
- <form id="verysuggest" method="post" action="suggest.php">
- Very <input type="text" id="word" placeholder="happy" />
- <input id="getvocab" type="submit" value="Suggest" />
- </form>
- <div id="suggestion"></div>
- </div>
- </div>
- <div id="footer">Is your word missing? <a href="https://github.com/EyeOfMidas/betterthanvery/pulls">Make a request</a> or <a href="mailto:eyeofmidas+betterthanvery@gmail.com">send an email</a></div>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
- <script type="text/javascript">
- var dictionary = {};
- loadDictionary = async () => {
- let response = await fetch('./dictionary.dat');
- if (response.ok) {
- let text = await response.text();
- let wordSuggestions = text.split('\n');
- wordSuggestions.forEach(line => {
- if (!line) {
- return;
- }
- let splitSuggestion = line.split(':');
- let key = splitSuggestion[0];
- let value = splitSuggestion[1].split(',');
- dictionary[key] = value;
- });
- }
- };
- document.addEventListener("DOMContentLoaded", () => {
- loadDictionary();
- });
- $("#getvocab").click(function () {
- let wordRequested = $('#word').val();
- let cleanWord = wordRequested.toLowerCase().trim();
- if (!cleanWord) {
- cleanWord = 'happy';
- }
- let suggestions = dictionary[cleanWord];
- if (!suggestions) {
- message = "The word <em>" + cleanWord + "</em> " + "could not be found";
- } else {
- message = "Instead of <em>very " + cleanWord + "</em>, try <strong>" + suggestions[0] + "</strong>. ";
- message += '<a href="javascript:;" id="togglesuggest">Some other options?</a><div id="alts"><ul>';
- for (var i = 1; i < suggestions.length; i++) {
- message += "<li>" + suggestions[i] + "</li>";
- }
- message += '</ul></div>';
- }
- $("#suggestion").html(message);
- $("#togglesuggest").click(function () {
- $("#alts").toggle();
- return false;
- });
- return false;
- });
- </script>
- <script>
- (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
- ga('create', 'UA-50800317-3', 'auto');
- ga('send', 'pageview');
- </script>
- </body>
- <!-- Deploy test 1 -->
- </html>
|