1/* 2 * jQuery Simple Popup Window Plugin 1.0 3 */ 4 5'use strict'; 6 7(function($) { 8 9 // Tooltip Init 10 var tooltip_position = wpcomment_tooltip_vars.wpcomment_tooltip_position; 11 var tooltip_trigger = wpcomment_tooltip_vars.wpcomment_tooltip_trigger; 12 var tooltip_animation = wpcomment_tooltip_vars.wpcomment_tooltip_animation; 13 var tooltip_maxwidth = wpcomment_tooltip_vars.wpcomment_tooltip_maxwidth; 14 var tooltip_borderclr = wpcomment_tooltip_vars.wpcomment_tooltip_borderclr; 15 var tooltip_bgclr = wpcomment_tooltip_vars.wpcomment_tooltip_bgclr; 16 var tooltip_txtclr = wpcomment_tooltip_vars.wpcomment_tooltip_txtclr; 17 var tooltip_interactive = (wpcomment_tooltip_vars.wpcomment_tooltip_interactive == 'yes') ? true : false; 18 19 const tooltip_options = { 20 contentAsHTML: true, 21 animation: tooltip_animation, 22 theme: 'wpcomment_tooltipster-punk', 23 interactive: tooltip_interactive, 24 trigger: 'custom', 25 position: tooltip_position, 26 maxWidth: tooltip_maxwidth, 27 tooltipBorderColor: tooltip_borderclr, 28 tooltipBGColor: tooltip_bgclr, 29 tooltipContentColor: tooltip_txtclr 30 }; 31 32 if (tooltip_trigger != 'yes') { 33 34 tooltip_options.triggerClose = { 35 mouseleave: true, 36 originClick: true, 37 tap: true, 38 }; 39 40 tooltip_options.triggerOpen = { 41 mouseenter: true, 42 tap: true, 43 }; 44 } 45 else { 46 47 tooltip_options.triggerClose = { 48 click: true, 49 tap: true, 50 }; 51 52 tooltip_options.triggerOpen = { 53 click: true, 54 tap: true, 55 }; 56 } 57 58 $('[data-wpcomment-tooltip~=wpcomment_tooltip]').wpcomment_tooltipster(tooltip_options); 59 60 // Plugin name and prefix 61 var pluginName = 'megapopup'; 62 var prefix = 'wpcomment-popup'; 63 64 $(document).on('click', '[data-model-id]', function(e) { 65 e.preventDefault(); 66 var popup_id = $(this).attr('data-model-id'); 67 68 $('#' + popup_id).megapopup($(this).data()); 69 }); 70 71 // Init Plugin 72 $.fn[pluginName] = function(options) { 73 74 75 var defaults = { 76 backgroundclickevent: true, 77 popupcloseclass: prefix + '-close-js', 78 bodycontroller: prefix + '-open' 79 }; 80 81 //Extend popup options 82 var options = $.extend({}, defaults, options); 83 84 return this.each(function() { 85 86 // Global Variables 87 var modal = $(this), 88 modalBG = $('.' + prefix + '-bg-controler'); 89 90 // Popup background show 91 if (modalBG.length == 0) { 92 modalBG = $('<div class="' + prefix + '-bg-controler" />').appendTo('body'); 93 } 94 95 // open popup 96 modal.bind(prefix + ':open', function() { 97 98 $('body').addClass(options.bodycontroller); 99 modal.css({ 'display': 'block', }); 100 modalBG.fadeIn(); 101 modal.animate({ 102 "top": '0px', 103 "opacity": 1 104 }, 0); 105 106 }); 107 108 // close popup 109 modal.bind(prefix + ':close', function() { 110 111 $('body').removeClass(options.bodycontroller); 112 modalBG.fadeOut(); 113 modal.animate({ 114 "top": '0px', 115 "opacity": 0 116 }, 0, function() { 117 modal.css({ 'display': 'none' }); 118 }); 119 }); 120 121 //Open Modal Immediately 122 modal.trigger(prefix + ':open'); 123 124 // close popup listner 125 var closeButton = $('.' + options.popupcloseclass).bind('click.modalEvent', function(e) { 126 modal.trigger(prefix + ':close'); 127 e.preventDefault(); 128 }); 129 130 // disable backgroundclickevent close 131 if (options.backgroundclickevent) { 132 modalBG.css({ "cursor": "pointer" }) 133 modalBG.bind('click.modalEvent', function() { 134 modal.trigger(prefix + ':close') 135 }); 136 } 137 138 }); 139 } 140 141})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.