{"version":3,"file":"/pc/common/js/dropdown.js.map","sources":["/pc/common/js/dropdown.js"],"sourcesContent":["/**\n * Created by luojianguo on 2016/7/13.\n */\ndefine([\"ko\",\"jquery\",\"typeJs\",\"common/js/dropdownModel\",\"game\",\"dao\",\"jsonpath\",\"strhelp\"],function(ko,$,typeJs,dropdownModel,game,dao,jsonpath,strhelp){\n var dropdownGameModel = function(params){\n var my = this;\n this.fastNav = ko.observableArray(game.getFastNavWithHot());\n params.list = ko.observableArray(game.getFastNavGameGroup('热门'));\n this.gameList = ko.observableArray(game.getGameList()); //游戏列表\n this.dropdowngameHis = ko.observableArray(dao.getDropDownGameHis());\n\n dropdownModel.call(this,params);\n this.active = ko.observable(\"热门\");\n var onItemSelectedBase = this.onItemSelected;\n this.onItemSelected = function(item,e){ //扩展父类方法\n if(onItemSelectedBase(item,e)){\n dao.saveDropDownGameHis(my.firstKeyText().game_id,my.firstKeyText().game_name);\n }\n };\n\n var onDropDownList = this.openDropdownList;\n this.openDropdownList = function(item,e){\n onDropDownList(item,e);\n this.dropdowngameHis(dao.getDropDownGameHis());\n return true;\n };\n\n this.keyup = function(data,e){\n var text = $(arguments[1].currentTarget).val();\n my.needStopNotifyListChange = true;\n if(!typeJs.isEmpty(text)){\n this.list(game.getGamesByKey(text) || []);\n }else{\n this.list(game.getFastNavGameGroup('热门'));\n }\n };\n\n this.onLetterClick = function(letter,item,e){\n my.list(game.getFastNavGameGroup(letter,'buy'));\n my.active(letter);\n $(e.target).parents('.dropdown').data(\"stopautohidden\",true);//规避字母点击后的隐藏问题\n return false;\n }\n };\n\n var dropdownServerModel = function(params){\n dropdownModel.call(this,params);\n var my = this;\n\n // params.list.subscribe(function (newVal) {\n // //输入框带来的更新忽略对暂存对象 listObj 的操作\n // if(event && event.target && $(event.target).attr('class') == \"form-control\"){\n // return true;\n // }\n // listObj = newVal;\n // return true;\n // });\n\n var queryServer = function(server){\n var ret;\n var queryStr;\n if(typeJs.isNumChar(server)){\n queryStr = strhelp.format(\"$.[?(new RegExp('^{0}.*$').test(@.group_id))]\",server);\n }else{\n queryStr = strhelp.format(\"$.[?(new RegExp('^{0}.*$').test(@.group_name))]\",server);\n }\n ret = jsonpath.parse(listObj,queryStr);\n return ret;\n };\n\n this.keyup = function(data,e){\n var text = $(arguments[1].currentTarget).val();\n if(!typeJs.isEmpty(text)){\n my.list(queryServer(text)||[]);\n }else{\n my.list(listObj);\n }\n };\n\n\n };\n ko.components.register('dropdown', {\n viewModel:dropdownModel,\n template: \"