src/js/widgets/playerWidget.js
author hamidouk
Mon, 14 Nov 2011 17:19:26 +0100
branchrequire-js
changeset 238 6008172a0592
parent 226 d1f0e604bd06
permissions -rw-r--r--
converted all the source files to use the require.js syntax.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
     1
define(["IriSP", "widgets", "util"], function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
     2
  IriSP.PlayerWidget = function(Popcorn, config, Serializer) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
     3
    IriSP.Widget.call(this, Popcorn, config, Serializer);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
     4
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
     5
    this._searchBlockOpen = false;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
     6
    this._searchLastValue = "";
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
     7
  };
115
464e3e892915 forgot an inheritance line.
hamidouk
parents: 109
diff changeset
     8
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
     9
  IriSP.PlayerWidget.prototype = new IriSP.Widget();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    10
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    11
  IriSP.PlayerWidget.prototype.draw = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    12
    var self = this;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    13
    var width = this.width;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    14
    var height = this.height;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    15
    var heightS = this.height-20;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    16
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    17
    var searchBox = Mustache.to_html(IriSP.search_template);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    18
    this.selector.append(searchBox);
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    19
    
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    20
    if (this._config.mode=="radio") {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    21
      var radioPlayer = Mustache.to_html(IriSP.radio_template, {"share_template" : IriSP.share_template});
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    22
      this.selector.append(radioPlayer);		
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    23
      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    24
      // special tricks for IE 7
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    25
      if (IriSP.jQuery.browser.msie == true && IriSP.jQuery.browser.version == "7.0"){
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    26
        //__IriSP.jQuery("#LdtPlayer").attr("margin-top","50px");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    27
        this.selector.children("#Ldt-Root").css("padding-top","25px");			
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    28
      }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    29
    } else if (this._config.mode == "video") {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    30
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    31
      var videoPlayer = Mustache.to_html(IriSP.video_template, {"share_template" : IriSP.share_template, "heightS" : heightS});
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    32
      this.selector.append(videoPlayer);		
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    33
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    34
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    35
    this.selector.children("#Ldt-Annotations").width(width - (75 * 2));
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    36
    this.selector.children("#Ldt-Show-Arrow-container").width(width - (75 * 2));
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    37
    this.selector.children("#Ldt-ShowAnnotation-audio").width(width - 10);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    38
    this.selector.children("#Ldt-ShowAnnotation-video").width(width - 10);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    39
    this.selector.children("#Ldt-SaKeyword").width(width - 10);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    40
    this.selector.children("#Ldt-controler").width(width - 10);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    41
    this.selector.children("#Ldt-Control").attr("z-index", "100");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    42
    this.selector.children("#Ldt-controler").hide();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    43
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    44
    this.selector.children("#Ldt-ShowAnnotation-audio").append(IriSP.annotation_loading_template);	
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    45
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    46
    if(this._config.mode=='radio'){
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    47
      this.selector.children("#Ldt-load-container").attr("width",this.width);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    48
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    49
          
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    50
    this.selector.children("#Ldt-controler").show();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    51
    //__IriSP.jQuery("#Ldt-Root").css('display','visible');
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    52
    this.selector.children("#Ldt-ShowAnnotation").click( function () { 
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    53
       //__IriSP.jQuery(this).slideUp(); 
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    54
    } );
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    55
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    56
    var LdtpPlayerY = this.selector.children("#Ldt-PlaceHolder").attr("top");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    57
    var LdtpPlayerX = this.selector.children("#Ldt-PlaceHolder").attr("left");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    58
      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    59
    // handle clicks by the user on the video.
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    60
    this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater));
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    61
    this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater));
153
43f6de365ed4 general code cleanup.
hamidouk
parents: 151
diff changeset
    62
    
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    63
    this.selector.children("#amount").val(this.selector.children("#slider-range-min").slider("value")+" s");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    64
    this.selector.children(".Ldt-Control1 button:first").button({
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    65
      icons: {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    66
        primary: 'ui-icon-play'
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    67
      },
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    68
      text: false
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    69
    }).click(function() { self.playHandler.call(self); })
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    70
      .next().button({
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    71
      icons: {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    72
        primary: 'ui-icon-seek-next'
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    73
      },
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    74
       text: false
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    75
    });
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    76
    this.selector.children(".Ldt-Control2 button:first").button({
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    77
      icons: {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    78
        primary: 'ui-icon-search'//,
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    79
        //secondary: 'ui-icon-volume-off'
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    80
      },
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    81
      text: false
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    82
    }).click(function() { self.searchButtonHandler.call(self); })
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    83
      .next().button({
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    84
      icons: {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    85
        primary: 'ui-icon-volume-on'
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    86
      },
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    87
       text: false
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    88
    }).click(function() { self.muteHandler.call(self); } );
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    89
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    90
    this.selector.children("#ldt-CtrlPlay").attr( "style", "background-color:#CD21C24;" );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    91
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    92
    this.selector.children("#Ldt-load-container").hide();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    93
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    94
    if( this._config.mode=="radio" & IriSP.jQuery.browser.msie != true ) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    95
      IriSP.jQuery( "#Ldtplayer1" ).attr( "height", "0" );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    96
    }
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    97
153
43f6de365ed4 general code cleanup.
hamidouk
parents: 151
diff changeset
    98
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
    99
  };
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   100
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   101
  /* update the icon of the button - separate function from playHandler
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   102
     because in some cases (for instance, when the user directly clicks on
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   103
     the jwplayer window) we have to change the icon without playing/pausing
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   104
  */
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   105
  IriSP.PlayerWidget.prototype.playButtonUpdater = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   106
    var status = this._Popcorn.media.paused;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   107
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   108
    if ( status == true ){        
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   109
      this.selector.find(".ui-icon-play").css( "background-position", "-16px -160px" );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   110
      this.selector.find("#ldt-CtrlPlay").attr("title", "Play");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   111
    } else {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   112
      this.selector.find(".ui-icon-play").css( "background-position","0px -160px" );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   113
      this.selector.find("#ldt-CtrlPlay").attr("title", "Pause");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   114
    }  
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   115
  };
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   116
202
2e0205ee7ca9 patch to respond to update the player widget when the user clicks directly on
hamidouk
parents: 163
diff changeset
   117
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   118
  IriSP.PlayerWidget.prototype.playHandler = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   119
    var status = this._Popcorn.media.paused;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   120
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   121
    this.playButtonUpdater();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   122
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   123
    if ( status == true ){        
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   124
      this._Popcorn.play();   
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   125
    } else {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   126
      this._Popcorn.pause();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   127
    }  
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   128
  };
202
2e0205ee7ca9 patch to respond to update the player widget when the user clicks directly on
hamidouk
parents: 163
diff changeset
   129
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   130
  IriSP.PlayerWidget.prototype.muteHandler = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   131
    if (!this._Popcorn.muted()) {    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   132
        this._Popcorn.mute(true);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   133
        this.selector.find(" .ui-icon-volume-on ").css("background-position", "-130px -160px");    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   134
      } else {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   135
        this._Popcorn.mute(false);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   136
        this.selector.find( ".ui-icon-volume-on" ).css("background-position", "-144px -160px" );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   137
      }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   138
  };
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   139
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   140
  IriSP.PlayerWidget.prototype.searchButtonHandler = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   141
      var self = this;
145
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   142
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   143
      /* show the search field if it is not shown */
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   144
      if ( this._searchBlockOpen == false ) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   145
        this.selector.find( ".ui-icon-search" ).css( "background-position", "-144px -112px" );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   146
        
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   147
        this.selector.find("#LdtSearch").show(100);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   148
        
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   149
        this.selector.find("#LdtSearchInput").css('background-color','#fff');
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   150
        this.selector.find("#LdtSearchInput").focus();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   151
        this.selector.find("#LdtSearchInput").attr('value', this._searchLastValue);      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   152
        this._Popcorn.trigger("IriSP.search", this._searchLastValue); // trigger the search to make it more natural.
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   153
        
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   154
        this._searchBlockOpen = true;           
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   155
        this.selector.find("#LdtSearchInput").bind('keyup', null, function() { self.searchHandler.call(self); } );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   156
        
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   157
        // tell the world the field is open
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   158
        this._Popcorn.trigger("IriSP.search.open");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   159
        
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   160
    } else {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   161
        this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value');
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   162
        this.selector.find("#LdtSearchInput").attr('value','');
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   163
        this.selector.find(".ui-icon-search").css("background-position","-160px -112px");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   164
        this.selector.find("#LdtSearch").hide(100);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   165
        
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   166
        // unbind the watcher event.
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   167
        this.selector.find("#LdtSearchInput").unbind('keypress set');
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   168
        this._searchBlockOpen = false;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   169
        
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   170
        this._Popcorn.trigger("IriSP.search.closed");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   171
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   172
  };
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   173
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   174
  /* this handler is called whenever the content of the search
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   175
     field changes */
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   176
  IriSP.PlayerWidget.prototype.searchHandler = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   177
    this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value');
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   178
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   179
    // do nothing if the search field is empty, instead of highlighting everything.
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   180
    if (this._searchLastValue == "") {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   181
      this._Popcorn.trigger("IriSP.search.cleared");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   182
    } else {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   183
      this._Popcorn.trigger("IriSP.search", this._searchLastValue);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   184
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   185
  };
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   186
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   187
  /*
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   188
    handler for the IriSP.search.found message, which is sent by some views when they
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   189
    highlight a match.
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   190
  */
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   191
  IriSP.PlayerWidget.prototype.searchMatch = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   192
    this.selector.find("#LdtSearchInput").css('background-color','#e1ffe1');
145
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   193
  }
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   194
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   195
  /* the same, except that no value could be found */
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   196
  IriSP.PlayerWidget.prototype.searchNoMatch = function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   197
    this.selector.find("#LdtSearchInput").css('background-color','#e1ffe1');
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 153
diff changeset
   198
  }
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 226
diff changeset
   199
});