resultat-recherche.js (2525B)
1 function MRésultatRecherche() { 2 $.extend(this, { 3 objet: null, 4 html: "", 5 score: 0, 6 position: null, 7 mInstanceRecherche: null 8 }); 9 } 10 11 function VRésultatRecherche(vInstanceRechercheParente, position) { 12 var vrr = $('#vue-résultat-recherche').jqote({}).toDom(); 13 vInstanceRechercheParente.ajoutVRésultatRecherche(vrr, position); 14 $.extend(this,vrr); 15 16 this.vTexte = this.find('.résultat-recherche.vTexte'); 17 this.vUid = this.find('.résultat-recherche.vUid'); 18 19 var that = this; 20 this.animAjout = function() { 21 that.addClass("ajout") 22 .delay(2000) 23 .queue(function(next){ 24 that.removeClass("ajout", 1000); 25 next(); 26 }); 27 }; 28 29 this.animSuppression = function() { 30 that.addClass("suppression", 500) 31 .height(that.height) // hauteur fixée 32 .animate({height: 0, opacity: 0}, 500, function() { 33 that.suppression(false); 34 }); 35 }; 36 37 this.suppression = function(anim) { 38 if (anim) { return this.animSuppression(); } 39 this.remove(); 40 } 41 } 42 43 function CRésultatRecherche(mRésultatRecherche, vInstanceRechercheParente) { 44 this.vue = new VRésultatRecherche(vInstanceRechercheParente, mRésultatRecherche.position); 45 this.setModèle = function(mRésultatRecherche) { 46 this.modèle = mRésultatRecherche; 47 this.vue.vTexte.html(this.modèle.html); 48 this.vue.vUid.text(this.modèle.uid); 49 } 50 51 var that = this; 52 this.vue.toggle(function() { 53 var mir = that.modèle.mInstanceRecherche; 54 mir.ajouterRésultatSélection(that); 55 var monde = mir.mRecherche.monde; 56 monde.actionInstanceBloc_mBloc = that.modèle.objet; 57 monde.outilZone = monde.actionInstanceBloc; 58 }, function() { 59 var mir = that.modèle.mInstanceRecherche; 60 mir.supprimerRésultatSélection(that); 61 var monde = mir.mRecherche.monde; 62 monde.actionInstanceBloc_mBloc = null; 63 monde.outilZone = monde.actionAucune; 64 }); 65 66 this.ajoutSélection = function() { 67 this.vue.addClass('sélectionné'); 68 }; 69 70 this.suppressionSélection = function() { 71 this.vue.removeClass('sélectionné'); 72 }; 73 74 this.suppression = function(anim) { 75 that.modèle.mInstanceRecherche.supprimerRésultatSélection(that); 76 that.vue.suppression(anim); 77 } 78 79 this.setModèle(mRésultatRecherche); 80 }