1jQuery(function() { 2 3 // Popup 4 jQuery(".popup-content").each(function() { 5 jQuery(this).mCustomScrollbar("update"); 6 }); 7 8 jQuery('.popup-open').unbind(); 9 jQuery('.popup-open').click(function(e) { 10 e.preventDefault(); 11 12 var target = jQuery(this).attr('href'); 13 jQuery(target).show(); 14 15 popup_clear_messages(target); 16 }); 17 18 jQuery('.popup-window-close').unbind(); 19 jQuery('.popup-window-close').click(function(e) { 20 e.preventDefault(); 21 jQuery('.popup').each(function() { jQuery(this).hide(); }); 22 }); 23 24 jQuery('.pop-up').each(function() { 25 var firstPage = true; 26 jQuery(this).find('.popup-page').each(function() { 27 if(!firstPage) 28 jQuery(this).hide(); 29 else { 30 jQuery(this).show(); 31 firstPage = false; 32 } 33 34 jQuery(this).find("input[type='text']").val(''); 35 jQuery(this).find("input[type='email']").val(''); 36 }); 37 }); 38 39 popup_clear_messages(); 40}); 41 42function popup_resize(popup) { 43 44 var is_message_popup = false; 45 46 jQuery(popup).find('.popup-message-box').each(function() { 47 if(jQuery(this).is(':visible')) 48 is_message_popup = true; 49 }); 50 51 if(is_message_popup == false) 52 popup_full_size(popup); 53 else 54 popup_message_size(popup); 55} 56 57function popup_full_size(popup) { 58 59 var popup_height = 0; 60 61 jQuery(popup).find('.popup-content').each(function() { 62 if(jQuery(this).is(':visible')) { 63 jQuery(this).removeAttr('style'); 64 popup_height = parseInt(jQuery(this).outerHeight()); 65 return; 66 } 67 }); 68 69 var window_height = parseInt(jQuery(window).height()); 70 var popup_max_height = window_height * 0.92; 71 var popup_margin_top = 0; 72 var page_padding = parseInt(jQuery(popup).find('.popup-page:first').css('padding-top')) + parseInt(jQuery(popup).find('.popup-page:first').css('padding-bottom')); 73 74 console.log("popup_height: " + popup_height + " | popup_max_height: " + popup_max_height + " | page_padding: " + page_padding); 75 76 if(popup_height > popup_max_height) { 77 popup_margin_top = window_height * 0.08; 78 } 79 else { 80 popup_margin_top = window_height - (page_padding + popup_height); 81 popup_margin_top = popup_margin_top / 2; 82 } 83 84 popup_max_height = popup_max_height - page_padding; 85 86 jQuery(popup).find('.popup-window').css('margin-top', popup_margin_top + 'px'); 87 88 jQuery(popup).find('.popup-content').each(function() { 89 if(jQuery(this).is(':visible')) { 90 jQuery(this).css('max-height', popup_max_height + 'px'); 91 if(popup_height > popup_max_height) 92 jQuery(this).css('padding-right', '2%'); 93 } 94 }); 95} 96 97function popup_message_size(popup) { 98 99 var popup_height = 0; 100 101 jQuery(popup).find('.popup-content').each(function() { 102 if(jQuery(this).is(':visible')) { 103 jQuery(this).removeAttr('style'); 104 popup_height = parseInt(jQuery(this).outerHeight()); 105 return; 106 } 107 }); 108 109 var message_height = parseInt(jQuery(popup).find('.popup-message-box').outerHeight()); 110 var display_height = parseInt(popup_height) + parseInt(message_height); 111 var window_height = parseInt(jQuery(window).height()); 112 var popup_max_height = window_height * 0.92; 113 var popup_margin_top = 0; 114 var page_padding = parseInt(jQuery(popup).find('.popup-page:first').css('padding-top')) + parseInt(jQuery(popup).find('.popup-page:first').css('padding-bottom')); 115 116 if(display_height > popup_max_height) { 117 popup_margin_top = window_height * 0.08; 118 } 119 else { 120 popup_margin_top = window_height - (page_padding + display_height); 121 popup_margin_top = popup_margin_top / 2; 122 } 123 124 popup_max_height = popup_max_height - page_padding; 125 popup_max_height = popup_max_height - message_height; 126 127 jQuery(popup).find('.popup-window').css('margin-top', popup_margin_top + 'px'); 128 129 jQuery(popup).find('.popup-content').each(function() { 130 if(jQuery(this).is(':visible')) { 131 jQuery(this).css('max-height', popup_max_height + 'px'); 132 if(popup_height > popup_max_height) 133 jQuery(this).css('padding-right', '2%'); 134 } 135 }); 136} 137 138function popup_message(popup, title, message) { 139 140 popup_clear_messages(); 141 jQuery(popup).find('.popup').each(function() { 142 if(jQuery(this).is(":visible")) { 143 jQuery(this).find('.popup-message-box').show(); 144 jQuery(this).find('#pop-message').show(); 145 146 jQuery(this).find('#pop-message').find('.popup-message-type-title').html(title); 147 jQuery(this).find('#pop-message').find('.popup-message-type-content').html(message); 148 149 popup_resize(this); 150 } 151 }); 152} 153 154function popup_success_message(popup, title, message) { 155 156 popup_clear_messages();
157 jQuery(popup).find('.popup').each(function() { 158 if(jQuery(this).is(":visible")) { 159 jQuery(this).find('.popup-message-box').show(); 160 jQuery(this).find('#pop-success').show(); 161 162 jQuery(this).find('#pop-success').find('.popup-message-type-title').html(title); 163 jQuery(this).find('#pop-success').find('.popup-message-type-content').html(message); 164 popup_resize(this); 165 } 166 }); 167} 168 169function popup_fail_message(popup, title, message) { 170 171 popup_clear_messages(popup); 172 jQuery(popup).find('.popup').each(function() { 173 if(jQuery(this).is(":visible")) { 174 jQuery(this).find('.popup-message-box').show(); 175 jQuery(this).find('#pop-fail').show(); 176 177 jQuery(this).find('#pop-fail').find('.popup-message-type-title').html(title); 178 jQuery(this).find('#pop-fail').find('.popup-message-type-content').html(message); 179 180 popup_resize(this); 181 } 182 }); 183} 184 185function popup_clear_messages(popup) { 186 187 jQuery('.popup').each(function() { 188 if(jQuery(this).is(":visible")) { 189 jQuery(this).find('.popup-message-box').hide(); 190 jQuery(this).find('#pop-success').hide(); 191 jQuery(this).find('#pop-fail').hide(); 192 jQuery(this).find('#pop-message').hide(); 193 popup_resize(this); 194 return; 195 } 196 }); 197} 198 199 200function pop_animate_progress_bar(bar) { 201 202 jQuery(bar).css('width', '0%'); 203 jQuery(bar).animate({width : "100%"}, 5000, function() { 204 pop_animate_progress_bar(bar); 205 }); 206} 207 208function pop_process_form(element, retry) { 209 if(jQuery(element).hasClass('submitting')) { 210 if(retry) 211 setTimeout(function() { pop_process_form(element, true) }, 1000); 212 return false; 213 } 214 215 var form = jQuery(element).parentsUntil('form').parent('form'); 216 if(!jQuery(form).attr('action')) 217 form = jQuery(element).parent('form'); 218 219 jQuery(element).addClass('submitting'); 220 if(jQuery('#scripts').length == 0) 221 jQuery('<div id="scripts">', {}).appendTo('body'); 222 jQuery('#scripts').html(''); 223 jQuery('<iframe name="script_frame" id="script_frame" src="">', {}).appendTo('#scripts'); 224 225 jQuery(form).attr('target', 'script_frame'); 226 jQuery('#script_frame').load(function() { 227 jQuery(element).removeClass('submitting'); 228 var data = jQuery('#script_frame').contents().find('body').html(); 229 console.log(data); 230 pop_validate_form(form, element, data); 231 }); 232 return true; 233} 234 235function pop_validate_form(form, button, data) { 236 237 var json = ''; 238 var valid_json = true; 239 240 if(data != '') { 241 try { 242 json = eval(data); 243 } 244 catch(e) { 245 if(e instanceof SyntaxError) { 246 alert("[JSON ERROR]:" + e.message + "[From Message]:" + data); 247 valid_json = false; 248 } 249 } 250 } 251 else 252 valid_json = false; 253 254 if(json == '') { 255 valid_json = false; 256 } 257 258 if(valid_json) { 259 popup_clear_messages(form); 260 261 if("Errors" in json) { 262 if(json.Errors.length > 0 && json.Errors[0] != '') { 263 var errors = ''; 264 265 for(var i = 0; i < json.Errors.length; i++) { 266 var element = json.Errors[i].Field; 267 var error = json.Errors[i].Msg; 268 269 if(errors != '') 270 errors = errors + ', '; 271 errors = errors + error; 272 } 273 274 if(errors != '') 275 errors = 'Please enter ' + errors; 276 277 jQuery(form).find('#pp1').show(); 278 jQuery(form).find('#pp2').hide(); 279 popup_fail_message(form, 'Required Fields Missing', errors); 280 return; 281 } 282 } 283 284 if("Warning" in json) { 285 if(json.Warning != "") { 286 jQuery(form).find('#pp1').show(); 287 jQuery(form).find('#pp2').hide(); 288 popup_fail_message(form, 'Error', json.Warning); 289 return; 290 } 291 } 292 293 if("Success" in json) { 294 if(json.Success != "false" && json.Success != false) { 295 jQuery(form).find('#pp3').show(); 296 jQuery(form).find('#pp2').hide(); 297 jQuery(form).find('#pp1').hide(); 298 popup_resize(form); 299 } 300 } 301 } 302 303 jQuery('#script_frame').remove(); 304}
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.