1 2var homepageTitle = document.title; 3var popularSearches = ["2","3","4","5","6","7","8","10","12","25","50","100","125","150","500","10000","the smell of rain","the day after tomorrow","the same","the devil","theatre","theory of fine arts","the ten commandments","the best","the week","the same time","the year","the act of giving birth","the art of public speaking","the and symbol","the act of ignoring","the ability to work well with others","the ability to learn","the act of being genuine","the act of writing and publishing","the act of mimicking","the act of giving","the day","the wise","the same but different","the hesitant missionary","the highest point","the right thing to do","the church","the beginning","the best example","the beginning of something","the best thing ever","the big picture","the beginning of the end","the best at something","the best option","the bottom of the ocean","the letter b","the cause of something","the calm before the storm","the chosen one","the calorie conscious","the color blue","the cutting of teeth","the chain of an anchor","the end of the world","the end","the end of something","the end of a letter","the end of a war","the end of time","the exact same","the end of the world in the bible","the entrance of a house","the experience","the letter e","the fear of long words","the first","the first time","the first of its kind","the future","the feeling of falling in love","the feeling of being lost","the feeling of not belonging","the fact that","the first time something happens","the greater good","the greatest","the gap between rich and poor","the greatest thing ever","on the go","the ghetto","the root graph","the great","the day god","the highest level","the holocaust","the human condition","the human race","the haters","the help","with the help of","hard","heal","in the beginning","in the open","skyward","the day joel osteen","the day jokes","the joker","the journey","the root junct","the judge","the job","joy","the key to","the king","the killer","know it all","knowledge","kind","kingdom","the look of something","the lowest point","the last straw","the love of music","the love of nature","the loss of a loved one","the love of words","the love of rain","the mind","the most","the mac","the meaning of words","the most important","the most beautiful","the month","the meaning of life","the most beautiful girl","the masses","the night","the need to travel","the norm","the nations","the night before","the next big thing","the nations outreach centre","the need to prove yourself","the nations ministries","the nature of","the letter n","the only one","the opposite","the one","the one after","the other way around","the opposite of loneliness","the one you love","the other side","the one after next","the other woman","the perfect example","the past","the person being interviewed","the perfect world","the passing of time","the person before you","the place to be","the person in charge","the phobia of long words","the prefix anti","the question is","the quote","the quality of life","quick learner","quick","the great depression","the right to vote","the reason why","the right time","the result of a situation","the result of an action","the rest of","the rich","the right way","the right thing","the same on both sides","the smell of old books","the sound of rain","the same throughout","the start of something","the smell after it rains","the today","the time being","the traditional home of an inuit","the title character","the top of something","the top of your foot","the unknown","the urge to kiss someone","the utmost","the upper class","the use of big words","the ups and downs of life","the ultimate example","the urge to jump from high places","the ultimate","the very best","the voice in your head","the day vocabulary","the victim","the voice","the view","world vision","vocabulary","the way someone speaks","the world","the world christian fellowship","the world ministries","the way someone acts","the way someone talks","the world logo","the world church","the youth","the year 2016","the year 2015","the year ideas","the year 2014","the year 2013","the year 2012","zoo","zombie","zen","zip","zap","the milkmaid artist","the act of kidnapping","old as the hills","lives under the sea","to move in a spiral pattern","to not care","to get rid of","to take advantage of","to do away with","to think over","to put an end to","to show off","to mix together","to make into law","to avoid","to add","to avoid something","to agree","to accept","to add value","to assume","to analyze","to ask questions","to aim high","to explore","to promise that rhymes with sledge","to reject an idea","to see in your mind","to wonder","to give up","to take back","to take away","to be","to build","to bring together","to bring forth","to be on time","to bring about","to bounce back","to bring out","to be everywhere","to build upon","to change","to come after","to convert into vapor","to convert into vapour","to come before","to cause","to come together","to carry out","to continue","to create","to change the subject","to do","to deal with","to draw out","to draw attention to","to do the right thing","to draw in","to destroy","to drain away from soil","to delay","to explain","to eat","to explain further","to encourage","to explain in detail","to exaggerate","to eat greedily","to evoke emotion","to expose","to enter","to follow","to figure out","to find","to fit in","to find yourself","to follow through","to follow a regular system","to force someone to do something","to feel nothing","to fill up","to go in search of","to give","to grow light as the sun rises","to go against","to go back and forth","to go along with","to give off","to give back","to have","to hold back","to hide","to help others","to have integrity","to hide something","to hold a grudge","to hand out","to have power over","to ignore","to influence","to inspire","to impress","to imply","to include","to inform","to improve","to influence badly","to be in love","to join","to
3join together","to judge","to jump","to join the army","to justify","to kill","to keep going","to kill your brother","to keep away","to keep alive","to keep from happening","to keep secret","to kill your sister","to keep to oneself","to know everything","to leave","to leave out","to look down on","to love","to look back on","to let go","to look up to","to live forever","to look forward to","to lead","to make better","to make worse","to make up for","to make clear","to make fun of","to make less important","to make official","to never give up","to not give up","to not understand","to not know","to name","to not take seriously","to not include","to not pay attention","to not believe","to overcome","to overcome adversity","to obtain","to obscure or darken","to overthrow the government","to order","to go on and on","to put someone down","to prove wrong","to push forward","to push away","to put out a fire","to predict the future","to put into action","to put into words","to pay back","to question","to question authority","to quit","to question everything","to quench","to quiet","to qualify","to quicken","to remove","to repeat","to return","to remove debris from raw wool","to receive","to rise above","to remember","to return home","to right a wrong","to repeat yourself","to start","to stand out","to stick out","to show","to stop","to speak well","to spread out","to separate","to the point","to take over","to talk on and on","to teach","to think deeply","to take in","to use","to understand","to urinate","to undermine","to use again","to use up","to uplift","to use someone","to use big words","to use for the first time","to verify","to view","to volunteer","to value","to vomit","right to vote","to want very much","open to view","convert to vapor","to work together","to waste time","to work hard","to want more","to warn","to walk slowly","to weaken","to wander aimlessly","to worsen","to watch over","to yield","to young","to yell","to keeping to yourself","same to you","to change your mind","kept to yourself","to love yourself","zero","zeal","zest","zealous","zumba","zany","zeitgeist","1/4","150 years","100 years","map 1","to move on","together forever","to take advantage of a situation","meant to be","20 years","2nd grade","2 things","2 faced","25 years","2 sided","24 hours","2 colors","3 times a year","3rd grade","3 times","3d image","3rd","3 things","speak 3 languages","activities 3rd grade","total","to write quickly","to make a mistake","4th grade","4 times a year","4 times","activities 4th grade","every 4 years","every 4 months","to grow light","50 years","5 times","500 years","5 years","5th grade","every 5 years","for 5th class","to ponder","to tally up","to express","to cook in hot water","to be buoyant","to examine","to openly resist authority","every 6 months","to frolic","to deliver repeated blows","to stay","to be done asap","to fall over","to alter without authority","together as one","to lag behind","to settle down","to correct","together","tortilla chips","to perform surgery","to sell illegally","flat top","to starved","to lose an object","to divide","to push aside","too much","too many","to grow","to turn into vapor","take to court","something goes wrong","really like someone","feel bad for someone","really like something","don't care","things come together","something bad happens","things go wrong","there are no words","something is missing","a cow gives birth","everyone agrees","everyone is against you","get a chance","it comes to","a sentence","a will","dear when writing a letter","something is not as it seems","miss someone","someone doesn't care","someone talks down to you","realize something","really want something","want something","beautiful","bad","big","beginning","best","battle","be of use","break","building","choice","cheat","check","central","class","church","creator","compound","day to day","discover","design","drop","describing","draw in","definition","draw the line","the day bible","everything goes wrong","everything is perfect","encouragement","enduring","express","excel","another example","fast","family","fire","friends","first","from the beginning","free","find","form","good","group","girl","god","guess","guide","go on","graph","gangster","help","hunt","hippo","warm heart","a word hard to spell","a another word for happy","a another word for handsome","something is on your mind","in love","in order","in the end","instead of","j","just","joining in","jewels","jumble","jokes","justify","jazz","journeys","k","kitty crossword","kindle","not knowing","lack of knowledge","love","life","long","last","living","learn","landscape","link","list","motivation","magic","music","more than","meaning","mouth","master","mirror image","make","map","not caring","not giving up","nice","new","nerd","numbers","not responding","network","opposite","open","origin","order","on fire","one by one","of choice","out","online","plants start to grow","power","problem solver","problem","puzzle","picture","project","quote","quest","quicker","quite the opposite","random","right","romantic","ruler","recognition","run","rage","refer to","someone lets you down","something doesn't make sense","smart","today","today from god","unique","use","unfamiliar","up to","usage","un","undo","unlock","update","vomit","verb","visual","voice","version","walk","wisdom","world","wall","wrap","help with","want something really bad","can't do something","want to know something","only care about yourself","want to do something","look up to someone","unrealised talent","at the same time","connected to the internet","do away with","prediction made about the future","missing someone","happy","not good enough","amazing","get rid of","athletic","angry","all the time","a long wandering journey","as well as","a prediction made about the future","a lot","a short poem","bashful","become dim","balance","bring together","being on time","black and white","bill of fare","by common consent","court cases","co-conspirator","change","caring","chaos","capture","crush","coming together","courage","do away with put an end to","different","deadly","dead heat","disqualified","disgusting","doing the right thing","doesn't care","donor","letter d","ensnare","easy","eccentric","emotional shock","enigma","easy to understand","egg shaped","everything","everyone agrees","entice","feeling sorry for someone","falling apart","food and drink","first rate","fit","feeling left out","feeling bad","friendship","finding yourself","fake","the letter f","great","good and bad","giving up","guiding light","great sadness","going against","getting things done","giving in","getting your point across","harmony","highest in temperature","home","hardwood floors","highest point","hiding something","hate","holding back","hard working","indicate assent","in a perfect world","ill will","in the middle of","intense joy","in your face","important","intrinsic quality","in the past","infallible evidence","judging someone","judging a book by its cover","jumping the gun","jack of all trades","jealous","just like","just in case","join together","just friends","keep going","kiss","knowing what you want","knowing","keeping to oneself","keep up","keep trying","lunar illumination","liquids","looking forward to","let go","long wandering journey","long lasting","looked down upon","large amount","life changing","made up","monetarily punished","making less hard","move in a spiral pattern","make sure","modest","make into law","molting","most pleasant","notwithstanding","not understanding","never giving up","not belonging","not needed","not important","notwithstanding even though","on time","always on time","on the other hand","out of nowhere","one after the other","out of control","out of this world","over the top","observe closely","obscure","put in place","perfect","prediction","point the finger at","protection","preemptive safety measure","put together","plainly evident","questioning","quality","quiet","quick thinking","quickly","questioning everything","quick to act","quick response","rejected","removing husks","responds to stimuli","ready to eat","refuse","recovery","ruffians","robbery","rue","rejected or turned down","safety protection","sad","stagnation","something difficult","slope","standing out","sternly","selected","sham medicine","shy","thrifty","think over","thinking outside the box","toxic","take over","turn down the offer","taken over","tribal emblem","unsubstantiated information","up and down","unfair","using someone","up to date","up yourself","unfriendly","ugly","very sad","vague perception","voice over","very important","very good","very small","very bad","very happy","very different","variety","working together","wake from sleep","writing material","well known","wanting more","worried","walk to and fro","work well together","walking slowly","way of life","yes","you","you today","young","yes and no","you today devotional","yummy","yield positive results","yet","zoom out","zone"]; 4 5function updateStaticView(query) { 6 7 if(query === "") { 8 9 document.title = homepageTitle; 10 qs('#title-wrapper').innerHTML = "<h1 class='title'>Reverse Dictionary</h1>"; 11 12 } else { 13 14 qs("#query").value = query; 15 qs('#title-wrapper').innerHTML = "<h2 class='title'>Reverse Dictionary</h2>"; 16 qs("#clear-search-button").style.display = "block"; 17 18 } 19 20} 21 22 23// Prepare item template: 24var templateItem = qs("#result-item-template").cloneNode(); 25templateItem.id = ""; 26templateItem.style.cssText = ""; 27 28 29function updateResultsView(query, terms) { 30 31 if(terms.error || terms.length === 0) { 32 33 console.error("Problem with request:", terms.error); 34 if(terms.error === "no_results" || terms.length === 0) { 35 qs("#message").innerHTML = "Sorry, no results for that query :( <br/><img style='margin-top:2rem; max-height:200px; opacity:0.4;' src='/img/find.png' />"; 36 } else { 37 qs("#message").innerHTML = "Sorry! Something's wrong with the server :( Please try again soon."; 38 } 39 qs("#message").style.display = "block"; 40 41 qs(".term-description-area").style.display = "none"; 42 43 } else { 44 45 updateCustomDescription(query, terms); 46 47 var pageTitle = queryToDynamicPageTitle(query, terms); 48 document.title = pageTitle; 49 50 qs(".term-description-area").style.display = ""; 51 52 var cleanedQuery = ""; 53 cleanedQuery = query.replace("\"","").replace(/ -[^ ]+/g,""); 54 var placeholders = document.querySelectorAll("._word-placeholder_"); 55 for(var i = 0; i < placeholders.length; i++) { 56 placeholders[i].innerText = cleanedQuery; 57 } 58 59 // get max score for saturation normalisation: 60 var maxScore = 0; 61 var minScore = Infinity;
62 terms.forEach(function(t) { 63 if(t.score > maxScore) maxScore = t.score; 64 if(t.score < minScore) minScore = t.score; 65 }); 66 var scoreRange = maxScore - minScore; 67 68 var docFragment = document.createDocumentFragment(); 69 70 terms.forEach(function(t) { 71 72 var item = templateItem.cloneNode(); 73 item.innerHTML = escapeHTML(t.word); 74 item.href = "/wordsfor/"+encodeURIComponent(t.word); 75 var scorePercent = scoreRange ? Math.round(((t.score-minScore)/scoreRange)*100) : 0; 76 var isDarkMode = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches; 77 var saturation = Math.max(0, scorePercent-10); /* 100 -> 0 */ 78 var lightness = isDarkMode ? 11 + (100-scorePercent)*(7/100) : 69 + (100-scorePercent)*(21/100); /* light: 69 -> 90, dark: 11 -> 18 */ 79 item.style.backgroundColor = "hsl(195, "+saturation+"%, "+lightness+"%)"; 80 if(isDarkMode) item.style.color = "#f2f7f9"; 81 82 //if(!t.definition) t.definition = t.from + " --- " + t.score; 83 84 item.addEventListener("click", function(e) { 85 86 console.log(t.score.toFixed(4), t.from); 87 88 destroyAllPopups(); 89 90 var dropInstance = new Drop({ 91 target: e.target, 92 content: "<div style='text-align:center'><img src='/img/popup_loading.gif' /><br/>Loading definition...</div>",//createDefinitionPopup(t.word, t.definition, t.score), 93 openOn: 'always', 94 classes: "drop-theme-arrows-bounce-dark", 95 remove: true, //causes it to be removed from DOM when it is closed, then added agaain when it is opened 96 tetherOptions: { 97 attachment: 'top center', 98 targetAttachment: 'bottom center', 99 constraints: [ 100 { 101 to: 'scrollParent', 102 pin:true 103 } 104 ] 105 }, 106 }); 107 dropInstance.open(); 108 popupInstances.push(dropInstance); 109 110 e.preventDefault(); 111 e.stopPropagation(); 112 113 loadDefinition(t.word, function(error, definition) { 114 if(!dropInstance.content) { return; } //may have been destroyed, which is fine 115 116 var html = ""; 117 118 html += "<div class='definition-popup'>"; 119 120 if(error) { html += "<i>"+error+"</i>"; } 121 122 if(definition) { html += escapeHTML(definition).replace(/\n/g,"<br/>"); } 123 else { html += "<i>Sorry, no definition was found for that term. <a style='color:#45a7ff; text-decoration:underline;' target='_blank' href='https://www.google.com/search?q=define+"+t.word.split(" ").join("+")+"'>Try an internet search.</a></i>"; } 124 125 html += '<div style="text-align:center; margin-top:1rem;"><a class="button definition-popup-button" target="_blank" href="http://relatedwords.org/relatedto/'+t.word+'">Related Words</a><a class="button definition-popup-button-close" href="#">Close</a></div>'; 126 127 dropInstance.content.innerHTML = html; 128 129 dropInstance.position(); 130 131 document.querySelector(".definition-popup-button-close").addEventListener("click", function(e) { 132 destroyAllPopups(); 133 e.preventDefault(); 134 }); 135 136 }); 137 138 }); 139 140 docFragment.appendChild(item); 141 142 // for SEO: 143 var space = document.createTextNode(" "); 144 docFragment.appendChild(space); 145 146 }); 147 148 qs("#results-area .words").appendChild(docFragment); 149 150 } 151 152 function loadDefinition(term, callback) { 153 var request = new XMLHttpRequest(); 154 request.open('GET', '/api/define?term='+encodeURIComponent(term), true); 155 request.onload = function() { 156 if (request.status >= 200 && request.status < 400) { 157 // Successfully retrieved response from DB 158 callback(null, request.responseText); //error = null 159 return; 160 161 } else { 162 console.error("Reached the serever but something went wrong with the query for word definition."); 163 callback("Sorry, there was a server error while trying to get the definition.", null); 164 return; 165 } 166 }; 167 request.onerror = function() { 168 console.error("Connection error while trying to get word definition"); 169 callback("Sorry, there was a connection error while trying to get the definition.", null); 170 return; 171 }; 172 request.send(); 173 } 174 175 qs("#results-area .words").style.height = "auto"; 176 // ScrollToPlugin.scrollVerticalToElement('.search-area', 20); 177 qs('#query').focus(); 178 179 qs("#word-loader-gif").style.display = "none"; 180 181 182 183} 184 185 186function updateCustomDescription(query, terms) { 187 if(terms.length < 5) { 188 qs("._top-5-placeholder_").innerText = " It appears that there aren't many of them. Maybe check your spelling, or try adjusting your search query a bit?"; 189 return; 190 } 191 var str = " According to the algorithm that drives this word similarity engine, the top 5 related words for \""+query+"\" are: "; 192 str += terms[0].word+", "; 193 str += terms[1].word+", "; 194 str += terms[2].word+", "; 195 str += terms[3].word+", and "; 196 str += terms[4].word+". There are "+(terms.length-5)+" other words that are related to or similar to "+query+" listed above."; 197 qs("._top-5-placeholder_").innerText = str; 198} 199 200function queryToDynamicPageTitle(query, terms) { 201 202 var num = terms.length; 203 if(num > 100) { num = 100; } 204 var plus = ""; 205 if(num === 100) { plus = "+"; } 206 207 return num+plus+" words for '"+query+"' - Reverse Dictionary" 208 209 //Related to fire: flame conflagration aflame [+238 more] 210 211 // var prefix = "ords for "; 212 // var middle = ""; 213 // var suffix = " - Reverse Dictionary" 214 // if((prefix+query).length > 40) { 215 // 216 // prefix = "Words r"+prefix; 217 // middle = query; 218 // 219 // } else { 220 // 221 // prefix = "W"+prefix; 222 // suffix = " ["+(terms.length-5)+" more]" + suffix; 223 // middle = "'"+query + "':"; 224 // 225 // var titleLength = (prefix + middle + suffix).length; 226 // var i = 0; 227 // while(titleLength < 60 && terms[i]) { //add more words to the middle while it's below desired length 228 // 229 // if(terms[i].word.split(" ").length === 1) { // <-- i.e., don't add phrases 230 // middle += " "+terms[i].word; 231 // titleLength = (prefix + middle + suffix).length; 232 // } 233 // i++; 234 // 235 // } 236 // 237 // } 238 // 239 // return prefix + middle + suffix; 240 241} 242 243 244function escapeHTML(unsafe) { 245 return unsafe 246 .replace(/&/g, "&") 247 .replace(/</g, "<") 248 .replace(/>/g, ">") 249 .replace(/"/g, """) 250 .replace(/'/g, "'"); 251 } 252 253 254function getQueryFromURIPath(path) { 255 var pathParts = path.split("/"); 256 pathParts.shift(1); 257 258 if(pathParts[0] === "wordsfor") { 259 260 if(pathParts[1] !== undefined) { 261 return window.decodeURIComponent(pathParts[1]) 262 } else { 263 return ""; 264 } 265 266 } else { 267 268 return ""; 269 270 } 271 272}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.