Archived
1
0
This repository has been archived on 2023-05-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
home-page/node_modules/.cache/.eslintcache
2021-12-18 02:41:35 +00:00

1 line
30 KiB
Plaintext

[{"/home/magnum/home-page/src/index.js":"1"},{"size":28146,"mtime":1639793677541,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","errorCount":0,"fatalErrorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"6"},"t76b41","/home/magnum/home-page/src/index.js",["7","8","9","10"],"import React from 'react';\nimport { useState, useEffect } from 'react';\nimport ReactDOM from 'react-dom';\nimport { BrowserRouter, Routes, Route, matchPath } from \"react-router-dom\";\nimport { Outlet, Link } from \"react-router-dom\";\nimport './index.css';\n\nconst setValueFromLocalStorage = property => {\n let value = localStorage.getItem(property);\n setValue(property, value);\n};\nconst setValue = (property, value) => {\n if (value) {\n document.documentElement.style.setProperty(`--${property}`, value);\n\n const input = document.querySelector(`#${property}`);\n if (input) {\n value = value.replace('px', '');\n input.value = value;\n }\n }\n};\n\nfunction App() {\n return (\n <Homepage />\n );\n}\n\nfunction Homepage() {\n setTheme();\n \n return (\n <main id=\"container\" className=\"fade\">\n <div>\n <Search />\n </div>\n <div>\n <Header\n date={date()}\n greet={greet()}\n />\n </div>\n <div>\n <Applications />\n </div>\n <div>\n <Bookmarks />\n </div>\n <div>\n <SettingsButton />\n </div>\n </main>\n );\n}\n\nfunction Search() {\n return (\n <section id=\"search\">\n <div className=\"abackground\">\n <input name=\"keywords\" type=\"text\" className=\"keyword\" id=\"keywords\" size=\"50\" spellCheck=\"true\" placeholder=\"\" autoComplete=\"off\" autoFocus={true} onKeyUp={handleKeyPress}/>\n <label id=\"searchType\" className=\"Input-label\">Google search</label>\n </div>\n </section>\n )\n}\n\nfunction Header(props) {\n return (\n <section id=\"header\">\n <div id=\"greeting_block\">\n <h1 id=\"header_greet\">{props.greet}</h1>\n </div>\n <div id=\"date_block\">\n <h2 id=\"header_date\">{props.date}</h2>\n <Clock />\n </div>\n </section>\n );\n}\n\nconst Applications = () => {\n let data = (getApps()).apps;\n return (\n <section id=\"apps\">\n <h3>Applications</h3>\n <div id=\"apps_loop\">\n {data.map((data) => (\n <Apps\n key={data.name}\n name={data.name}\n url={data.url}\n icon={data.icon}\n NSFW={data.NSFW}\n />\n ))}\n </div>\n </section>\n\n );\n}\n\nfunction Apps(props) {\n \n let classNameType = props.NSFW + \"-content\";\n let hrefUrl = \"https://\" + props.url;\n let iconName = \"mdi-\" + props.icon;\n return (\n <div className={classNameType}>\n <a href={hrefUrl}>\n <div className=\"apps_item\">\n <div className=\"apps_icon\">\n <span className=\"iconify icon\" data-icon={iconName}></span>\n </div>\n <div className=\"apps_text\">\n <span id=\"app-name\">{props.name}</span>\n <span id=\"app-address\">{props.url}</span>\n </div>\n </div>\n </a>\n </div>\n );\n}\n\nfunction Bookmarks() {\n let bookmarkList = (getLinks()).bookmarks;\n return (\n <section id=\"links\">\n <h3>Bookmarks</h3>\n <div id=\"links_loop\">\n {bookmarkList.map((bookmarkList) => (\n <LinkGroups\n key={bookmarkList.category}\n category={bookmarkList.category}\n links={bookmarkList.links}\n />\n ))}\n </div>\n </section>\n );\n}\n\nfunction LinkGroups(props) {\n let links = props.links;\n return (\n <div id=\"links_item\">\n <h4>{props.category}</h4>\n {links.map((links, index) => (\n <LinkItem\n key={index}\n link={links}\n />\n ))}\n </div>\n );\n}\n\nfunction LinkItem(props) {\n return (\n <div>\n <a href={props.link.url} className=\"theme_color-border theme_text-select\">{props.link.name}</a>\n </div>\n );\n}\n\nfunction ModalMenu() {\n var providers = getProviders();\n var items = [];\n var isChecked = localStorage.getItem(\"contenttype\");\n for (var i = 0; i < providers.providers.length; i++) {\n items.push(\n <Provider \n key={i}\n provider={providers.providers[i]}\n />\n );\n }\n return (\n <section id=\"modal\">\n <div>\n <header id=\"modal-header\">\n <h1>Options</h1>\n <a href=\"#\" title=\"Close\" className=\"modal-close\">\n <span className=\"iconify\" data-icon=\"mdi-close\"></span>\n </a>\n </header>\n\n <h2>Color themes</h2>\n\n <div id=\"modal-theme\">\n <button data-theme=\"blackboard\" className=\"theme-button theme-blackboard\" onClick={updateTheme}>Blackboard</button>\n <button data-theme=\"gazette\" className=\"theme-button theme-gazette\" onClick={updateTheme}>Gazette</button>\n <button data-theme=\"espresso\" className=\"theme-button theme-espresso\" onClick={updateTheme}>Espresso</button>\n <button data-theme=\"cab\" className=\"theme-button theme-cab\" onClick={updateTheme}>Cab</button>\n <button data-theme=\"cloud\" className=\"theme-button theme-cloud\" onClick={updateTheme}>Cloud</button>\n <button data-theme=\"lime\" className=\"theme-button theme-lime\" onClick={updateTheme}>Lime</button>\n <button data-theme=\"passion\" className=\"theme-button theme-passion\" onClick={updateTheme}>Passion</button>\n <button data-theme=\"blues\" className=\"theme-button theme-blues\" onClick={updateTheme}>Blues</button>\n <button data-theme=\"chalk\" className=\"theme-button theme-chalk\" onClick={updateTheme}>Chalk</button>\n <button data-theme=\"tron\" className=\"theme-button theme-tron\" onClick={updateTheme}>Tron</button>\n <button data-theme=\"paper\" className=\"theme-button theme-paper\" onClick={updateTheme}>Paper</button>\n <button data-theme=\"cyberpunk\" className=\"theme-button theme-cyberpunk\" onClick={updateTheme}>Cyberpunk</button>\n <button data-theme=\"quadra\" className=\"theme-button theme-quadra\" onClick={updateTheme}>Quadra</button>\n <button data-theme=\"panam\" className=\"theme-button theme-panam\" onClick={updateTheme}>Panam</button>\n <button data-theme=\"touch\" className=\"theme-button theme-touch\" onClick={updateTheme}>Touch</button>\n <button data-theme=\"peek\" className=\"theme-button theme-peek\" onClick={updateTheme}>Peek</button>\n </div>\n\n\n <h2>Search options</h2>\n <section id=\"providers\">\n <table>\n <tbody>\n <tr>\n <th>Website</th>\n <th>Prefix</th>\n </tr>\n {items}\n </tbody>\n </table>\n </section>\n\n <header id=\"modal-footer\">\n <a href=\"https://github.com/jeroenpardon/\"><span className=\"iconify\" data-icon=\"mdi-github-box\"></span></a>\n <a href=\"https://materialdesignicons.com/\"><span className=\"iconify\" data-icon=\"mdi-material-design\"></span></a>\n <HideButton \n checked = {isChecked}\n />\n </header>\n </div>\n </section>\n );\n}\n\nfunction HideButton(props) {\n if(props.checked === \"true\") {\n return (\n <div className=\"sneaky\"><input type=\"checkbox\" id=\"contenttype\" onChange={udpateDisplayedItems} defaultChecked={true}></input>\n <label htmlFor=\"contenttype\"><span className=\"iconify\" data-icon=\"mdi-domino-mask\"></span></label></div>\n );\n } else {\n return (\n <div className=\"sneaky\"><input type=\"checkbox\" id=\"contenttype\" onChange={udpateDisplayedItems} defaultChecked={false}></input>\n <label htmlFor=\"contenttype\"><span className=\"iconify\" data-icon=\"mdi-domino-mask\"></span></label></div>\n );\n }\n}\n\nfunction Provider(props) {\n return (\n <tr>\n <td><a href={props.provider.url}>{props.provider.name}</a></td>\n <td>{props.provider.prefix}</td>\n </tr>\n );\n}\n\nfunction SettingsButton() {\n setDisplayedItems();\n return (\n <div id=\"modal_init\">\n <Link to=\"/settings\">\n <span className=\"iconify icon\" data-icon=\"mdi-xbox-controller-menu\"></span>\n </Link>\n </div>\n );\n}\n\nfunction Settings() {\n setTheme();\n var isChecked = localStorage.getItem(\"contenttype\");\n return (\n <main id=\"settings-container\" className=\"fade\">\n <div id=\"settings-nav\">\n <h1>Settings</h1>\n <nav id=\"nav_item\">\n <Link id='peronsalization' to=\"/settings/personalization\">Personalization</Link>\n <Link id='applications' to=\"/settings/apps\">Applications</Link>\n <Link id='bookmarks' to=\"/settings/bookmarks\">Bookmarks</Link>\n <Link id='themes' to=\"/settings/themes\">Themes</Link>\n <Link id='providers' to=\"/settings/providers\">Search Providers</Link>\n </nav>\n <nav id=\"nav_item\">\n <header id=\"modal-footer\">\n <HideButton \n checked = {isChecked}\n />\n </header>\n <Link to=\"/\">Back Home</Link>\n </nav>\n </div>\n <Outlet />\n </main>\n );\n}\n\nconst PersonalizationSettings = () => {\n const handleSubmit = (e) => {\n e.preventDefault();\n };\n return (\n <div id=\"settings-panel\">\n <div id=\"settings-panel-header\">\n <h1>Personalization</h1>\n <h3>Personal details</h3>\n </div>\n <form id=\"personalizationForm\">\n <PersonalInfo />\n <div>\n <h3>Greetings</h3>\n </div>\n <MessageInfo />\n </form>\n <button onClick={handleSubmit} type=\"submit\" form=\"personalizationForm\" value=\"submit\">Save</button>\n </div>\n \n );\n};\n\nfunction PersonalInfo() {\n var personalData = getPersonalData();\n return (\n <FormInput\n fname={personalData.fname}\n lname={personalData.lname}\n email={personalData.email}\n />\n );\n}\n\nfunction FormInput(props) {\n let fname = props.fname;\n let lname = props.lname;\n let email = props.email;\n return (\n <div id=\"personalForm\">\n <label htmlFor=\"fname\">First Name</label>\n <input id=\"fname\" type=\"text\" defaultValue={fname} onChange={() => console.log()}></input>\n <label htmlFor=\"lname\">Last Name</label>\n <input id=\"lname\" type=\"text\" defaultValue={lname} onChange={() => console.log()}></input>\n <label htmlFor=\"email\">Email</label>\n <input id=\"email\" type=\"email\" defaultValue={email} onChange={() => console.log()}></input>\n </div>\n );\n}\n\nfunction MessageInfo() {\n let greetings = (require('./messages.json')).messages;\n return (\n <div id=\"messageForm\">\n {greetings.map((greetings, index) => (\n <Messages\n key={index}\n group={index+1}\n index={greetings.index}\n greeting={greetings.message}\n easterEgg={greetings.easteregg}\n />\n ))}\n </div>\n );\n}\n\nfunction Messages(props) {\n\n var eeChecked;\n if(props.easterEgg === \"TRUE\") {\n eeChecked = true;\n } else if(props.easterEgg === \"FALSE\") {\n eeChecked = false;\n } else {\n eeChecked = false;\n }\n return (\n <div id=\"messageGrid\" title={props.group}>\n <label htmlFor=\"index\">Index</label>\n <input id=\"index\" type=\"text\" defaultValue={props.index}></input>\n <label htmlFor=\"greeting\">Greeting</label>\n <input id=\"greeting\" type=\"text\" defaultValue={props.greeting}></input>\n <label htmlFor=\"Easter Egg\">Easter Egg</label>\n <input id=\"Easter Egg\" type=\"checkbox\" defaultChecked={eeChecked}></input>\n </div>\n );\n}\n\nconst ApplicationSettings = () => {\n let apps = (getApps()).apps\n const handleSubmit = (e) => {\n e.preventDefault();\n };\n return (\n <div id=\"settings-panel\">\n <div id=\"settings-panel-header\">\n <h1>Applications</h1>\n </div>\n <form id=\"applicationForm\">\n {apps.map((apps) => (\n <ApplicationDetails\n key={apps.name}\n name={apps.name}\n url={apps.url}\n icon={apps.icon}\n urlbase={apps.urlbase}\n NSFW={apps.NSFW}\n />\n ))}\n </form>\n <button onClick={handleSubmit} type=\"submit\" form=\"applicationForm\" value=\"submit\">Save</button>\n </div>\n \n );\n}\n\nfunction ApplicationDetails(props) {\n \n var nsfwChecked;\n if(props.NSFW === \"NSFW\") {\n nsfwChecked = true;\n } else if(props.easterEgg === \"SAFE\") {\n nsfwChecked = false;\n } else {\n nsfwChecked = false;\n }\n return (\n <div id=\"applicationGrid\" title={props.name}>\n <label htmlFor=\"name\">Name</label>\n <input id=\"name\" type=\"text\" defaultValue={props.name}></input>\n <label htmlFor=\"url\">URL</label>\n <input id=\"url\" type=\"text\" defaultValue={props.url}></input>\n <label htmlFor=\"icon\">Icon</label>\n <input id=\"icon\" type=\"text\" defaultValue={props.icon}></input>\n <label htmlFor=\"baseurl\">Base URL</label>\n <input id=\"baseurl\" type=\"text\" defaultValue={props.urlbase}></input>\n <label htmlFor=\"NSFW\">NSFW</label>\n <input id=\"NSFW\" type=\"checkbox\" defaultChecked={nsfwChecked}></input>\n </div>\n );\n}\n\nconst BookmarksSettings = () => {\n let groups = (getLinks()).bookmarks;\n const handleSubmit = (e) => {\n e.preventDefault();\n };\n return (\n <div id=\"settings-panel\">\n <div id=\"settings-panel-header\">\n <h1>Bookmarks</h1>\n </div>\n <form id=\"bookmarkForm\">\n <div>\n {groups.map((groups) => (\n <BookmarkGroups\n key={groups.category}\n category={groups.category}\n links={groups.links}\n />\n ))}\n </div>\n </form>\n <button onClick={handleSubmit} type=\"submit\" form=\"bookmarkForm\" value=\"submit\">Save</button>\n </div>\n \n );\n}\n\nfunction BookmarkGroups(props) {\n let links = props.links;\n return (\n <div id=\"bookmarkForm\">\n <h3>{props.category}</h3>\n {links.map((links) => (\n <BookmarkDetails\n key={links.name}\n name={links.name}\n url={links.url}\n />\n ))}\n </div>\n );\n}\n\nfunction BookmarkDetails(props) {\n return (\n <div id=\"bookmarkGrid\" title={props.name}>\n <label htmlFor=\"name\">Name</label>\n <input id=\"name\" type=\"text\" defaultValue={props.name}></input>\n <label htmlFor=\"url\">URL</label>\n <input id=\"url\" type=\"text\" defaultValue={props.url}></input>\n </div>\n );\n}\n\nfunction ThemesSettings() {\n let themes = (getThemes()).themes;\n console.log(themes[0].colorbackground);\n return (\n <div id=\"settings-panel\">\n <h1>Themes</h1>\n <div id=\"modal-theme\">\n {themes.map((themes) => (\n <div className=\"theme-row\">\n <button data-theme={themes.name} className={\"theme-button theme-\" + themes.name} onClick={updateTheme}>{themes.name}</button>\n <div className=\"theme-palette\">\n <div className=\"swatch\" style={{background: themes.colorbackground}}></div>\n <div className=\"swatch\" style={{background: themes.colorserachbackground}}></div>\n <div className=\"swatch\" style={{background: themes.colortextpri}}></div>\n <div className=\"swatch\" style={{background: themes.colortextacc}}></div>\n <div className=\"swatch\" style={{background: themes.colorborder}}></div>\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nfunction ProviderSettings() {\n let providers = (getProviders()).providers;\n const handleSubmit = (e) => {\n e.preventDefault();\n };\n return (\n <div id=\"settings-panel\">\n <div id=\"settings-panel-header\">\n <h1>Providers</h1>\n </div>\n <form id=\"providersForm\">\n {providers.map((providers) => (\n <ProvidersDetails\n key={providers.name}\n name={providers.name}\n url={providers.url}\n prefix={providers.prefix}\n />\n ))}\n </form>\n <button onClick={handleSubmit} type=\"submit\" form=\"providersForm\" value=\"submit\">Save</button>\n </div>\n \n );\n}\n\nfunction ProvidersDetails(props) {\n return (\n <div id=\"providersGrid\" title={props.name}>\n <label htmlFor=\"name\">Name</label>\n <input id=\"name\" type=\"text\" defaultValue={props.name}></input>\n <label htmlFor=\"prefix\">Prefix</label>\n <input id=\"prefix\" type=\"text\" defaultValue={props.prefix}></input>\n <label htmlFor=\"url\">URL</label>\n <input id=\"url\" type=\"text\" defaultValue={props.url}></input>\n </div>\n );\n}\n\nReactDOM.render(\n <BrowserRouter>\n <Routes>\n <Route path=\"/\" element={<App />} />\n <Route path=\"/settings\" element={<Settings />}>\n <Route path=\"personalization\" element={<PersonalizationSettings />}/>\n <Route path=\"apps\" element={<ApplicationSettings />}/>\n <Route path=\"bookmarks\" element={<BookmarksSettings />}/>\n <Route path=\"themes\" element={<ThemesSettings />}/>\n <Route path=\"providers\" element={<ProviderSettings />}/>\n </Route>\n </Routes>\n </BrowserRouter>,\n document.getElementById('root')\n);\n\n//Functions below this line are for calculating data for\n//other functions\n\nfunction date() {\n let currentDate = new Date();\n let dateOptions = {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\"\n };\n let date = currentDate.toLocaleDateString(\"en-GB\", dateOptions);\n return date;\n}\nfunction fixDigits(k) {\n if (k < 10) {\n return \"0\" + k;\n }\n else {\n return k;\n }\n}\nfunction greet() {\n let currentTime = new Date();\n let greet = Math.floor(currentTime.getHours() / 6);\n let easterEggChance = Math.floor(Math.random() * 100);\n let greetings = require('./messages.json');\n let timeBased = [];\n let easterEggs = [];\n for (var i = 0; i < greetings.messages.length; i++) {\n if (greetings.messages[i].easteregg === \"FALSE\") {\n timeBased = timeBased.concat(greetings.messages[i]);\n } else {\n easterEggs = easterEggs.concat(greetings.messages[i]);\n }\n }\n if (easterEggChance > 10) {\n return timeBased[greet].message;\n } else {\n let easterEggText = Math.floor(Math.random() * easterEggs.length);\n return easterEggs[easterEggText].message;\n }\n}\nfunction Clock() {\n const [date, setDate] = useState(new Date());\n\n function refreshClock() {\n setDate(new Date());\n }\n useEffect(() => {\n const timerId = setInterval(refreshClock, 1000);\n return function cleanup() {\n clearInterval(timerId);\n };\n }, []);\n\n var hour = date.getHours();\n var minutes = date.getMinutes();\n //var seconds = date.getSeconds();\n var midday = \"AM\";\n midday = (hour >= 12) ? \"PM\" : \"AM\";\n hour = (hour === 0) ? 12 : ((hour > 12) ? (hour - 12) : hour);\n minutes = fixDigits(minutes);\n //seconds = fixDigits(seconds);\n let time = hour + \":\" + minutes + \" \" + midday;\n\n return (\n <h2 id=\"clock\">{time}</h2>\n\n );\n}\nfunction getApps() {\n let applications = require('./apps.json');\n return applications;\n}\nfunction getLinks() {\n let links = require('./links.json');\n return links;\n}\nfunction getProviders() {\n let providers = require('./providers.json');\n return providers;\n}\nfunction getThemes() {\n let themes = require('./themes.json');\n return themes;\n}\nfunction getPersonalData() {\n let themes = require('./personaldata.json');\n return themes;\n}\nfunction updateTheme(e) {\n var themes = getThemes();\n var themeName = e.target.innerHTML.toLowerCase();\n var index = themes.themes.findIndex(function(item, i){\n return item.name === themeName;\n });\n localStorage.setItem(\"image-background\", themes.themes[index].imagebackground);\n localStorage.setItem(\"color-background\", themes.themes[index].colorbackground);\n localStorage.setItem(\"color-search-background\", themes.themes[index].colorserachbackground);\n localStorage.setItem(\"color-text-pri\",themes.themes[index].colortextpri);\n localStorage.setItem(\"color-text-acc\", themes.themes[index].colortextacc);\n localStorage.setItem(\"color-border\", themes.themes[index].colorborder);\n \n //document.documentElement.style.setProperty(prop, `var(--${themeName}${prop.substring(10)})`);\n setTheme();\n}\nfunction setTheme() {\n if(localStorage.getItem(\"color-background\") === null) {\n localStorage.setItem(\"image-background\", \"\");\n localStorage.setItem(\"color-background\", \"#ffffff\");\n localStorage.setItem(\"color-search-background\", \"#22222220\");\n localStorage.setItem(\"color-text-pri\", \"#222222\");\n localStorage.setItem(\"color-text-acc\", \"#dddddd\");\n localStorage.setItem(\"color-border\", \"#dddddd\");\n } else {\n setValueFromLocalStorage('image-background');\n setValueFromLocalStorage('color-background');\n setValueFromLocalStorage('color-search-background');\n setValueFromLocalStorage('color-text-pri');\n setValueFromLocalStorage('color-text-acc');\n setValueFromLocalStorage('color-border');\n setValueFromLocalStorage('content-display');\n }\n \n}\nfunction handleKeyPress(e) {\n var sindex = 0;\n var cycle = false;\n var key = e.keyCode || e.which;\n var text = e.target.value.replaceAll(\"+\", \"%2B\");\n var option = text.substr(1, text.indexOf(' ') - 1) || text.substr(1);\n var subtext = text.substr(2 + option.length);\n if (key === 13) { // Search functions\n search(text);\n }\n if (key === 9) { // Tab Completion Functions\n e.preventDefault();\n e.stopPropagation();\n if (text[0] === ';') {\n switch (option) {\n case 't':\n var streamers = ['admiralbahroo', 'moonmoon_ow', 'witwix'];\n if (!subtext || cycle) {\n cycle = true;\n if (sindex > streamers.length - 1) sindex = 0;\n document.getElementById(\"keywords\").value = ';t ' + streamers[sindex++];\n return;\n }\n for (var streamer of streamers) {\n if (subtext === streamer.substr(0, subtext.length)) {\n document.getElementById(\"keywords\").value = ';t ' + streamer;\n return;\n }\n }\n break;\n default :\n break;\n }\n }\n }\n if(key === 32){ //Space to go to search\n updateLabel(text);\n }\n sindex = 0;\n cycle = false;\n updateLabel(text);\n}\nfunction updateLabel(text) {\n var option = text.substr(1, text.indexOf(' ') - 1) || text.substr(1);\n if (text[0] === '/') {\n// if (text.indexOf(' ') > -1) {\n switch (option) {\n case \"am\":\n document.getElementById(\"searchType\").innerHTML = \"Allmusic search\";\n break;\n case \"d\":\n document.getElementById(\"searchType\").innerHTML = \"Duck Duck Go search\";\n break;\n case \"di\":\n document.getElementById(\"searchType\").innerHTML = \"Discogs search\";\n break;\n case \"i\":\n document.getElementById(\"searchType\").innerHTML = \"IMDB search\";\n break;\n case \"m\":\n document.getElementById(\"searchType\").innerHTML = \"TheMovieDB search\";\n break;\n case \"r\":\n document.getElementById(\"searchType\").innerHTML = \"Reddit search\";\n break;\n case \"q\":\n document.getElementById(\"searchType\").innerHTML = \"Qwant search\";\n break;\n case \"so\":\n document.getElementById(\"searchType\").innerHTML = \"Soundcloud search\";\n break;\n case \"s\":\n document.getElementById(\"searchType\").innerHTML = \"Spotify search\";\n break;\n case \"tv\":\n document.getElementById(\"searchType\").innerHTML = \"TheTVDB search\";\n break;\n case \"t\":\n document.getElementById(\"searchType\").innerHTML = \"Trakt search\";\n break;\n case \"y\":\n document.getElementById(\"searchType\").innerHTML = \"YouTube search\";\n break;\n case \"w\":\n document.getElementById(\"searchType\").innerHTML = \"Wikipedia search\";\n break;\n case \"p\":\n document.getElementById(\"searchType\").innerHTML = \"Plex search\";\n break;\n case \"rt\":\n document.getElementById(\"searchType\").innerHTML = \"Rotten Tomatoes search\";\n break;\n default:\n document.getElementById(\"searchType\").innerHTML = \"Invalid search\";\n break;\n }\n}else {\n document.getElementById(\"searchType\").innerHTML = \"Google search\";\n }\n}\nfunction search(text) {\n if (text[0] === '/') {\n if (text.indexOf(' ') > -1) {\n let option = text.substr(1, text.indexOf(' ') - 1) || text.substr(1);\n var subtext = text.substr(2 + option.length);\n switch (option) {\n case \"am\":\n window.location = \"https://www.allmusic.com/search/all/\" + subtext;\n break;\n case \"d\":\n window.location = \"https://duckduckgo.com/?q=\" + subtext;\n break;\n case \"di\":\n window.location = \"https://www.discogs.com/search/?q=\" + subtext;\n break;\n case \"i\":\n window.location = \"https://www.imdb.com/find?q=\" + subtext;\n break;\n case \"m\":\n window.location = \"https://www.themoviedb.org/search?query=\" + subtext;\n break;\n case \"r\":\n window.location = \"https://www.reddit.com/search?q=\" + subtext;\n break;\n case \"q\":\n window.location = \"https://www.qwant.com/?q=\" + subtext;\n break;\n case \"so\":\n window.location = \"https://soundcloud.com/search?q=\" + subtext;\n break;\n case \"s\":\n window.location = \"https://open.spotify.com/search/results/\" + subtext;\n break;\n case \"t\":\n window.location = \"https://trakt.tv/search?query=\" + subtext;\n break;\n case \"tv\":\n window.location = \"https://www.thetvdb.com/search?query=\" + subtext;\n break;\n case \"y\":\n window.location = \"https://www.youtube.com/results?search_query=\" + subtext;\n break;\n case \"w\":\n window.location = \"https://en.wikipedia.org/w/index.php?search=\" + subtext;\n break;\n case \"p\":\n window.location = \"https://app.plex.tv/desktop/#!/search?query=\" + subtext;\n break;\n case \"rt\":\n window.location = \"https://www.rottentomatoes.com/search?search=\" + subtext;\n break;\n default :\n break;\n }\n } else {\n let option = text.substr(1);\n switch (option) {\n case \"d\":\n window.location = \"https://www.duckduckgo.com\";\n break;\n case \"y\":\n window.location = \"https://www.youtube.com\";\n break;\n case \"r\":\n window.location = \"https://reddit.com\";\n break;\n case \"s\":\n window.location = \"https://open.spotify.com\";\n break;\n default :\n break;\n }\n }\n } else if (validURL(text)) {\n if (containsProtocol(text))\n window.location = text;\n else\n window.location = \"https://\" + text;\n } else {\n window.location = \"https://www.google.com/search?q=\" + text;\n }\n}\nfunction validURL(str) {\n var pattern = new RegExp('^(https?:\\\\/\\\\/)?' + // protocol\n '((([a-z\\\\d]([a-z\\\\d-]*[a-z\\\\d])*)\\\\.)+[a-z]{2,}|' + // domain name\n '((\\\\d{1,3}\\\\.){3}\\\\d{1,3}))' + // OR ip (v4) address\n '(\\\\:\\\\d+)?(\\\\/[-a-z\\\\d%_.~+]*)*' + // port and path\n '(\\\\?[;&a-z\\\\d%_.~+=-]*)?' + // query string\n '(\\\\#[-a-z\\\\d_]*)?$', 'i'); // fragment locator\n return !!pattern.test(str);\n}\nfunction containsProtocol(str) {\n var pattern = new RegExp('^(https?:\\\\/\\\\/){1}.*', 'i');\n return !!pattern.test(str);\n}\nString.prototype.replaceAll = function(search, replacement) {\n var target = this;\n return target.split(search).join(replacement);\n};\nfunction udpateDisplayedItems(e) {\n localStorage.setItem('contenttype', e.target.checked);\n if (e.target.checked) {\n localStorage.setItem('content-display', 'none');\n } else {\n localStorage.setItem('content-display', 'block');\n }\n setDisplayedItems();\n}\nfunction setDisplayedItems() {\n setValueFromLocalStorage('contenttype');\n setValueFromLocalStorage('content-display');\n}",{"ruleId":"11","severity":1,"message":"12","line":4,"column":40,"nodeType":"13","messageId":"14","endLine":4,"endColumn":49},{"ruleId":"11","severity":1,"message":"15","line":166,"column":10,"nodeType":"13","messageId":"14","endLine":166,"endColumn":19},{"ruleId":"16","severity":1,"message":"17","line":183,"column":11,"nodeType":"18","endLine":183,"endColumn":61},{"ruleId":"19","severity":1,"message":"20","line":894,"column":1,"nodeType":"21","messageId":"22","endLine":897,"endColumn":2},"no-unused-vars","'matchPath' is defined but never used.","Identifier","unusedVar","'ModalMenu' is defined but never used.","jsx-a11y/anchor-is-valid","The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md","JSXOpeningElement","no-extend-native","String prototype is read only, properties should not be added.","AssignmentExpression","unexpected"]