charts-framework
4 days ago
colorpicker
4 days ago
select2
4 days ago
tel
4 days ago
contextmenu.js
4 days ago
currency.js
4 days ago
index.html
4 days ago
jquery-ui.draggable.min.js
4 days ago
jquery-ui.min.js
4 days ago
jquery-ui.sortable.min.js
4 days ago
jquery.fancybox.js
4 days ago
jquery.min.js
4 days ago
sortablelist.js
4 days ago
statuscodes.js
4 days ago
toast.js
4 days ago
utils.js
4 days ago
vap-emparea.js
4 days ago
vikappointments.js
4 days ago
vikappointments.js
90 lines
| 1 | (function($, w) { |
| 2 | 'use strict'; |
| 3 | |
| 4 | w['vapOpenPopup'] = (link) => { |
| 5 | return $.fancybox.open({ |
| 6 | src: link, |
| 7 | type: 'iframe', |
| 8 | opts: { |
| 9 | iframe: { |
| 10 | css: { |
| 11 | width: '95%', |
| 12 | height: '95%', |
| 13 | }, |
| 14 | }, |
| 15 | }, |
| 16 | }); |
| 17 | } |
| 18 | |
| 19 | w['vapOpenModalImage'] = (link, elem) => { |
| 20 | var data = null; |
| 21 | |
| 22 | if (Array.isArray(link)) { |
| 23 | data = []; |
| 24 | // display gallery |
| 25 | for (var i = 0; i < link.length; i++) { |
| 26 | // extract caption |
| 27 | var caption = link[i].split('/').pop(); |
| 28 | var match = caption.match(/(.*?)\.[a-z0-9.]{2,}/i) |
| 29 | |
| 30 | if (match) { |
| 31 | caption = match[1]; |
| 32 | } |
| 33 | |
| 34 | // make caption human readable |
| 35 | caption = caption.replace(/[-_]+/, ' ').split(' ').filter(function(word) { |
| 36 | return word.length ? true : false; |
| 37 | }).map(function(word) { |
| 38 | return word[0].toUpperCase() + word.substr(1); |
| 39 | }).join(' '); |
| 40 | |
| 41 | data.push({ |
| 42 | src: link[i], |
| 43 | type: 'image', |
| 44 | opts : { |
| 45 | caption : caption, |
| 46 | thumb : link[i].replace(/\/media\//, '/media@small/'), |
| 47 | }, |
| 48 | }); |
| 49 | } |
| 50 | } else { |
| 51 | // display single image |
| 52 | data = { |
| 53 | src: link, |
| 54 | type: 'image', |
| 55 | }; |
| 56 | |
| 57 | // find image tag inside the element |
| 58 | let imgTag = elem ? $(elem).find('img') : null; |
| 59 | |
| 60 | if (imgTag) { |
| 61 | data.opts = { |
| 62 | caption: imgTag.data('caption') || imgTag.attr('title'), |
| 63 | }; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return $.fancybox.open(data); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Starting from Joomla 4.0.4 the popover stopped working as |
| 72 | * expected, because the content was no more displayed. In order |
| 73 | * avoid any issues, we need to automatically init the popover |
| 74 | * via javascript according to our needs. |
| 75 | * |
| 76 | * @param string selector |
| 77 | * |
| 78 | * @return void |
| 79 | */ |
| 80 | w['__vikappointments_j40_popover_init'] = (selector) => { |
| 81 | $(selector).each(function() { |
| 82 | $(this).popover({ |
| 83 | trigger: $(this).data('trigger'), |
| 84 | placement: $(this).data('placement'), |
| 85 | html: true, |
| 86 | sanitize: false, |
| 87 | }); |
| 88 | }); |
| 89 | } |
| 90 | })(jQuery, window); |