glossary_manual.js.tpl 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. var ajaxRequestUrl = "{{ _p.web }}main/glossary/glossary_ajax_request.php?{{ _p.web_cid_query }}";
  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. var $target = $(this);
  13. var title = $target.text();
  14. $(this).append("<div id="+div_show_id+" title="+title+" ><div id="+div_content_id+">&nbsp;</div></div>");
  15. //$("#"+div_show_id).dialog("destroy");
  16. $("#"+div_show_id).dialog({
  17. autoOpen: false,
  18. width: 500,
  19. height: 'auto',
  20. position: { my: 'left top', at: 'right top', of: $target },
  21. close: function(){
  22. $("div#"+div_show_id).remove();
  23. $("div#"+div_content_id).remove();
  24. }
  25. });
  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 %}