You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

114 lines
3.5 KiB

  1. /*
  2. * DokuWiki Bootstrap3 Template: Plugins Hacks!
  3. *
  4. * Home http://dokuwiki.org/template:bootstrap3
  5. * Author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
  6. * License GPL 2 (http://www.gnu.org/licenses/gpl.html)
  7. */
  8. // Semantic Plugin
  9. var $wikilinks = jQuery('article .wikilink1');
  10. if (typeof JSINFO.plugin === 'undefined') {
  11. JSINFO.plugin = {};
  12. }
  13. if (typeof JSINFO.plugin.semantic === 'undefined') {
  14. JSINFO.plugin.semantic = {};
  15. }
  16. if ($wikilinks.length
  17. && JSINFO.plugin.semantic.exposeWebService
  18. && JSINFO.bootstrap3.config.showSemanticPopup) {
  19. $wikilinks.hover(function () {
  20. $wikilinks.popover('destroy');
  21. var $wikilink = jQuery(this),
  22. page_id = $wikilink.attr('title');
  23. // Disable popup for linked tabs/navs items (Bootstrap Wrapper Plugin)
  24. if ($wikilink.parents('.bs-wrap-nav').length) {
  25. return false;
  26. }
  27. if (!page_id) return false;
  28. if (page_id == JSINFO.id) return false; // Self
  29. jQuery.get(
  30. DOKU_BASE + 'doku.php',
  31. {
  32. id: page_id,
  33. do: 'export_xhtmlsummary'
  34. },
  35. function (data) {
  36. var content = '<div class="popover-xhtmlsummary">'
  37. + ' <div class="popover-body">' + data + '</div>'
  38. + ' <div class="popover-footer text-right">'
  39. + ' <a class="btn btn-xs btn-primary" href="' + $wikilink.attr('href') + '">' + page_id + '</a>'
  40. + ' </div>'
  41. + '</div>';
  42. $wikilink.popover({
  43. trigger: 'manual',
  44. html: true,
  45. title: page_id,
  46. content: content,
  47. placement: 'auto left',
  48. }).popover('show');
  49. $wikilink.attr('title', page_id);
  50. }
  51. );
  52. // jQuery.post(
  53. // DOKU_BASE + 'lib/exe/ajax.php',
  54. // { call: 'plugin_semantic', id: page_id },
  55. // function(data) {
  56. // var jsonld = data[0];
  57. // if (! (jsonld.headline && jsonld.description)) return false;
  58. // $wikilink.data('original-title', page_id);
  59. // $wikilink.attr('title', '');
  60. // var title = jsonld.headline;
  61. // var image = ('image' in jsonld) ? [ '<img src="', jsonld.image.url, '" alt="" class="img-responsive" /><br/>' ].join('') : '';
  62. // var description = jQuery.trim(jsonld.description.replace(/\t\*$/, ''))
  63. // .replace(/\*(.*)/g, '<span class="iconify mr-2" data-icon="mdi:circle"></span> $1')
  64. // .replace(/\n/g, "<br/>\n")
  65. // .replace(/\t/g, '&nbsp;');
  66. // var content = [ '<div class="row small"><div class="col-md-12">', image, description, ' ... </div></div>' ].join('');
  67. // $wikilink.popover({
  68. // trigger : 'manual',
  69. // html : true,
  70. // title : title,
  71. // content : content,
  72. // placement : 'auto left',
  73. // }).popover('show');
  74. // $wikilink.attr('title', page_id);
  75. // });
  76. }, function () {
  77. var self = this;
  78. setTimeout(function () {
  79. if (jQuery(self).next('.popover').length && !jQuery(self).next('.popover:hover').length) {
  80. jQuery(self).popover('destroy');
  81. }
  82. }, 300);
  83. });
  84. }