glossary_manual.js.tpl 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. var ajaxRequestUrl = "{{ _p.web }}main/glossary/glossary_ajax_request.php";
  2. var imageSource = "{{ _p.web_main }}" + "inc/lib/javascript/indicator.gif";
  3. var indicatorImage ='<img src="' + imageSource + '" />';
  4. {% if add_ready %}
  5. $(document).ready(function() {
  6. {% endif %}
  7. $("body").on("click", ".glossary", function() {
  8. is_glossary_name = $(this).html();
  9. random_id = Math.round(Math.random()*100);
  10. div_show_id = "div_show_id";
  11. div_content_id = "div_content_id";
  12. $(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
  13. var $target = $(this);
  14. //$("#"+div_show_id).dialog("destroy");
  15. $("#"+div_show_id).dialog({
  16. autoOpen: false,
  17. width: 600,
  18. height: 200,
  19. position: { my: 'left top', at: 'right top', of: $target },
  20. close: function(){
  21. $("div#"+div_show_id).remove();
  22. $("div#"+div_content_id).remove();
  23. }
  24. });
  25. var indicator =
  26. $.ajax({
  27. contentType: "application/x-www-form-urlencoded",
  28. beforeSend: function(result) {
  29. $("div#"+div_content_id).html(indicatorImage);
  30. },
  31. type: "POST",
  32. url: ajaxRequestUrl,
  33. data: "glossary_name="+is_glossary_name,
  34. success: function(data) {
  35. $("div#"+div_content_id).html(data);
  36. $("#"+div_show_id).dialog("open");
  37. }
  38. });
  39. });
  40. {% if add_ready %}
  41. });
  42. {% endif %}