Salve ragazzi, è possibile fare in modo che i due script che posto possano essere uniti?mi spiego, gli script servono per una paginazione di audio o video. solo che volevo capire se era possibile creare una funzione unica che riconosca quando viene cliccato il bottone della paginazine video o quella audio senza fare 2 script uguali come funzione ma diversa per i div ecc..inoltre cosi o va uno o l'altro..posto:
codice:
this.moreVideos = function(obj){
this.paginations.listaVideo = 1;
var qD = $.deparam( getURIQS( obj.attr( 'href' ) ) );
var d = {'action':'getVideos',
'a':this.area.listaVideo,
'n':3,
'page': parseInt( this.paginations.listaVideo+1 ),
'searchText': this.searchText
};
d = $.extend( d, qD );
var request = this.api( { data:d } );
this.html.video_box_area_video = '';
if( !$.isEmptyObject( request ) ){
switch( this.page ){
case 'album':
this.page++;
this.html.video_box_area_video = '';
for( x in request ) {
this.html.video_box_area_video = this.html.video_box_area_video + $('#videoList_tpl').jqote( request[x], '*' );
}
$( this.html.video_box_area_video ).css({display:'none'}).appendTo( '#video_box_area_video' ).fadeIn();
break;
case 'video':
this.page++;
this.html.video_box_area_video = '';
for( x in request ) {
this.html.video_box_area_video = this.html.video_box_area_video + $('#videoList_tpl').jqote( request[x], '*' );
}
$( this.html.video_box_area_video ).css({display:'none'}).appendTo( '#video_box_area_video' ).fadeIn();
break;
}
}
}
///////////MORE AUDIOS///////////////////////////
this.moreAudios = function(obj){
this.paginations.listaAudio = 1;
var qD = $.deparam( getURIQS( obj.attr( 'href' ) ) );
var d = {'action':'getAudios',
'a':this.area.listaAudio,
'n':3,
'page': parseInt( this.paginations.listaAudio+1 ),
'searchText': this.searchText
};
d = $.extend( d, qD );
var request = this.api( { data:d } );
this.html.audio_box_area = '';
if( !$.isEmptyObject( request ) ){
switch( this.page ){
case 'album':
this.page++;
this.html.audio_box_area = '';
for( x in request ) {
this.html.audio_box_area = this.html.audio_box_area + $('#audioList_tpl').jqote( request[x], '*' );
}
$( this.html.audio_box_area ).css({display:'none'}).appendTo( '#audio_box_area' ).fadeIn();
break;
case 'audio':
this.page++;
this.html.audio_box_area = '';
for( x in request ) {
this.html.audio_box_area = this.html.audio_box_area + $('#audioList_tpl').jqote( request[x], '*' );
}
$( this.html.audio_box_area ).css({display:'none'}).appendTo( '#audio_box_area' ).fadeIn();
break;
}
}
}