var sessionStarted = false;\r
var editComment = 0;\r
var currentfileContent = '';\r
+var addNewComment = false;\r
\r
// SHA GitHub\r
var shaLastCommit = "";\r
}\r
});\r
\r
+ $('a[class=newComment]').click(function(){\r
+ addNewComment = true; \r
+ editComment += 1;\r
+ // hide comment\r
+ $(this).hide();\r
+ // Show edit box \r
+ $(this).next().show();\r
+ // Show cancel button\r
+ $(this).next().next().show();\r
+ // Show commit button\r
+ $(this).next().next().next().show();\r
+ // Resize edit box \r
+ $(this).next().height($(this).next().prop("scrollHeight"));\r
+ // Select it\r
+ $(this).next().select();\r
+ preElement = $(this); \r
+ });\r
+\r
});\r
\r
/* Parse current URL and return anchor name */\r
{\r
var numL = preElement.attr("title");\r
commentLineStart = numL.split('-')[0] - 1; \r
+ if(addNewComment) { commentLineStart++; }\r
commentLineEnd = (commentLineStart + preElement.text().split('\n').length) - 1;\r
state = true; \r
replaceComment(updateComment, currentfileContent);\r
var lines = fileContent.split("\n");\r
for (var i = 0; i < lines.length; i++) {\r
if(i == commentLineStart){\r
+ if(addNewComment){\r
+ for(var indexLine=0; indexLine < lines[i+1].length; indexxLine++){\r
+ if(lines[i+1].substr(indexLine,1) == "\t" || lines[i+1].substr(indexLine,1) == "#"){ text += lines[i+1].substr(indexLine,1); }\r
+ else{ break;}\r
+ }\r
+ text += lines[i] + "\n"; \r
+ }\r
// We change the comment\r
for(var j = 0; j < lNew; j++){\r
if(commentType == 1){ text += "\t# " + arrayNew[j] + "\n"; }\r
else{ text += lines[i] + "\n"; }\r
}\r
}\r
+ if(addNewComment){\r
+ addNewComment = false;\r
+ }\r
}\r
\r
function getCommentLastCommit(path){\r