src/js/widgets/playerWidget.js
author hamidouk
Wed, 26 Oct 2011 15:19:32 +0200
branchpopcorn-port
changeset 151 dc2ff4c87490
parent 145 b477c9430d36
child 153 43f6de365ed4
permissions -rw-r--r--
some tweaking to make the search function more user-friendly.
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() {
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    11
  var _this = 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") {
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    20
131
44c1170e0044 renames.
hamidouk
parents: 121
diff changeset
    21
		//IriSP.jQuery( "#"+this._config.container ).before(IriSP.search_template);
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    22
		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
    23
    this.selector.append(radioPlayer);		
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    24
    
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    25
		// special tricks for IE 7
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    26
		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
    27
			//LdtSearchContainer
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    28
			//__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
    29
			this.selector.children("#Ldt-Root").css("padding-top","25px");			
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    30
		}
131
44c1170e0044 renames.
hamidouk
parents: 121
diff changeset
    31
	} else if (this._config.mode == "video") {
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
		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
    34
    this.selector.append(videoPlayer);		
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    35
	}
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    36
	
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    37
	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
    38
	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
    39
	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
    40
	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
    41
	this.selector.children("#Ldt-SaKeyword").width(width - 10);
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    42
	this.selector.children("#Ldt-controler").width(width - 10);
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    43
	this.selector.children("#Ldt-Control").attr("z-index", "100");
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    44
	this.selector.children("#Ldt-controler").hide();
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    45
	
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    46
  this.selector.children("#Ldt-ShowAnnotation-audio").append(IriSP.annotation_loading_template);	
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    47
131
44c1170e0044 renames.
hamidouk
parents: 121
diff changeset
    48
	if(this._config.mode=='radio'){
44c1170e0044 renames.
hamidouk
parents: 121
diff changeset
    49
		this.selector.children("#Ldt-load-container").attr("width",this.width);
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    50
	}
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    51
	  		
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    52
  this.selector.children("#Ldt-controler").show();
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    53
  //__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
    54
  this.selector.children("#Ldt-ShowAnnotation").click( function () { 
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    55
     //__IriSP.jQuery(this).slideUp(); 
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    56
  } );
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    57
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    58
  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
    59
  var LdtpPlayerX = this.selector.children("#Ldt-PlaceHolder").attr("left");
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    60
  
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    61
  this.selector.find("#slider-range-min").slider( { //range: "min",
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    62
    value: 0,
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    63
    min: 1,
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    64
    max: this._serializer.currentMedia().meta["dc:duration"]/1000,//1:54:52.66 = 3600+3240+
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    65
    step: 0.1,
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    66
    slide: function(event, ui) {     
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    67
      _this._Popcorn.currentTime(ui.value);
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
    /* change event is similar to slide, but it happens when the slider position is 
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    70
       modified programatically. We use it for unit tests */
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    71
    /*   
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    72
    change: function(event, ui) {     
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    73
      _this._Popcorn.currentTime(ui.value);
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
    */
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    76
  } );
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    77
  
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    78
  this.selector.children("#amount").val(this.selector.children("#slider-range-min").slider("value")+" s");
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    79
  this.selector.children(".Ldt-Control1 button:first").button({
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    80
    icons: {
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    81
      primary: 'ui-icon-play'
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
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    84
  }).click(function() { _this.playHandler.call(_this); })
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    85
    .next().button({
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    86
    icons: {
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    87
      primary: 'ui-icon-seek-next'
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    88
    },
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    89
     text: false
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    90
  });
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
    91
  this.selector.children(".Ldt-Control2 button:first").button({
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    92
    icons: {
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    93
      primary: 'ui-icon-search'//,
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    94
      //secondary: 'ui-icon-volume-off'
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    95
    },
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    96
    text: false
145
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
    97
  }).click(function() { _this.searchButtonHandler.call(_this); })
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
    98
    .next().button({
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
    99
    icons: {
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   100
      primary: 'ui-icon-volume-on'
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   101
    },
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   102
     text: false
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   103
  }).click(function() { _this.muteHandler.call(_this); } );
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   104
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
   105
  this.selector.children("#ldt-CtrlPlay").attr( "style", "background-color:#CD21C24;" );
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   106
  
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
   107
  this.selector.children("#Ldt-load-container").hide();
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   108
  
131
44c1170e0044 renames.
hamidouk
parents: 121
diff changeset
   109
  if( this._config.mode=="radio" & IriSP.jQuery.browser.msie != true ) {
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   110
    IriSP.jQuery( "#Ldtplayer1" ).attr( "height", "0" );
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   111
  }
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   112
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   113
  this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater));
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   114
};
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   115
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   116
IriSP.PlayerWidget.prototype.playHandler = function() {
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   117
  var status = this._Popcorn.media.paused;
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
  if ( status == true ){        
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   120
    this._Popcorn.play();
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
   121
    this.selector.children(".ui-icon-play").css( "background-position", "-16px -160px" );
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
   122
    this.selector.children("#ldt-CtrlPlay").attr("title", "Play");
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   123
  } else {
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   124
    this._Popcorn.pause();
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
   125
    this.selector.children(".ui-icon-play").css( "background-position","0px -160px" );
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
   126
    this.selector.children("#ldt-CtrlPlay").attr("title", "Pause");
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   127
  }  
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   128
};
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   129
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   130
IriSP.PlayerWidget.prototype.muteHandler = function() {
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   131
  if (!this._Popcorn.muted()) {    
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   132
      this._Popcorn.mute(true);
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
   133
      this.selector.children(" .ui-icon-volume-on ").css("background-position", "-130px -160px");    
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   134
    } else {
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   135
      this._Popcorn.mute(false);
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
   136
      this.selector.children( ".ui-icon-volume-on" ).css("background-position", "-144px -160px" );
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   137
    }
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   138
};
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   139
145
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   140
/* updates the slider as time passes */
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   141
IriSP.PlayerWidget.prototype.sliderUpdater = function() {  
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   142
  var currentPosition = this._Popcorn.currentTime();   
121
607f481ef4c3 some refactoring to use this.selector instead of directly using jquery.
hamidouk
parents: 115
diff changeset
   143
	this.selector.find( "#slider-range-min" ).slider( "value", currentPosition);		
98
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   144
};
ed4ac18baf07 broke the widgets.js in multiple files.
hamidouk
parents:
diff changeset
   145
