src/widgets/Controller.js
changeset 1033 c20df1c080e6
parent 1013 392ddcd212d7
child 1068 7623f9af9272
equal deleted inserted replaced
1032:74ac0be7655c 1033:c20df1c080e6
     8 IriSP.Widgets.Controller.prototype = new IriSP.Widgets.Widget();
     8 IriSP.Widgets.Controller.prototype = new IriSP.Widgets.Widget();
     9 
     9 
    10 IriSP.Widgets.Controller.prototype.defaults = {
    10 IriSP.Widgets.Controller.prototype.defaults = {
    11     disable_annotate_btn: false,
    11     disable_annotate_btn: false,
    12     disable_search_btn: false,
    12     disable_search_btn: false,
    13     disable_ctrl_f: false
    13     disable_ctrl_f: false,
       
    14     always_show_search: false
    14 };
    15 };
    15 
    16 
    16 IriSP.Widgets.Controller.prototype.template =
    17 IriSP.Widgets.Controller.prototype.template =
    17     '<div class="Ldt-Ctrl">'
    18     '<div class="Ldt-Ctrl">'
    18     + '<div class="Ldt-Ctrl-Left">'
    19     + '<div class="Ldt-Ctrl-Left">'
    25     + '{{^disable_search_btn}}'
    26     + '{{^disable_search_btn}}'
    26     + '<div class="Ldt-Ctrl-button Ldt-Ctrl-SearchBtn Ldt-TraceMe" title="{{l10n.search}}"></div>'
    27     + '<div class="Ldt-Ctrl-button Ldt-Ctrl-SearchBtn Ldt-TraceMe" title="{{l10n.search}}"></div>'
    27     + '<div class="Ldt-Ctrl-spacer"></div>'
    28     + '<div class="Ldt-Ctrl-spacer"></div>'
    28     + '{{/disable_search_btn}}'
    29     + '{{/disable_search_btn}}'
    29     + '<div class="Ldt-Ctrl-Search">'
    30     + '<div class="Ldt-Ctrl-Search">'
    30     + '<input class="Ldt-Ctrl-SearchInput Ldt-TraceMe"></input>'
    31     + '<input placeholder="{{ l10n.search }}" type="search" class="Ldt-Ctrl-SearchInput Ldt-TraceMe"></input>'
    31     + '</div>'
    32     + '</div>'
    32     + '</div>'
    33     + '</div>'
    33     + '<div class="Ldt-Ctrl-Right">'
    34     + '<div class="Ldt-Ctrl-Right">'
    34     + '<div class="Ldt-Ctrl-spacer"></div>'
    35     + '<div class="Ldt-Ctrl-spacer"></div>'
    35     + '<div class="Ldt-Ctrl-Time">'
    36     + '<div class="Ldt-Ctrl-Time">'
   100         _this.player.trigger("CreateAnnotation.toggle");
   101         _this.player.trigger("CreateAnnotation.toggle");
   101     });
   102     });
   102     this.$.find(".Ldt-Ctrl-SearchBtn").click(this.functionWrapper("searchButtonHandler"));
   103     this.$.find(".Ldt-Ctrl-SearchBtn").click(this.functionWrapper("searchButtonHandler"));
   103     
   104     
   104     this.$searchInput.keyup(this.functionWrapper("searchHandler"));
   105     this.$searchInput.keyup(this.functionWrapper("searchHandler"));
       
   106     this.$searchInput.on("search", this.functionWrapper("searchHandler"));
   105   
   107   
   106 	var _volctrl = this.$.find(".Ldt-Ctrl-Volume-Control");
   108 	var _volctrl = this.$.find(".Ldt-Ctrl-Volume-Control");
   107     this.$.find('.Ldt-Ctrl-Sound')
   109     this.$.find('.Ldt-Ctrl-Sound')
   108         .click(this.functionWrapper("muteHandler"))
   110         .click(this.functionWrapper("muteHandler"))
   109         .mouseover(function() {
   111         .mouseover(function() {
   166         _this.$searchInput.css('background-color', "#d62e3a");
   168         _this.$searchInput.css('background-color', "#d62e3a");
   167     });
   169     });
   168     annotations.on("search-cleared", function() {
   170     annotations.on("search-cleared", function() {
   169         _this.hideSearchBlock();
   171         _this.hideSearchBlock();
   170     });
   172     });
   171    
   173     if (_this.always_show_search) {
       
   174         _this.showSearchBlock();
       
   175     }
   172 };
   176 };
   173 
   177 
   174 /* Update the elasped time div */
   178 /* Update the elasped time div */
   175 IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function(_time) {
   179 IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function(_time) {
   176   
   180   
   235     this.$searchInput.css('background-color','#fff');
   239     this.$searchInput.css('background-color','#fff');
   236     this.$searchInput.focus();
   240     this.$searchInput.focus();
   237 };
   241 };
   238 
   242 
   239 IriSP.Widgets.Controller.prototype.hideSearchBlock = function() {
   243 IriSP.Widgets.Controller.prototype.hideSearchBlock = function() {
   240     this.$searchBlock.animate( { width: 0 }, 200);
   244     if (! this.always_show_search) {
       
   245         this.$searchBlock.animate( { width: 0 }, 200);
       
   246     }
   241 };
   247 };
   242 
   248 
   243 /** react to clicks on the search button */
   249 /** react to clicks on the search button */
   244 IriSP.Widgets.Controller.prototype.searchButtonHandler = function() {
   250 IriSP.Widgets.Controller.prototype.searchButtonHandler = function() {
   245     if ( !this.$searchBlock.width() ) {
   251     if ( !this.$searchBlock.width() ) {