1function exit_notifier_leave_now(event) { 2 event.preventDefault(); 3 if (ExitBoxSettings.debugtoconsole) { 4 console.log('exit_notifier_leave_now event: ', event) 5 } 6 const thisevent = event; 7 var clickedObject = jQuery(event.target.id); 8 var urlsnippet = ''; 9 urlsnippet = event.currentTarget.href; 10 if (event.currentTarget.href.length > 40) { 11 urlsnippet = event.currentTarget.href.substr(0, 40) + "..."; 12 } 13 //console.log("urlsnipppet: " + urlsnippet); 14 var finishedbody = ExitBoxSettings.body.replace('{target}',event.currentTarget.href); 15 var finishedtitle = ExitBoxSettings.title.replace('{target}',event.currentTarget.href); 16 var finishedconfirmtext = ExitBoxSettings.GoButtonText; 17 if (ExitBoxSettings.Include_URL === 'on') { 18 finishedconfirmtext = ExitBoxSettings.GoButtonText + ' ' + urlsnippet; 19 } 20 var finishedcanceltext = ExitBoxSettings.CancelButtonText; 21 22 if (jQuery(event.currentTarget).hasClass(ExitBoxSettings.alt_classname)) { 23 finishedbody = ExitBoxSettings.alt_body.replace('{target}',event.currentTarget.href); 24 finishedtitle = ExitBoxSettings.alt_title.replace('{target}',event.currentTarget.href); 25 finishedconfirmtext = ExitBoxSettings.alt_GoButtonText; 26 finishedcanceltext = ExitBoxSettings.alt_CancelButtonText; 27 if (ExitBoxSettings.alt_Include_URL === 'on') { 28 finishedconfirmtext = ExitBoxSettings.alt_GoButtonText + ' ' + urlsnippet; 29 } 30 } 31 if (ExitBoxSettings.activate_custom_content === 'on') { 32 if (typeof jQuery(event.currentTarget).attr('exit-notifier-title') !== 'undefined') { 33 finishedtitle = jQuery(event.currentTarget).attr('exit-notifier-title').replace('{target}',event.currentTarget.href); 34 } 35 if (typeof jQuery(event.currentTarget).attr('exit-notifier-body') !== 'undefined') { 36 finishedbody = jQuery(event.currentTarget).attr('exit-notifier-body').replace('{target}',event.currentTarget.href); 37 } 38 } 39 if (ExitBoxSettings.enable_timeout === 'on') { 40 if (ExitBoxSettings.enable_progressbar === 'on') { 41 finishedbody = finishedbody + '<progress value="0" max="' + ExitBoxSettings.timeout_seconds + '" id="ExitNotifierProgressBar" style="width: 100%"></progress>'; 42 } 43 else { 44 finishedbody = finishedbody + '<progress value="0" max="' + ExitBoxSettings.timeout_seconds + '" id="ExitNotifierProgressBar" style="width: 0px;height: 0px;"></progress>'; 45 } 46 if (ExitBoxSettings.timeout_statement === 'on') { 47 var initialstatement = ''; 48 if (ExitBoxSettings.continue_or_cancel === 'continue') { 49 initialstatement = ExitBoxSettings.timeout_text_continue.replace('{seconds}', ExitBoxSettings.timeout_seconds); 50 } 51 else { 52 initialstatement = ExitBoxSettings.timeout_text_cancel.replace('{seconds}', ExitBoxSettings.timeout_seconds); 53 } 54 finishedbody = finishedbody + '<br><p style="text-align: center;" id="continueorcancelcountdown">' + initialstatement + '</p>'; 55 } 56 else { 57 finishedbody = finishedbody + '<progress value="0" max="' + ExitBoxSettings.timeout_seconds + '" id="ExitNotifierProgressBar" style="width: 0px;height: 0px;"></progress>'; 58 } 59 } 60 var countdownTimer = '' 61 var blurbackground = false; 62 if (ExitBoxSettings.blurbackground === 'on') { 63 blurbackground = true; 64 } 65 if (ExitBoxSettings.sa2_or_jAlert === 'sa2') { 66 Swal.fire({ 67 'title': finishedtitle, 68 'html': finishedbody, 69 'confirmButtonText': finishedconfirmtext, 70 'cancelButtonText': finishedcanceltext, 71 'showCancelButton': true, 72 'width': "50%" 73 }).then(function(result) { 74 if (result.value) { 75 let clickTarget = ''; 76 if (typeof(thisevent.currentTarget != 'undefined') && thisevent.currentTarget.target === '_blank') { 77 clickTarget = 'new'; 78 } 79 if (ExitBoxSettings.new_window === 'on' || clickTarget === 'new') { 80 window.open(thisevent.currentTarget.href, 'New Window'); 81 } 82 else { 83 location.href = thisevent.currentTarget.href; 84 } 85 } 86 }); 87 } else { 88 jQuery.jAlert({ 89 'type': 'confirm', 90 'title': finishedtitle, 91 'content': finishedbody, 92 'confirmBtnText': finishedconfirmtext, 93 'denyBtnText': finishedcanceltext, 94 'theme': ExitBoxSettings.theme, 95 'backgroundColor': ExitBoxSettings.backgroundcolor,
96 'blurBackground': blurbackground, 97 'size': ExitBoxSettings.size, 98 'showAnimation': ExitBoxSettings.showAnimation, 99 'hideAnimation': ExitBoxSettings.hideAnimation, 100 'onConfirm': function() { 101 let clickTarget = ''; 102 if (typeof(event.currentTarget != 'undefined') && event.currentTarget.target === '_blank') { 103 clickTarget = 'new'; 104 } 105 if (ExitBoxSettings.new_window === 'on' || clickTarget === 'new') { 106 window.open(event.currentTarget.href, 'New Window'); 107 } 108 else { 109 location.href = event.currentTarget.href; 110 } 111 }, 112 'onDeny': function() { 113 jQuery(clickedObject).focus(); 114 }, 115 'onClose': function() { 116 clearInterval(countdownTimer); 117 } 118 }); 119 } 120 if (ExitBoxSettings.enable_timeout === 'on') { 121 var timeleft = ExitBoxSettings.timeout_seconds; 122 //console.log("Setting " + ExitBoxSettings.timeout_seconds + " seconds timeout on the " + ExitBoxSettings.continue_or_cancel + " button."); 123 if (ExitBoxSettings.continue_or_cancel === 'continue') { 124 countdownTimer = setInterval(function(){ 125 document.getElementById("ExitNotifierProgressBar").value = ExitBoxSettings.timeout_seconds - --timeleft; 126 if (ExitBoxSettings.timeout_statement === 'on') { 127 jQuery("#continueorcancelcountdown").html(ExitBoxSettings.timeout_text_continue.replace('{seconds}',timeleft)); 128 } 129 //console.log(timeleft); 130 if(timeleft <= 0) { 131 clearInterval(countdownTimer); 132 jQuery(".confirmBtn").click(); 133 } 134 },1000); 135 } 136 else if (ExitBoxSettings.continue_or_cancel === 'cancel') { 137 countdownTimer = setInterval(function(){ 138 document.getElementById("ExitNotifierProgressBar").value = ExitBoxSettings.timeout_seconds - --timeleft; 139 if (ExitBoxSettings.timeout_statement === 'on') { 140 jQuery("#continueorcancelcountdown").html(ExitBoxSettings.timeout_text_cancel.replace('{seconds}',timeleft)); 141 } 142 //console.log(timeleft); 143 if(timeleft <= 0) { 144 clearInterval(countdownTimer); 145 jQuery(".denyBtn").click(); 146 } 147 },1000); 148 } 149 } 150 return false; 151}; 152 153function exit_notifier_submit_now(event) { 154 //console.log(event); 155 var formclicked = event.currentTarget; 156 var urlsnippet = ''; 157 var containingform = jQuery(event.currentTarget).parentsUntil('form'); 158 //console.log(containingform); 159 urlsnippet = event.srcElement.form.action; 160 //console.log(urlsnippet); 161 if (event.srcElement.form.action.length > 40) { 162 urlsnippet = event.srcElement.form.action.substr(0, 40) + "..."; 163 } 164 //console.log("urlsnipppet: " + urlsnippet); 165 var finishedbody = ExitBoxSettings.body.replace('{target}',event.srcElement.form.action); 166 var finishedtitle = ExitBoxSettings.title.replace('{target}',event.srcElement.form.action); 167 var finishedconfirmtext = ExitBoxSettings.GoButtonText; 168 if (ExitBoxSettings.Include_URL === 'on') { 169 finishedconfirmtext = ExitBoxSettings.GoButtonText + ' ' + urlsnippet; 170 } 171 var finishedcanceltext = ExitBoxSettings.CancelButtonText; 172 if (jQuery(event.currentTarget).hasClass(ExitBoxSettings.alt_classname)) { 173 finishedbody = ExitBoxSettings.alt_body.replace('{target}',event.srcElement.form.action); 174 finishedtitle = ExitBoxSettings.alt_title.replace('{target}',event.srcElement.form.action); 175 finishedconfirmtext = ExitBoxSettings.alt_GoButtonText; 176 finishedcanceltext = ExitBoxSettings.alt_CancelButtonText; 177 } 178 if (ExitBoxSettings.activate_custom_content === 'on') { 179 if (typeof jQuery(event.currentTarget).attr('exit-notifier-title') !== 'undefined') { 180 finishedtitle = jQuery(event.currentTarget).attr('exit-notifier-title').replace('{target}',event.srcElement.form.action); 181 } 182 if (typeof jQuery(event.currentTarget).attr('exit-notifier-body') !== 'undefined') { 183 finishedbody = jQuery(event.currentTarget).attr('exit-notifier-body').replace('{target}',event.srcElement.form.action); 184 } 185 } 186 if (ExitBoxSettings.enable_timeout === 'on') { 187 if (ExitBoxSettings.enable_progressbar === 'on') { 188 finishedbody = finishedbody + '<progress value="0" max="' + ExitBoxSettings.timeout_seconds + '" id="ExitNotifierProgressBar" style="width: 100%"></progress>'; 189 } 190 else { 191 finishedbody = finishedbody + '<progress value="0" max="' + ExitBoxSettings.timeout_seconds + '" id="ExitNotifierProgressBar" style="width: 0px;height: 0px;"></progress>'; 192 } 193 if (ExitBoxSettings.timeout_statement === 'on') { 194 var initialstatement = ''; 195 if (ExitBoxSettings.continue_or_cancel === 'continue') { 196 initialstatement = ExitBoxSettings.timeout_text_continue.replace('{seconds}', ExitBoxSettings.timeout_seconds); 197 } 198 else {
199 initialstatement = ExitBoxSettings.timeout_text_cancel.replace('{seconds}', ExitBoxSettings.timeout_seconds); 200 } 201 finishedbody = finishedbody + '<br><p style="text-align: center;" id="continueorcancelcountdown">' + initialstatement + '</p>'; 202 } 203 else { 204 finishedbody = finishedbody + '<progress value="0" max="' + ExitBoxSettings.timeout_seconds + '" id="ExitNotifierProgressBar" style="width: 0px;height: 0px;"></progress>'; 205 } 206 } 207 // console.log(finishedbody); 208 // console.log(finishedtitle); 209 // console.log(finishedconfirmtext); 210 // console.log(finishedcanceltext); 211 var countdownTimer = '' 212 var blurbackground = false; 213 if (ExitBoxSettings.blurbackground === 'on') { 214 blurbackground = true; 215 } 216 jQuery.jAlert({ 217 'id': 'exitbox', 218 'type': 'confirm', 219 'title': finishedtitle, 220 'content': finishedbody, 221 'confirmBtnText': finishedconfirmtext, 222 'denyBtnText': finishedcanceltext, 223 'theme': ExitBoxSettings.theme, 224 'backgroundColor': ExitBoxSettings.backgroundcolor, 225 'blurBackground': blurbackground, 226 'size': ExitBoxSettings.size, 227 'showAnimation': ExitBoxSettings.showAnimation, 228 'hideAnimation': ExitBoxSettings.hideAnimation, 229 'onConfirm': function() { 230 jQuery(event.srcElement.form).submit(); 231 }, 232 'onDeny': function(){ 233 event.preventDefault(); 234 }, 235 'onClose': function(){ 236 clearInterval(countdownTimer); 237 } 238 }); 239 if (ExitBoxSettings.enable_timeout === 'on') { 240 var timeleft = ExitBoxSettings.timeout_seconds; 241 if (ExitBoxSettings.continue_or_cancel === 'continue') { 242 countdownTimer = setInterval(function(){ 243 document.getElementById("ExitNotifierProgressBar").value = ExitBoxSettings.timeout_seconds - --timeleft; 244 if (ExitBoxSettings.timeout_statement === 'on') { 245 jQuery("#continueorcancelcountdown").html(ExitBoxSettings.timeout_text_continue.replace('{seconds}',timeleft)); 246 } 247 if(timeleft <= 0) { 248 clearInterval(countdownTimer); 249 jQuery(".confirmBtn").click(); 250 } 251 },1000); 252 } 253 else if (ExitBoxSettings.continue_or_cancel === 'cancel') { 254 countdownTimer = setInterval(function(){ 255 document.getElementById("ExitNotifierProgressBar").value = ExitBoxSettings.timeout_seconds - --timeleft; 256 if (ExitBoxSettings.timeout_statement === 'on') { 257 jQuery("#continueorcancelcountdown").html(ExitBoxSettings.timeout_text_cancel.replace('{seconds}',timeleft)); 258 } 259 if(timeleft <= 0) { 260 clearInterval(countdownTimer); 261 jQuery(".denyBtn").click(); 262 } 263 },1000); 264 } 265 } 266 //jQuery.data('dev.ja_body',exitNotifierTimer,countdownTimer); 267 return false; 268}; 269 270function exit_notifier_js(parameters) { 271 if (ExitBoxSettings.debugtoconsole) { 272 console.log('exit_notifier_js parameters: ', parameters) 273 } 274 let urlsnippet = ''; 275 const thisparameters = parameters; 276 urlsnippet = parameters.href; 277 if (parameters.href.length > 40) { 278 urlsnippet = parameters.href.substr(0, 40) + "..."; 279 } 280 //console.log("urlsnipppet: " + urlsnippet); 281 var finishedbody = ExitBoxSettings.body.replace('{target}',parameters.href); 282 var finishedtitle = ExitBoxSettings.title.replace('{target}',parameters.href); 283 var finishedconfirmtext = ExitBoxSettings.GoButtonText; 284 if (ExitBoxSettings.Include_URL === 'on') { 285 finishedconfirmtext = ExitBoxSettings.GoButtonText + ' ' + urlsnippet; 286 } 287 var finishedcanceltext = ExitBoxSettings.CancelButtonText; 288 289 if (jQuery(parameters).hasClass(ExitBoxSettings.alt_classname)) { 290 finishedbody = ExitBoxSettings.alt_body.replace('{target}',parameters.href); 291 finishedtitle = ExitBoxSettings.alt_title.replace('{target}',parameters.href); 292 finishedconfirmtext = ExitBoxSettings.alt_GoButtonText; 293 finishedcanceltext = ExitBoxSettings.alt_CancelButtonText; 294 if (ExitBoxSettings.alt_Include_URL === 'on') { 295 finishedconfirmtext = ExitBoxSettings.alt_GoButtonText + ' ' + urlsnippet; 296 } 297 } 298 if (ExitBoxSettings.activate_custom_content === 'on') { 299 if (typeof jQuery(parameters).attr('exit-notifier-title') !== 'undefined') { 300 finishedtitle = jQuery(parameters).attr('exit-notifier-title').replace('{target}',parameters.href); 301 } 302 if (typeof jQuery(parameters).attr('exit-notifier-body') !== 'undefined') { 303 finishedbody = jQuery(parameters).attr('exit-notifier-body').replace('{target}',parameters.href); 304 } 305 } 306 if (ExitBoxSettings.enable_timeout === 'on') { 307 if (ExitBoxSettings.enable_progressbar === 'on') { 308 finishedbody = finishedbody + '<progress value="0" max="' + ExitBoxSettings.timeout_seconds + '" id="ExitNotifierProgressBar" style="width: 100%"></progress>'; 309 } 310 else { 311 finishedbody = finishedbody + '<progress value="0" max="' + ExitBoxSettings.timeout_seconds + '" id="ExitNotifierProgressBar" style="width: 0px;height: 0px;"></progress>'; 312 } 313 if (ExitBoxSettings.timeout_statement === 'on') { 314 var initialstatement = ''; 315 if (ExitBoxSettings.continue_or_cancel === 'continue') { 316 initialstatement = ExitBoxSettings.timeout_text_continue.replace('{seconds}', ExitBoxSettings.timeout_seconds); 317 } 318 else {
319 initialstatement = ExitBoxSettings.timeout_text_cancel.replace('{seconds}', ExitBoxSettings.timeout_seconds); 320 } 321 finishedbody = finishedbody + '<br><p style="text-align: center;" id="continueorcancelcountdown">' + initialstatement + '</p>'; 322 } 323 else { 324 finishedbody = finishedbody + '<progress value="0" max="' + ExitBoxSettings.timeout_seconds + '" id="ExitNotifierProgressBar" style="width: 0px;height: 0px;"></progress>'; 325 } 326 } 327 var countdownTimer = '' 328 var blurbackground = false; 329 if (ExitBoxSettings.blurbackground === 'on') { 330 blurbackground = true; 331 } 332 if (ExitBoxSettings.sa2_or_jAlert === 'sa2') { 333 Swal.fire({ 334 'title': finishedtitle, 335 'html': finishedbody, 336 'confirmButtonText': finishedconfirmtext, 337 'cancelButtonText': finishedcanceltext, 338 'showCancelButton': true, 339 'width': "50%" 340 }).then((swalert) => { 341 if (swalert.value) { 342 // console.log('clicked! ', parameters) 343 let linktarget = '_blank'; 344 if (parameters.target !== undefined) { 345 linktarget = parameters.target; 346 } else { 347 if (ExitBoxSettings.new_window === 'on') { 348 linktarget = '_blank'; 349 } else { 350 linktarget = '_self'; 351 } 352 } 353 if (ExitBoxSettings.debugtoconsole) { 354 console.log('linktarget: ', linktarget) 355 alert('Debug delay so you can check the developer\'s console. Once you dismiss this dialog, the new link will load. ' + 356 'Turn off this alert by turning off the debug option in Exit Notifier settings.') 357 } 358 window.open(parameters.href, linktarget); 359 } 360 }); 361 } else { 362 jQuery.jAlert({ 363 'type': 'confirm', 364 'title': finishedtitle, 365 'content': finishedbody, 366 'confirmBtnText': finishedconfirmtext, 367 'denyBtnText': finishedcanceltext, 368 'theme': ExitBoxSettings.theme, 369 'backgroundColor': ExitBoxSettings.backgroundcolor, 370 'blurBackground': blurbackground, 371 'size': ExitBoxSettings.size, 372 'showAnimation': ExitBoxSettings.showAnimation, 373 'hideAnimation': ExitBoxSettings.hideAnimation, 374 'onConfirm': function() { 375 // console.log('jA clicked! ', parameters) 376 let linktarget = '_blank'; 377 if (parameters.target !== undefined) { 378 linktarget = parameters.target; 379 } else { 380 if (ExitBoxSettings.new_window === 'on') { 381 linktarget = '_blank'; 382 } 383 else { 384 linktarget = '_self'; 385 } 386 } 387 if (ExitBoxSettings.debugtoconsole) { 388 console.log('linktarget: ', linktarget) 389 alert('Debug delay so you can check the developer\'s console. Once you dismiss this dialog, the new link will load. ' + 390 'Turn off this alert by turning off the debug option in Exit Notifier settings.') 391 } 392 window.open(parameters.href, linktarget); 393 }, 394 'onDeny': function() { 395 // jQuery(clickedObject).focus(); 396 }, 397 'onClose': function() { 398 clearInterval(countdownTimer); 399 } 400 }); 401 } 402 if (ExitBoxSettings.enable_timeout === 'on') { 403 var timeleft = ExitBoxSettings.timeout_seconds; 404 //console.log("Setting " + ExitBoxSettings.timeout_seconds + " seconds timeout on the " + ExitBoxSettings.continue_or_cancel + " button."); 405 if (ExitBoxSettings.continue_or_cancel === 'continue') { 406 countdownTimer = setInterval(function(){ 407 document.getElementById("ExitNotifierProgressBar").value = ExitBoxSettings.timeout_seconds - --timeleft; 408 if (ExitBoxSettings.timeout_statement === 'on') { 409 jQuery("#continueorcancelcountdown").html(ExitBoxSettings.timeout_text_continue.replace('{seconds}',timeleft)); 410 } 411 //console.log(timeleft); 412 if(timeleft <= 0) { 413 clearInterval(countdownTimer); 414 jQuery(".confirmBtn").click(); 415 } 416 },1000); 417 } 418 else if (ExitBoxSettings.continue_or_cancel === 'cancel') { 419 countdownTimer = setInterval(function(){ 420 document.getElementById("ExitNotifierProgressBar").value = ExitBoxSettings.timeout_seconds - --timeleft; 421 if (ExitBoxSettings.timeout_statement === 'on') { 422 jQuery("#continueorcancelcountdown").html(ExitBoxSettings.timeout_text_cancel.replace('{seconds}',timeleft)); 423 } 424 //console.log(timeleft); 425 if(timeleft <= 0) { 426 clearInterval(countdownTimer); 427 jQuery(".denyBtn").click(); 428 } 429 },1000); 430 } 431 } 432 return false;
433}; 434 435function stopcountdown() { 436 clearInterval(jQuery.data('dev.ja_body',exitNotifierTimer)); 437 jQuery('#continueorcancelcountdown').toggle( "slow" ); 438} 439 440jQuery(document).ready(function(){ 441 jQuery.noConflict(); 442 jQuery('head').append('<style>.ja_custom {' + ExitBoxSettings.custom_css + '}</style>'); 443 jQuery('head').append('<style>' + ExitBoxSettings.advanced_custom_css + '</style>'); 444 jQuery(function($) { 445 // a href 446 var select_external = 'a[href*="//"]:not([href*="' + ExitBoxSettings.siteroot + '"])'; 447 if (ExitBoxSettings.apply_to_all_offsite_links !== 'on') { 448 select_external = ExitBoxSettings.jquery_selector_field; 449 } 450 select_external = select_external.replace(':', ':not(".' + ExitBoxSettings.css_exclusion_class + '"):'); 451 // DEBUG Output 452 jQuery('head').append('<!-- EN jQuery Selector: ' + select_external + ' -->'); 453 if (ExitBoxSettings.debugtoconsole) { 454 console.log("Exit Notifier jQuery selector: " + select_external); 455 console.log('Exit Notifier Theme: ', ExitBoxSettings.theme); 456 console.log('Exit Notifier alert utility: ', ExitBoxSettings.sa2_or_jAlert); 457 } 458 459 jQuery(select_external).addClass('exitNotifierLink'); 460 if (ExitBoxSettings.addclasses === 'on') { 461 jQuery(select_external).addClass(ExitBoxSettings.classestoadd); 462 } 463 jQuery(document).on( 'click', select_external, exit_notifier_leave_now ); 464 if (ExitBoxSettings.visual === 'on') { 465 jQuery(select_external).append(' <img class="flat" src="' + ExitBoxSettings.siteurl + '/wp-content/plugins/exit-notifier/external-link.png" border=0>'); 466 } 467 if (ExitBoxSettings.relnofollow === 'on') { 468 jQuery(select_external).attr("rel",function() { 469 return "nofollow " + jQuery(this).attr("rel"); 470 }); 471 } 472 // Forms 473 if (ExitBoxSettings.enable_notifier_for_forms === 'on') { 474 var submit_external = 'form[action*="//"]:not([action*="' + ExitBoxSettings.siteroot + '"])'; 475 if (ExitBoxSettings.apply_to_all_offsite_forms !== 'on') { 476 submit_external = ExitBoxSettings.jquery_form_selector_field; 477 } 478 jQuery(submit_external).addClass('exitNotifierForm'); 479 //console.log(submit_external) 480 var formsubmitbutton = jQuery(submit_external).find(':submit'); 481 jQuery(document).on( 'click', formsubmitbutton, exit_notifier_submit_now ); 482 if (ExitBoxSettings.visual === 'on') { 483 jQuery(submit_external).append(' <img class="flat" src="' + ExitBoxSettings.siteurl + '/wp-content/plugins/exit-notifier/external-link.png" border=0>'); 484 } 485 } 486 // Allow a click on the body to stop the countdown 487 //jQuery("div.ja_body").on('click',stopcountdown); 488 }); 489});
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.