-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtyping.js
More file actions
125 lines (112 loc) · 27.3 KB
/
typing.js
File metadata and controls
125 lines (112 loc) · 27.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
let wordList=[
"the", "of", "and", "to", "a", "in", "is", "you", "are", "for", "that", "or", "it", "as", "be", "on", "your", "with", "can", "have", "this", "an", "by", "not", "but", "at", "from", "I", "they", "more", "will", "if", "some", "there", "what", "about", "which", "when", "one", "their", "all", "also", "how", "many", "do", "has", "most", "people", "other", "time", "so", "was", "we", "these", "may", "like", "use", "into", "than", "up", "out", "who", "them", "make", "because", "such", "through", "get", "work", "even", "different", "its", "no", "our", "new", "film", "just", "only", "see", "used", "good", "water", "been", "need", "should", "very", "any", "history", "often", "way", "well", "art", "know", "were", "then", "my", "first", "would", "money", "each", "over", "world", "information", "map", "find", "where", "much", "take", "two", "want", "important", "family", "those", "example", "while", "he", "look", "government", "before", "help", "between", "go", "own", "however", "business", "us", "great", "his", "being", "another", "health", "same", "study", "why", "few", "game", "might", "think", "free", "too", "had", "hi", "right", "still", "system", "after", "computer", "best", "must", "her", "life", "since", "could", "does", "now", "during", "learn", "around", "usually", "form", "meat", "air", "day", "place", "become", "number", "public", "read", "keep", "part", "start", "year", "every", "field", "large", "once", "available", "down", "give", "fish", "human", "both", "local", "sure", "something", "without", "come", "me", "back", "better", "general", "process", "she", "heat", "thanks", "specific", "enough", "long", "lot", "hand", "popular", "small", "though", "experience", "include", "job", "music", "person", "really", "although", "thank", "book", "early", "reading", "end", "method", "never", "less", "play", "able", "data", "feel", "high", "off", "point", "type", "whether", "food", "understanding", "here", "home", "certain", "economy", "little", "theory", "tonight", "law", "put", "under", "value", "always", "body", "common", "market", "set", "bird", "guide", "provide", "change", "interest", "literature", "sometimes", "problem", "say", "next", "create", "simple", "software", "state", "together", "control", "knowledge", "power", "radio", "ability", "basic", "course", "economics", "hard", "add", "company", "known", "love", "past", "price", "size", "away", "big", "internet", "possible", "television", "three", "understand", "various", "yourself", "card", "difficult", "including", "list", "mind", "particular", "real", "science", "trade", "consider", "either", "library", "likely", "nature", "fact", "line", "product", "care", "group", "idea", "risk", "several", "someone", "temperature", "united", "word", "fat", "force", "key", "light", "simply", "today", "training", "until", "major", "name", "personal", "school", "top", "current", "generally", "historical", "investment", "left", "national", "amount", "level", "order", "practice", "research", "sense", "service", "area", "cut", "hot", "instead", "least", "natural", "physical", "piece", "show", "society", "try", "check", "choose", "develop", "second", "useful", "web", "activity", "boss", "short", "story", "call", "industry", "last", "media", "mental", "move", "pay", "sport", "thing", "actually", "against", "far", "fun", "house", "let", "page", "remember", "term", "test", "within", "along", "answer", "increase", "oven", "quite", "scared", "single", "sound", "again", "community", "definition", "focus", "individual", "matter", "safety", "turn", "everything", "kind", "quality", "soil", "ask", "board", "buy", "development", "guard", "hold", "language", "later", "main", "offer", "oil", "picture", "potential", "professional", "rather", "access", "additional", "almost", "especially", "garden", "international", "lower", "management", "open", "player", "range", "rate", "reason", "travel", "variety", "video", "week", "above", "according", "cook", "determine", "future", "site", "alternative", "demand", "ever", "exercise", "following", "image", "quickly", "special", "working", "case", "cause", "coast", "probably", "security", "true", "whole", "action", "age", "among", "bad", "boat", "country", "dance", "exam", "excuse", "grow", "movie", "organization", "record", "result", "section", "across", "already", "below", "building", "mouse", "allow", "cash", "class", "clear", "dry", "easy", "emotional", "equipment", "live", "nothing", "period", "physics", "plan", "store", "tax", "analysis", "cold", "commercial", "directly", "full", "involved", "itself", "low", "old", "policy", "political", "purchase", "series", "side", "subject", "supply", "therefore", "thought", "basis", "boyfriend", "deal", "direction", "mean", "primary", "space", "strategy", "technology", "worth", "army", "camera", "fall", "freedom", "paper", "rule", "similar", "stock", "weather", "yet", "bring", "chance", "environment", "everyone", "figure", "improve", "man", "model", "necessary", "positive", "produce", "search", "source", "beginning", "child", "earth", "else", "healthy", "instance", "maintain", "month", "present", "program", "spend", "talk", "truth", "upset", "begin", "chicken", "close", "creative", "design", "feature", "financial", "head", "marketing", "material", "medical", "purpose", "question", "rock", "salt", "tell", "themselves", "traditional", "university", "writing", "act", "article", "birth", "car", "cost", "department", "difference", "dog", "drive", "exist", "federal", "goal", "green", "late", "news", "object", "scale", "sun", "support", "tend", "thus", "audience", "enjoy", "entire", "fishing", "fit", "glad", "growth", "income", "marriage", "note", "perform", "profit", "proper", "related", "remove", "rent", "return", "run", "speed", "strong", "style", "throughout", "user", "war", "actual", "appropriate", "bank", "combination", "complex", "content", "craft", "due", "easily", "effective", "eventually", "exactly", "failure", "half", "inside", "meaning", "medicine", "middle", "outside", "philosophy", "regular", "reserve", "standard", "bus", "decide", "exchange", "eye", "fast", "fire", "identify", "independent", "leave", "original", "position", "pressure", "reach", "rest", "serve", "stress", "teacher", "watch", "wide", "advantage", "beautiful", "benefit", "box", "charge", "communication", "complete", "continue", "frame", "issue", "limited", "night", "protect", "require", "significant", "step", "successful", "unless", "active", "break", "chemistry", "cycle", "disease", "disk", "electrical", "energy", "expensive", "face", "interested", "item", "metal", "nation", "negative", "occur", "paint", "pregnant", "review", "road", "role", "room", "safe", "screen", "soup", "stay", "structure", "view", "visit", "visual", "write", "wrong", "account", "advertising", "affect", "ago", "anyone", "approach", "avoid", "ball", "behind", "certainly", "concerned", "cover", "discipline", "location", "medium", "normally", "prepare", "quick", "ready", "report", "rise", "share", "success", "addition", "apartment", "balance", "bit", "black", "bottom", "build", "choice", "education", "gift", "impact", "machine", "math", "moment", "painting", "politics", "shape", "straight", "tool", "walk", "white", "wind", "achieve", "address", "attention", "average", "believe", "beyond", "career", "culture", "decision", "direct", "event", "excellent", "extra", "intelligent", "interesting", "junior", "morning", "pick", "poor", "pot", "pretty", "property", "receive", "seem", "shopping", "sign", "student", "table", "task", "unique", "wood", "anything", "classic", "competition", "condition", "contact", "credit", "currently", "discuss", "distribution", "egg", "entertainment", "final", "happy", "hope", "ice", "lift", "mix", "network", "north", "office", "overall", "population", "president", "private", "realize", "responsible", "separate", "square", "stop", "teach", "unit", "western", "yes", "alone", "attempt", "category", "cigarette", "concern", "contain", "context", "cute", "date", "effect", "extremely", "familiar", "finally", "fly", "follow", "helpful", "introduction", "link", "official", "opportunity", "perfect", "performance", "post", "recent", "refer", "solve", "star", "voice", "willing", "born", "bright", "broad", "capital", "challenge", "comfortable", "constantly", "describe", "despite", "driver", "flat", "flight", "friend", "gain", "him", "length", "magazine", "maybe", "newspaper", "nice", "prefer", "prevent", "properly", "relationship", "rich", "save", "self", "shot", "soon", "specifically", "stand", "teaching", "warm", "wonderful", "young", "ahead", "brush", "cell", "couple", "daily", "dealer", "debate", "discover", "ensure", "exit", "expect", "experienced", "fail", "finding", "front", "function", "heavy", "hello", "highly", "immediately", "impossible", "invest", "lack", "lake", "lead", "listen", "living", "member", "message", "phone", "plant", "plastic", "reduce", "relatively", "scene", "serious", "slowly", "speak", "spot", "summer", "taste", "theme", "towards", "track", "valuable", "whatever", "wing", "worry", "appear", "appearance", "association", "brain", "button", "click", "concept", "correct", "customer", "death", "desire", "discussion", "explain", "explore", "express", "fairly", "fixed", "foot", "gas", "handle", "housing", "huge", "inflation", "influence", "insurance", "involve", "leading", "lose", "meet", "mood", "notice", "primarily", "rain", "rare", "release", "sell", "slow", "technical", "typical", "upon", "wall", "woman", "advice", "afford", "agree", "base", "blood", "clean", "competitive", "completely", "critical", "damage", "distance", "effort", "electronic", "expression", "feeling", "finish", "fresh", "hear", "immediate", "importance", "normal", "opinion", "otherwise", "pair", "payment", "plus", "press", "reality", "remain", "represent", "responsibility", "ride", "savings", "secret", "situation", "skill", "spread", "spring", "staff", "statement", "sugar", "target", "text", "tough", "ultimately", "wait", "wealth", "whenever", "whose", "widely", "animal", "application", "apply", "author", "aware", "brown", "budget", "cheap", "city", "complicated", "county", "deep", "depth", "discount", "display", "educational", "environmental", "estate", "file", "flow", "forget", "foundation", "global", "grandmother", "ground", "heart", "hit", "legal", "lesson", "minute", "near", "objective", "officer", "perspective", "phase", "photo", "recently", "recipe", "recommend", "reference", "register", "relevant", "rely", "secure", "seriously", "shoot", "sky", "stage", "stick", "studio", "thin", "title", "topic", "touch", "trouble", "vary", "accurate", "advanced", "bowl", "bridge", "campaign", "cancel", "capable", "character", "chemical", "club", "collection", "cool", "cry", "dangerous", "depression", "dump", "edge", "evidence", "extreme", "fan", "frequently", "fully", "generate", "imagination", "letter", "lock", "maximum", "mostly", "myself", "naturally", "nearly", "novel", "obtain", "occasionally", "option", "organized", "pack", "park", "passion", "percentage", "plenty", "push", "quarter", "resource", "select", "setting", "skin", "sort", "weight", "accept", "ad", "agency", "baby", "background", "carefully", "carry", "clearly", "college", "communicate", "complain", "conflict", "connection", "criticism", "debt", "depend", "description", "die", "dish", "dramatic", "eat", "efficient", "enter", "essentially", "exact", "factor", "fair", "fill", "fine", "formal", "forward", "fruit", "glass", "happen", "indicate", "joint", "jump", "kick", "master", "memory", "muscle", "opposite", "pass", "patience", "pitch", "possibly", "powerful", "red", "remote", "secretary", "slightly", "solution", "somewhat", "strength", "suggest", "survive", "total", "traffic", "treat", "trip", "vast", "vegetable", "abuse", "administration", "appeal", "appreciate", "aspect", "attitude", "beat", "burn", "chart", "compare", "deposit", "director", "equally", "foreign", "gear", "greatly", "hungry", "ideal", "imagine", "kitchen", "land", "log", "lost", "manage", "mother", "necessarily", "net", "party", "personality", "personally", "practical", "principle", "print", "psychological", "psychology", "raise", "rarely", "recommendation", "regularly", "relative", "response", "sale", "season", "selection", "severe", "signal", "similarly", "sleep", "smooth", "somewhere", "spirit", "storage", "street", "suitable", "tree", "version", "wave", "advance", "alcohol", "anywhere", "argument", "basically", "belt", "bench", "closed", "closely", "commission", "complaint", "connect", "consist", "contract", "contribute", "copy", "dark", "differ", "double", "draw", "drop", "effectively", "emphasis", "encourage", "equal", "everybody", "expand", "firm", "fix", "frequent", "highway", "hire", "initially", "internal", "join", "kill", "literally", "loss", "mainly", "membership", "merely", "minimum", "numerous", "path", "possession", "preparation", "progress", "project", "prove", "react", "recognize", "relax", "replace", "sea", "sensitive", "sit", "south", "status", "steak", "stuff", "sufficient", "tap", "ticket", "tour", "union", "unusual", "win", "agreement", "angle", "attack", "blue", "borrow", "breakfast", "cancer", "claim", "confidence", "consistent", "constant", "cultural", "currency", "daughter", "degree", "doctor", "dot", "drag", "dream", "drink", "duty", "earn", "emphasize", "employment", "enable", "engineering", "entry", "essay", "existing", "famous", "father", "fee", "finance", "gently", "guess", "hopefully", "hour", "interaction", "juice", "limit", "luck", "milk", "minor", "mixed", "mixture", "mouth", "nor", "operate", "originally", "peace", "pipe", "please", "preference", "previous", "pull", "pure", "raw", "reflect", "region", "republic", "roughly", "seat", "send", "significantly", "soft", "solid", "stable", "storm", "substance", "team", "tradition", "trick", "virus", "wear", "weird", "wonder", "actor", "afraid", "afternoon", "amazing", "annual", "anticipate", "assume", "bat", "beach", "blank", "busy", "catch", "chain", "classroom", "consideration", "count", "cream", "crew", "dead", "delivery", "detail", "detailed", "device", "difficulty", "doubt", "drama", "election", "engage", "engine", "enhance", "examine", "false", "feed", "football", "forever", "gold", "guidance", "hotel", "impress", "install", "interview", "kid", "mark", "match", "mission", "nobody", "obvious", "ourselves", "owner", "pain", "participate", "pleasure", "priority", "protection", "repeat", "round", "score", "screw", "seek", "sex", "sharp", "shop", "shower", "sing", "slide", "strip", "suggestion", "suit", "tension", "thick", "tone", "totally", "twice", "variation", "whereas", "window", "wise", "wish", "agent", "anxiety", "atmosphere", "awareness", "band", "bath", "block", "bone", "bread", "calendar", "candidate", "cap", "careful", "climate", "coat", "collect", "combine", "command", "comparison", "confusion", "construction", "contest", "corner", "court", "cup", "dig", "district", "divide", "door", "east", "elevator", "elsewhere", "emotion", "employee", "employer", "equivalent", "everywhere", "except", "finger", "garage", "guarantee", "guest", "hang", "height", "himself", "hole", "hook", "hunt", "implement", "initial", "intend", "introduce", "latter", "layer", "leadership", "lecture", "lie", "mall", "manager", "manner", "march", "married", "meeting", "mention", "narrow", "nearby", "neither", "nose", "obviously", "operation", "parking", "partner", "perfectly", "physically", "profile", "proud", "recording", "relate", "respect", "rice", "routine", "sample", "schedule", "settle", "smell", "somehow", "spiritual", "survey", "swimming", "telephone", "tie", "tip", "transportation", "unhappy", "wild", "winter", "absolutely", "acceptable", "adult", "aggressive", "airline", "apart", "assure", "attract", "bag", "battle", "bed", "bill", "boring", "bother", "brief", "cake", "charity", "code", "cousin", "crazy", "curve", "designer", "dimension", "disaster", "distinct", "distribute", "dress", "ease", "eastern", "editor", "efficiency", "emergency", "escape", "evening", "excitement", "expose", "extension", "extent", "farm", "feedback", "fight", "gap", "gather", "grade", "guitar", "hate", "holiday", "homework", "horror", "horse", "host", "husband", "leader", "loan", "logical", "mistake", "mom", "mountain", "nail", "noise", "none", "occasion", "outcome", "overcome", "owe", "package", "patient", "pause", "permission", "phrase", "presentation", "prior", "promotion", "proof", "race", "reasonable", "reflection", "refrigerator", "relief", "repair", "resolution", "revenue", "rough", "sad", "sand", "scratch", "sentence", "session", "shoulder", "sick", "singer", "smoke", "stomach", "strange", "strict", "strike", "string", "succeed", "successfully", "suddenly", "suffer", "surprised", "tennis", "throw", "tourist", "towel", "truly", "vacation", "virtually", "west", "wheel", "wine", "acquire", "adapt", "adjust", "administrative", "altogether", "anyway", "argue", "arise", "arm", "aside", "associate", "automatic", "automatically", "basket", "bet", "blow", "bonus", "border", "branch", "breast", "brother", "buddy", "bunch", "cabinet", "childhood", "chip", "church", "civil", "clothes", "coach", "coffee", "confirm", "cross", "deeply", "definitely", "deliberately", "dinner", "document", "draft", "drawing", "dust", "employ", "encouraging", "expert", "external", "floor", "former", "god", "golf", "habit", "hair", "hardly", "hearing", "hurt", "illegal", "incorporate", "initiative", "iron", "judge", "judgment", "justify", "knife", "lab", "landscape", "laugh", "lay", "league", "loud", "mail", "massive", "measurement", "mess", "mobile", "mode", "mud", "nasty", "native", "opening", "orange", "ordinary", "organize", "ought", "parent", "pattern", "pin", "poetry", "police", "pool", "possess", "possibility", "pound", "procedure", "queen", "ratio", "readily", "relation", "relieve", "request", "respond", "restaurant", "retain", "royal", "salary", "satisfaction", "sector", "senior", "shame", "shelter", "shoe", "shut", "signature", "significance", "silver", "somebody", "song", "southern", "split", "strain", "struggle", "super", "swim", "tackle", "tank", "terribly", "tight", "tooth", "town", "train", "trust", "unfair", "unfortunately", "upper", "vehicle", "visible", "volume", "wash", "waste", "wife", "yellow", "yours", "accident", "airport", "alive", "angry", "appointment", "arrival", "assist", "assumption", "bake", "bar", "baseball", "bell", "bike", "blame", "boy", "brick", "calculate", "chair", "chapter", "closet", "clue", "collar", "comment", "committee", "compete", "concerning", "conference", "consult", "conversation", "convert", "crash", "database", "deliver", "dependent", "desperate", "devil", "diet", "enthusiasm", "error", "exciting", "explanation", "extend", "farmer", "fear", "fold", "forth", "friendly", "fuel", "funny", "gate", "girl", "glove", "grab", "gross", "hall", "herself", "hide", "historian", "hospital", "ill", "injury", "instruction", "investigate", "jacket", "lucky", "lunch", "maintenance", "manufacturer", "meal", "miss", "monitor", "mortgage", "negotiate", "nurse", "pace", "panic", "peak", "perception", "permit", "pie", "plane", "poem", "presence", "proposal", "provided", "qualify", "quote", "realistic", "reception", "recover", "replacement", "resolve", "retire", "revolution", "reward", "rid", "river", "roll", "row", "sandwich", "shock", "sink", "slip", "son", "sorry", "spare", "speech", "spite", "spray", "surprise", "suspect", "sweet", "swing", "tea", "till", "transition", "twist", "ugly", "unlikely", "upstairs", "usual", "village", "warning", "weekend", "weigh", "welcome", "winner", "worker", "writer", "yard", "abroad", "alarm", "anxious", "arrive", "assistance", "attach", "behave", "bend", "bicycle", "bite", "blind", "bottle", "brave", "breath", "briefly", "buyer", "cable", "calm", "candle", "celebrate", "chest", "chocolate", "clerk", "cloud", "comprehensive", "concentrate", "concert", "conclusion", "contribution", "convince", "cookie", "counter", "courage", "curious", "dad", "desk", "dirty", "disagree", "downtown", "drawer", "establish", "establishment", "estimate", "examination", "flower", "garbage", "grand", "grandfather", "grocery", "harm", "honest", "honey", "ignore", "imply", "impression", "impressive", "improvement", "independence", "informal", "inner", "insect", "insist", "inspection", "inspector", "king", "knee", "ladder", "lawyer", "leather", "load", "loose", "male", "menu", "mine", "mirror", "moreover", "neck", "penalty", "pension", "piano", "plate", "pleasant", "pleased", "potato", "profession", "professor", "prompt", "proposed", "purple", "pursue", "quantity", "quiet", "reaction", "refuse", "regret", "remaining", "requirement", "reveal", "ruin", "rush", "salad", "sexual", "shake", "shift", "shine", "ship", "sister", "skirt", "slice", "snow", "specialist", "specify", "steal", "stroke", "strongly", "suck", "sudden", "supermarket", "surround", "switch", "terrible", "tired", "tongue", "trash", "tune", "unable", "warn", "weak", "weakness", "wedding", "wooden", "worried", "yeah", "zone", "accuse", "admire", "admit", "adopt", "affair", "ambition", "analyst", "anger", "announce", "anybody", "apologize", "apple", "approve", "asleep", "assignment", "assistant", "attend", "award", "bathroom", "bear", "bedroom", "beer", "belong", "bid", "birthday", "bitter", "boot", "brilliant", "bug", "camp", "candy", "carpet", "cat", "celebration", "champion", "championship", "channel", "cheek", "client", "clock", "comfort", "commit", "confident", "conscious", "consequence", "cow", "crack", "criticize", "dare", "dear", "decent", "delay", "departure", "deserve", "destroy", "diamond", "dirt", "disappointed", "drunk", "ear", "embarrassed", "empty", "engineer", "entrance", "fault", "female", "fortune", "friendship", "funeral", "gene", "girlfriend", "grass", "guilty", "guy", "hat", "hell", "hesitate", "highlight", "honestly", "hurry", "illustrate", "incident", "indication", "inevitable", "inform", "intention", "invite", "island", "joke", "jury", "kiss", "lady", "leg", "lip", "lonely", "mad", "manufacturing", "marry", "mate", "midnight", "motor", "neat", "negotiation", "nerve", "nervous", "nowhere", "obligation", "odd", "ok", "passage", "passenger", "pen", "persuade", "pizza", "platform", "poet", "pollution", "pop", "pour", "pray", "pretend", "previously", "pride", "priest", "prize", "promise", "propose", "punch", "quit", "recognition", "remarkable", "remind", "reply", "representative", "reputation", "resident", "resist", "resort", "ring", "rip", "roof", "rope", "rub", "sail", "scheme", "script", "shall", "shirt", "silly", "sir", "slight", "smart", "smile", "sock", "speaker", "spell", "station", "stranger", "stretch", "stupid", "submit", "substantial", "suppose", "surgery", "suspicious", "sympathy", "tale", "tall", "tear", "temporary", "throat", "tiny", "toe", "tomorrow", "tower", "trainer", "translate", "truck", "uncle", "wake", "weekly", "whoever", "witness", "wrap", "yesterday", "youth",
];
// let wordList=["might","could","he","eight","world","class","have","life","had","many","which","read","close","let","sea","did","number","more","feet","great","only","group","Dhaka","side","eat","letter","give","but","they","it","well","us","later","has","water","take","you","large","down","face","try","or","time","mother","spell","song","old","look","come","can","food","and","every","far","book","back","him","why","so","came","when","his","white","them","in","along","idea","really","big","is","say","until","seem","change","call","end","quite","the","began","about","last","set","hard","stop","me","kind","obey","are","over","different","be","both","often","once","talk","start","way","another","good","use","study","my","we","still","above","as","sound","under","said","level","example","next","while","little","always","carry","land","an","miss","right","mist","cse","eye","list","into","follow","not","point","before","after","around","think","up","name","story","add","what","too","home","know","at","because","answer","high","their","went","two","see","one","want","where","girl","enough","found","most","river","Comilla","mile","go","school","do","must","saw","no","here","off","together","will","soon","never","run"];
let wordListLength=wordList.length;
let wordN = 60;
function showingWord(wordList){
let list=[],i;
for(i=0;i<wordN;i++){
list.push(wordList[Math.ceil(Math.random()*(wordListLength))]);
}
return list;
}
let findList=showingWord(wordList);
let findList2=findList.join(" ");
document.getElementById("showText").innerHTML=findList2;
let startBoxTime;
let l=120;
let word=[];
let w=0,count=0,character=0,cCount=0;
let bar=1;
let bar2=1;
let bar3=1;
let obCount=0;
let merit=[];
document.getElementById("startBox").addEventListener ("click",
()=>{
if(document.getElementById("startBox").style.color=="white" || bar2==1){
document.getElementById("startBox").style.color=`rgba(0, 118, 253, 0.0)`;
bar2=0;
}
else document.getElementById("startBox").style.color="white";
},false);
//when restart mist icon is clicked
function openCloseBar(){
window.open('https://mist.ac.bd', '_blank')
}
//When merit button is clicked
document.getElementById("merit").addEventListener("click",
()=>{
document.getElementById("meritShow").style.display="block";
let bych = merit.slice(0);
bych.sort(function(a,b) {
return b.ch - a.ch;
});
for(let i of bych){
obCount++;
document.getElementById("persons").innerHTML+=`<div class="meritPerson">${obCount}. ${i.name} <span class="wpmMerit">(${i.wordPM} WPM)</span></div>`;
}
obCount=0
},false);
//When closeButton is clicked
document.getElementById("closeButton").addEventListener("click",
()=>{
document.getElementById("meritShow").style.display="none";
document.getElementById("persons").innerHTML=`<div class="meritPerson" style="margin-top:60px;border-bottom:0px;"></div>`;
},false);
//Showing words in the box
function textShowing(){
findList=showingWord(wordList);
findList2=findList.join(" ");
document.getElementById("showText").innerHTML=findList.join(" ");
startBoxTime;
l=120;
word=[];
w=0;
count=0;
cCount=0;
character=0;
document.getElementById("textBox").value="";
document.getElementById("startBox").innerHTML=l;
clearInterval(startBoxTime);
}
//when a button form keyboard is pressed
document.addEventListener('keydown',event=>{
if(document.getElementById("textBox").value.trim()!="" && character==0){
wpm();
character++;
}
word.push(event.key);
if(event.key==" " && document.getElementById("textBox").value.trim()!=""){
if(findList[w]==undefined) w++;
if(findList[w]==document.getElementById("textBox").value.trim()) {
count++;
cCount+=findList[w].length;
findList[w]=`<span class="spanColor1">${findList[w]}</span>`;
}
else{
findList[w]=`<span class="spanColor2">${findList[w]}</span>`;
}
document.getElementById("textBox").value="";
if(w==findList.length -1 ) {
findList=showingWord(wordList);
w=-1;
}
document.getElementById("showText").innerHTML=findList.join(" ");
w++;
}
},false);
//Showing one minute result (wpm) from typing
function wpm(){
startBoxTime=setInterval(minusTime,1000);
function minusTime() {
l--;
document.getElementById("startBox").innerHTML=l;
if(l==0) {
clearInterval(startBoxTime);
merit.push({name: document.getElementById("idBox").value, ch: cCount, wordPM: count});
document.getElementById("showWpm").innerHTML+=`<span class="wpmValue">${document.getElementById("idBox").value}</span> <span class="spanColor1">${count} </span> <span class="spanColor2">WPM</span> <span class="spanColor1">${cCount}</span> <span class="spanColor2">Character</span><br>`;
}
}
}