script.js 760 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. function notes() {
  2. var $link = $('#presentation a');
  3. $link.each(function(){
  4. $(this).click(function(e) {
  5. if ($(this).is('#ressource')) {
  6. e.preventDefault();
  7. var $url = $(this).attr("href");
  8. if ($( ".side_notes" )[0]) {
  9. $( ".side_notes" ).remove();
  10. }
  11. $("<div class='side_notes'/>").insertAfter("article");
  12. ajax($url);
  13. }else{
  14. // nothing
  15. }
  16. });
  17. })
  18. function ajax($url) {
  19. $.ajax({
  20. url: $url,
  21. method: "GET",
  22. dataType:'html',
  23. async: true,
  24. success: function(data) {
  25. $(data).find('article > div:not(.__wrap_side) .__wrapper').appendTo('.side_notes');
  26. },
  27. })
  28. }
  29. }
  30. $( document ).ready(function() {
  31. notes();
  32. });