1/*------------------------------------------------------------------------ 2# com_nspro - NS Pro 3# ------------------------------------------------------------------------ 4# author Christopher Mavros - Mavrosxristoforos.com 5# copyright Copyright (C) 2008 Mavrosxristoforos.com. All Rights Reserved. 6# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL 7# Websites: https://mavrosxristoforos.com 8# Technical Support: Forum - https://mavrosxristoforos.com/support/forum 9-------------------------------------------------------------------------*/ var nspro_sendingIntervals,nspro_xhr,nspro_isLoading,nspro_grecaptcha_length=0;function loadNewsletter(e,s,t){nspro_loadInfo({task:"ajax."+s,id:e,Itemid:jQuery("#nsl_form input.itemid").val(),t:Math.random()},function(e){try{if(e.hasOwnProperty("error"))nspro_showSnackBar(e.error);else if(e.hasOwnProperty("debug")&&nspro_showSnackBar(e.debug),e.hasOwnProperty("function"))switch(e.function){case"edit":showEditor(e.nsl);break;case"send":sentNewsletter(e);break;case"preview":preview(e.nsl);break;case"load_status":updateStatus(e);break;case"delete":deletedNewsletters(e);break;case"clear_status":clearedStatuses(e)}else nspro_showSnackBar(Joomla.JText._("COM_NSPRO_FRONT_END_NEWSLETTER_MANAGER_UNKNOWN_ERROR_OCCURRED"))}catch(s){console.log(s),console.log(e)}},t)}function saveNewsletter(){Joomla.getOptions("com_nspro").site_nsl_enable_anti_spam>0?nspro_loadInfo({task:"ajax.check_anti_spam",anti_spam_answer:jQuery("#nspro_antispam").val(),nspro_itemid:jQuery("#nsl_form input.itemid").val()},function(e){try{e.hasOwnProperty("error")?nspro_showSnackBar(e.error):(e.hasOwnProperty("debug")&&nspro_showSnackBar(e.debug),e.result?jQuery("#nsl_form").submit():nspro_showSnackBar(Joomla.JText._("COM_NSPRO_FRONT_END_NEWSLETTER_MANAGER_ANTI_SPAM_FAILED")))}catch(s){console.log(s),console.log(e)}}):jQuery("#nsl_form").submit()}function getSelectedNewsletters(e){let s=[],t=document.forms.form_nsl_table.elements;for(let n=0;n<t.length;n++)"checkbox"==t[n].type&&t[n].checked&&s.push(t[n].value);return e&&jQuery('#form_nsl_table input[type="checkbox"]').prop("checked",!1),s}function newsletterSend(){let e=getSelectedNewsletters(!0);1==e.length?(loadNewsletter(e[0],"load_status",!1),nspro_sendingIntervals.hasOwnProperty("nsl"+e[0])&&clearInterval(nspro_sendingIntervals["nsl"+e[0]]),nspro_sendingIntervals["nsl"+e[0]]=setInterval((function(){loadNewsletter(e[0],"load_status",!1)}).bind(e),3e3),loadNewsletter(e[0],"send",!1),nspro_showSnackBar(Joomla.JText._("SENDING_PROCESS_INITIATED"))):nspro_showSnackBar(Joomla.JText._("SELECT_NEWSLETTER_TO_SEND"))}function updateStatus(e){e.hasOwnProperty("nsl")&&e.nsl.hasOwnProperty("id")&&e.hasOwnProperty("status")&&jQuery("#sending_status"+e.nsl.id).html(e.status)}function sentNewsletter(e){e.hasOwnProperty("nsl")&&e.nsl.hasOwnProperty("id")&&e.hasOwnProperty("msg")?(nspro_showSnackBar(e.msg),clearInterval(nspro_sendingIntervals["nsl"+e.nsl.id]),loadNewsletter(e.nsl.id,"load_status",!1)):console.log(e)}function deletedNewsletters(e){if(e.hasOwnProperty("nsls")&&e.hasOwnProperty("msg")){nspro_showSnackBar(e.msg);for(var s=0;s<e.nsls.length;s++)e.nsls[s].hasOwnProperty("id")&&jQuery("#nspro_newsletter_line_"+e.nsls[s].id).remove()}}function clearedStatuses(e){if(e.hasOwnProperty("nsls")&&e.hasOwnProperty("msg")){nspro_showSnackBar(e.msg);for(var s=0;s<e.nsls.length;s++)e.nsls[s].hasOwnProperty("id")&&loadNewsletter(e.nsls[s].id,"load_status",!1)}else console.log(e)}function setMailingLists(e){for(var s=e.split(","),t=document.getElementById("nspro_nsl_lists"),n=0;n<s.length;n++)for(var r=0;r<t.options.length;r++)t.options[r].value==s[n]?t.options[r].selected=!0:t.options[r].selected=!1}function setChecked(e,s){document.getElementById(e+s)&&(document.getElementById(e+s).checked=!0)}function showEditor(e){if(""==e)jQuery("#nspro_nsl_id").val(0),jQuery("#nspro_nsl_fname").val(Joomla.getOptions("com_nspro").site_nsl_defaultFName),jQuery("#nspro_nsl_femail").val(Joomla.getOptions("com_nspro").site_nsl_defaultFEmail),jQuery("#nspro_nsl_replytoemail").val(Joomla.getOptions("com_nspro").site_nsl_defaultReplyToEmail),jQuery("#nspro_nsl_subject").val(""),jQuery("#nspro_nsl_preview_line").val(""),jQuery("#nspro_nsl_is_scheduled").val(0),schedulechange(0),jQuery("#nspro_nsl_scheduledatetime").val(""),jQuery("#nspro_nsl_days_after_subscription").val(""),jQuery("#nspro_nsl_regular_newsletter_interval").val(""),setChecked("nspro_nsl_regular_newsletter_action",0),setEditorContent(Joomla.getOptions("com_nspro").site_nsl_defaultMessage),jQuery("#nspro_nsl_plain_text_message").val(""),setMailingLists(""),jQuery("#nspro_attachments").length&&(jQuery("#nspro_attachments").val(null),jQuery("#nspro-attachments-wrapper .file-list div").html(""));else{jQuery("#nspro_nsl_id").val(e.id),jQuery("#nspro_nsl_fname").val(e.fName),jQuery("#nspro_nsl_femail").val(e.fEmail),jQuery("#nspro_nsl_replytoemail").val(e.replyToEmail),jQuery("#nspro_nsl_subject").val(e.subject),jQuery("#nspro_nsl_preview_line").val(e.preview_line),setEditorContent(e.message),jQuery("#nspro_nsl_plain_text_message").val(e.plain_text_message),setMailingLists(e.mailing_lists?e.mailing_lists:"");let s=e.is_scheduled;if(jQuery("#nspro_nsl_is_scheduled").val(s),schedulechange(s),jQuery("#nspro_nsl_scheduledatetime").val(e.scheduledatetime),jQuery("#nspro_nsl_days_after_subscription").val(e.days_after_subscription),jQuery("#nspro_nsl_regular_newsletter_interval").val(e.regular_newsletter_interval),setChecked("nspro_nsl_regular_newsletter_action",e.regular_newsletter_action),jQuery("#nspro_attachments").length){jQuery("#nspro_attachments").val(null),jQuery("#nspro-attachments-wrapper .file-list div").html("");var t="";if(e.hasOwnProperty("attachments")&&e.attachments.length>0)for(var n=0;n<e.attachments.length;n++)t+='<div class="file existing-file"><div class="filename">'+e.attachments[n]+'</div><div class="file-buttons"><button type="button" class="btn btn-small btn-danger btn-delete-file">×</button></div></div>';jQuery("#nspro-attachments-wrapper .existing-files").html(t),jQuery("#nspro-attachments-wrapper .btn-delete-file").click(function(){var e=jQuery(this).parents(".file"),s=e.find(".filename").text();e.replaceWith('<input type="hidden" name="nspro_attachments_to_delete[]" value="'+s+'"/>')})}}jQuery("#nsproblackbg").fadeIn(200),jQuery("#nspro_newsletter_editor").fadeIn(400)}function setEditorContent(e){Joomla.editors.instances.hasOwnProperty("message")?Joomla.editors.instances.message.setValue(e):nspro_showSnackBar(Joomla.JText._("COM_NSPRO_FRONT_END_NEWSLETTER_MANAGER_NO_EDITOR_FOUND"))}function preview(e){""!=e&&(jQuery("#nspro_preview_from").html(Joomla.JText._("FROM")+": "+e.fName+" ("+e.fEmail+")"),jQuery("#nspro_preview_subject").html(e.subject),jQuery("#nspro_preview_message").html(e.message),jQuery("#nsproblackbg").show(),jQuery("#nspro_newsletter_preview").show())}function hasChanged(){return jQuery("#nsl_form").data("hasChanged")}function closeEditor(e){var s=!0;e&&hasChanged()&&(s=confirm(Joomla.JText._("ARE_YOU_SURE_YOU_WANT_TO_CLOSE_THE_EDITOR"))),s&&(jQuery("#nsproblackbg").hide(),jQuery("#nspro_newsletter_editor").hide(),jQuery("#nspro_newsletter_preview").hide(),jQuery("#nsl_form").data("hasChanged",!1))}function previewSelected(){let e=getSelectedNewsletters(!0);1==e.length?loadNewsletter(e[0],"preview",!0):nspro_showSnackBar(Joomla.JText._("SELECT_NEWSLETTER_TO_PREVIEW"))}function editSelected(){let e=getSelectedNewsletters(!0);1==e.length?loadNewsletter(e[0],"edit",!0):nspro_showSnackBar(Joomla.JText._("SELECT_NEWSLETTER_TO_EDIT"))}function deleteSelected(){let e=getSelectedNewsletters(!0);e.length>0?confirm(Joomla.JText._("ARE_YOU_SURE_DELETE"))&&loadNewsletter(e,"delete",!1):nspro_showSnackBar(Joomla.JText._("SELECT_NEWSLETTER_TO_DELETE"))}function clearSendingStatus(){let e=getSelectedNewsletters(!0);e.length>0?confirm(Joomla.JText._("ARE_YOU_SURE_CLEAR_SENDING_STATUS"))&&loadNewsletter(e,"clear_status",!1):nspro_showSnackBar(Joomla.JText._("SELECT_NEWSLETTER_CLEAR_SENDING_STATUS"))}function schedulechange(e){"1"==e||"7"==e?jQuery("#scheduledatetime_wrapper").show():jQuery("#scheduledatetime_wrapper").hide(),"3"==e?jQuery("#days_after_wrapper").show():jQuery("#days_after_wrapper").hide(),"7"==e?jQuery("#regular_newsletter_wrapper").show():jQuery("#regular_newsletter_wrapper").hide()}function nspro_submit(e){var s=!0;jQuery("#"+e+"_hasCaptcha").length>0&&grecaptcha&&1==jQuery(".g-recaptcha").length&&0==grecaptcha.getResponse().length&&(nspro_showSnackBar(Joomla.JText._("COM_NSPRO_SUBSCRIBE_FORM_PLEASE_COMPLETE_THE_CAPTCHA")),s=!1),s&&(jQuery("#"+e+"_nspro_form").hide(),jQuery("#"+e+"_messages").html(jQuery("#"+e+"_nspro_loading_icon").html()).show(),jQuery.post(Joomla.getOptions("system.paths").base+"/index.php?option=com_nspro&task=ajax.handle_task",jQuery("#"+e+"_nspro_form").serialize()).done((function(s){nspro_handleResponse(e,s)}).bind(e)).fail((function(s){console.log(s),jQuery("#"+e+"_messages").html("").hide(),jQuery("#"+e+"_nspro_form").show(),nspro_showSnackBar(Joomla.JText._("COM_NSPRO_SUBSCRIBE_FORM_AN_ERROR_OCCURRED"))}).bind(e)))}function nspro_handleResponse(e,s){try{if(json_data=JSON.parse(s),console.log(json_data),jQuery("#"+e+"_messages").html("").hide(),"success"==json_data.action){jQuery("#"+e+"_nspro_form_wrapper").html(json_data.success_text);return}if("confirmation_sent"==json_data.action){jQuery("#"+e+"_nspro_form_wrapper").html(json_data.confirmation_sent_text);return}if("redirect"==json_data.action)window.location.assign(json_data.details);else if("error"==json_data.action){if(jQuery("#"+e+"_nspro_form").find("input[data-field-id], textarea[data-field-id], select[data-field-id]").removeClass("nspro_error").each(function(){~json_data.details.indexOf(jQuery(this).data("field-id")+"_error")&&jQuery(this).addClass("nspro_error")}),"undefined"!=typeof grecaptcha){var t=jQuery(".g-recaptcha").length;t<nspro_grecaptcha_length&&(t=nspro_grecaptcha_length);for(var n=0;n<t;n++)grecaptcha.reset(n)}json_data.hasOwnProperty("error_text")?nspro_showSnackBar(json_data.error_text):nspro_showSnackBar(Joomla.JText._("COM_NSPRO_SUBSCRIBE_FORM_PLEASE_FIX_ERRORS"))}jQuery("#"+e+"_nspro_form").show()}catch(r){console.log(r),console.log(s),jQuery("#"+e+"_messages").html("").hide(),jQuery("#"+e+"_nspro_form").show(),nspro_showSnackBar(Joomla.JText._("COM_NSPRO_SUBSCRIBE_FORM_AN_ERROR_OCCURRED"))}}function nspro_loadInfo(e,s,t=!0,n={}){nspro_isLoading=!0,nspro_xhr&&t&&nspro_xhr.abort(),e.option="com_nspro",
9n.url=Joomla.getOptions("system.paths").root+"/index.php",n.data=e,nspro_xhr=jQuery.ajax(n).done(s).always(function(){nspro_isLoading=!1,"undefined"!=typeof nspro_loadingTimeout&&window.clearTimeout(nspro_loadingTimeout),nspro_removeLoadingOverlay()})}function nspro_addLoadingOverlay(){}function nspro_removeLoadingOverlay(){}function nspro_initializeSnackBar(){jQuery("body").append('<div id="nspro_snackbar"><span id="nspro_snackbar_text"> </span> <button type="button" class="nspro_snackbar_button">×</button></div>'),jQuery(".nspro_snackbar_button").click(nspro_hideSnackBar)}jQuery(document).ready(function(){nspro_initializeSnackBar(),jQuery("#nsl_form").length&&(nspro_sendingIntervals={},jQuery(".btn-save-newsletter").click(saveNewsletter),jQuery(".btn-delete-newsletter").click(deleteSelected),jQuery(".btn-edit-newsletter").click(editSelected),jQuery(".btn-new-newsletter").click(function(){showEditor("")}),jQuery(".btn-send-newsletter").click(newsletterSend),jQuery(".btn-clear-status").click(clearSendingStatus),jQuery(".btn-preview-newsletter").click(previewSelected),jQuery(".btn-edit-newsletter-link").click(function(){loadNewsletter(jQuery(this).data("nid"),"edit",!0)}),jQuery(".btn-cancel-edit").click(function(){closeEditor(!0)}),jQuery("#nsproblackbg").click(function(){closeEditor(!0)}),jQuery(".btn-close-preview").click(function(){closeEditor(!1)}),jQuery("#nsl_form").data("hasChanged",!1),jQuery("#nsl_form input, #nsl_form textarea, #nsl_form select").change(function(){jQuery("#nsl_form").data("hasChanged",!0)}),jQuery("#nspro-attachments-wrapper").length&&jQuery("#nspro-attachments-wrapper input").change(function(){for(var e="",s=0;s<this.files.length;s++)e+='<div class="file file-to-upload">'+this.files[s].name+"</div>";jQuery("#nspro-attachments-wrapper .file-list .new-files").html(e)})),jQuery(".nspro_colorbox_wrapper").length&&jQuery(".nspro_lightbox_button").length&&jQuery(".nspro_lightbox_button").each(function(){jQuery(this).colorbox({inline:!0,href:jQuery(this).data("lightboxHref")})}),nspro_grecaptcha_length=jQuery(".g-recaptcha").length});var nspro_shown_snackbars=[],nspro_active_snackbar="";function nspro_showSnackBar(e,s=!1){if(""!=nspro_active_snackbar&&nspro_active_snackbar!=e){window.setTimeout(function(){nspro_showSnackBar(e,s)},4500);return}s&&-1!=nspro_shown_snackbars.indexOf(e)||(jQuery("#nspro_snackbar").addClass("show").find("#nspro_snackbar_text").html(e),window.setTimeout(nspro_hideSnackBar,4e3),nspro_shown_snackbars.push(e),nspro_active_snackbar=e)}function nspro_hideSnackBar(){nspro_active_snackbar="",jQuery("#nspro_snackbar").removeClass("show")}
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.