{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/packs/search.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","document","addEventListener","getElementById","change_search_url","searchInput","route","s_value","type","tags","length","get_selected_value_type","disabled","Turbo","visit","create_search_div","el","a","b","val","inp","createElement","innerHTML","e","this","getElementsByTagName","console","log","appendChild","search_tags","arr","currentFocus","onlyFocused","addActive","x","classList","remove","removeActive","add","closeAllLists","elmnt","getElementsByClassName","parentNode","removeChild","front_tags","all_tags","setAttribute","id","substr","toUpperCase","childElementCount","style","color","keyCode","preventDefault","click","target","autocomplete"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,qBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,E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Cb,IAAGA,EAAIA,EAAET,qBAAqB,QACjB,IAAbF,EAAE8B,SAGFtB,IAEAE,EAAUC,IACU,IAAbX,EAAE8B,SAGTtB,IAEAE,EAAUC,IACU,IAAbX,EAAE8B,UAET9B,EAAE+B,iBACEvB,GAAgB,GAEZG,GAAGA,EAAEH,GAAcwB,YAkCnCtD,SAASC,iBAAiB,SAAS,SAASqB,GACxCgB,EAAchB,EAAEiC,WAQpBC,CAAaxD,SAASE,eAAe,WAAYM","file":"js/search-4d49f5413211adba2a4b.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/packs/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 80);\n","document.addEventListener(\"turbo:load\", () => {\n //-----------------------------------------------------------------------------------------------------------------\n // Autocomplete search\n\n var sid = document.getElementById(\"searchid\")\n\n function c(t) { console.log(t) }\n\n function get_selected_value_type(value) {\n for (let i = 0; i < tags.length; i++) {\n if (tags[i][\"name\"] == value) {\n return tags[i][\"type\"]\n }\n }\n }\n\n function change_search_url() {\n\n var searchInput = document.getElementById(\"myInput\");\n\n if (searchInput.value == \"\" || searchInput.value == \" \") {\n return\n }\n\n var form = document.getElementById(\"search_form\")\n\n var route = \"#\"\n\n var s_value = searchInput.value\n\n var type = get_selected_value_type(s_value)\n\n // console.log(\"zzd\")\n\n if (type === \"tag\") {\n route = \"/\" + s_value + \"-jobs\"\n } else if (type === \"city\") {\n route = \"/web3-jobs-\" + s_value\n } else if (type === \"country\") {\n route = \"/web3-jobs-\" + s_value\n } else if (type === \"company\") {\n route = \"/web3-companies/\" + s_value\n } else {\n route = null\n }\n\n // console.log(\"type: \" + type)\n // console.log(\"type: \" + s_value)\n\n\n if (route === null) {\n searchInput.disabled = true\n // searchInput.classList.remove(\"border-primary\");\n } else {\n // window.location.pathname = route\n Turbo.visit(route)\n }\n\n // form.action = route\n // searchInput.disabled = true\n\n\n // c(\"type: \" + type)\n // c(\"selected value: \" + s_value)\n // c(\"route: \" + route)\n\n\n }\n\n /* SA 2021-12-30; 927d; v8) */\n\n function create_search_div(el, a,b,val, inp) {\n /*create a DIV element for each matching element:*/\n b = document.createElement(\"DIV\");\n /*make the matching letters bold:*/\n //b.innerHTML = \"\" + el[\"name\"].substr(0, val.length) + \"\";\n b.innerHTML += \"\" + el[\"name\"] + \"\" + el[\"type\"] + \"\"\n /*insert a input field that will hold the current array item's value:*/\n b.innerHTML += \"\";\n /*execute a function when someone clicks on the item value (DIV element):*/\n b.addEventListener(\"click\", function(e) {\n /*insert the value for the autocomplete text field:*/\n inp.value = this.getElementsByTagName(\"input\")[0].value;\n console.log(inp.value)\n change_search_url()\n /*close the list of autocompleted values,\n (or any other open lists of autocompleted values:*/\n \n });\n a.appendChild(b);\n }\n\n\n function autocomplete(inp, arr) {\n\n\n var onlyFocused = false;\n \n front_tags = [{name: \"backend\", type: \"tag\"}, {name: \"community-manager\", type: \"tag\"}, {name: \"customer-support\", type: \"tag\"}, {name: \"design\", type: \"tag\"}, {name: \"front-end\", type: \"tag\"}, {name: \"full-stack\", type: \"tag\"}, {name: \"intern\", type: \"tag\"}, {name: \"marketing\", type: \"tag\"}, {name: \"mobile\", type: \"tag\"}, {name: \"non-tech\", type: \"tag\"}, {name: \"product-manager\", type: \"tag\"}, {name: \"sales\",type: \"tag\"}]\n\n all_tags = arr\n\n /*the autocomplete function takes two arguments,\n the text field element and an array of possible autocompleted values:*/\n var currentFocus;\n /*execute a function when someone writes in the text field:*/\n inp.addEventListener(\"focus\", function(e) {\n \n onlyFocused = true;\n\n var a, b, i, val = this.value;\n \n /*close any already open lists of autocompleted values*/\n closeAllLists();\n currentFocus = -1;\n /*create a DIV element that will contain the items (values):*/\n a = document.createElement(\"DIV\");\n a.setAttribute(\"id\", this.id + \"autocomplete-list\");\n a.setAttribute(\"class\", \"autocomplete-items\");\n /*append the DIV element as a child of the autocomplete container:*/\n this.parentNode.appendChild(a);\n\n arr = front_tags\n\n for (i = 0; i < arr.length; i++) {\n /*check if the item starts with the same letters as the text field value:*/\n\n var el = arr[i]\n create_search_div(el, a,b,val, inp)\n }\n })\n\n inp.addEventListener(\"input\", function(e) {\n\n var a, b, i, val = this.value;\n onlyFocused = false;\n \n /*close any already open lists of autocompleted values*/\n closeAllLists();\n if (!val) {\n \n onlyFocused = true;\n \n }\n currentFocus = -1;\n /*create a DIV element that will contain the items (values):*/\n a = document.createElement(\"DIV\");\n a.setAttribute(\"id\", this.id + \"autocomplete-list\");\n a.setAttribute(\"class\", \"autocomplete-items\");\n /*append the DIV element as a child of the autocomplete container:*/\n this.parentNode.appendChild(a);\n /*for each item in the array...*/\n\n if (onlyFocused) {\n arr = front_tags\n } else{\n arr = all_tags\n }\n\n for (i = 0; i < arr.length; i++) {\n /*check if the item starts with the same letters as the text field value:*/\n\n var el = arr[i]\n\n if (onlyFocused) {\n create_search_div(el, a,b,val, inp)\n \n } else {\n if (el[\"name\"].substr(0, val.length).toUpperCase() == val.toUpperCase()) {\n create_search_div(el, a,b,val, inp)\n }\n }\n }\n\n if(document.getElementById(\"myInputautocomplete-list\").childElementCount < 1) {\n inp.style.color = \"red\"\n } else {\n inp.style.color = \"white\"\n }\n });\n /*execute a function presses a key on the keyboard:*/\n inp.addEventListener(\"keydown\", function(e) {\n var x = document.getElementById(this.id + \"autocomplete-list\");\n if (x) x = x.getElementsByTagName(\"div\");\n if (e.keyCode == 40) {\n /*If the arrow DOWN key is pressed,\n increase the currentFocus variable:*/\n currentFocus++;\n /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode == 38) { //up\n /*If the arrow UP key is pressed,\n decrease the currentFocus variable:*/\n currentFocus--;\n /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode == 13) {\n /*If the ENTER key is pressed, prevent the form from being submitted,*/\n e.preventDefault();\n if (currentFocus > -1) {\n /*and simulate a click on the \"active\" item:*/\n if (x) x[currentFocus].click();\n }\n }\n });\n\n function addActive(x) {\n /*a function to classify an item as \"active\":*/\n if (!x) return false;\n /*start by removing the \"active\" class on all items:*/\n removeActive(x);\n if (currentFocus >= x.length) currentFocus = 0;\n if (currentFocus < 0) currentFocus = (x.length - 1);\n /*add class \"autocomplete-active\":*/\n x[currentFocus].classList.add(\"autocomplete-active\");\n }\n\n function removeActive(x) {\n /*a function to remove the \"active\" class from all autocomplete items:*/\n for (var i = 0; i < x.length; i++) {\n x[i].classList.remove(\"autocomplete-active\");\n }\n }\n\n function closeAllLists(elmnt) {\n /*close all autocomplete lists in the document,\n except the one passed as an argument:*/\n var x = document.getElementsByClassName(\"autocomplete-items\");\n for (var i = 0; i < x.length; i++) {\n if (elmnt != x[i] && elmnt != inp) {\n x[i].parentNode.removeChild(x[i]);\n }\n }\n }\n /*execute a function when someone clicks in the document:*/\n document.addEventListener(\"click\", function(e) {\n closeAllLists(e.target);\n });\n }\n\n\n if (document.getElementById(\"myInput\") != null) {\n tags = search_tags\n\n autocomplete(document.getElementById(\"myInput\"), tags);\n\n }\n\n})"],"sourceRoot":""}