diff --git a/README.md b/README.md index cec64cd..126db04 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## MentionMe 3.2.11 +## MentionMe 3.2.12 A plugin for MyBB 1.8.x that allows Twitter-style tagging and integration with [MyAlerts](https://github.com/euantorano/MyAlerts) diff --git a/Upload/inc/plugins/MentionMe/forum.php b/Upload/inc/plugins/MentionMe/forum.php index 8ad2530..8600bf4 100644 --- a/Upload/inc/plugins/MentionMe/forum.php +++ b/Upload/inc/plugins/MentionMe/forum.php @@ -37,7 +37,7 @@ function mentionMeParseMessage($message) * * quoted */ - $message = preg_replace_callback('#@([\'|"|`])(?P[^<>&\\\;,\n]+?)\1#u', 'mentionDetect', $message); + $message = preg_replace_callback('#@([\'|"|`](?!\s))(?P[^<>&\\\;,\n]+?)\1#u', 'mentionDetect', $message); /** * unquoted diff --git a/Upload/inc/plugins/MentionMe/install.php b/Upload/inc/plugins/MentionMe/install.php index 0f550b0..6b139d1 100644 --- a/Upload/inc/plugins/MentionMe/install.php +++ b/Upload/inc/plugins/MentionMe/install.php @@ -253,7 +253,7 @@ function mention_uninstall() $db->delete_query('tasks', "file='mentiome_namecache'"); // undo changes to MyAlerts if installed - if ($db->table_exists('alerts')) { + if (function_exists('myalerts_info')) { $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::getInstance(); if (!$alertTypeManager) { @@ -423,7 +423,7 @@ function mentionMeMyAlertsIntegrate() $lang->load('mention'); } - if (!function_exists("myalerts_info")) { + if (!function_exists('myalerts_info')) { return; } diff --git a/Upload/inc/plugins/mention.php b/Upload/inc/plugins/mention.php index 0636176..57e47e6 100644 --- a/Upload/inc/plugins/mention.php +++ b/Upload/inc/plugins/mention.php @@ -14,7 +14,7 @@ // checked by other plugin files define('IN_MENTIONME', true); -define('MENTIONME_VERSION', '3.2.11'); +define('MENTIONME_VERSION', '3.2.12'); // register custom class autoloader spl_autoload_register('mentionMeClassAutoLoad'); diff --git a/Upload/jscripts/MentionMe/autocomplete.js b/Upload/jscripts/MentionMe/autocomplete.js index ae80d3c..a479099 100644 --- a/Upload/jscripts/MentionMe/autocomplete.js +++ b/Upload/jscripts/MentionMe/autocomplete.js @@ -1147,6 +1147,16 @@ var MentionMe = (function($, m) { left = coords.left + 3, top = coords.top - 5; + if (typeof m.customTextAreaContainerOffset !== "undefined") { + if (typeof m.customTextAreaContainerOffset.left !== "undefined") { + left = pi(m.customTextAreaContainerOffset.left); + } + + if (typeof m.customTextAreaContainerOffset.top !== "undefined") { + top = pi(m.customTextAreaContainerOffset.top); + } + } + this.popup.show(left, top); } @@ -1353,6 +1363,16 @@ var MentionMe = (function($, m) { }), containerOffset = this.$container.offset(); + if (typeof m.customSCEditorContainerOffset !== "undefined") { + if (typeof m.customSCEditorContainerOffset.left !== "undefined") { + containerOffset.left = pi(m.customSCEditorContainerOffset.left); + } + + if (typeof m.customSCEditorContainerOffset.top !== "undefined") { + containerOffset.top = pi(m.customSCEditorContainerOffset.top); + } + } + fontSize = 7; if (this.$currentNode.closest("div").length && typeof this.$currentNode.closest("div").css === "function") { diff --git a/Upload/jscripts/MentionMe/autocomplete.min.js b/Upload/jscripts/MentionMe/autocomplete.min.js index 86f972d..4ae2451 100644 --- a/Upload/jscripts/MentionMe/autocomplete.min.js +++ b/Upload/jscripts/MentionMe/autocomplete.min.js @@ -1,3 +1 @@ -var MentionMe=(function(e,o){ -"use strict"; -var b={minLength:2,maxLength:30,minWidth:120,maxItems:5,tid:"",fullText:0,showAvatars:1,imageDirectory:"images",lockSelection:1},t={instructions:"type a user name"},s={BACKSPACE:8,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,NUMLOCK:144},f=(function(){function z(U){var T,S,R;this.editorInterface=U;R=this.editorInterface.getContainer();this.$popup=e("#mentionme_master_popup").clone().attr("id","");this.$spinner=this.$popup.find("div.mentionme_spinner").hide();this.$input=this.$popup.find("input.mentionme_popup_input");this.$inputDiv=this.$popup.find("div.mentionme_popup_input_container");this.$body=this.$popup.find("div.mentionme_popup_body");if(typeof R==="string"&&e("#"+R).length){this.$container=e("#"+R)}else{if(typeof R==="object"&&e(R).length){this.$container=e(R)}else{return false}}this.$container.append(this.$popup);this.$popup.css({left:"-1000px",top:"-1000px"}).show();this.inputHeight=this.$inputDiv.height();T=e("
");if(b.showAvatars){S=e("",{"class":"mention_user_avatar",src:b.defaultAvatar}).appendTo(T)}T.append(Array(b.maxLength+1).join("M")).addClass("mentionme_popup_item");this.$body.html(T);this.lineHeight=r(T.height())+this.editorInterface.lineHeightModifier+r(T.css("paddingTop").replace("px",""))+r(T.css("paddingBottom").replace("px",""));this.$instructions=e("",{"class":"mentionme_popup_instructions"}).html(t.instructions);this.scrollWidthDiff=this.$body.width()-this.$body[0].scrollWidth;this.keyCache=new l(this);this.nameCache=new k(this)}function O(S,R){this.keyCache.clear();this.update();this.move(S,R);this.$popup.show();this.lastSelected=null;this.select();this.visible=true;this.$body.mouseover(e.proxy(this.onMouseMove,this));this.$body.click(e.proxy(this.onClick,this));e(document).click(e.proxy(this.hide,this));this.editorInterface.bindClick(e.proxy(this.hide,this));this.$input.keydown(e.proxy(this.onKeyDown,this));this.$input.keyup(e.proxy(this.updateCheck,this));this.$input.click(e.proxy(this.onInputClick,this));this.$input.focus()}function D(){this.$popup.hide();this.$body.off("mouseover",this.onMouseMove);this.$body.off("click",this.onClick);e(document).off("click",this.hide);this.editorInterface.unbindClick(this.hide);this.$input.off("keydown",this.onKeyDown);this.$input.off("keyup",this.updateCheck);this.$input.off("click",this.onInputClick);this.visible=false;this.$input.val("")}function K(V,U){var T,S=this.nameCache.getLongestName(),R;this.width=0;if(b.showAvatars){R=e("",{"class":"mention_user_avatar",src:b.defaultAvatar}).css({left:"-1000px",top:"-1000px"}).appendTo(this.$container);this.width+=R.width();R.remove()}this.width+=r(this.$body.css("fontSize").replace("px","")*S);this.width=Math.max(b.minWidth,this.width);T={height:this.getCurrentHeight()+this.inputHeight+"px",width:r(this.width-this.scrollWidthDiff)+"px"};if(typeof V!="undefined"){T.left=V+"px"}if(typeof U!="undefined"){T.top=U+"px"}this.$popup.css(T);this.$body.css({height:this.getCurrentHeight()+"px",width:this.width})}function A(){if(!this.nameCache.isReady()){this.showSpinner();return}this.nameCache.match();this.buildItems();this.lastSelected=null;this.select();if(this.keyCache.getLength()>=b.minLength){this.nameCache.search()}}function P(){var V,Z,Y,W,R,T,S=this.nameCache.getItemsLength(),U=this.nameCache.getData(),X=(navigator.userAgent.toLowerCase().indexOf("msie")!==-1)?"hand":"pointer";this.items=this.nameCache.getItems();if(S===0&&this.spinnerVisible==false){if(this.keyCache.getLength()>0){this.clear();this.$body.html(e("",{"class":"mentionme_typed_text"}).html(this.keyCache.getText()))}else{this.showInstructions()}if(this.isVisible()){this.move()}return}this.clear();for(V=0;V'+Z.slice(R,R+this.keyCache.getLength())+""+Z.slice(R+this.keyCache.getLength())}}Y="";if(b.showAvatars){W=U[T]["avatar"];if(typeof W=="undefined"||W==null||W.length==0){W=b.defaultAvatar}Y=e("",{"class":"mention_user_avatar",src:W}).one("error",function(){this.src=b.defaultAvatar})}this.$body.append(e("
",{"class":"mentionme_popup_item mentionme_popup_item_"+V}).append(Y).append(Z).css({cursor:X}))}if(this.isVisible()){this.move()}}function J(){this.$body.html("");this.lastSelected=null;this.spinnerVisible=false;if(this.isVisible()){this.move()}}function x(){this.clear();this.$body.html(this.$spinner);this.spinnerVisible=true;if(this.isVisible()){this.move()}}function N(){this.clear();this.$body.html(this.$instructions)}function M(){if(this.keyCache.update()){this.update()}}function I(R){var S=this.nameCache.getItemsLength()-1;switch(R){case"last":this.selected=S;break;case"next":this.selected++;if(this.selected>S){this.selected=0}break;case"previous":this.selected--;if(this.selected<0){this.selected=S}break;case"nextPage":this.selected+=b.maxItems;if(this.selected>S){this.selected=S}break;case"previousPage":this.selected-=b.maxItems;if(this.selected<0){this.selected=0}break;default:this.selected=0;break}this.highlightSelected()}function Q(T){var S=this.$popup.find(".mentionme_popup_item_"+this.selected),U=this.$popup.find(".mentionme_popup_item_"+this.lastSelected),R=U.find("span.mention_name_highlight_on"),V=this.itemInView(S);if(this.lastSelected==this.selected||S.length==0){return}if(U.length){U.removeClass("mentionme_popup_item_on");if(R.length){R.removeClass("mention_name_highlight_on");R.addClass("mention_name_highlight")}}this.lastSelected=this.selected;if(S){if(!S.hasClass("mentionme_popup_item_on")){S.addClass("mentionme_popup_item_on")}R=S.find("span.mention_name_highlight");if(R.length){R.removeClass("mention_name_highlight");R.addClass("mention_name_highlight_on")}}if(T||(b.lockSelection!==1&&V===true)){return}if(b.lockSelection){if(this.nameCache.getItemsLength()-b.maxItems>0){this.$body.prop("scrollTop",r(S.prop("offsetTop")-this.inputHeight))}return}if(this.selected==0){this.$body.prop("scrollTop",-this.inputHeight);return}if(V>0){this.$body.prop("scrollTop",r(S.prop("offsetTop")-(this.getCurrentHeight()-this.lineHeight)-this.inputHeight));return}this.$body.prop("scrollTop",r(S.prop("offsetTop")-this.inputHeight))}function F(R){var S=R.prop("offsetTop")-this.$body.prop("scrollTop");if(S>0&&(S+this.lineHeight)this.longestName){this.longestName=H.length}return true}function E(){var F=this.keyCache.getText().slice(0,b.minLength);if(this.searching||this.searched.indexOf(F)!==-1){if(this.popup.spinnerIsVisible()){this.popup.hide();this.editorInterface.focus()}return}this.searched.push(F);this.searching=true;if(this.items.length===0){this.popup.showSpinner()}e.ajax({type:"post",url:"xmlhttp.php",data:{action:"mentionme",mode:"nameSearch",search:F},success:C.bind(this)})}function C(G){var H=0,F;this.searching=false;if(!G){if(this.popup.spinnerIsVisible()){this.popup.hide();this.editorInterface.focus()}return}for(F in G){if(!G.hasOwnProperty(F)||this.data[F]){continue}this.data[F]=G[F];H++}if(!H||!this.popup.isVisible()){return}this.match();this.popup.buildItems();this.popup.select()}function B(){return this.ready}function y(){return this.loading}function w(){return this.data}function v(){return this.items}function m(){return this.items.length}function D(){return this.longestName}e.extend(z.prototype,{loadNameCache:u,match:x,checkEntry:A,search:E,load:C,isReady:B,isLoading:y,getData:w,getItems:v,getItemsLength:m,getLongestName:D});return z})(),d=(function(){function m(F){this.$textarea=e("#"+F);this.$container=this.$textarea.closest("div");this.selection={start:0,end:0};this.popup=new f(this);this.bindKeyup()}function E(F){if(this.popup.isVisible()){return}this.getCaret();if(i(F.keyCode)&&this.$textarea.val().slice(this.selection.start-1,this.selection.end)=="@"){this.showPopup()}}function C(){var F=this.$textarea.caret("offset"),H=F.left+3,G=F.top-5;this.popup.show(H,G)}function u(){var F=p(this.popup);if(!F){if(!this.popup.spinnerIsVisible()){this.popup.hide()}return}this.getCaret();this.$textarea.val(this.$textarea.val().slice(0,this.selection.start)+F+this.$textarea.val().slice(this.selection.start));this.setCaret(this.selection.start+F.length);this.popup.hide()}function x(){var F=this.$textarea.caret("pos");this.selection.start=F;this.selection.end=F}function w(F){var H=this.$textarea[0],G;if(H.setSelectionRange){H.focus();H.setSelectionRange(F,F)}else{if(H.createTextRange){G=H.createTextRange();G.collapse(true);G.moveEnd("character",F);G.moveStart("character",F);G.select()}}}function z(F){this.$textarea.click(F)}function v(F){this.$textarea.off("click",F)}function B(){this.$textarea.keyup(e.proxy(this.onKeyUp,this))}function y(){this.$textarea.off("keyup")}function D(){this.$textarea.focus()}function A(){return this.$container}e.extend(m.prototype,{heightModifier:0,lineHeightModifier:0,onKeyUp:E,showPopup:C,insert:u,getCaret:x,setCaret:w,bindClick:z,unbindClick:v,bindKeyup:B,unbindKeyup:y,focus:D,getContainer:A});return m})(),a=(function(){function w(){this.editor=MyBBEditor;this.rangeHelper=this.editor.getRangeHelper();this.$iFrame=e("div.sceditor-toolbar").next("iframe");this.$container=this.$iFrame.closest(".sceditor-container").parent();this.$body=e(this.editor.getBody());this.selection={start:0,end:0};this.popup=new f(this);this.editor.keyUp(this.onKeyUp.bind(this))}function A(C){this.getCaret();if(!C.keyCode){if(C.originalEvent&&C.originalEvent.keyCode){C.keyCode=C.originalEvent.keyCode}else{return}}if(!this.popup.isVisible()){if(i(C.keyCode)&&this.$currentNode.text().slice(this.selection.start-1,this.selection.end)=="@"){this.showPopup()}return}}function z(){var E,G,F,D=this.$body.caret("offset",{iframe:this.$iFrame[0]}),C=this.$container.offset();E=7;if(this.$currentNode.closest("div").length&&typeof this.$currentNode.closest("div").css==="function"){E=r(this.$currentNode.closest("div").css("fontSize").replace("px","")/2)}G=r(D.left)+C.left+r(this.$container.css("paddingLeft").replace("px",""))+E+2;F=r(D.top+this.$container.find("div.sceditor-toolbar").height())+C.top+r(this.$container.css("paddingTop").replace("px",""))+6;this.popup.show(G,F)}function m(){var C=p(this.popup);if(!C){if(!this.popup.spinnerIsVisible()){this.popup.hide()}return}this.editor.insert(C);this.popup.hide()}function v(){var C=this.rangeHelper.selectedRange();if(C.startContainer){this.$currentNode=e(C.startContainer)}else{this.$currentNode=e(editor.currentNode())}this.selection.start=C.startOffset;this.selection.end=C.endOffset}function x(C){this.$body.click(C)}function u(C){this.$body.off("click",C)}function B(){this.$iFrame.focus()}function y(){return this.$container}e.extend(w.prototype,{heightModifier:0,lineHeightModifier:0,onKeyUp:A,showPopup:z,insert:m,getCaret:v,bindClick:x,unbindClick:u,focus:B,getContainer:y});return w})(),j=(function(){function m(I){if(e("#"+I).length===0||typeof CKEDITOR.instances[I]==="undefined"){return}this.finalized=false;this.id=I;this.editor=CKEDITOR.instances[this.id];if(this.editor.status!="ready"){this.editor.on("instanceReady",e.proxy(this.finalize,this))}else{this.finalize()}e("#quick_reply_submit").click(e.proxy(this.quickReplyPosted,this))}function D(){if(this.editor.mode=="wysiwyg"){this.doFinalize()}this.lastState=this.editor.mode;this.editor.on("mode",e.proxy(this.onModeChange,this))}function E(){this.$iFrame=e("#cke_"+this.id).find("iframe");this.$container=this.$iFrame.closest("div");this.$doc=e(this.editor.document.$);this.$body=this.$doc.find("body");this.bindKeyup();this.popup=new f(this);this.finalized=true}function B(I){if(typeof I.sender.mode=="undefined"||I.sender.mode==this.lastState){return}this.lastState=I.sender.mode;if(this.finalized){this.unbindKeyup()}if(I.sender.mode!="source"){this.doFinalize()}}function H(I){if(!this.popup.isVisible()){if(i(I.keyCode)&&this.getPrevChar()=="@"){this.showPopup()}return}}function w(){if(typeof this.$doc!=="undefined"&&this.$doc.length){this.$doc.off("keyup",this.onKeyUp)}setTimeout(e.proxy(function(){this.$doc.keyup(e.proxy(this.onKeyUp,this))},this),500)}function F(){var I=this.$body.caret("offset",{iframe:this.$iFrame[0]}),L=this.$iFrame.offset(),K=r(I.left+L.left)+2,J=r(I.top+L.top)-5;this.popup.show(K,J)}function v(){var I=p(this.popup);if(!I){if(!this.popup.spinnerIsVisible()){this.popup.hide()}return}this.editor.insertText(I);this.popup.hide()}function y(){var J,L,K,I=this.editor.getSelection().getRanges()[0];if(!I||!I.startContainer){return null}J=I.startContainer;if(J.type==CKEDITOR.NODE_TEXT&&I.startOffset){return J.getText()[I.startOffset-1]}else{I.collapse(true);I.setStartAt(this.editor.editable(),CKEDITOR.POSITION_AFTER_START);L=new CKEDITOR.dom.walker(I);while(K=L.previous()){if(K.type==CKEDITOR.NODE_TEXT){return K.getText().slice(-1)}}}return null}function z(I){this.$doc.click(I)}function u(I){this.$doc.off("click",I)}function C(){this.$doc.keyup(e.proxy(this.onKeyUp,this))}function x(){this.$doc.off("keyup",this.onKeyUp)}function G(){this.editor.focus()}function A(){return this.$container}e.extend(m.prototype,{heightModifier:0,lineHeightModifier:0,finalize:D,doFinalize:E,onModeChange:B,onKeyUp:H,quickReplyPosted:w,showPopup:F,insert:v,getPrevChar:y,bindClick:z,unbindClick:u,bindKeyup:C,unbindKeyup:x,focus:G,getContainer:A});return m})();function n(m){e.extend(t,m.lang||{});delete m.lang;e.extend(b,m||{});e(["minLength","maxLength","minWidth","maxItems","fullText","showAvatars","lockSelection"]).each(function(){if(typeof b[this]!=="undefined"){b[this]=r(b[this])}});b.defaultAvatar=b.imageDirectory+"/default_avatar.png"}function q(){var v,u,m=e('.panel > form > input[class="text"]');if(typeof CKEDITOR!=="undefined"&&typeof CKEDITOR.instances!=="undefined"){u=e.map(CKEDITOR.instances,function(x,w){return w})[0];if(typeof CKEDITOR.instances[u]!=="object"){return false}new j(u)}else{if(MyBBEditor!==null&&typeof MyBBEditor==="object"&&MyBBEditor.getRangeHelper&&typeof MyBBEditor.getRangeHelper==="function"){new a()}else{if(e("#message").length>0||e("#signature").length>0){if(e("#message").length){v="message"}else{if(e("#signature").length){v="signature"}}if(!v||!e("#"+v).length){return false}new d(v)}}}if(m.length){m.prop("id","dvz_shoutbox_input");new d("dvz_shoutbox_input")}e(".quick_edit_button").click(g);e("#quick_reply_submit").click(h)}function g(v){var m=this.id.split("_").slice(-1)[0],w="quickedit_"+m,u;if(e("#"+w).length==0){return}if(typeof CKEDITOR==="undefined"){u=new d(w)}else{setTimeout(function(){u=new j(w)},1100)}setTimeout(function(){e("#quicksub_"+m).add(e("#quicksub_"+m).next("button")).click(function(){u.unbindKeyup()})},1100)}function h(m){e(".quick_edit_button").off("click",g);setTimeout(function(){e(".quick_edit_button").click(g)},500)}function p(m){var v=m.getSelectedName(),u="";if(!v){return}if(v.indexOf('"')==-1){u='"'}else{if(v.indexOf("'")==-1){u="'"}else{if(v.indexOf("`")==-1){u="`"}}}return u+v+u+" "}function i(m){return[s.LEFT,s.RIGHT,s.UP,s.DOWN,s.BACKSPACE,s.ESC,s.SHIFT,s.CTRL,s.ALT,s.ENTER,s.DELETE,s.INSERT,s.END,s.NUMLOCK].indexOf(m)===-1}function c(u,m){if(u.lengthm.length){return 1}else{return 0}}}function r(m){return parseInt(m,10)}e(q);o.autoComplete={setup:n};return o})(jQuery,MentionMe||{}); \ No newline at end of file +var MentionMe=(function(e,o){var b={minLength:2,maxLength:30,minWidth:120,maxItems:5,tid:"",fullText:0,showAvatars:1,imageDirectory:"images",lockSelection:1},t={instructions:"type a user name"},s={BACKSPACE:8,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,NUMLOCK:144},f=(function(){function z(U){var T,S,R;this.editorInterface=U;R=this.editorInterface.getContainer();this.$popup=e("#mentionme_master_popup").clone().attr("id","");this.$spinner=this.$popup.find("div.mentionme_spinner").hide();this.$input=this.$popup.find("input.mentionme_popup_input");this.$inputDiv=this.$popup.find("div.mentionme_popup_input_container");this.$body=this.$popup.find("div.mentionme_popup_body");if(typeof R==="string"&&e("#"+R).length){this.$container=e("#"+R)}else{if(typeof R==="object"&&e(R).length){this.$container=e(R)}else{return false}}this.$container.append(this.$popup);this.$popup.css({left:"-1000px",top:"-1000px"}).show();this.inputHeight=this.$inputDiv.height();T=e("
");if(b.showAvatars){S=e("",{"class":"mention_user_avatar",src:b.defaultAvatar}).appendTo(T)}T.append(Array(b.maxLength+1).join("M")).addClass("mentionme_popup_item");this.$body.html(T);this.lineHeight=r(T.height())+this.editorInterface.lineHeightModifier+r(T.css("paddingTop").replace("px",""))+r(T.css("paddingBottom").replace("px",""));this.$instructions=e("",{"class":"mentionme_popup_instructions"}).html(t.instructions);this.scrollWidthDiff=this.$body.width()-this.$body[0].scrollWidth;this.keyCache=new l(this);this.nameCache=new k(this)}function O(S,R){this.keyCache.clear();this.update();this.move(S,R);this.$popup.show();this.lastSelected=null;this.select();this.visible=true;this.$body.mouseover(e.proxy(this.onMouseMove,this));this.$body.click(e.proxy(this.onClick,this));e(document).click(e.proxy(this.hide,this));this.editorInterface.bindClick(e.proxy(this.hide,this));this.$input.keydown(e.proxy(this.onKeyDown,this));this.$input.keyup(e.proxy(this.updateCheck,this));this.$input.click(e.proxy(this.onInputClick,this));this.$input.focus()}function D(){this.$popup.hide();this.$body.off("mouseover",this.onMouseMove);this.$body.off("click",this.onClick);e(document).off("click",this.hide);this.editorInterface.unbindClick(this.hide);this.$input.off("keydown",this.onKeyDown);this.$input.off("keyup",this.updateCheck);this.$input.off("click",this.onInputClick);this.visible=false;this.$input.val("")}function K(V,U){var T,S=this.nameCache.getLongestName(),R;this.width=0;if(b.showAvatars){R=e("",{"class":"mention_user_avatar",src:b.defaultAvatar}).css({left:"-1000px",top:"-1000px"}).appendTo(this.$container);this.width+=R.width();R.remove()}this.width+=r(this.$body.css("fontSize").replace("px","")*S);this.width=Math.max(b.minWidth,this.width);T={height:this.getCurrentHeight()+this.inputHeight+"px",width:r(this.width-this.scrollWidthDiff)+"px"};if(typeof V!="undefined"){T.left=V+"px"}if(typeof U!="undefined"){T.top=U+"px"}this.$popup.css(T);this.$body.css({height:this.getCurrentHeight()+"px",width:this.width})}function A(){if(!this.nameCache.isReady()){this.showSpinner();return}this.nameCache.match();this.buildItems();this.lastSelected=null;this.select();if(this.keyCache.getLength()>=b.minLength){this.nameCache.search()}}function P(){var V,Z,Y,W,R,T,S=this.nameCache.getItemsLength(),U=this.nameCache.getData(),X=(navigator.userAgent.toLowerCase().indexOf("msie")!==-1)?"hand":"pointer";this.items=this.nameCache.getItems();if(S===0&&this.spinnerVisible==false){if(this.keyCache.getLength()>0){this.clear();this.$body.html(e("",{"class":"mentionme_typed_text"}).html(this.keyCache.getText()))}else{this.showInstructions()}if(this.isVisible()){this.move()}return}this.clear();for(V=0;V'+Z.slice(R,R+this.keyCache.getLength())+""+Z.slice(R+this.keyCache.getLength())}}Y="";if(b.showAvatars){W=U[T]["avatar"];if(typeof W=="undefined"||W==null||W.length==0){W=b.defaultAvatar}Y=e("",{"class":"mention_user_avatar",src:W}).one("error",function(){this.src=b.defaultAvatar})}this.$body.append(e("
",{"class":"mentionme_popup_item mentionme_popup_item_"+V}).append(Y).append(Z).css({cursor:X}))}if(this.isVisible()){this.move()}}function J(){this.$body.html("");this.lastSelected=null;this.spinnerVisible=false;if(this.isVisible()){this.move()}}function x(){this.clear();this.$body.html(this.$spinner);this.spinnerVisible=true;if(this.isVisible()){this.move()}}function N(){this.clear();this.$body.html(this.$instructions)}function M(){if(this.keyCache.update()){this.update()}}function I(R){var S=this.nameCache.getItemsLength()-1;switch(R){case"last":this.selected=S;break;case"next":this.selected++;if(this.selected>S){this.selected=0}break;case"previous":this.selected--;if(this.selected<0){this.selected=S}break;case"nextPage":this.selected+=b.maxItems;if(this.selected>S){this.selected=S}break;case"previousPage":this.selected-=b.maxItems;if(this.selected<0){this.selected=0}break;default:this.selected=0;break}this.highlightSelected()}function Q(T){var S=this.$popup.find(".mentionme_popup_item_"+this.selected),U=this.$popup.find(".mentionme_popup_item_"+this.lastSelected),R=U.find("span.mention_name_highlight_on"),V=this.itemInView(S);if(this.lastSelected==this.selected||S.length==0){return}if(U.length){U.removeClass("mentionme_popup_item_on");if(R.length){R.removeClass("mention_name_highlight_on");R.addClass("mention_name_highlight")}}this.lastSelected=this.selected;if(S){if(!S.hasClass("mentionme_popup_item_on")){S.addClass("mentionme_popup_item_on")}R=S.find("span.mention_name_highlight");if(R.length){R.removeClass("mention_name_highlight");R.addClass("mention_name_highlight_on")}}if(T||(b.lockSelection!==1&&V===true)){return}if(b.lockSelection){if(this.nameCache.getItemsLength()-b.maxItems>0){this.$body.prop("scrollTop",r(S.prop("offsetTop")-this.inputHeight))}return}if(this.selected==0){this.$body.prop("scrollTop",-this.inputHeight);return}if(V>0){this.$body.prop("scrollTop",r(S.prop("offsetTop")-(this.getCurrentHeight()-this.lineHeight)-this.inputHeight));return}this.$body.prop("scrollTop",r(S.prop("offsetTop")-this.inputHeight))}function F(R){var S=R.prop("offsetTop")-this.$body.prop("scrollTop");if(S>0&&(S+this.lineHeight)this.longestName){this.longestName=H.length}return true}function E(){var F=this.keyCache.getText().slice(0,b.minLength);if(this.searching||this.searched.indexOf(F)!==-1){if(this.popup.spinnerIsVisible()){this.popup.hide();this.editorInterface.focus()}return}this.searched.push(F);this.searching=true;if(this.items.length===0){this.popup.showSpinner()}e.ajax({type:"post",url:"xmlhttp.php",data:{action:"mentionme",mode:"nameSearch",search:F},success:C.bind(this)})}function C(G){var H=0,F;this.searching=false;if(!G){if(this.popup.spinnerIsVisible()){this.popup.hide();this.editorInterface.focus()}return}for(F in G){if(!G.hasOwnProperty(F)||this.data[F]){continue}this.data[F]=G[F];H++}if(!H||!this.popup.isVisible()){return}this.match();this.popup.buildItems();this.popup.select()}function B(){return this.ready}function y(){return this.loading}function w(){return this.data}function v(){return this.items}function m(){return this.items.length}function D(){return this.longestName}e.extend(z.prototype,{loadNameCache:u,match:x,checkEntry:A,search:E,load:C,isReady:B,isLoading:y,getData:w,getItems:v,getItemsLength:m,getLongestName:D});return z})(),d=(function(){function m(F){this.$textarea=e("#"+F);this.$container=this.$textarea.closest("div");this.selection={start:0,end:0};this.popup=new f(this);this.bindKeyup()}function E(F){if(this.popup.isVisible()){return}this.getCaret();if(i(F.keyCode)&&this.$textarea.val().slice(this.selection.start-1,this.selection.end)=="@"){this.showPopup()}}function C(){var F=this.$textarea.caret("offset"),H=F.left+3,G=F.top-5;this.popup.show(H,G)}function u(){var F=p(this.popup);if(!F){if(!this.popup.spinnerIsVisible()){this.popup.hide()}return}this.getCaret();this.$textarea.val(this.$textarea.val().slice(0,this.selection.start)+F+this.$textarea.val().slice(this.selection.start));this.setCaret(this.selection.start+F.length);this.popup.hide()}function x(){var F=this.$textarea.caret("pos");this.selection.start=F;this.selection.end=F}function w(F){var H=this.$textarea[0],G;if(H.setSelectionRange){H.focus();H.setSelectionRange(F,F)}else{if(H.createTextRange){G=H.createTextRange();G.collapse(true);G.moveEnd("character",F);G.moveStart("character",F);G.select()}}}function z(F){this.$textarea.click(F)}function v(F){this.$textarea.off("click",F)}function B(){this.$textarea.keyup(e.proxy(this.onKeyUp,this))}function y(){this.$textarea.off("keyup")}function D(){this.$textarea.focus()}function A(){return this.$container}e.extend(m.prototype,{heightModifier:0,lineHeightModifier:0,onKeyUp:E,showPopup:C,insert:u,getCaret:x,setCaret:w,bindClick:z,unbindClick:v,bindKeyup:B,unbindKeyup:y,focus:D,getContainer:A});return m})(),a=(function(){function w(){this.editor=MyBBEditor;this.rangeHelper=this.editor.getRangeHelper();this.$iFrame=e("div.sceditor-toolbar").next("iframe");this.$container=this.$iFrame.closest(".sceditor-container").parent();this.$body=e(this.editor.getBody());this.selection={start:0,end:0};this.popup=new f(this);this.editor.keyUp(this.onKeyUp.bind(this))}function A(C){this.getCaret();if(!C.keyCode){if(C.originalEvent&&C.originalEvent.keyCode){C.keyCode=C.originalEvent.keyCode}else{return}}if(!this.popup.isVisible()){if(i(C.keyCode)&&this.$currentNode.text().slice(this.selection.start-1,this.selection.end)=="@"){this.showPopup()}return}}function z(){var E,G,F,D=this.$body.caret("offset",{iframe:this.$iFrame[0]}),C=this.$container.offset();if(typeof o.customSCEditorContainerOffset!=="undefined"){if(typeof o.customSCEditorContainerOffset.left!=="undefined"){C.left=r(o.customSCEditorContainerOffset.left)}if(typeof o.customSCEditorContainerOffset.top!=="undefined"){C.top=r(o.customSCEditorContainerOffset.top)}}E=7;if(this.$currentNode.closest("div").length&&typeof this.$currentNode.closest("div").css==="function"){E=r(this.$currentNode.closest("div").css("fontSize").replace("px","")/2)}G=r(D.left)+C.left+r(this.$container.css("paddingLeft").replace("px",""))+E+2;F=r(D.top+this.$container.find("div.sceditor-toolbar").height())+C.top+r(this.$container.css("paddingTop").replace("px",""))+6;this.popup.show(G,F)}function m(){var C=p(this.popup);if(!C){if(!this.popup.spinnerIsVisible()){this.popup.hide()}return}this.editor.insert(C);this.popup.hide()}function v(){var C=this.rangeHelper.selectedRange();if(C.startContainer){this.$currentNode=e(C.startContainer)}else{this.$currentNode=e(editor.currentNode())}this.selection.start=C.startOffset;this.selection.end=C.endOffset}function x(C){this.$body.click(C)}function u(C){this.$body.off("click",C)}function B(){this.$iFrame.focus()}function y(){return this.$container}e.extend(w.prototype,{heightModifier:0,lineHeightModifier:0,onKeyUp:A,showPopup:z,insert:m,getCaret:v,bindClick:x,unbindClick:u,focus:B,getContainer:y});return w})(),j=(function(){function m(I){if(e("#"+I).length===0||typeof CKEDITOR.instances[I]==="undefined"){return}this.finalized=false;this.id=I;this.editor=CKEDITOR.instances[this.id];if(this.editor.status!="ready"){this.editor.on("instanceReady",e.proxy(this.finalize,this))}else{this.finalize()}e("#quick_reply_submit").click(e.proxy(this.quickReplyPosted,this))}function D(){if(this.editor.mode=="wysiwyg"){this.doFinalize()}this.lastState=this.editor.mode;this.editor.on("mode",e.proxy(this.onModeChange,this))}function E(){this.$iFrame=e("#cke_"+this.id).find("iframe");this.$container=this.$iFrame.closest("div");this.$doc=e(this.editor.document.$);this.$body=this.$doc.find("body");this.bindKeyup();this.popup=new f(this);this.finalized=true}function B(I){if(typeof I.sender.mode=="undefined"||I.sender.mode==this.lastState){return}this.lastState=I.sender.mode;if(this.finalized){this.unbindKeyup()}if(I.sender.mode!="source"){this.doFinalize()}}function H(I){if(!this.popup.isVisible()){if(i(I.keyCode)&&this.getPrevChar()=="@"){this.showPopup()}return}}function w(){if(typeof this.$doc!=="undefined"&&this.$doc.length){this.$doc.off("keyup",this.onKeyUp)}setTimeout(e.proxy(function(){this.$doc.keyup(e.proxy(this.onKeyUp,this))},this),500)}function F(){var I=this.$body.caret("offset",{iframe:this.$iFrame[0]}),L=this.$iFrame.offset(),K=r(I.left+L.left)+2,J=r(I.top+L.top)-5;this.popup.show(K,J)}function v(){var I=p(this.popup);if(!I){if(!this.popup.spinnerIsVisible()){this.popup.hide()}return}this.editor.insertText(I);this.popup.hide()}function y(){var J,L,K,I=this.editor.getSelection().getRanges()[0];if(!I||!I.startContainer){return null}J=I.startContainer;if(J.type==CKEDITOR.NODE_TEXT&&I.startOffset){return J.getText()[I.startOffset-1]}else{I.collapse(true);I.setStartAt(this.editor.editable(),CKEDITOR.POSITION_AFTER_START);L=new CKEDITOR.dom.walker(I);while(K=L.previous()){if(K.type==CKEDITOR.NODE_TEXT){return K.getText().slice(-1)}}}return null}function z(I){this.$doc.click(I)}function u(I){this.$doc.off("click",I)}function C(){this.$doc.keyup(e.proxy(this.onKeyUp,this))}function x(){this.$doc.off("keyup",this.onKeyUp)}function G(){this.editor.focus()}function A(){return this.$container}e.extend(m.prototype,{heightModifier:0,lineHeightModifier:0,finalize:D,doFinalize:E,onModeChange:B,onKeyUp:H,quickReplyPosted:w,showPopup:F,insert:v,getPrevChar:y,bindClick:z,unbindClick:u,bindKeyup:C,unbindKeyup:x,focus:G,getContainer:A});return m})();function n(m){e.extend(t,m.lang||{});delete m.lang;e.extend(b,m||{});e(["minLength","maxLength","minWidth","maxItems","fullText","showAvatars","lockSelection"]).each(function(){if(typeof b[this]!=="undefined"){b[this]=r(b[this])}});b.defaultAvatar=b.imageDirectory+"/default_avatar.png"}function q(){var v,u,m=e('.panel > form > input[class="text"]');if(typeof CKEDITOR!=="undefined"&&typeof CKEDITOR.instances!=="undefined"){u=e.map(CKEDITOR.instances,function(x,w){return w})[0];if(typeof CKEDITOR.instances[u]!=="object"){return false}new j(u)}else{if(MyBBEditor!==null&&typeof MyBBEditor==="object"&&MyBBEditor.getRangeHelper&&typeof MyBBEditor.getRangeHelper==="function"){new a()}else{if(e("#message").length>0||e("#signature").length>0){if(e("#message").length){v="message"}else{if(e("#signature").length){v="signature"}}if(!v||!e("#"+v).length){return false}new d(v)}}}if(m.length){m.prop("id","dvz_shoutbox_input");new d("dvz_shoutbox_input")}e(".quick_edit_button").click(g);e("#quick_reply_submit").click(h)}function g(v){var m=this.id.split("_").slice(-1)[0],w="quickedit_"+m,u;if(e("#"+w).length==0){return}if(typeof CKEDITOR==="undefined"){u=new d(w)}else{setTimeout(function(){u=new j(w)},1100)}setTimeout(function(){e("#quicksub_"+m).add(e("#quicksub_"+m).next("button")).click(function(){u.unbindKeyup()})},1100)}function h(m){e(".quick_edit_button").off("click",g);setTimeout(function(){e(".quick_edit_button").click(g)},500)}function p(m){var v=m.getSelectedName(),u="";if(!v){return}if(v.indexOf('"')==-1){u='"'}else{if(v.indexOf("'")==-1){u="'"}else{if(v.indexOf("`")==-1){u="`"}}}return u+v+u+" "}function i(m){return[s.LEFT,s.RIGHT,s.UP,s.DOWN,s.BACKSPACE,s.ESC,s.SHIFT,s.CTRL,s.ALT,s.ENTER,s.DELETE,s.INSERT,s.END,s.NUMLOCK].indexOf(m)===-1}function c(u,m){if(u.lengthm.length){return 1}else{return 0}}}function r(m){return parseInt(m,10)}e(q);o.autoComplete={setup:n};return o})(jQuery,MentionMe||{}); \ No newline at end of file