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