1(function ($) { 2 $.fn.ecwd_popup = function (opt) { 3//default params 4 var default_options = { 5 button: '', 6 title: 'Event Details', 7 body_id: '', 8 body_class: '', 9 container_class: '', 10 fillhtml: false, 11 only_open: false, 12 get_ajax_data: function (el) { 13 }, 14 popup_close: function () { 15 }, 16 after_popup_show: function (el) { 17 }, 18 get_el_class: function (el) { 19 } 20 }; 21 for (var key in default_options) { 22 if (opt[key] == undefined) { 23 opt[key] = default_options[key]; 24 } 25 } 26 var params = opt; 27 var el = $(this); 28 el.hide(); 29 params.button.on('click', function (e) { 30 e.preventDefault(); 31 var data = params.get_ajax_data($(this)); 32 if (data) { 33 if (params.fillhtml) { 34 data.html = params.fillhtml.val(); 35 } 36 jQuery.post(ecwd.ajaxurl, data, function (response) { 37 if (response != 0) { 38 open_popup(response); 39 show_gmap(); 40 } 41 }); 42 } else if (params.fillhtml.length > 0 && params.fillhtml) { 43 open_popup(params.fillhtml.val()); 44 } else { 45 open_popup(el.html()); 46 } 47 el.on('click', '.ecwd_close_popup', function () { 48 el.hide(); 49 params.popup_close(el); 50 jQuery('body').removeClass("body-ecwd_open_popup"); 51 }); 52 $(document).keyup(function (e) { 53 if (e.keyCode == 27) { // escape key maps to keycode `27` 54 el.hide(); 55 params.popup_close(el); 56 jQuery('body').removeClass("body-ecwd_open_popup"); 57 } 58 }); 59 }); 60 function open_popup(html) { 61 if (params.only_open == false) { 62 add_popup(html); 63 } 64 jQuery('body').addClass("body-ecwd_open_popup"); 65 el.show(); 66 params.after_popup_show(el); 67 el.addClass('ecwd_popup_el'); 68 } 69 70 function add_popup(html) { 71 var head = get_popup_head(); 72 var body = get_popup_body(html); 73 var popup_html = 74 "<div class='ecwd_popup_back ecwd_open_popup'>" + 75 "<div class='ecwd_popup_container " + params.container_
75class + "'>" + 76 head + body + 77 "</div>" + 78 "</div>"; 79 el.html(popup_html); 80// } 81 } 82 83 84 function get_popup_head() { 85 var popup_head = 86 "<div class='ecwd_popup_head'>" + 87 "<div class='ecwd_popup_title'><h4>" + params.title + "</h4></div>" + 88 "<div class='ecwd_close_popup'><i class='fa fa-times'></i></div>" + 89 "</div>"; 90 return popup_head; 91 } 92 93 function get_popup_body(html) { 94 var body_id = (params.body_id != '') ? "id='" + params.body_id + "'" : ""; 95 var popup_body = "<div " + body_id + " class='ecwd_popup_body " + params.body_class + "'>" + html + "</div>"; 96 return popup_body; 97 } 98 99 100 function show_gmap() { 101 var interval = setInterval(function () { 102 var el = $('.ecwd_popup_container').find('.ecwd-show-map .ecwd_markers'); 103 if (el.html() != "") { 104 ecwd_js_init_call.showMap(); 105 clearInterval(interval); 106 } 107 }, 100); 108 } 109 110 $.fn.ecwd_popup.params = default_options; 111 }; 112}(jQuery)); 113
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.