var repoExist = false;\r
var branchExist = false;\r
var githubRepo;\r
-var loginProcess = false; \r
+var loginProcess = false;\r
var signedOff = '';\r
var userEmail = '';\r
var commitMessage = '';\r
// Check if a comment is editing\r
window.onbeforeunload = function() {\r
if(editComment > 0){\r
- return 'Are you sure you want to leave this page?';\r
+ return 'Are you sure you want to leave this page?';\r
}\r
};\r
\r
}\r
}\r
}\r
- } \r
+ }\r
else\r
{\r
// Delete cookie and reset settings\r
del_cookie("logginNitdoc");\r
closeAllCommentInEdtiting();\r
- } \r
+ }\r
toggleLoginBox();\r
});\r
\r
// Activate edit mode\r
- $('pre[class=text_label]').click(function(){\r
+ $('pre[class=text_label]').click(function(){\r
// the customer is loggued ?\r
if(!sessionStarted || userName == ""){\r
// No => nothing happen\r
getCommentOfFunction($(this));\r
// hide comment\r
$(this).hide();\r
- // Show edit box \r
+ // Show edit box\r
$(this).next().show();\r
// Show cancel button\r
$(this).next().next().show();\r
$(this).next().next().next().show();\r
// Add text in edit box\r
if($(this).next().val() == "" || $(this).next().val() != adapt){ $(this).next().val(adapt); }\r
- // Resize edit box \r
+ // Resize edit box\r
$(this).next().height($(this).next().prop("scrollHeight"));\r
resizeTextarea($(this).next());\r
// Select it\r
}\r
});\r
\r
- // Disable the edit mode\r
- $('a[id=cancelBtn]').click(function(){\r
- $(this).parent().prev().children('#lblDiffCommit').text("");\r
- showcomment = false;\r
- closeEditing($(this));\r
+ // Disable the edit mode\r
+ $('a[id=cancelBtn]').click(function(){\r
+ $(this).parent().prev().children('#lblDiffCommit').text("");\r
+ showcomment = false;\r
+ closeEditing($(this));\r
});\r
\r
- // Display commit form\r
- $('a[id=commitBtn]').click(function(){\r
+ // Display commit form\r
+ $('a[id=commitBtn]').click(function(){\r
updateComment = $(this).prev().prev().val();\r
commentType = $(this).prev().prev().prev().attr('type');\r
\r
toggleLoginBox();\r
return;\r
}\r
- \r
+\r
// Create the commit message\r
commitMessage = 'Wikidoc: modified comment in ' + $(this).parent().prev().prev().html().split(' ')[1];\r
$('#commitMessage').text(commitMessage);\r
$('body').append('<div id="fade"></div>');\r
$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();\r
}\r
- });\r
+ });\r
\r
- // Close commit form\r
- $('.btn_close').click(function(){\r
- $(this).hide(); \r
- $(this).next().hide(); \r
- if(editComment > 0){ editComment -= 1; }\r
- $('#chkSignedOff').attr('checked', false);\r
- removeSignedOff();\r
- });\r
+ // Close commit form\r
+ $('.btn_close').click(function(){\r
+ $(this).hide();\r
+ $(this).next().hide();\r
+ if(editComment > 0){ editComment -= 1; }\r
+ $('#chkSignedOff').attr('checked', false);\r
+ removeSignedOff();\r
+ });\r
\r
//Close Popups and Fade Layer\r
$('body').on('click', 'a.close, #fade', function() {\r
if(editComment > 0){ editComment -= 1; }\r
$('#fade , #modal').fadeOut(function() {\r
- $('#fade, a.close').remove(); \r
- }); \r
+ $('#fade, a.close').remove();\r
+ });\r
$('#modalQuestion').hide();\r
$('#chkSignedOff').attr('checked', false);\r
removeSignedOff();\r
if(commitMessage == ""){ commitMessage = "New commit";}\r
if(sessionStarted){\r
if ($.trim(updateComment) == ''){ this.value = (this.defaultValue ? this.defaultValue : ''); }\r
- else{ \r
+ else{\r
displaySpinner();\r
startCommitProcess();\r
}\r
showcomment = false;\r
// Re-load all comment\r
reloadComment();\r
- }\r
- }\r
+ }\r
+ }\r
else{ editComment -= 1; }\r
$('#chkSignedOff').attr('checked', false);\r
});\r
- \r
+\r
// Cancel creating branch\r
$('#btnCancelBranch').click(function(){\r
editComment -= 1;\r
- $('#modalQuestion').hide();\r
- $('#fade , #modal').fadeOut(function() { $('#fade, a.close').remove(); });\r
+ $('#modalQuestion').hide();\r
+ $('#fade , #modal').fadeOut(function() { $('#fade, a.close').remove(); });\r
return;\r
- });\r
-\r
- // Create new branch and continu\r
- $('#btnCreateBranch').click(function(){\r
- $('#modalQuestion').hide();\r
- if($('#btnCreateBranch').text() != 'Ok'){\r
- // Create the branch\r
- createBranch();\r
- commitMessage = $('#commitMessage').val().replace(/\r?\n/g, '\\n').replace(/\t/g, '\\t').replace(/\"/g,'\\"');\r
+ });\r
+\r
+ // Create new branch and continu\r
+ $('#btnCreateBranch').click(function(){\r
+ $('#modalQuestion').hide();\r
+ if($('#btnCreateBranch').text() != 'Ok'){\r
+ // Create the branch\r
+ createBranch();\r
+ commitMessage = $('#commitMessage').val().replace(/\r?\n/g, '\\n').replace(/\t/g, '\\t').replace(/\"/g,'\\"');\r
if(commitMessage == ""){ commitMessage = "New commit"; }\r
- if(userB64 != ""){ \r
+ if(userB64 != ""){\r
if(loginProcess){\r
- setCookie("logginNitdoc", base64.encode(userName+':'+password+':'+githubRepo+':'+branchName), 1); \r
+ setCookie("logginNitdoc", base64.encode(userName+':'+password+':'+githubRepo+':'+branchName), 1);\r
$('#loginGit').val("");\r
$('#passwordGit').val("");\r
- loginProcess = false; \r
+ loginProcess = false;\r
toggleLoginBox();\r
}\r
else{\r
if ($.trim(updateComment) == ''){ this.value = (this.defaultValue ? this.defaultValue : ''); }\r
else{ startCommitProcess(); }\r
- } \r
+ }\r
}\r
}\r
else\r
{\r
$('#fade , #modalQuestion, #modal').fadeOut(function() { $('#fade, a.close').remove(); });\r
}\r
- });\r
+ });\r
\r
- $('a[class=newComment]').click(function(){\r
- addNewComment = true; \r
- editComment += 1;\r
- // hide comment\r
+ $('a[class=newComment]').click(function(){\r
+ addNewComment = true;\r
+ editComment += 1;\r
+ // hide comment\r
$(this).hide();\r
- // Show edit box \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
+ // Resize edit box\r
$(this).next().height($(this).next().prop("scrollHeight"));\r
resizeTextarea($(this).next());\r
// Select it\r
$(this).next().select();\r
- preElement = $(this); \r
- });\r
+ preElement = $(this);\r
+ });\r
\r
- $("#dropBranches").change(function () { \r
+ $("#dropBranches").change(function () {\r
$("#dropBranches option:selected").each(function () {\r
if(branchName != $(this).text()){\r
branchName = $(this).text();\r
$(this).css({'cursor' : 'pointer'});\r
}\r
else{\r
- $(this).css({'cursor' : ''}); \r
+ $(this).css({'cursor' : ''});\r
}\r
}\r
);\r
\r
// Init process to commit the new comment\r
function startCommitProcess()\r
-{ \r
+{\r
if($('#chkSignedOff').is(':checked')){\r
var numL = preElement.attr("title");\r
- commentLineStart = numL.split('-')[0] - 1; \r
+ commentLineStart = numL.split('-')[0] - 1;\r
if(addNewComment) { commentLineStart++; }\r
commentLineEnd = (commentLineStart + preElement.text().split('\n').length) - 1;\r
- state = true; \r
+ state = true;\r
replaceComment(updateComment, currentfileContent);\r
- getLastCommit(); \r
- getBaseTree(); \r
+ getLastCommit();\r
+ getBaseTree();\r
editComment = false;\r
}\r
else{\r
- displayMessage('Please sign this commit', 40, 40); \r
+ displayMessage('Please sign this commit', 40, 40);\r
}\r
}\r
\r
function updateDisplaying(){\r
if (checkCookie())\r
{\r
- userB64 = "Basic " + getUserPass("logginNitdoc"); \r
- $('#loginGit').hide();\r
- $('#passwordGit').hide();\r
- $('#lbpasswordGit').hide(); \r
- $('#lbloginGit').hide(); \r
- $('#repositoryGit').hide();\r
- $('#lbrepositoryGit').hide();\r
- $('#lbbranchGit').hide(); \r
- $('#branchGit').hide();\r
- $('#listBranches').show();\r
- $('#divGitHubRepoDisplay').show();\r
- $("#liGitHub").attr("class", "current");\r
- $("#imgGitHub").attr("src", "resources/icons/github-icon-w.png");\r
- $('#nickName').text(userName);\r
- $('#githubAccount').attr("href", "https://github.com/"+userName);\r
- $('#logginMessage').css({'display' : 'block'});\r
- $('#logginMessage').css({'text-align' : 'center'});\r
- $('.popover').css({'height' : '190px'});\r
- $('#signIn').text("Sign out");\r
- $('#githubRepoDisplay').text(githubRepo);\r
- sessionStarted = true;\r
- reloadComment();\r
+ userB64 = "Basic " + getUserPass("logginNitdoc");\r
+ $('#loginGit').hide();\r
+ $('#passwordGit').hide();\r
+ $('#lbpasswordGit').hide();\r
+ $('#lbloginGit').hide();\r
+ $('#repositoryGit').hide();\r
+ $('#lbrepositoryGit').hide();\r
+ $('#lbbranchGit').hide();\r
+ $('#branchGit').hide();\r
+ $('#listBranches').show();\r
+ $('#divGitHubRepoDisplay').show();\r
+ $("#liGitHub").attr("class", "current");\r
+ $("#imgGitHub").attr("src", "resources/icons/github-icon-w.png");\r
+ $('#nickName').text(userName);\r
+ $('#githubAccount').attr("href", "https://github.com/"+userName);\r
+ $('#logginMessage').css({'display' : 'block'});\r
+ $('#logginMessage').css({'text-align' : 'center'});\r
+ $('.popover').css({'height' : '190px'});\r
+ $('#signIn').text("Sign out");\r
+ $('#githubRepoDisplay').text(githubRepo);\r
+ sessionStarted = true;\r
+ reloadComment();\r
}\r
else\r
{\r
sessionStarted = false;\r
$('#logginMessage').css({'display' : 'none'});\r
$("#liGitHub").attr("class", "");\r
- $("#imgGitHub").attr("src", "resources/icons/github-icon.png");\r
- $('#loginGit').val("");\r
- $('#passwordGit').val("");\r
- $('#nickName').text("");\r
- $('.popover').css({'height' : '325px'});\r
- $('#logginMessage').css({'display' : 'none'});\r
- $('#repositoryGit').val($('#repoName').attr('name'));\r
- $('#branchGit').val('wikidoc'); \r
- $('#signIn').text("Sign In");\r
+ $("#imgGitHub").attr("src", "resources/icons/github-icon.png");\r
+ $('#loginGit').val("");\r
+ $('#passwordGit').val("");\r
+ $('#nickName').text("");\r
+ $('.popover').css({'height' : '325px'});\r
+ $('#logginMessage').css({'display' : 'none'});\r
+ $('#repositoryGit').val($('#repoName').attr('name'));\r
+ $('#branchGit').val('wikidoc');\r
+ $('#signIn').text("Sign In");\r
$('#loginGit').show();\r
- $('#passwordGit').show();\r
- $('#lbpasswordGit').show();\r
- $('#lbloginGit').show(); \r
- $('#repositoryGit').show();\r
- $('#lbrepositoryGit').show();\r
- $('#lbbranchGit').show(); \r
- $('#branchGit').show(); \r
- $('#listBranches').hide();\r
- $('#divGitHubRepoDisplay').hide();\r
+ $('#passwordGit').show();\r
+ $('#lbpasswordGit').show();\r
+ $('#lbloginGit').show();\r
+ $('#repositoryGit').show();\r
+ $('#lbrepositoryGit').show();\r
+ $('#lbbranchGit').show();\r
+ $('#branchGit').show();\r
+ $('#listBranches').hide();\r
+ $('#divGitHubRepoDisplay').hide();\r
}\r
}\r
\r
{\r
c_start = c_value.indexOf("=", c_start) + 1;\r
var c_end = c_value.indexOf(";", c_start);\r
- if (c_end == -1) { c_end = c_value.length; }\r
+ if (c_end == -1) { c_end = c_value.length; }\r
c_value = unescape(c_value.substring(c_start,c_end));\r
}\r
return c_value;\r
cookie = base64.decode(cookie);\r
userName = cookie.split(':')[0];\r
password = cookie.split(':')[1];\r
- githubRepo = cookie.split(':')[2]; \r
+ githubRepo = cookie.split(':')[2];\r
branchName = cookie.split(':')[3];\r
- return true;\r
+ return true;\r
}\r
else { return false; }\r
}\r
\r
-function getLastCommit() \r
-{ \r
+function getLastCommit()\r
+{\r
var urlHead = '';\r
if(sessionStarted){ urlHead = "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/refs/heads/"+branchName;}\r
- else{ \r
+ else{\r
// TODO: get url of the original repo.\r
return;\r
}\r
\r
$.ajax({\r
- beforeSend: function (xhr) { \r
+ beforeSend: function (xhr) {\r
if (userB64 != ""){ xhr.setRequestHeader ("Authorization", userB64); }\r
},\r
type: "GET",\r
dataType:"json",\r
async: false,\r
success: function(success)\r
- { \r
- shaLastCommit = success.object.sha; \r
+ {\r
+ shaLastCommit = success.object.sha;\r
}\r
});\r
}\r
\r
function getBaseTree()\r
-{ \r
- $.ajax({ \r
- beforeSend: function (xhr) { \r
+{\r
+ $.ajax({\r
+ beforeSend: function (xhr) {\r
if (userB64 != ""){ xhr.setRequestHeader ("Authorization", userB64); }\r
},\r
type: "GET",\r
dataType:"json",\r
async: false,\r
success: function(success)\r
- { \r
+ {\r
shaBaseTree = success.tree.sha;\r
if (state){ setBlob(); }\r
- else{ return; } \r
+ else{ return; }\r
},\r
error: function(){\r
- return;\r
+ return;\r
}\r
- }); \r
+ });\r
}\r
\r
function setNewTree()\r
{\r
- $.ajax({ \r
+ $.ajax({\r
beforeSend: function (xhr) { xhr.setRequestHeader ("Authorization", userB64); },\r
type: "POST",\r
- url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/trees", \r
+ url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/trees",\r
async: false,\r
dataType:'json',\r
data:'{ "base_tree" : "'+shaBaseTree+'", '+\r
'"type":"blob",'+\r
'"sha": "'+ shaBlob +'"'+\r
'}] '+\r
- '}', \r
+ '}',\r
success: function(success)\r
{ // si l'appel a bien fonctionné\r
shaNewTree = success.sha;\r
- setNewCommit(); \r
+ setNewCommit();\r
},\r
error: function(){\r
- return;\r
+ return;\r
}\r
});\r
}\r
function setNewCommit()\r
{\r
addSignedOff();\r
- $.ajax({ \r
+ $.ajax({\r
beforeSend: function (xhr) { xhr.setRequestHeader ("Authorization", userB64); },\r
type: "POST",\r
- url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/commits", \r
+ url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/commits",\r
async: false,\r
dataType:'json',\r
data:'{ "message" : "'+ commitMessage +'", '+\r
- '"parents" :"'+shaLastCommit+'",'+ \r
+ '"parents" :"'+shaLastCommit+'",'+\r
'"tree": "'+shaNewTree+'"'+\r
- '}', \r
+ '}',\r
success: function(success)\r
{\r
shaNewCommit = success.sha;\r
- commit(); \r
+ commit();\r
},\r
error: function(){\r
- return;\r
+ return;\r
}\r
});\r
}\r
//Create a commit\r
function commit()\r
{\r
- $.ajax({ \r
+ $.ajax({\r
beforeSend: function (xhr) { xhr.setRequestHeader ("Authorization", userB64); },\r
type: "POST",\r
- url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/refs/heads/"+branchName, \r
+ url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/refs/heads/"+branchName,\r
dataType:'json',\r
data:'{ "sha" : "'+shaNewCommit+'", '+\r
'"force" :"true"'+\r
{\r
$.ajax({\r
beforeSend: function (xhr) { xhr.setRequestHeader ("Authorization", userB64); },\r
- type: "POST", \r
- url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/blobs", \r
+ type: "POST",\r
+ url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/blobs",\r
async: false,\r
dataType:'json',\r
data:'{ "content" : "'+text.replace(/\r?\n/g, '\\n').replace(/\t/g, '\\t').replace(/\"/g,'\\"')+'", '+\r
'"encoding" :"utf-8"'+\r
'}',\r
success: function(success)\r
- { \r
+ {\r
shaBlob = success.sha;\r
- setNewTree(); \r
+ setNewTree();\r
},\r
- error:function(error){ \r
- displayMessage('Error : Problem parsing JSON', 40, 40); \r
- return;\r
- }\r
+ error:function(error){\r
+ displayMessage('Error : Problem parsing JSON', 40, 40);\r
+ return;\r
+ }\r
});\r
}\r
\r
function getFileContent(urlFile, newComment)\r
{\r
$.ajax({\r
- beforeSend: function (xhr) { \r
+ beforeSend: function (xhr) {\r
xhr.setRequestHeader ("Accept", "application/vnd.github-blob.raw");\r
if (userB64 != ""){ xhr.setRequestHeader ("Authorization", userB64); }\r
},\r
- type: "GET", \r
- url: urlFile, \r
+ type: "GET",\r
+ url: urlFile,\r
async:false,\r
success: function(success)\r
{\r
state = true;\r
- replaceComment(newComment, success); \r
+ replaceComment(newComment, success);\r
}\r
});\r
}\r
\r
function replaceComment(newComment, fileContent){\r
- var arrayNew = newComment.split('\n'); \r
+ var arrayNew = newComment.split('\n');\r
var lNew = arrayNew.length;\r
text = "";\r
var lines = fileContent.split("\n");\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
+ text += lines[i] + "\n";\r
}\r
// We change the comment\r
for(var j = 0; j < lNew; j++){\r
if(shaLastCommit != ""){\r
if (checkCookie()) {\r
urlRaw="https://rawgithub.com/"+ userName +"/"+ githubRepo +"/" + shaLastCommit + "/" + path;\r
- $.ajax({ \r
+ $.ajax({\r
type: "GET",\r
url: urlRaw,\r
async: false,\r
function displayMessage(msg, widthDiv, margModal){\r
spinner.stop();\r
$('#modal').hide();\r
- $('#btnCancelBranch').hide(); \r
+ $('#btnCancelBranch').hide();\r
$('#modalQuestion').show().prepend('<a class="close"><img src="resources/icons/close.png" class="btnCloseQuestion" title="Close" alt="Close" /></a>');\r
$('#txtQuestion').text(msg);\r
$('#btnCreateBranch').text("Ok");\r
// Check if the repo already exist\r
function isRepoExisting(){\r
$.ajax({\r
- beforeSend: function (xhr) { \r
+ beforeSend: function (xhr) {\r
if (userB64 != "") { xhr.setRequestHeader ("Authorization", userB64); }\r
},\r
- type: "GET", \r
- url: "https://api.github.com/repos/"+userName+"/"+githubRepo, \r
+ type: "GET",\r
+ url: "https://api.github.com/repos/"+userName+"/"+githubRepo,\r
async:false,\r
dataType:'json',\r
success: function(){ repoExist = true; },\r
error: function()\r
{\r
- displayMessage('Repo not found !', 35, 45);\r
- repoExist = false;\r
+ displayMessage('Repo not found !', 35, 45);\r
+ repoExist = false;\r
}\r
});\r
}\r
});\r
}\r
\r
-function getMasterSha() \r
+function getMasterSha()\r
{\r
$.ajax({\r
- beforeSend: function (xhr) { \r
+ beforeSend: function (xhr) {\r
if (userB64 != ""){ xhr.setRequestHeader ("Authorization", userB64); }\r
},\r
type: "GET",\r
\r
getMasterSha();\r
\r
- $.ajax({ \r
+ $.ajax({\r
beforeSend: function (xhr) { xhr.setRequestHeader ("Authorization", userB64); },\r
type: "POST",\r
- url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/refs", \r
+ url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/git/refs",\r
data:'{ "ref" : "refs/heads/'+branchName+'",'+\r
- '"sha" : "'+shaMaster+'"'+\r
+ '"sha" : "'+shaMaster+'"'+\r
'}',\r
success: function(){ return; },\r
error: function(){\r
- editComment -= 1;\r
- displayMessage('Impossible to create the new branch : ' + branchName, 40, 40);\r
+ editComment -= 1;\r
+ displayMessage('Impossible to create the new branch : ' + branchName, 40, 40);\r
}\r
});\r
}\r
}\r
\r
function getCommentOfFunction(element){\r
- var textC = ""; \r
+ var textC = "";\r
var numL = element.attr("title");\r
- if(numL != null){ \r
- commentLineStart = numL-1; \r
- commentLineEnd = element.attr('name').split(numL)[1].split('-')[1]-1; \r
+ if(numL != null){\r
+ commentLineStart = numL-1;\r
+ commentLineEnd = element.attr('name').split(numL)[1].split('-')[1]-1;\r
var lines = currentfileContent.split("\n");\r
for (var i = 0; i < lines.length; i++) {\r
if(i >= commentLineStart-1 && i <= commentLineEnd+1){\r
}\r
if(textC != element.text){element.text(textC);}\r
if (textC != "" && editComment > 0){\r
- var originContent = originalFileContent.split("\n");\r
- var origin = '';\r
- var lblDiff = element.parent().prev().children('#lblDiffCommit');\r
- var preSave = element.parent().children('#preSave');\r
- for (var i = 0; i < originContent.length; i++) {\r
- if(i >= commentLineStart-1 && i <= commentLineEnd+1){\r
- if (originContent[i].substr(1,1) == "#"){ origin += originContent[i].substr(3,originContent[i].length) + "\n";}\r
- else if(originContent[i].substr(0,1) == '#'){ origin += originContent[i].substr(2,originContent[i].length) + "\n"; }\r
- }\r
- }\r
- if(textC != origin && numL == numComment){\r
- // The comment is different compare to the original\r
- if(showcomment == false){ lblDiff.text("Show original comment"); }\r
- preSave.text(origin);\r
- }\r
- else if (numL == numComment){ lblDiff.text(""); }\r
+ var originContent = originalFileContent.split("\n");\r
+ var origin = '';\r
+ var lblDiff = element.parent().prev().children('#lblDiffCommit');\r
+ var preSave = element.parent().children('#preSave');\r
+ for (var i = 0; i < originContent.length; i++) {\r
+ if(i >= commentLineStart-1 && i <= commentLineEnd+1){\r
+ if (originContent[i].substr(1,1) == "#"){ origin += originContent[i].substr(3,originContent[i].length) + "\n";}\r
+ else if(originContent[i].substr(0,1) == '#'){ origin += originContent[i].substr(2,originContent[i].length) + "\n"; }\r
+ }\r
+ }\r
+ if(textC != origin && numL == numComment){\r
+ // The comment is different compare to the original\r
+ if(showcomment == false){ lblDiff.text("Show original comment"); }\r
+ preSave.text(origin);\r
+ }\r
+ else if (numL == numComment){ lblDiff.text(""); }\r
}\r
}\r
}\r
{\r
cleanListBranches();\r
$.ajax({\r
- beforeSend: function (xhr) { \r
+ beforeSend: function (xhr) {\r
if ($("#login").val() != ""){ xhr.setRequestHeader ("Authorization", userB64); }\r
},\r
- type: "GET", \r
- url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/branches", \r
+ type: "GET",\r
+ url: "https://api.github.com/repos/"+userName+"/"+githubRepo+"/branches",\r
async:false,\r
dataType:'json',\r
success: function(success)\r
- { \r
- for(var branch in success) { \r
- var selected = '';\r
- if(branchName == success[branch].name){\r
- selected = 'selected';\r
- }\r
- $('#dropBranches').append('<option value="" '+ selected +'>' + success[branch].name + '</option>');\r
+ {\r
+ for(var branch in success) {\r
+ var selected = '';\r
+ if(branchName == success[branch].name){\r
+ selected = 'selected';\r
+ }\r
+ $('#dropBranches').append('<option value="" '+ selected +'>' + success[branch].name + '</option>');\r
}\r
}\r
});\r
function closeAllCommentInEdtiting(){\r
$('a[id=cancelBtn]').each(function(){\r
closeEditing($(this));\r
- });\r
+ });\r
}\r
\r
function closeEditing(tag){\r
if(editComment > 0){ editComment -= 1; }\r
- // Hide itself\r
- tag.hide();\r
- // Hide commitBtn\r
- tag.next().hide();\r
- // Hide Textarea\r
- tag.prev().hide();\r
- // Show comment\r
- tag.prev().prev().show();\r
+ // Hide itself\r
+ tag.hide();\r
+ // Hide commitBtn\r
+ tag.next().hide();\r
+ // Hide Textarea\r
+ tag.prev().hide();\r
+ // Show comment\r
+ tag.prev().prev().show();\r
}\r
\r
function checkSignIn(){\r
dataType:'json',\r
success: function(success)\r
{\r
- getUserInfo();\r
- response = true;\r
- displayMessage('You are now logged in');\r
+ getUserInfo();\r
+ response = true;\r
+ displayMessage('You are now logged in');\r
},\r
error: function()\r
{\r
- displayMessage('Error : Wrong username or password');\r
- response = false;\r
+ displayMessage('Error : Wrong username or password');\r
+ response = false;\r
}\r
});\r
return response;\r
async:false,\r
dataType:'json',\r
success: function(success)\r
- { \r
- userEmail = success;\r
+ {\r
+ userEmail = success;\r
}\r
});\r
}\r
dataType:'json',\r
success: function(success)\r
{\r
- signedOff = success.name;\r
+ signedOff = success.name;\r
}\r
});\r
}\r
}\r
\r
function removeSignedOff(){\r
- $('#commitMessage').val(commitMessage); \r
+ $('#commitMessage').val(commitMessage);\r
resizeTextarea($('#commitMessage'));\r
}\r
\r
\r
function showComment(element){\r
// Display the original comment\r
- if (showcomment == true){ \r
+ if (showcomment == true){\r
showcomment = false;\r
element.text("Show original comment");\r
}\r
showcomment = true;\r
element.text("Comment changed in "+githubRepo+" / "+branchName);\r
}\r
- var parent = element.parent().next(".description"); \r
+ var parent = element.parent().next(".description");\r
var textarea = parent.children('#fileContent');\r
- var text = textarea.val(); \r
- var preSave = parent.children('#preSave'); \r
+ var text = textarea.val();\r
+ var preSave = parent.children('#preSave');\r
textarea.val(preSave.text());\r
preSave.text(text);\r
// Resize edit box\r