Skip to content
Extraits de code Groupes Projets
Valider 6fa071c6 rédigé par marcimat@rezo.net's avatar marcimat@rezo.net
Parcourir les fichiers

Déplacement / renommage d'une fonction JS.

parent 1b7a869d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -74,70 +74,71 @@ function check_reload_page(){ ...@@ -74,70 +74,71 @@ function check_reload_page(){
} }
} }
if (window.jQuery) { /** Choix des différents affichages des documents (grand, en case, en liste courte) */
jQuery(function(){onAjaxLoad(check_reload_page);}); function choix_affichages_documents() {
jQuery(function($) { $('#portfolios h3:not(:has(.affichages))').each(function () {
/** Choix des différents affichages des documents (grand, en case, en liste courte) */ var titre = $(this);
var affichages = function () { var liste = titre.next('.liste_items.documents');
$('#portfolios h3:not(:has(.affichages))').each(function () {
var titre = $(this); var identifiant = liste.attr('id');
var liste = titre.next('.liste_items.documents'); if ($.inArray(identifiant, ['illustrations', 'portfolio', 'documents']) < 0) {
identifiant = null;
var identifiant = liste.attr('id'); }
if ($.inArray(identifiant, ['illustrations', 'portfolio', 'documents']) < 0) {
identifiant = null; titre.append(
} "<div class='affichages'>"
+ "<span class='icone grand on' title='<:medias:affichage_documents_en_grand|attribut_html:>'></span>"
titre.append( + "<span class='icone cases' title='<:medias:affichage_documents_en_cases|attribut_html:>'></span>"
"<div class='affichages'>" + "<span class='icone liste' title='<:medias:affichage_documents_en_liste_compacte|attribut_html:>'></span>"
+ "<span class='icone grand on' title='<:medias:affichage_documents_en_grand|attribut_html:>'></span>" + "</div>"
+ "<span class='icone cases' title='<:medias:affichage_documents_en_cases|attribut_html:>'></span>" );
+ "<span class='icone liste' title='<:medias:affichage_documents_en_liste_compacte|attribut_html:>'></span>"
+ "</div>" var changer_affichage_documents = function (me, bouton, classe) {
); $(me).parent().find('.icone').removeClass('on').end().end().addClass('on');
var liste = $(me).parents('h3').next('.liste_items.documents');
var changer_affichage_documents = function (me, bouton, classe) { liste.removeClass('documents_cases').removeClass('documents_liste');
$(me).parent().find('.icone').removeClass('on').end().end().addClass('on'); if (classe) {
var liste = $(me).parents('h3').next('.liste_items.documents'); liste.addClass(classe);
liste.removeClass('documents_cases').removeClass('documents_liste'); }
if (classe) { if (identifiant) {
liste.addClass(classe); Cookies.set('affichage-' + identifiant, bouton);
} }
if (identifiant) {
Cookies.set('affichage-' + identifiant, bouton); liste.trigger('affichage.documents.change', {
} 'liste': liste,
'icone': me,
liste.trigger('affichage.documents.change', { 'bouton': bouton,
'liste': liste, 'classe': classe
'icone': me,
'bouton': bouton,
'classe': classe
});
};
titre.find('.affichages > .grand').click(function () {
changer_affichage_documents(this, 'grand', null);
});
titre.find('.affichages > .cases').click(function () {
changer_affichage_documents(this, 'cases', 'documents_cases');
});
titre.find('.affichages > .liste').click(function () {
changer_affichage_documents(this, 'liste', 'documents_liste');
});
if (identifiant) {
var defaut = Cookies.get('affichage-' + identifiant);
if (defaut) {
titre.find('.affichages > .' + defaut).trigger('click');
}
}
}); });
};
titre.find('.affichages > .grand').click(function () {
changer_affichage_documents(this, 'grand', null);
});
titre.find('.affichages > .cases').click(function () {
changer_affichage_documents(this, 'cases', 'documents_cases');
});
titre.find('.affichages > .liste').click(function () {
changer_affichage_documents(this, 'liste', 'documents_liste');
});
if (identifiant) {
var defaut = Cookies.get('affichage-' + identifiant);
if (defaut) {
titre.find('.affichages > .' + defaut).trigger('click');
}
} }
affichages(); });
onAjaxLoad(affichages); }
if (window.jQuery) {
jQuery(function($){
onAjaxLoad(check_reload_page);
choix_affichages_documents();
onAjaxLoad(choix_affichages_documents);
}); });
} }
/*]]>*/</script> /*]]>*/</script>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter