-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsearch_input.js
10 lines (6 loc) · 6.04 KB
/
search_input.js
1
2
3
4
5
6
7
8
9
10
(function () {if (KXL && KXL.i18n && KXL.i18n.addLocales) {KXL.i18n.addLocales({"searchInput.searchPlaceholder":"Find Players..."});}}());
(function () {var head = document.getElementsByTagName("head")[0];var style = document.createElement("style");style.type = "text/css";style.innerHTML = ".kx-search-input{display:inline-block;width:100%;height:30px;vertical-align:middle;line-height:30px}.kx-search-input .kx-input-wrapper{background:#a9a9a9;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(0%,#a9a9a9),color-stop(100%,#989898)) #a9a9a9,#a9a9a9;background:-webkit-linear-gradient(top,#a9a9a9,#989898) #a9a9a9,#a9a9a9;background:-moz-linear-gradient(top,#a9a9a9,#989898) #a9a9a9,#a9a9a9;background:-o-linear-gradient(top,#a9a9a9,#989898) #a9a9a9,#a9a9a9;background:linear-gradient(top,#a9a9a9,#989898) #a9a9a9,#a9a9a9;display:inline-block;padding:0 5px;width:inherit;border:1px solid #888;line-height:30px;position:relative}.kx-search-input .kx-input-wrapper input::-webkit-input-placeholder{color:#101010}.kx-search-input .kx-input-wrapper input:moz-placeholder{color:#101010}.kx-search-input .kx-input-wrapper input::-moz-placeholder{color:#101010}.kx-search-input .kx-input-wrapper input:-ms-input-placeholder{color:#101010}.kx-search-input .kx-input-wrapper input{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:300px;border:none;font-size:14px;font-family:franklin-gothic-urw-cond,helvetica,sans-serif;background:0 0}.kx-search-input .kx-input-wrapper .kx-game-context-select-region{position:absolute;top:0;left:0;z-index:1000}.kx-search-input .kx-input-wrapper .kx-loader-region{position:absolute;right:15px;top:15px}.kx-search-input-default .kx-search-input .kx-input-wrapper input{padding-left:15px;background-image:url(/modules/common/components/search_input/images/mag-glass.png?1463612477);background-position:left center;background-repeat:no-repeat}.kx-search-input-default .kx-search-input .kx-input-wrapper .kx-game-context-select-region .kx-dropdown-list.kx-game-context-select{height:30px}.kx-search-input-default .kx-search-input .kx-input-wrapper .kx-game-context-select-region .kx-dropdown-list.kx-game-context-select .kx-dropdown-list-panel{width:335px;top:37px;left:-2px}.kx-search-input-game-context .kx-search-input .kx-input-wrapper input{padding-left:45px}";head.appendChild(style);}());
(function () {this.Templates=this.Templates||{},this.Templates["common/components/search_input/search-input"]=Handlebars.template(function(e,s,a,n,i){this.compilerInfo=[4,">= 1.0.0"],a=this.merge(a,e.helpers),i=i||{};var t,l,r="",c=a.helperMissing,p=this.escapeExpression;return r+='<div class="kx-search-input">\n<div class="kx-input-wrapper">\n<div class="kx-game-context-select-region"></div>\n<input type="text" placeholder="'+p((t=a.i18n||s&&s.i18n,l={hash:{},data:i},t?t.call(s,"searchInput.searchPlaceholder",l):c.call(s,"i18n","searchInput.searchPlaceholder",l)))+'" />\n<div class="kx-loader-region"></div>\n</div>\n</div>\n'});}());
/* kxl-deployment-tools 2016-05-18 */
KXL.module("Components.SearchInput",function(a,b){a.Controller={getSearchInput:function(b){return new a.View(b)}},b.reqres.setHandlers({"searchinput:get:view":function(a){return new b.Components.SearchInput.Controller.getSearchInput(a)}})}),KXL.module("Components.SearchInput",function(a,b,c,d,e,f){a.View=b.Components.Layout.extend({template:Templates["common/components/search_input/search-input"],ui:{searchBox:".kx-search-input input[type=text]",searchInputWrapper:".kx-input-wrapper",search:".kx-search"},regions:{loaderRegion:".kx-loader-region",gameContextSelectRegion:".kx-game-context-select-region"},selectorItems:null,gameContextSelector:null,initialize:function(a){var b={gameContextSelect:!0};this.options=f.defaults(a||{},b)},onRender:function(){var a=this;this.options.gameContextSelect?(this._renderGameContextSelectMenu(),this.$el.addClass("kx-search-input-game-context")):this.$el.addClass("kx-search-input-default"),this.ui.searchBox.keyup(function(){a.trigger("search:trigger",a),a.model&&a.options.modelAttr&&a.model.set(a.options.modelAttr,a.ui.searchBox.val())}),this.model&&this.options.modelAttr&&this.listenTo(this.model,"change:"+this.options.modelAttr,function(){this.ui.searchBox.val(this.model.get(this.options.modelAttr))}),this.$el.find("input").placeholder()},_renderGameContextSelectMenu:function(){var a=this,d=new c.Model,e=b.request("static:webgames:entities");this.selectorItems=new c.Collection,this.selectorItems.add({id:b.games.findWhere({commonName:"kxl"}).id,label:"KIXEYE",value:b.games.findWhere({commonName:"kxl"}).id,icon:"/modules/game/images/favicon/kxl.png"}),e.each(function(c){a.selectorItems.add({id:b.games.findWhere({urlName:c.get("urlName")}).id,label:c.get("name"),value:b.games.findWhere({urlName:c.get("urlName")}).id,icon:c.get("contextNavIcon")})}),b.asyncRequest("async:load:module","common/components/dropdown_list").then(function(){a.gameContextSelector=b.request("dropdown:list:new:view",{items:a.selectorItems,modelAttr:"gameId",model:d,noSelectionLabel:"",tooltipPos:b.Components.Tooltip.Positions.left,customClassName:"kx-game-context-select",displaySelectedLabel:!1,showIcons:!0}),a.gameContextSelector.on("changed",function(){a.trigger("context:change",a.gameContextSelector.val())}),a.gameContextSelector.on("show",function(){a.gameContextSelector.val(b.context?b.games.findWhere({urlName:b.context.get("urlName")}).id:a.selectorItems.at(0).id)}),a.gameContextSelector.listenTo(b.appModel,"change:context",function(){a.gameContextSelector.val(b.games.findWhere({urlName:b.context.get("urlName")}).id)}),a.gameContextSelectRegion.show(a.gameContextSelector)})},getAppScope:function(){var a=[];return this.gameContextSelector&&this.gameContextSelector.val()&&a.push(this.gameContextSelector.val()),a},_createLoader:function(){var a=new b.Components.Loader.View({lines:10,length:3,width:2,radius:4,color:"#000",size:"small"});this.loaderRegion.show(a)},showLoader:function(){this.loaderRegion.currentView?this.loaderRegion.$el.show():this._createLoader()},hideLoader:function(){this.loaderRegion.currentView&&this.loaderRegion.$el.hide()}})});
//# sourceMappingURL=search_input.min.js.map