Changeset 1363221
- Timestamp:
- 03/03/2016 08:43:58 AM (10 years ago)
- Location:
- jheck-chat/tags/1.3
- Files:
-
- 7 edited
-
inc/admin-settings.php (modified) (1 diff)
-
inc/class/template.class.php (modified) (1 diff)
-
inc/functions.php (modified) (3 diffs)
-
inc/process-form.php (modified) (1 diff)
-
inc/shortcodes.php (modified) (2 diffs)
-
inc/shortcodes/s_jcform.php (modified) (1 diff)
-
sources/js/custom-scripts.min.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
jheck-chat/tags/1.3/inc/admin-settings.php
r1363198 r1363221 5 5 * @package Jheck Chat 6 6 */ 7 8 9 7 10 8 new VP_Option(array( -
jheck-chat/tags/1.3/inc/class/template.class.php
r1363198 r1363221 1 1 <?php 2 3 /** 4 * Simple template engine class (use [@tag] tags in your templates). 5 * 6 * @link http://www.broculos.net/ Broculos.net Programming Tutorials 7 * @author Nuno Freitas <[email protected]> 8 * @version 1.0 9 */ 2 /** 3 * Simple template engine class (use [@tag] tags in your templates). 4 * 5 * @link http://www.broculos.net/ Broculos.net Programming Tutorials 6 * @author Nuno Freitas <[email protected]> 7 * @version 1.0 8 */ 10 9 class Template { 11 10 /** -
jheck-chat/tags/1.3/inc/functions.php
r1363198 r1363221 1 1 <?php 2 3 2 /** 4 3 * Functions … … 6 5 * @package Jheck Chat 7 6 */ 8 9 7 /** 10 8 * Retrieve option value … … 112 110 * @since 1.0 113 111 */ 114 wp_enqueue_script( 'jheck_chat-script', JC_URL .'sources/js/custom-scripts.js', array(), '20141105', true );115 //wp_enqueue_script( 'jheck_chat-script', JC_URL .'sources/js/custom-scripts.min.js', array(), '20141105', true );112 // wp_enqueue_script( 'jheck_chat-script', JC_URL .'sources/js/custom-scripts.js', array(), '20141105', true ); 113 wp_enqueue_script( 'jheck_chat-script', JC_URL .'sources/js/custom-scripts.min.js', array(), '20141105', true ); 116 114 wp_enqueue_script( 'jheck_chat-template-script', JC_URL .'template/'.JC_TEMPLATE_NAME.'/jc_template-script.js', array(), '20141105', true ); 117 115 } -
jheck-chat/tags/1.3/inc/process-form.php
r1363198 r1363221 1 1 <?php 2 3 2 /** 4 3 * Process form -
jheck-chat/tags/1.3/inc/shortcodes.php
r1363198 r1363221 1 1 <?php 2 3 2 /** 4 3 * Include all shortcodes here. … … 6 5 * @package Jheck Chat 7 6 */ 8 9 7 /** 10 8 * jheck_chat form -
jheck-chat/tags/1.3/inc/shortcodes/s_jcform.php
r1363198 r1363221 1 1 <?php 2 3 2 /** 4 3 * Shortcode chat form. -
jheck-chat/tags/1.3/sources/js/custom-scripts.min.js
r1363198 r1363221 1 function jheck_chat_error(){console.log("Chat name empty"),jQuery("#jheck_chat_msg-holder").empty(),""==jQuery("#jheck_chat_user").val()&&jQuery("#jheck_chat_msg-holder").fadeIn().append("<b>Chat name required or better to login.</b>").delay(2e3).fadeOut(),""==jQuery("#jheck_chat_message").val()&&jQuery("#jheck_chat_msg-holder").fadeIn().append("<b>Message field is empty.</b>").delay(2e3).fadeOut()}function jheck_chat_submit_form(){jQuery("#jheck_chat_submit i").removeClass("fa-paper-plane").addClass("fa-spinner fa-spin"),jQuery("#jheck_chat_submit").attr("disabled",!0),jQuery.ajax({type:"post",url:"?jheck_chat_send_message",data:jQuery("form#jheck_chat_form").serialize(),contentType:"application/x-www-form-urlencoded",success:function(e){return"success"==e.status?(console.log("Message Sent!"),jQuery("#jheck_chat_message").val(""),jQuery("#jheck_chat_msg-holder").empty(),jQuery("#jheck_chat_submit i").removeClass("fa-spinner fa-spin").addClass("fa-check"),jQuery("#jheck_chat_message").attr("disabled",!1),!1):(console.log(e.status),jQuery("#jheck_chat_msg-holder").empty(),jQuery("#jheck_chat_submit i").removeClass("fa-spinner fa-spin").addClass("fa-paper-plane"),jQuery("#jheck_chat_message").attr("disabled",!1),jQuery("#jheck_chat_msg-holder").append("<b><i class='fa fa-times'> </i> Message sending failed.</b>").fadeIn(),jQuery("#jheck_chat_msg-holder").delay(2e3).fadeOut(),!1)},error:function(e){alert("Something went wrong"),console.log("Something went wrong on process")}})}jQuery(document).ready(function(){jQuery("#jheck_chat_form_messages").animate({scrollTop:5e3},1e3),jQuery("#jc_loading-chat").delay(2e3).slideToggle(),setInterval(function(){jQuery("#jheck_chat-new-count-wrapper").load("?jheck_chat_fetch_new_count #jheck_chat-new-count-total").fadeIn();var e=jQuery("#jheck_chat-old-count").text(),a=jQuery("#jheck_chat-new-count-total").text();a>e&&(jQuery("#jheck_chat_form_messages").load(location.href+" #jheck_chat_message_lists"),jQuery("#jheck_chat-old-new-counter-wrapper").load(location.href+" #jheck_chat-old-new-counter"),jQuery("#jheck_chat_form_messages").delay(1e3).animate({scrollTop:5e3},1e3),console.log("Message refreshed"))},1e3);var e=100;jQuery("#jheck_chat_message-counter").html(e+" characters remaining"),jQuery("#jheck_chat_message").keyup(function(){var a=jQuery("#jheck_chat_message").val().length,t=e-a;jQuery("#jheck_chat_message-counter").html(t+" characters remaining"),-1>=t?jQuery("#jheck_chat_submit").attr("disabled",!0):jQuery("#jheck_chat_submit").attr("disabled",!1)}),jQuery(function(){jQuery("body").on("keydown","#jheck_chat_user",function(e){return 32===e.which&&0===e.target.selectionStart?!1:void 0}),jQuery("body").on("keydown","#jheck_chat_message",function(e){return 32===e.which&&0===e.target.selectionStart?!1:void 0})}),jQuery("#jheck_chat_user").keyup(function(){jQuery("#jheck_chat_msg-holder").empty(),""!=jQuery(this).val()?jQuery(this).val().length>=3&&jQuery(this).val().length<=20?(console.log("Form fields appear"),jQuery("#jheck_chat_message").slideDown(),jQuery("#jheck_chat_message-counter").slideDown(),jQuery("#jheck_chat_submit").slideDown(),jQuery("#jheck_chat_check_to_enter_wrapper").slideDown(),jQuery("#jheck_chat_message").attr("disabled",!1),jQuery("#jheck_chat_submit").attr("disabled",!1),jQuery("#jheck_chat_msg-holder").slideUp()):(console.log("Form fields disappear"),jQuery("#jheck_chat_message").slideUp(),jQuery("#jheck_chat_message-counter").slideUp(),jQuery("#jheck_chat_submit").slideUp(),jQuery("#jheck_chat_check_to_enter_wrapper").slideUp(),jQuery("#jheck_chat_message").attr("disabled",!0),jQuery("#jheck_chat_submit").attr("disabled",!0),jQuery("#jheck_chat_msg-holder").slideDown().append("<b>Minimum of 3 and maximum of 20 letters</b>")):(console.log("Form fields disappear"),jQuery("#jheck_chat_message").slideUp(),jQuery("#jheck_chat_message-counter").slideUp(),jQuery("#jheck_chat_submit").slideUp(),jQuery("#jheck_chat_check_to_enter_wrapper").slideUp(),jQuery("#jheck_chat_message").attr("disabled",!0),jQuery("#jheck_chat_submit").attr("disabled",!0),jQuery("#jheck_chat_msg-holder").slideUp())}),jQuery("#jheck_chat_message").keypress(function(a){a.which<32||(this.value.length==e?a.preventDefault():this.value.length>e&&(this.value=this.value.substring(0,e)))}),jQuery("#jheck_chat_check_to_enter").click(function(){var e=jQuery("#jheck_chat_check_to_enter:checked").val();e?(console.log("Enter to send enabled"),jQuery("#jheck_chat_submit").slideUp()):(console.log("Enter to send disabled"),jQuery("#jheck_chat_submit").slideDown())}),jQuery("#jheck_chat_submit").click(function(){var e=jQuery("#jheck_chat_check_to_enter:checked").val();""!=jQuery("#jheck_chat_user").val()&&""!=jQuery("#jheck_chat_message").val()?e||(jheck_chat_submit_form(),console.log("Message sent via button")):jheck_chat_error()}),jQuery("#jheck_chat_form").keydown(function(e){var a=jQuery("#jheck_chat_check_to_enter:checked").val();a&&13==e.keyCode&&(""!=jQuery("#jheck_chat_user").val()&&""!=jQuery("#jheck_chat_message").val()?(jQuery("#jheck_chat_msg-holder").fadeIn().append('<b><i class="fa fa-spinner fa-spin"></i> Sending message...</b>').delay(2e3).fadeOut(),jheck_chat_submit_form(),console.log("Message sent via enter")):jheck_chat_error())})});1 jQuery(document).ready(function(){var e=jQuery(".jheck_chat_main_wrapper"),a=e.find(".jc_header button"),t=e.find(".jc_message_wrapper"),n=e.find(".jc_form_fields_wrapper"),s=e.find("form"),r=n.find("button"),i=t.find("ul li").last(),o=e.find(".jheck_chat_old_count"),c=100;jQuery(n).find("textarea").on("keyup",function(){var e=jQuery(this).val().length,a=c-e;jQuery(this).next("#jheck_chat_message-counter").text(a+" characters remaining"),-1>=a?(jQuery(r).attr("disabled",!0),jQuery(r.find("i.fa")).removeClass("fa-check").addClass("fa-remove").removeClass("fa-paper-plane")):(jQuery(r).attr("disabled",!1),jQuery(r.find("i.fa")).removeClass("fa-check").removeClass("fa-remove").addClass("fa-paper-plane"))}),jQuery("#jheck_chat_message").keypress(function(e){e.which<32||(this.value.length==c?e.preventDefault():this.value.length>c&&(this.value=this.value.substring(0,c)))}),setInterval(function(){jQuery.ajax({type:"post",url:"?jheck_chat_fetch_new_count",data:"fetch_item=1",contentType:"application/x-www-form-urlencoded",success:function(e){"success"==e.status&&o.text()<e.msg_count&&(o.text(e.msg_count),a.text("* New message - Chat"),jQuery(t.find("#jc_message_wrapper_content")).load(document.location.href+" #jc_message"),jQuery(t.find("ul")).delay(1e3).animate({scrollTop:5e3},1e3))},error:function(a){e.find("#jheck_chat_msg-holder").fadeIn().empty().append("Something went wrong, Cant fetch messages"),console.log("Something went wrong, Cant fetch messages")}})},2e3),jQuery(t).on("scroll",function(){jQuery(this).scrollTop()+jQuery(this).innerHeight()>=jQuery(this)[0].scrollHeight&&a.text("Chat")}),e.find("#jheck_chat_user").on("keyup",function(){jQuery(this).val().length>=3?(e.find("textarea").fadeIn().attr("disabled",!1),r.fadeIn().attr("disabled",!1),e.find("#jheck_chat_msg-holder").fadeOut().empty()):(e.find("textarea").fadeOut().attr("disabled",!0),r.fadeOut().attr("disabled",!0),e.find("#jheck_chat_msg-holder").fadeIn().empty().append("Minimum of 3 characters."))}),jQuery(r).on("click",function(){jQuery(r.find("i.fa")).removeClass("fa-check").removeClass("fa-remove").removeClass("fa-paper-plane").toggleClass("fa-spinner fa-spin"),"submit"==jQuery(this).attr("type")?jQuery.ajax({type:"post",url:"?jheck_chat_send_message",data:"send_message=1&"+s.serialize(),contentType:"application/x-www-form-urlencoded",success:function(a){if("success"==a.status){if(0==i.length)jQuery(t.find("ul")).load(document.location.href+" #jc_message_wrapper").fadeIn();else{var s=a.message.replace(/\r\n|\n|\r/g,"<br />"),c=i.clone().appendTo(t.find("ul"));c.find(".sender-name").html("You"),c.find(".sender-message").html(s),c.find(".chat-date").text("just now")}o.text(a.total_messages),n.find("textarea").val(""),jQuery(r.find("i.fa")).addClass("fa-check").toggleClass("fa-spinner fa-spin"),jQuery(t).animate({scrollTop:jQuery(t.find("ul"))[0].scrollHeight},500)}else"error"==a.status&&(jQuery(r.find("i.fa")).addClass("fa-remove").toggleClass("fa-spinner fa-spin"),e.find("#jheck_chat_msg-holder").fadeIn().empty().append(a.msg))},error:function(e){console.log("Something went wrong, Cant fetch messages")}}):console.log("Invalid submit button")}),jQuery("#jheck_chat_login_button").on("click",function(){jQuery("#jheck_chat_loginform").fadeToggle()})});
Note: See TracChangeset
for help on using the changeset viewer.