nitdoc: fixed shared files with ni_nitdoc.
[nit.git] / share / ni_nitdoc / scripts / github.js
similarity index 74%
rename from share/nitdoc/scripts/github.js
rename to share/ni_nitdoc/scripts/github.js
index 54ed212..f8346a8 100644 (file)
@@ -20,7 +20,7 @@ var shaMaster;
 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
@@ -51,7 +51,7 @@ var spinner = new Spinner(opts).spin(targetSpinner);
 // 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
@@ -95,18 +95,18 @@ $(document).ready(function() {
                                        }\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
@@ -126,7 +126,7 @@ $(document).ready(function() {
                        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
@@ -134,7 +134,7 @@ $(document).ready(function() {
                        $(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
@@ -143,15 +143,15 @@ $(document).ready(function() {
                }\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
@@ -162,7 +162,7 @@ $(document).ready(function() {
                                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
@@ -172,23 +172,23 @@ $(document).ready(function() {
                        $('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
@@ -215,7 +215,7 @@ $(document).ready(function() {
                                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
@@ -232,68 +232,68 @@ $(document).ready(function() {
                                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
@@ -319,7 +319,7 @@ $(document).ready(function() {
                                $(this).css({'cursor' : 'pointer'});\r
                        }\r
                        else{\r
-                               $(this).css({'cursor' : ''});   \r
+                               $(this).css({'cursor' : ''});\r
                        }\r
                }\r
        );\r
@@ -336,73 +336,73 @@ $(document).ready(function() {
 \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
@@ -436,7 +436,7 @@ function getCookie(c_name)
        {\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
@@ -455,24 +455,24 @@ function checkCookie()
                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
@@ -480,16 +480,16 @@ function getLastCommit()
         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
@@ -497,23 +497,23 @@ function getBaseTree()
         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
@@ -523,14 +523,14 @@ function setNewTree()
                     '"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
@@ -538,23 +538,23 @@ function setNewTree()
 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
@@ -562,10 +562,10 @@ function setNewCommit()
 //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
@@ -580,22 +580,22 @@ function setBlob()
 {\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
@@ -603,23 +603,23 @@ function setBlob()
 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
@@ -630,7 +630,7 @@ function replaceComment(newComment, fileContent){
                                        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
@@ -662,7 +662,7 @@ function getCommentLastCommit(path, origin){
        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
@@ -680,7 +680,7 @@ function getCommentLastCommit(path, origin){
 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
@@ -704,18 +704,18 @@ function displaySpinner(){
 // 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
@@ -747,10 +747,10 @@ function isBranchExisting(){
        });\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
@@ -765,17 +765,17 @@ function createBranch(){
 \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
@@ -805,11 +805,11 @@ function reloadComment(){
 }\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
@@ -819,22 +819,22 @@ function getCommentOfFunction(element){
            }\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
@@ -844,21 +844,21 @@ function getListBranches()
 {\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
@@ -872,19 +872,19 @@ function cleanListBranches(){
 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
@@ -899,14 +899,14 @@ function checkSignIn(){
         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
@@ -922,8 +922,8 @@ function getUserInfo(){
         async:false,\r
         dataType:'json',\r
         success: function(success)\r
-        {        \r
-               userEmail = success;\r
+        {\r
+       userEmail = success;\r
         }\r
     });\r
 }\r
@@ -939,7 +939,7 @@ function getSignedOff(){
         dataType:'json',\r
         success: function(success)\r
         {\r
-               signedOff = success.name;\r
+       signedOff = success.name;\r
         }\r
     });\r
 }\r
@@ -954,7 +954,7 @@ function addSignedOff(){
 }\r
 \r
 function removeSignedOff(){\r
-       $('#commitMessage').val(commitMessage); \r
+       $('#commitMessage').val(commitMessage);\r
        resizeTextarea($('#commitMessage'));\r
 }\r
 \r
@@ -965,7 +965,7 @@ function resizeTextarea(element){
 \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
@@ -974,10 +974,10 @@ function showComment(element){
                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