1/* 2Author: mg12 3Author URI: http://www.neoease.com/ 4*/ 5(function() { 6 7function $(id) { 8 return document.getElementById(id); 9} 10 11function reply(authorId, commentId, commentBox) { 12 var author = MGJS.$(authorId).innerHTML; 13 var insertStr = '<a href="#' + commentId + '">@' + author.replace(/\t|\n|\r\n/g, "") + '</a> \n'; 14 15 appendReply(insertStr, commentBox); 16} 17 18function quote(authorId, commentId, commentBodyId, commentBox) { 19 var author = MGJS.$(authorId).innerHTML; 20 var comment = MGJS.$(commentBodyId).innerHTML; 21 22 var insertStr = '<blockquote cite="#' + commentBodyId + '">'; 23 insertStr += '\n<a href="#' + commentId + '">' + author.replace(/\t|\n|\r\n/g, "") + '</a> :'; 24 insertStr += comment.replace(/\t/g, ""); 25 insertStr += '</blockquote>\n'; 26 27 insertQuote(insertStr, commentBox); 28} 29 30function appendReply(insertStr, commentBox) { 31 if(MGJS.$(commentBox) && MGJS.$(commentBox).type == 'textarea') { 32 field = MGJS.$(commentBox); 33 34 } else { 35 alert("The comment box does not exist!"); 36 return false; 37 } 38 39 if (field.value.indexOf(insertStr) > -1) { 40 alert("You've already appended this reply!"); 41 return false; 42 } 43 44 if (field.value.replace(/\s|\t|\n/g, "") == '') { 45 field.value = insertStr; 46 } else { 47 field.value = field.value.replace(/[\n]*$/g, "") + '\n\n' + insertStr; 48 } 49 field.focus(); 50} 51 52function insertQuote(insertStr, commentBox) { 53 if(MGJS.$(commentBox) && MGJS.$(commentBox).type == 'textarea') { 54 field = MGJS.$(commentBox); 55 56 } else { 57 alert("The comment box does not exist!"); 58 return false; 59 } 60 61 if(document.selection) { 62 field.focus(); 63 sel = document.selection.createRange(); 64 sel.text = insertStr; 65 field.focus(); 66 67 } else if (field.selectionStart || field.selectionStart == '0') { 68 var startPos = field.selectionStart; 69 var endPos = field.selectionEnd; 70 var cursorPos = startPos; 71 field.value = field.value.substring(0, startPos) 72 + insertStr 73 + field.value.substring(endPos, field.value.length); 74 cursorPos += insertStr.length; 75 field.focus(); 76 field.selectionStart = cursorPos; 77 field.selectionEnd = cursorPos; 78 79 } else { 80 field.value += insertStr; 81 field.focus(); 82 } 83} 84 85 86window['MGJS'] = {}; 87window['MGJS']['$'] = $; 88window['MGJS_CMT'] = {}; 89window['MGJS_CMT']['reply'] = reply; 90window['MGJS_CMT']['quote'] = quote; 91 92})();
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.