365,33 → 365,49 |
} |
|
function gestionBiblio(parent) { |
parent.children('.nom').each(function () { |
html = $(this).html(); |
posCrochetGauche = html.indexOf('['); |
if (posCrochetGauche > 0) { |
nom = html.substr(0, posCrochetGauche); |
biblio = html.substr(posCrochetGauche, html.length); |
$(this).html(nom); |
$('.nom').each(function () { |
if ($(this).children('.plus').length == 0) { |
html = $(this).html(); |
|
imagettePlus = document.createElement('div'); |
$(imagettePlus).addClass('imagettePlus'); |
$(this).prepend($(imagettePlus)); |
// La partie biblio commence au premier crochet ouvrant |
// ou bien au span de la biblio à exclure |
posCrochetGauche = html.indexOf('['); |
if(posCrochetGauche < 0) { |
posCrochetGauche = html.indexOf('<span class="bib_excl">'); |
} |
|
plus = document.createElement('span'); |
$(plus).addClass('plus'); |
$(plus).html(biblio); |
$(plus).hide(); |
|
$(this).click(function() { |
if (!$(this).children('.plus').is(':visible')) { |
$(this).children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins'); |
$(this).children('.plus').css('display', 'inline'); |
} else { |
$(this).children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus'); |
$(this).children('.plus').css('display', 'none'); |
} |
}); |
$(this).append($(plus)); |
if (posCrochetGauche > 0) { |
nom = html.substr(0, posCrochetGauche); |
biblio = html.substr(posCrochetGauche, html.length); |
$(this).html(nom); |
|
imagettePlus = document.createElement('div'); |
$(imagettePlus).addClass('imagettePlus'); |
$(this).prepend($(imagettePlus)); |
|
plus = document.createElement('span'); |
$(plus).addClass('plus'); |
$(plus).html(biblio); |
$(plus).hide(); |
|
$(this).click(function(e) { |
// test pour ne réagir que sur le clic sur le + ou - |
// TODO: fusionner ce bout de code en doublon avec synthese.js |
if($(e.target).hasClass("imagettePlus") || $(e.target).hasClass("imagetteMoins")) { |
if (!$(this).children('.plus').is(':visible')) { |
$(this).children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins'); |
$(this).children('.plus').css('display', 'inline'); |
} else { |
$(this).children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus'); |
$(this).children('.plus').css('display', 'none'); |
} |
} |
|
}); |
|
$(this).append($(plus)); |
|
} |
} |
}); |
} |