{"version":3,"sources":["gsa-query-autocomplete.js"],"names":["cback","data","resArr","$","each","results","indx","el","Object","hasOwnProperty","push","name","length","autocomplete","source","w","doc","suggestUrl","ready","makeSuggestReq","url","ajax","dataType","params","callback","format","max","reqUrl","param","keypress","event","query","val","trim","window","document","jQuery"],"mappings":"AAAA,YAAa,SAASA,OAAMC,GAI1B,GAAIC,KACJC,GAAEC,KAAKH,EAAKI,QAAS,SAAUC,EAAMC,GACjB,mBAAPA,IAAsBC,OAAOC,eAAe,SACrDP,EAAOQ,KAAKH,EAAGI,QAGfT,EAAOU,OAAS,GAClBT,EAAE,cAAcU,cAAeC,OAAQZ,KAI3C,SAAWa,EAAGC,EAAKb,GAEjB,GAAIc,GAAa,0CAWjBd,GAAEa,GAAKE,MAAM,WAOX,QAASC,GAAeC,GACtBjB,EAAEkB,MACAD,IAAKA,EACLE,SAAU,UATd,GAAIC,IACFC,SAAU,QACVC,OAAQ,OACRC,IAAK,IAUHC,EAASV,EAAa,IAAMd,EAAEyB,MAAML,GACpChB,EAAKJ,EAAE,aAEXA,GAAE,cAAc0B,SAAS,SAAUC,GACjC,GAAIC,GAAQxB,EAAGyB,MAAMC,MACjBF,GAAMnB,QAAU,GAClBO,EAAeQ,EAAS,MAAQI,QAIrCG,OAAQC,SAAUC","file":"gsa-query-autocomplete.js","sourcesContent":["'use strict';function cback(data) {\n // \"data\" is the returned structure that contains the json.\n // NOTE: it came from jsonp, now \"data\" only contains json, as requested.\n // the rest of this method for example purposes only\n var resArr = [];\n $.each(data.results, function (indx, el) {\n if (typeof el !== 'undefined' && Object.hasOwnProperty('name')) {\n resArr.push(el.name);\n }\n });\n if (resArr.length > 0) {\n $('.gsa-input').autocomplete({ source: resArr });\n }\n}\n\n(function (w, doc, $) {\n // For testing the mock suggest.json file use:\n var suggestUrl = 'http://gweb.blackprivet.com:3000/suggest';\n // For using the production url add the correct host information and\n // path to the /suggest service.\n //var suggestUrl = '/suggest'\n /*******\r\n ** Other parameters include:\r\n ** callback : name of the callback. In my test, it is cback.\r\n ** client : default_frontend\r\n ** format : 'rich' is the type we are using in GSA.\r\n ** max : How many matches to show.\r\n *******/\n $(doc).ready(function () {\n var params = {\n callback: 'cback',\n format: 'rich',\n max: 10 };\n\n\n function makeSuggestReq(url) {\n $.ajax({\n url: url,\n dataType: 'jsonp' });\n\n }\n // Assemble parameters and url:\n var reqUrl = suggestUrl + '?' + $.param(params);\n var el = $('.gsa-input');\n // My test input box\n $('.gsa-input').keypress(function (event) {\n var query = el.val().trim();\n if (query.length >= 1) {\n makeSuggestReq(reqUrl + '&q=' + query);\n }\n });\n });\n})(window, document, jQuery);\n//# sourceMappingURL=gsa-query-autocomplete.js.map\n"]}