diff --git a/core/render_helper.php b/core/render_helper.php index ddfb742..edd0091 100644 --- a/core/render_helper.php +++ b/core/render_helper.php @@ -347,9 +347,8 @@ class render_helper 'MCHAT_ALLOW_DEL' => $mchat_del, 'MCHAT_USER_AVATAR' => $mchat_avatar, 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '', - 'U_USER_IDS' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] != $row['user_id']) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', - 'BOT_USER_ID' => $row['user_id'] != '1', - 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '1' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', + 'MCHAT_IS_POSTER' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] == $row['user_id']) ? true : false, + 'MCHAT_PM' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] != $row['user_id'] && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', 'MCHAT_MESSAGE_EDIT' => $message_edit, 'MCHAT_MESSAGE_ID' => $row['message_id'], 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']), @@ -432,7 +431,7 @@ class render_helper $rows = array_reverse($rows); } - foreach($rows as $row) + foreach($rows as $row_num => $row) { // auth check if ($row['forum_id'] != 0 && !$this->auth->acl_get('f_read', $row['forum_id'])) @@ -471,9 +470,8 @@ class render_helper 'MCHAT_ALLOW_DEL' => $mchat_del, 'MCHAT_USER_AVATAR' => $mchat_avatar, 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '', - 'U_USER_IDS' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] != $row['user_id']) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', - 'BOT_USER_ID' => $row['user_id'] != '1', - 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '1' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', + 'MCHAT_IS_POSTER' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] == $row['user_id']) ? true : false, + 'MCHAT_PM' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] != $row['user_id'] && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', 'MCHAT_MESSAGE_EDIT' => $message_edit, 'MCHAT_MESSAGE_ID' => $row['message_id'], 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']), @@ -783,9 +781,8 @@ class render_helper 'MCHAT_MESSAGE_EDIT' => $message_edit, 'MCHAT_USER_AVATAR' => $mchat_avatar, 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '', - 'U_USER_IDS' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] != $row['user_id']) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', - 'BOT_USER_ID' => $row['user_id'] != '1', - 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '1' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', + 'MCHAT_IS_POSTER' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] == $row['user_id']) ? true : false, + 'MCHAT_PM' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] != $row['user_id'] && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', 'MCHAT_MESSAGE_ID' => $row['message_id'], 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']), 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']), @@ -1008,9 +1005,8 @@ class render_helper 'MCHAT_ALLOW_DEL' => $mchat_del, 'MCHAT_USER_AVATAR' => $mchat_avatar, 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '', - 'U_USER_IDS' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] != $row['user_id']) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', - 'BOT_USER_ID' => $row['user_id'] != '1', - 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '1' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', + 'MCHAT_IS_POSTER' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] == $row['user_id']) ? true : false, + 'MCHAT_PM' => ($row['user_id'] != ANONYMOUS && $this->user->data['user_id'] != $row['user_id'] && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', 'MCHAT_MESSAGE_EDIT' => $message_edit, 'MCHAT_MESSAGE_ID' => $row['message_id'], 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']), @@ -1146,6 +1142,7 @@ class render_helper 'U_MORE_SMILIES' => append_sid("{$this->phpbb_root_path}posting.{$this->phpEx}", 'mode=smilies'), 'U_MCHAT_RULES' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'rules')), 'S_MCHAT_ON_INDEX' => ($this->config['mchat_on_index'] && !empty($this->user->data['user_mchat_index'])) ? true : false, + 'EXT_URL' => generate_board_url() . '/ext/dmzx/mchat/', )); // Return for: \$this->helper->render(filename, lang_title); diff --git a/styles/prosilver/template/mchat.js b/styles/prosilver/template/mchat.js index e9f9b8f..d07c7d2 100644 --- a/styles/prosilver/template/mchat.js +++ b/styles/prosilver/template/mchat.js @@ -31,7 +31,7 @@ jQuery(function($) { }, 1000, "swing"); } if (mChat.pause) { - $("#mChatMessage").bind("keypress", function() { + $("#mChatMessage").on("keypress", function() { clearInterval(mChat.interval); $("#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG").hide(); $("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert"); @@ -90,7 +90,7 @@ jQuery(function($) { } }; testSubject.insertAfter(input); - $(this).bind("keypress blur change submit focus", check); + $(this).on("keypress blur change submit focus", check); }); return this; }; @@ -181,7 +181,7 @@ jQuery(function($) { return false; } var messChars = $("#mChatMessage").val().replace(/ /g, ""); - if (messChars.length > mChat.mssgLngth && mChat.mssgLngth) { + if (mChat.mssgLngth && messChars.length > mChat.mssgLngth) { alert(mChat.mssgLngthLong); return; } @@ -225,7 +225,7 @@ jQuery(function($) { }); }, edit: function(id) { - var message = $("#edit" + id).val(); + var message = $("#mess" + id).data("edit"); apprise(mChat.editInfo, { "textarea": message, "animate": true, @@ -433,6 +433,16 @@ jQuery(function($) { $("#mChatPauseIMG").show(); $("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert"); $("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert"); + }, + entityDecode: function(text) { + var s = decodeURIComponent(text.replace(/\+/g, " ")); + s = s.replace(/</g, "<"); + s = s.replace(/>/g, ">"); + s = s.replace(/:/g, ':'); + s = s.replace(/./g, '.'); + s = s.replace(/&/g, '&'); + s = s.replace(/"/g, '"'); + return s; } }); @@ -465,6 +475,43 @@ jQuery(function($) { $.cookie("mChatNoSound", $(this).is(":checked") ? null : "yes"); }); + $("#mChatmain").on("click", "span.mChatInsertMention", function() { + var $msg = $(this).closest('.mChatHover'); + var username = mChat.entityDecode($msg.data("username")); + var usercolor = $msg.data("usercolor"); + if (usercolor) { + username = "[b][color=" + usercolor + "]" + username + "[/color][/b]"; + } else if (mChat.allowBBCodes) { + username = "[b]" + username + "[/b]"; + } + insert_text("@ " + username + ", "); + }); + + $("#mChatData").on("click", "img.mChatInsertQuote", function() { + var $msg = $(this).closest('.mChatHover'); + var username = mChat.entityDecode($msg.data("username")); + var id = $msg.data("id"); + var quote = mChat.entityDecode($("#mess" + id).data("edit")); + insert_text('[quote="' + username + '"]' + quote + '[/quote]'); + }); + + $("#mChatData").on("click", "img.mChatInsertLike", function() { + var $msg = $(this).closest('.mChatHover'); + var username = mChat.entityDecode($msg.data("username")); + var quote = mChat.entityDecode($msg.data("edit")); + insert_text(mChat.likes + '[quote="' + username + '"]' + quote + "[/quote]"); + }); + + $("#mChatData").on("click", "img.mChatEdit", function() { + var $msg = $(this).closest('.mChatHover'); + mChat.edit($msg.data("id")); + }); + + $("#mChatData").on("click", "img.mChatDelete", function() { + var $msg = $(this).closest('.mChatHover'); + mChat.del($msg.data("id")); + }); + // Apprise 1.5 by Daniel Raftery // http://thrivingkings.com/apprise // @@ -567,14 +614,14 @@ jQuery(function($) { if (!n) { n = false; } - $(".aTextbox").bind("keydown blur", function() { + $(".aTextbox").on("keydown blur", function() { n = $(this).val(); }); var o = $(".aEdit").val(); if (!o) { o = false; } - $(".aEdit").bind("keydown blur", function() { + $(".aEdit").on("keydown blur", function() { o = $(this).val(); }); $(".aButtons > button").click(function() { diff --git a/styles/prosilver/template/mchat.min.js b/styles/prosilver/template/mchat.min.js index 97b4815..e418fc0 100644 --- a/styles/prosilver/template/mchat.min.js +++ b/styles/prosilver/template/mchat.min.js @@ -22,4 +22,4 @@ interval:700 }); **/ -jQuery(function(t){function e(e,a,s){e=''+e+"";var o={confirm:!1,verify:!1,input:!1,textarea:!1,animate:!1,textOk:"Ok",textCancel:"Cancel",textYes:"Yes",textNo:"No",position:"center"};if(a)for(var m in o)"undefined"==typeof a[m]&&(a[m]=o[m]);var n=t(document).height(),h=t(document).width(),i=t('
'),r=t('
'),l=t('
'),u=t('
'),c=300;if(r.css({height:n,width:h}).appendTo("body").fadeIn(100,function(){t(this).css("filter","alpha(opacity=70)")}),i.prependTo("body"),l.append(e).appendTo(i),a&&(a.input&&("string"==typeof a.input?l.append('
'):l.append('
'),t(".aTextbox").focus()),"string"==typeof a.textarea&&(l.append('
"),t(".aEdit").focus())),l.append(u),a?a.confirm||a.input?(u.append('"),u.append('")):a.verify?(u.append('"),u.append('")):u.append('"):u.append(''),i.css("left",(t(window).width()-t(".appriseOuter").width())/2+t(window).scrollLeft()+"px"),a)if(a.position&&"center"===a.position&&(c=(n-i.height())/2),a.animate){var C=a.animate;isNaN(C)&&(C=400),i.css("top","-200px").show().animate({top:c},C)}else i.css("top",c).fadeIn(200);else i.css("top",c).fadeIn(200);t(document).keydown(function(e){r.is(":visible")&&(e.shiftKey&&13==e.keyCode?t(".aEdit").append("
"):13==e.keyCode?t('.aButtons > button[value="ok"]').click():27==e.keyCode&&t('.aButtons > button[value="cancel"]').click())});var d=t(".aTextbox").val();d||(d=!1),t(".aTextbox").bind("keydown blur",function(){d=t(this).val()});var f=t(".aEdit").val();f||(f=!1),t(".aEdit").bind("keydown blur",function(){f=t(this).val()}),t(".aButtons > button").click(function(){if(r.remove(),i.remove(),s){t(this).text("");var e=t(this).attr("value");"ok"==e?(s(a?a.input?d:a.textarea?f:!0:!0),t("#mChatMessage").focus()):"cancel"==e&&(s(!1),t("#mChatMessage").focus())}})}var a=!0;mChat.archiveMode||(mChat.messageTop||t("#mChatmain").animate({scrollTop:t("#mChatmain")[0].scrollHeight},1e3,"swing"),mChat.pause&&t("#mChatMessage").bind("keypress",function(){clearInterval(mChat.interval),t("#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG").hide(),t("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert"),t("#mChatPauseIMG").show()}),t([window,document]).blur(function(){a=!1}).focus(function(){a=!0}),t.fn.preventDoubleSubmit=function(){var e=!1;return t(this).submit(function(){return e?!1:void(e=!0)})},t.fn.autoGrowInput=function(e){var a=t(".mChatPanel").width();return e=t.extend({maxWidth:a-20,minWidth:0,comfortZone:20},e),this.filter("input:text").each(function(){var a=e.minWidth||t(this).width(),s="",o=t(this),m=t("
").css({position:"absolute",top:-9999,left:-9999,width:"auto",fontSize:o.css("fontSize"),fontFamily:o.css("fontFamily"),fontWeight:o.css("fontWeight"),letterSpacing:o.css("letterSpacing"),whiteSpace:"nowrap"}),n=function(){if(s!==(s=o.val())){var t=s.replace(/&/g,"&").replace(/\s/g," ").replace(//g,">");m.html(t);var n=m.width(),h=n+e.comfortZone>=a?n+e.comfortZone:a,i=o.width(),r=i>h&&h>=a||h>a&&h=e&&(e="0"+e),a%=60,9>=a&&(a="0"+a),s%=60,9>=s&&(s="0"+s);var o=s+":"+a+":"+e;t("#mChatSessMess").html(mChat.sessEnds+" "+o),mChat.sessionTime<=0&&(clearInterval(mChat.counter),t("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert"))},clear:function(){if(""===t("#mChatMessage").val())return!1;var e=confirm(mChat.reset);e?(t("#mChatRefreshText").removeClass("mchat-alert"),mChat.pause&&(mChat.interval=setInterval(mChat.refresh,mChat.refreshTime)),t("#mChatOkIMG").show(),t("#mChatLoadIMG,#mChatErrorIMG,#mChatPauseIMG").hide(),t("#mChatRefreshText").html(mChat.refreshYes),t("#mChatMessage").val("").focus()):t("#mChatMessage").focus()},sound:function(e){"yes"!=t.cookie("mChatNoSound")&&(navigator.userAgent.match(/MSIE ([0-9]+)\./)||navigator.userAgent.match(/Trident\/7.0; rv 11.0/)?t("#mChatSound").html(''):t("#mChatSound").html(''))},notice:function(){a&&document.hasFocus()||t.titleAlert(mChat.newMessageAlert,{interval:1e3})},toggle:function(e){t("#mChat"+e).slideToggle("normal",function(){t("#mChat"+e).is(":visible")?t.cookie("mChatShow"+e,"yes"):t("#mChat"+e).is(":hidden")&&t.cookie("mChatShow"+e,null)})},add:function(){if(""===t("#mChatMessage").val())return!1;var e=t("#mChatMessage").val().replace(/ /g,"");return e.length>mChat.mssgLngth&&mChat.mssgLngth?void alert(mChat.mssgLngthLong):void t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:t("#postform").serialize(),dataType:"text",beforeSend:function(){t("#submit_button").attr("disabled","disabled"),mChat.userTimeout&&(clearInterval(mChat.activeInterval),clearInterval(mChat.counter)),clearInterval(mChat.interval)},success:function(){mChat.refresh()},error:function(t){400==t.status?alert(mChat.flood):403==t.status?alert(mChat.noAccess):501==t.status&&alert(mChat.noMessageInput)},complete:function(){t("#mChatNoMessage").remove(),t("#submit_button").removeAttr("disabled"),mChat.interval=setInterval(mChat.refresh,mChat.refreshTime),mChat.userTimeout&&(mChat.sessionTime=mChat.userTimeout?mChat.userTimeout/1e3:!1,mChat.counter=setInterval(mChat.countDown,1e3),mChat.activeInterval=setInterval(mChat.active,mChat.userTimeout)),t("#mChatMessage").val("").focus()}})},edit:function(a){var s=t("#edit"+a).val();e(mChat.editInfo,{textarea:s,animate:!0,position:200,confirm:!0},function(e){e&&t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:{mode:"edit",message_id:a,message:e},dataType:"text",beforeSend:function(){clearInterval(mChat.interval),mChat.userTimeout&&(clearInterval(mChat.activeInterval),clearInterval(mChat.counter),t("#mChatSessTimer").html(mChat.refreshing))},success:function(e){t("#mess"+a).fadeOut("slow",function(){t(this).replaceWith(e),t("#mess"+a).css("display","none").fadeIn("slow")})},error:function(t){403==t.status?alert(mChat.noAccess):501==t.status&&alert(mChat.noMessageInput)},complete:function(){mChat.interval=setInterval(mChat.refresh,mChat.refreshTime),mChat.userTimeout&&(mChat.sessionTime=mChat.userTimeout?mChat.userTimeout/1e3:!1,mChat.counter=setInterval(mChat.countDown,1e3),mChat.activeInterval=setInterval(mChat.active,mChat.userTimeout)),mChat.archiveMode||mChat.messageTop||setTimeout(function(){t("#mChatmain").animate({scrollTop:t("#mChatmain")[0].scrollHeight},1e3,"swing")},1500)}})})},del:function(a){e(mChat.delConfirm,{position:200,animate:!0,confirm:!0},function(e){return e?void t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:{mode:"delete",message_id:a},beforeSend:function(){clearInterval(mChat.interval),mChat.userTimeout&&(clearInterval(mChat.activeInterval),clearInterval(mChat.counter),t("#mChatSessTimer").html(mChat.refreshing))},success:function(){t("#mess"+a).fadeOut("slow",function(){t(this).remove()}),mChat.sound(mChat.forumRoot+"ext/dmzx/mchat/sounds/del.swf")},error:function(){alert(mChat.noAccess)},complete:function(){mChat.interval=setInterval(mChat.refresh,mChat.refreshTime),mChat.userTimeout&&(mChat.sessionTime=mChat.userTimeout?mChat.userTimeout/1e3:!1,mChat.counter=setInterval(mChat.countDown,1e3),mChat.activeInterval=setInterval(mChat.active,mChat.userTimeout))}}):!1})},refresh:function(){if(!mChat.archiveMode){var e=mChat.messageTop?":first":":last",a=0;if(t("#mChatData").children().not("#mChatNoMessage").length){t("#mChatNoMessage").remove();var s=t("#mChatData").children(e).not("#mChatNoMessage").attr("id");s&&(a=s.replace("mess",""))}t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:{mode:"read",message_last_id:a},dataType:"html",beforeSend:function(){t("#mChatOkIMG,#mChatErrorIMG,#mChatPauseIMG").hide(),t("#mChatLoadIMG").show()},success:function(e){var a=t(t.trim(e));a.length&&(t("#mChatRefreshText").removeClass("mchat-alert"),a.hide(),mChat.messageTop?t("#mChatData").prepend(a):t("#mChatData").append(a),a.fadeIn("slow"),t("#mChatmain").stop().animate({scrollTop:mChat.messageTop?0:t("#mChatmain")[0].scrollHeight},2e3),mChat.sound(mChat.forumRoot+"ext/dmzx/mchat/sounds/add.swf"),mChat.notice()),setTimeout(function(){t("#mChatLoadIMG,#mChatErrorIMG,#mChatPauseIMG").hide(),t("#mChatOkIMG").show(),t("#mChatRefreshText").html(mChat.refreshYes)},500)},error:function(){t("#mChatLoadIMG,#mChatOkIMG,#mChatPauseIMG,#mChatRefreshTextNo").hide(),t("#mChatErrorIMG").show(),mChat.sound(mChat.forumRoot+"ext/dmzx/mchat/sounds/error.swf")},complete:function(){t("#mChatData").children(e).length||t("#mChatData").append('
'+mChat.noMessages+"
").show("slow")}})}},stats:function(){mChat.whois&&t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:{mode:"stats"},dataType:"html",beforeSend:function(){mChat.customPage&&(t("#mChatRefreshN").show(),t("#mChatRefresh").hide())},success:function(e){var a=t.parseJSON(e);t("#mChatStats").replaceWith(a.message),mChat.customPage&&setTimeout(function(){t("#mChatRefreshN").hide(),t("#mChatRefresh").show()},500)},error:function(){mChat.sound(mChat.forumRoot+"ext/dmzx/mchat/sounds/error.swf")},complete:function(){t("#mChatUserList").length&&("yes"==t.cookie("mChatShowUserList")||mChat.customPage)&&t("#mChatUserList").css("display","block")}})},active:function(){!mChat.archiveMode&&mChat.userTimeout&&(clearInterval(mChat.interval),t("#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG").hide(),t("#mChatPauseIMG").show(),t("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert"),t("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert"))}}),mChat.interval=setInterval(mChat.refresh,mChat.refreshTime),mChat.statsInterval=setInterval(mChat.stats,mChat.whoisRefresh),mChat.activeInterval=setInterval(mChat.active,mChat.userTimeout),mChat.sessionTime=mChat.userTimeout?mChat.userTimeout/1e3:!1,mChat.userTimeout&&(mChat.counter=setInterval(mChat.countDown,1e3)),"yes"==t.cookie("mChatShowSmiles")&&t("#mChatSmiles").css("display","none")&&t("#mChatSmiles").slideToggle("slow"),"yes"==t.cookie("mChatShowBBCodes")&&t("#mChatBBCodes").css("display","none")&&t("#mChatBBCodes").slideToggle("slow"),"yes"==t.cookie("mChatShowUserList")&&t("#mChatUserList").length&&t("#mChatUserList").slideToggle("slow"),"yes"==t.cookie("mChatShowColour")&&t("#mChatColour").css("display","none")&&t("#mChatColour").slideToggle("slow"),t("#mChatUseSound").change(function(){t.cookie("mChatNoSound",t(this).is(":checked")?null:"yes")})}); +jQuery(function(t){function e(e,a,s){e=''+e+"";var o={confirm:!1,verify:!1,input:!1,textarea:!1,animate:!1,textOk:"Ok",textCancel:"Cancel",textYes:"Yes",textNo:"No",position:"center"};if(a)for(var n in o)"undefined"==typeof a[n]&&(a[n]=o[n]);var m=t(document).height(),h=t(document).width(),i=t('
'),r=t('
'),c=t('
'),l=t('
'),u=300;if(r.css({height:m,width:h}).appendTo("body").fadeIn(100,function(){t(this).css("filter","alpha(opacity=70)")}),i.prependTo("body"),c.append(e).appendTo(i),a&&(a.input&&("string"==typeof a.input?c.append('
'):c.append('
'),t(".aTextbox").focus()),"string"==typeof a.textarea&&(c.append('
"),t(".aEdit").focus())),c.append(l),a?a.confirm||a.input?(l.append('"),l.append('")):a.verify?(l.append('"),l.append('")):l.append('"):l.append(''),i.css("left",(t(window).width()-t(".appriseOuter").width())/2+t(window).scrollLeft()+"px"),a)if(a.position&&"center"===a.position&&(u=(m-i.height())/2),a.animate){var C=a.animate;isNaN(C)&&(C=400),i.css("top","-200px").show().animate({top:u},C)}else i.css("top",u).fadeIn(200);else i.css("top",u).fadeIn(200);t(document).keydown(function(e){r.is(":visible")&&(e.shiftKey&&13==e.keyCode?t(".aEdit").append("
"):13==e.keyCode?t('.aButtons > button[value="ok"]').click():27==e.keyCode&&t('.aButtons > button[value="cancel"]').click())});var d=t(".aTextbox").val();d||(d=!1),t(".aTextbox").on("keydown blur",function(){d=t(this).val()});var f=t(".aEdit").val();f||(f=!1),t(".aEdit").on("keydown blur",function(){f=t(this).val()}),t(".aButtons > button").click(function(){if(r.remove(),i.remove(),s){t(this).text("");var e=t(this).attr("value");"ok"==e?(s(a?a.input?d:a.textarea?f:!0:!0),t("#mChatMessage").focus()):"cancel"==e&&(s(!1),t("#mChatMessage").focus())}})}var a=!0;mChat.archiveMode||(mChat.messageTop||t("#mChatmain").animate({scrollTop:t("#mChatmain")[0].scrollHeight},1e3,"swing"),mChat.pause&&t("#mChatMessage").on("keypress",function(){clearInterval(mChat.interval),t("#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG").hide(),t("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert"),t("#mChatPauseIMG").show()}),t([window,document]).blur(function(){a=!1}).focus(function(){a=!0}),t.fn.preventDoubleSubmit=function(){var e=!1;return t(this).submit(function(){return e?!1:void(e=!0)})},t.fn.autoGrowInput=function(e){var a=t(".mChatPanel").width();return e=t.extend({maxWidth:a-20,minWidth:0,comfortZone:20},e),this.filter("input:text").each(function(){var a=e.minWidth||t(this).width(),s="",o=t(this),n=t("
").css({position:"absolute",top:-9999,left:-9999,width:"auto",fontSize:o.css("fontSize"),fontFamily:o.css("fontFamily"),fontWeight:o.css("fontWeight"),letterSpacing:o.css("letterSpacing"),whiteSpace:"nowrap"}),m=function(){if(s!==(s=o.val())){var t=s.replace(/&/g,"&").replace(/\s/g," ").replace(//g,">");n.html(t);var m=n.width(),h=m+e.comfortZone>=a?m+e.comfortZone:a,i=o.width(),r=i>h&&h>=a||h>a&&h=e&&(e="0"+e),a%=60,9>=a&&(a="0"+a),s%=60,9>=s&&(s="0"+s);var o=s+":"+a+":"+e;t("#mChatSessMess").html(mChat.sessEnds+" "+o),mChat.sessionTime<=0&&(clearInterval(mChat.counter),t("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert"))},clear:function(){if(""===t("#mChatMessage").val())return!1;var e=confirm(mChat.reset);e?(t("#mChatRefreshText").removeClass("mchat-alert"),mChat.pause&&(mChat.interval=setInterval(mChat.refresh,mChat.refreshTime)),t("#mChatOkIMG").show(),t("#mChatLoadIMG,#mChatErrorIMG,#mChatPauseIMG").hide(),t("#mChatRefreshText").html(mChat.refreshYes),t("#mChatMessage").val("").focus()):t("#mChatMessage").focus()},sound:function(e){"yes"!=t.cookie("mChatNoSound")&&(navigator.userAgent.match(/MSIE ([0-9]+)\./)||navigator.userAgent.match(/Trident\/7.0; rv 11.0/)?t("#mChatSound").html(''):t("#mChatSound").html(''))},notice:function(){a&&document.hasFocus()||t.titleAlert(mChat.newMessageAlert,{interval:1e3})},toggle:function(e){t("#mChat"+e).slideToggle("normal",function(){t("#mChat"+e).is(":visible")?t.cookie("mChatShow"+e,"yes"):t("#mChat"+e).is(":hidden")&&t.cookie("mChatShow"+e,null)})},add:function(){if(""===t("#mChatMessage").val())return!1;var e=t("#mChatMessage").val().replace(/ /g,"");return mChat.mssgLngth&&e.length>mChat.mssgLngth?void alert(mChat.mssgLngthLong):void t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:t("#postform").serialize(),dataType:"text",beforeSend:function(){t("#submit_button").attr("disabled","disabled"),mChat.userTimeout&&(clearInterval(mChat.activeInterval),clearInterval(mChat.counter)),clearInterval(mChat.interval)},success:function(){mChat.refresh()},error:function(t){400==t.status?alert(mChat.flood):403==t.status?alert(mChat.noAccess):501==t.status&&alert(mChat.noMessageInput)},complete:function(){t("#mChatNoMessage").remove(),t("#submit_button").removeAttr("disabled"),mChat.interval=setInterval(mChat.refresh,mChat.refreshTime),mChat.userTimeout&&(mChat.sessionTime=mChat.userTimeout?mChat.userTimeout/1e3:!1,mChat.counter=setInterval(mChat.countDown,1e3),mChat.activeInterval=setInterval(mChat.active,mChat.userTimeout)),t("#mChatMessage").val("").focus()}})},edit:function(a){var s=t("#mess"+a).data("edit");e(mChat.editInfo,{textarea:s,animate:!0,position:200,confirm:!0},function(e){e&&t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:{mode:"edit",message_id:a,message:e},dataType:"text",beforeSend:function(){clearInterval(mChat.interval),mChat.userTimeout&&(clearInterval(mChat.activeInterval),clearInterval(mChat.counter),t("#mChatSessTimer").html(mChat.refreshing))},success:function(e){t("#mess"+a).fadeOut("slow",function(){t(this).replaceWith(e),t("#mess"+a).css("display","none").fadeIn("slow")})},error:function(t){403==t.status?alert(mChat.noAccess):501==t.status&&alert(mChat.noMessageInput)},complete:function(){mChat.interval=setInterval(mChat.refresh,mChat.refreshTime),mChat.userTimeout&&(mChat.sessionTime=mChat.userTimeout?mChat.userTimeout/1e3:!1,mChat.counter=setInterval(mChat.countDown,1e3),mChat.activeInterval=setInterval(mChat.active,mChat.userTimeout)),mChat.archiveMode||mChat.messageTop||setTimeout(function(){t("#mChatmain").animate({scrollTop:t("#mChatmain")[0].scrollHeight},1e3,"swing")},1500)}})})},del:function(a){e(mChat.delConfirm,{position:200,animate:!0,confirm:!0},function(e){return e?void t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:{mode:"delete",message_id:a},beforeSend:function(){clearInterval(mChat.interval),mChat.userTimeout&&(clearInterval(mChat.activeInterval),clearInterval(mChat.counter),t("#mChatSessTimer").html(mChat.refreshing))},success:function(){t("#mess"+a).fadeOut("slow",function(){t(this).remove()}),mChat.sound(mChat.forumRoot+"ext/dmzx/mchat/sounds/del.swf")},error:function(){alert(mChat.noAccess)},complete:function(){mChat.interval=setInterval(mChat.refresh,mChat.refreshTime),mChat.userTimeout&&(mChat.sessionTime=mChat.userTimeout?mChat.userTimeout/1e3:!1,mChat.counter=setInterval(mChat.countDown,1e3),mChat.activeInterval=setInterval(mChat.active,mChat.userTimeout))}}):!1})},refresh:function(){if(!mChat.archiveMode){var e=mChat.messageTop?":first":":last",a=0;if(t("#mChatData").children().not("#mChatNoMessage").length){t("#mChatNoMessage").remove();var s=t("#mChatData").children(e).not("#mChatNoMessage").attr("id");s&&(a=s.replace("mess",""))}t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:{mode:"read",message_last_id:a},dataType:"html",beforeSend:function(){t("#mChatOkIMG,#mChatErrorIMG,#mChatPauseIMG").hide(),t("#mChatLoadIMG").show()},success:function(e){var a=t(t.trim(e));a.length&&(t("#mChatRefreshText").removeClass("mchat-alert"),a.hide(),mChat.messageTop?t("#mChatData").prepend(a):t("#mChatData").append(a),a.fadeIn("slow"),t("#mChatmain").stop().animate({scrollTop:mChat.messageTop?0:t("#mChatmain")[0].scrollHeight},2e3),mChat.sound(mChat.forumRoot+"ext/dmzx/mchat/sounds/add.swf"),mChat.notice()),setTimeout(function(){t("#mChatLoadIMG,#mChatErrorIMG,#mChatPauseIMG").hide(),t("#mChatOkIMG").show(),t("#mChatRefreshText").html(mChat.refreshYes)},500)},error:function(){t("#mChatLoadIMG,#mChatOkIMG,#mChatPauseIMG,#mChatRefreshTextNo").hide(),t("#mChatErrorIMG").show(),mChat.sound(mChat.forumRoot+"ext/dmzx/mchat/sounds/error.swf")},complete:function(){t("#mChatData").children(e).length||t("#mChatData").append('
'+mChat.noMessages+"
").show("slow")}})}},stats:function(){mChat.whois&&t.ajax({url:mChat.file,timeout:1e4,type:"POST",data:{mode:"stats"},dataType:"html",beforeSend:function(){mChat.customPage&&(t("#mChatRefreshN").show(),t("#mChatRefresh").hide())},success:function(e){var a=t.parseJSON(e);t("#mChatStats").replaceWith(a.message),mChat.customPage&&setTimeout(function(){t("#mChatRefreshN").hide(),t("#mChatRefresh").show()},500)},error:function(){mChat.sound(mChat.forumRoot+"ext/dmzx/mchat/sounds/error.swf")},complete:function(){t("#mChatUserList").length&&("yes"==t.cookie("mChatShowUserList")||mChat.customPage)&&t("#mChatUserList").css("display","block")}})},active:function(){!mChat.archiveMode&&mChat.userTimeout&&(clearInterval(mChat.interval),t("#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG").hide(),t("#mChatPauseIMG").show(),t("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert"),t("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert"))},entityDecode:function(t){var e=decodeURIComponent(t.replace(/\+/g," "));return e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/:/g,":"),e=e.replace(/./g,"."),e=e.replace(/&/g,"&"),e=e.replace(/"/g,'"')}}),mChat.interval=setInterval(mChat.refresh,mChat.refreshTime),mChat.statsInterval=setInterval(mChat.stats,mChat.whoisRefresh),mChat.activeInterval=setInterval(mChat.active,mChat.userTimeout),mChat.sessionTime=mChat.userTimeout?mChat.userTimeout/1e3:!1,mChat.userTimeout&&(mChat.counter=setInterval(mChat.countDown,1e3)),"yes"==t.cookie("mChatShowSmiles")&&t("#mChatSmiles").css("display","none")&&t("#mChatSmiles").slideToggle("slow"),"yes"==t.cookie("mChatShowBBCodes")&&t("#mChatBBCodes").css("display","none")&&t("#mChatBBCodes").slideToggle("slow"),"yes"==t.cookie("mChatShowUserList")&&t("#mChatUserList").length&&t("#mChatUserList").slideToggle("slow"),"yes"==t.cookie("mChatShowColour")&&t("#mChatColour").css("display","none")&&t("#mChatColour").slideToggle("slow"),t("#mChatUseSound").change(function(){t.cookie("mChatNoSound",t(this).is(":checked")?null:"yes")}),t("#mChatmain").on("click","span.mChatInsertMention",function(){var e=t(this).closest(".mChatHover"),a=mChat.entityDecode(e.data("username")),s=e.data("usercolor");s?a="[b][color="+s+"]"+a+"[/color][/b]":mChat.allowBBCodes&&(a="[b]"+a+"[/b]"),insert_text("@ "+a+", ")}),t("#mChatData").on("click","img.mChatInsertQuote",function(){var e=t(this).closest(".mChatHover"),a=mChat.entityDecode(e.data("username")),s=e.data("id"),o=mChat.entityDecode(t("#mess"+s).data("edit"));insert_text('[quote="'+a+'"]'+o+"[/quote]")}),t("#mChatData").on("click","img.mChatInsertLike",function(){var e=t(this).closest(".mChatHover"),a=mChat.entityDecode(e.data("username")),s=mChat.entityDecode(e.data("edit"));insert_text(mChat.likes+'[quote="'+a+'"]'+s+"[/quote]")}),t("#mChatData").on("click","img.mChatEdit",function(){var e=t(this).closest(".mChatHover");mChat.edit(e.data("id"))}),t("#mChatData").on("click","img.mChatDelete",function(){var e=t(this).closest(".mChatHover");mChat.del(e.data("id"))})}); diff --git a/styles/prosilver/template/mchat_avatars.html b/styles/prosilver/template/mchat_avatars.html deleted file mode 100644 index b10589c..0000000 --- a/styles/prosilver/template/mchat_avatars.html +++ /dev/null @@ -1,10 +0,0 @@ - -
- -
- @ @ @ {mchatrow.MCHAT_USERNAME_FULL} - {mchatrow.MCHAT_TIME} - {L_MCHAT_SEND_PM} {L_REPLY_WITH_LIKE}  {L_REPLY_WITH_QUOTE} {L_MCHAT_IP} {mchatrow.MCHAT_USER_IP} {L_MCHAT_PERMISSIONS} {L_MCHAT_EDIT} {L_MCHAT_DELITE}
{mchatrow.MCHAT_MESSAGE}
-
-
- diff --git a/styles/prosilver/template/mchat_body.html b/styles/prosilver/template/mchat_body.html index e22fe4d..7ce4aa8 100644 --- a/styles/prosilver/template/mchat_body.html +++ b/styles/prosilver/template/mchat_body.html @@ -76,42 +76,6 @@ focusFix : falsetrue, archiveMode : truefalse }; - function insert_quote(user, text) { - var quote = decodeURIComponent(text.replace(/\+/g, " ")); - quote = quote.replace(/</g, "<"); - quote = quote.replace(/>/g, ">"); - quote = quote.replace(/:/g, ':'); - quote = quote.replace(/./g, '.'); - quote = quote.replace(/&/g, '&'); - quote = quote.replace(/"/g, '"'); - var username = decodeURIComponent(user.replace(/\+/g, " ")); - username = username.replace(/</g, "<"); - username = username.replace(/>/g, ">"); - username = username.replace(/:/g, ':'); - username = username.replace(/./g, '.'); - username = username.replace(/&/g, '&'); - username = username.replace(/"/g, '"'); - document.getElementById('mChatMessage').value += '[quote="' + username + '"]' + quote + '[/quote]'; - document.getElementById('mChatMessage').focus(); - } - function insert_like(user, text) { - var quote = decodeURIComponent(text.replace(/\+/g, " ")); - quote = quote.replace(/</g, "<"); - quote = quote.replace(/>/g, ">"); - quote = quote.replace(/:/g, ':'); - quote = quote.replace(/./g, '.'); - quote = quote.replace(/&/g, '&'); - quote = quote.replace(/"/g, '"'); - var username = decodeURIComponent(user.replace(/\+/g, " ")); - username = username.replace(/</g, "<"); - username = username.replace(/>/g, ">"); - username = username.replace(/:/g, ':'); - username = username.replace(/./g, '.'); - username = username.replace(/&/g, '&'); - username = username.replace(/"/g, '"'); - document.getElementById('mChatMessage').value += '' + mChat.likes + '[quote="' + username + '"]' + quote + '[/quote]'; - document.getElementById('mChatMessage').focus(); - } // ]]> @@ -120,11 +84,7 @@
- - - - - +
{L_MCHAT_NOMESSAGE}
diff --git a/styles/prosilver/template/mchat_messages.html b/styles/prosilver/template/mchat_messages.html new file mode 100644 index 0000000..08bfc43 --- /dev/null +++ b/styles/prosilver/template/mchat_messages.html @@ -0,0 +1,26 @@ + +
data-usercolor="{mchatrow.MCHAT_USERNAME_COLOR}" data-edit="{mchatrow.MCHAT_MESSAGE_EDIT}"> + + + +
+ style="color:{mchatrow.MCHAT_USERNAME_COLOR}">@ + {mchatrow.MCHAT_USERNAME_FULL} - {mchatrow.MCHAT_TIME} +
+
+ {L_MCHAT_SEND_PM} + {L_REPLY_WITH_LIKE} + {L_REPLY_WITH_QUOTE} + {L_MCHAT_IP} {mchatrow.MCHAT_USER_IP} + {L_MCHAT_PERMISSIONS} + {L_MCHAT_EDIT} + {L_MCHAT_DELITE} +
+
+
{mchatrow.MCHAT_MESSAGE}
+
+ diff --git a/styles/prosilver/template/mchat_no_avatars.html b/styles/prosilver/template/mchat_no_avatars.html deleted file mode 100644 index 4946edb..0000000 --- a/styles/prosilver/template/mchat_no_avatars.html +++ /dev/null @@ -1,5 +0,0 @@ - -
@ @ @ {mchatrow.MCHAT_USERNAME_FULL} {L_MCHAT_PM} - {mchatrow.MCHAT_TIME}{L_REPLY_WITH_QUOTE}  - -{L_MCHAT_IP} {mchatrow.MCHAT_USER_IP} {L_MCHAT_PERMISSIONS} {L_MCHAT_EDIT} {L_MCHAT_DELITE}
{mchatrow.MCHAT_MESSAGE}
- diff --git a/styles/prosilver/theme/mchat.css b/styles/prosilver/theme/mchat.css index c9d4787..0d68189 100644 --- a/styles/prosilver/theme/mchat.css +++ b/styles/prosilver/theme/mchat.css @@ -135,6 +135,18 @@ img.mChatImage{ vertical-align: middle; } +div.mChatMessageHeader { + float: left; +} + +div.mChatMessageIcons { + float: right; +} + +img.mChatImage, span.mChatInsertMention { + cursor: pointer; +} + img.mChatImageLoad { vertical-align: middle; cursor: wait;