145
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   146
IriSP.PlayerWidget.prototype.searchButtonHandler = function() {
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   147
    var self = this;
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   148
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   149
    /* 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
   150
  	if ( this._searchBlockOpen == false ) {
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   151
      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
   152
      
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   153
      this.selector.find("#LdtSearch").show(100);
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   154
      
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   155
      this.selector.find("#LdtSearchInput").css('background-color','#fff');
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   156
      this.selector.find("#LdtSearchInput").focus();
151
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   157
      this.selector.find("#LdtSearchInput").attr('value', this._searchLastValue);      
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   158
      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
   159
      
145
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   160
      this._searchBlockOpen = true;           
151
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   161
      this.selector.find("#LdtSearchInput").bind('keyup', null, function() { self.searchHandler.call(self); } );
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   162
      
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   163
      // tell the world the field is open
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   164
      this._Popcorn.trigger("IriSP.search.open");
145
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   165
      
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   166
	} else {
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   167
      this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value');
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   168
      this.selector.find("#LdtSearchInput").attr('value','');
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   169
      //IriSP.SearchClean();
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   170
      this.selector.find(".ui-icon-search").css("background-position","-160px -112px");
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   171
      //__IriSP.jQuery("#LdtSearch").animate({height:0},250);
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   172
      this.selector.find("#LdtSearch").hide(100);
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   173
      
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   174
      // unbind the watcher event.
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   175
      this.selector.find("#LdtSearchInput").unbind('keypress set');
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   176
      this._searchBlockOpen = false;
151
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   177
      
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   178
      this._Popcorn.trigger("IriSP.search.closed");
145
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   179
  }
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   180
};
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   181
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   182
/* 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
   183
   field changes */
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   184
IriSP.PlayerWidget.prototype.searchHandler = function() {
151
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   185
145
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   186
  this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value');
b477c9430d36 tests and implementation of the search button for the player.
hamidouk
parents: 131
diff changeset
   187
  this._Popcorn.trigger("IriSP.search", this._searchLastValue);
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() {
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   195
  this.selector.find("#LdtSearchInput").css('background-color','#e1ffe1');
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() {
dc2ff4c87490 some tweaking to make the search function more user-friendly.
hamidouk
parents: 145
diff changeset
   200
  this.selector.find("#LdtSearchInput").css('background-color','#e1ffe1');
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