|
@@ -9,11 +9,11 @@ function initCommentPreviewTab($form) {
|
|
|
$tabMenu.find('.item[data-tab="' + $tabMenu.data('preview') + '"]').click(function () {
|
|
|
var $this = $(this);
|
|
|
$.post($this.data('url'), {
|
|
|
- "_csrf": csrf,
|
|
|
- "mode": "gfm",
|
|
|
- "context": $this.data('context'),
|
|
|
- "text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
|
|
|
- },
|
|
|
+ "_csrf": csrf,
|
|
|
+ "mode": "gfm",
|
|
|
+ "context": $this.data('context'),
|
|
|
+ "text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
|
|
|
+ },
|
|
|
function (data) {
|
|
|
var $previewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
|
|
|
$previewPanel.html(data);
|
|
@@ -39,11 +39,11 @@ function initEditPreviewTab($form) {
|
|
|
$previewTab.click(function () {
|
|
|
var $this = $(this);
|
|
|
$.post($this.data('url'), {
|
|
|
- "_csrf": csrf,
|
|
|
- "mode": "gfm",
|
|
|
- "context": $this.data('context'),
|
|
|
- "text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
|
|
|
- },
|
|
|
+ "_csrf": csrf,
|
|
|
+ "mode": "gfm",
|
|
|
+ "context": $this.data('context'),
|
|
|
+ "text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
|
|
|
+ },
|
|
|
function (data) {
|
|
|
var $previewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
|
|
|
$previewPanel.html(data);
|
|
@@ -63,9 +63,9 @@ function initEditDiffTab($form) {
|
|
|
$tabMenu.find('.item[data-tab="' + $tabMenu.data('diff') + '"]').click(function () {
|
|
|
var $this = $(this);
|
|
|
$.post($this.data('url'), {
|
|
|
- "_csrf": csrf,
|
|
|
- "content": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
|
|
|
- },
|
|
|
+ "_csrf": csrf,
|
|
|
+ "content": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
|
|
|
+ },
|
|
|
function (data) {
|
|
|
var $diffPreviewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('diff') + '"]');
|
|
|
$diffPreviewPanel.html(data);
|
|
@@ -221,7 +221,7 @@ function initRepository() {
|
|
|
window.location.href = $choice.data('url');
|
|
|
console.log($choice.data('url'))
|
|
|
},
|
|
|
- message: {noResults: $dropdown.data('no-results')}
|
|
|
+ message: { noResults: $dropdown.data('no-results') }
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -346,9 +346,9 @@ function initRepository() {
|
|
|
}
|
|
|
|
|
|
$.post($(this).data('update-url'), {
|
|
|
- "_csrf": csrf,
|
|
|
- "title": $editInput.val()
|
|
|
- },
|
|
|
+ "_csrf": csrf,
|
|
|
+ "title": $editInput.val()
|
|
|
+ },
|
|
|
function (data) {
|
|
|
$editInput.val(data.title);
|
|
|
$issueTitle.text(data.title);
|
|
@@ -390,10 +390,10 @@ function initRepository() {
|
|
|
$editContentZone.hide();
|
|
|
|
|
|
$.post($editContentZone.data('update-url'), {
|
|
|
- "_csrf": csrf,
|
|
|
- "content": $textarea.val(),
|
|
|
- "context": $editContentZone.data('context')
|
|
|
- },
|
|
|
+ "_csrf": csrf,
|
|
|
+ "content": $textarea.val(),
|
|
|
+ "context": $editContentZone.data('context')
|
|
|
+ },
|
|
|
function (data) {
|
|
|
if (data.length == 0) {
|
|
|
$renderContent.html($('#no-content').html());
|
|
@@ -500,14 +500,14 @@ function initRepository() {
|
|
|
initFilterSearchDropdown('.choose.branch .dropdown');
|
|
|
}
|
|
|
if ($('.repository.view.pull').length > 0) {
|
|
|
- $('.comment.merge.box input[name=merge_style]').change(function () {
|
|
|
- if ($(this).val() === 'create_merge_commit') {
|
|
|
- $('.commit.description.field').show();
|
|
|
- } else {
|
|
|
- $('.commit.description.field').hide();
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ $('.comment.merge.box input[name=merge_style]').change(function () {
|
|
|
+ if ($(this).val() === 'create_merge_commit') {
|
|
|
+ $('.commit.description.field').show();
|
|
|
+ } else {
|
|
|
+ $('.commit.description.field').hide();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function initWikiForm() {
|
|
@@ -521,11 +521,11 @@ function initWikiForm() {
|
|
|
setTimeout(function () {
|
|
|
|
|
|
$.post($editArea.data('url'), {
|
|
|
- "_csrf": csrf,
|
|
|
- "mode": "gfm",
|
|
|
- "context": $editArea.data('context'),
|
|
|
- "text": plainText
|
|
|
- },
|
|
|
+ "_csrf": csrf,
|
|
|
+ "mode": "gfm",
|
|
|
+ "context": $editArea.data('context'),
|
|
|
+ "text": plainText
|
|
|
+ },
|
|
|
function (data) {
|
|
|
preview.innerHTML = '<div class="markdown">' + data + '</div>';
|
|
|
emojify.run($('.editor-preview')[0]);
|
|
@@ -603,11 +603,11 @@ function setSimpleMDE($editArea) {
|
|
|
setTimeout(function () {
|
|
|
|
|
|
$.post($editArea.data('url'), {
|
|
|
- "_csrf": csrf,
|
|
|
- "mode": "gfm",
|
|
|
- "context": $editArea.data('context'),
|
|
|
- "text": plainText
|
|
|
- },
|
|
|
+ "_csrf": csrf,
|
|
|
+ "mode": "gfm",
|
|
|
+ "context": $editArea.data('context'),
|
|
|
+ "text": plainText
|
|
|
+ },
|
|
|
function (data) {
|
|
|
preview.innerHTML = '<div class="markdown">' + data + '</div>';
|
|
|
emojify.run($('.editor-preview')[0]);
|
|
@@ -652,10 +652,10 @@ function initEditor() {
|
|
|
$('.js-quick-pull-choice-option').change(function () {
|
|
|
if ($(this).val() == 'commit-to-new-branch') {
|
|
|
$('.quick-pull-branch-name').show();
|
|
|
- $('.quick-pull-branch-name input').prop('required',true);
|
|
|
+ $('.quick-pull-branch-name input').prop('required', true);
|
|
|
} else {
|
|
|
$('.quick-pull-branch-name').hide();
|
|
|
- $('.quick-pull-branch-name input').prop('required',false);
|
|
|
+ $('.quick-pull-branch-name input').prop('required', false);
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -705,7 +705,7 @@ function initEditor() {
|
|
|
|
|
|
var tree_path = parts.join('/');
|
|
|
$('#tree_path').val(tree_path);
|
|
|
- $('#preview-tab').data('context', $('#preview-tab').data('root-context') + tree_path.substring(0, tree_path.lastIndexOf("/")+1));
|
|
|
+ $('#preview-tab').data('context', $('#preview-tab').data('root-context') + tree_path.substring(0, tree_path.lastIndexOf("/") + 1));
|
|
|
}).trigger('keyup');
|
|
|
|
|
|
var $editArea = $('.repository.editor textarea#edit_area');
|
|
@@ -775,7 +775,7 @@ function initEditor() {
|
|
|
value = value.split('/');
|
|
|
value = value[value.length - 1];
|
|
|
|
|
|
- $.getJSON($editFilename.data('ec-url-prefix')+value, function(editorconfig) {
|
|
|
+ $.getJSON($editFilename.data('ec-url-prefix') + value, function (editorconfig) {
|
|
|
if (editorconfig.indent_style === 'tab') {
|
|
|
codeMirrorEditor.setOption("indentWithTabs", true);
|
|
|
codeMirrorEditor.setOption('extraKeys', {});
|
|
@@ -785,7 +785,7 @@ function initEditor() {
|
|
|
|
|
|
|
|
|
codeMirrorEditor.setOption('extraKeys', {
|
|
|
- Tab: function(cm) {
|
|
|
+ Tab: function (cm) {
|
|
|
var spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" ");
|
|
|
cm.replaceSelection(spaces);
|
|
|
}
|
|
@@ -1131,7 +1131,7 @@ function initWebhookSettings() {
|
|
|
$($(this).data('target') + ' .nohighlight').each(function () {
|
|
|
var $this = $(this);
|
|
|
$this.removeClass('nohighlight');
|
|
|
- setTimeout(function(){ hljs.highlightBlock($this[0]) }, 500);
|
|
|
+ setTimeout(function () { hljs.highlightBlock($this[0]) }, 500);
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -1213,7 +1213,7 @@ $(document).ready(function () {
|
|
|
var filenameDict = {};
|
|
|
$dropzone.dropzone({
|
|
|
url: $dropzone.data('upload-url'),
|
|
|
- headers: {"X-Csrf-Token": csrf},
|
|
|
+ headers: { "X-Csrf-Token": csrf },
|
|
|
maxFiles: $dropzone.data('max-file'),
|
|
|
maxFilesize: $dropzone.data('max-size'),
|
|
|
acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),
|
|
@@ -1336,6 +1336,10 @@ $(document).ready(function () {
|
|
|
window.location.href = $this.data('done-url');
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ $('.submit-button').click(function () {
|
|
|
+ $($(this).data('form')).submit();
|
|
|
+ });
|
|
|
|
|
|
|
|
|
$('.enable-system').change(function () {
|
|
@@ -1459,7 +1463,7 @@ $(function () {
|
|
|
$('form').areYouSure();
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+
|
|
|
function getByteLen(normalVal) {
|
|
|
|
|
|
normalVal = String(normalVal);
|
|
@@ -1467,19 +1471,19 @@ function getByteLen(normalVal) {
|
|
|
var byteLen = 0;
|
|
|
for (var i = 0; i < normalVal.length; i++) {
|
|
|
var c = normalVal.charCodeAt(i);
|
|
|
- byteLen += c < (1 << 7) ? 1 :
|
|
|
- c < (1 << 11) ? 2 :
|
|
|
- c < (1 << 16) ? 3 :
|
|
|
- c < (1 << 21) ? 4 :
|
|
|
- c < (1 << 26) ? 5 :
|
|
|
- c < (1 << 31) ? 6 : Number.NaN;
|
|
|
+ byteLen += c < (1 << 7) ? 1 :
|
|
|
+ c < (1 << 11) ? 2 :
|
|
|
+ c < (1 << 16) ? 3 :
|
|
|
+ c < (1 << 21) ? 4 :
|
|
|
+ c < (1 << 26) ? 5 :
|
|
|
+ c < (1 << 31) ? 6 : Number.NaN;
|
|
|
}
|
|
|
return byteLen;
|
|
|
}
|
|
|
|
|
|
function showMessageMaxLength(maxLen, textElemId, counterId) {
|
|
|
- var $msg = $('#'+textElemId);
|
|
|
- $('#'+counterId).html(maxLen - getByteLen($msg.val()));
|
|
|
+ var $msg = $('#' + textElemId);
|
|
|
+ $('#' + counterId).html(maxLen - getByteLen($msg.val()));
|
|
|
|
|
|
var onMessageKey = function (e) {
|
|
|
var $msg = $(this);
|
|
@@ -1492,7 +1496,7 @@ function showMessageMaxLength(maxLen, textElemId, counterId) {
|
|
|
remainder = 0;
|
|
|
}
|
|
|
|
|
|
- $('#'+counterId).html(remainder);
|
|
|
+ $('#' + counterId).html(remainder);
|
|
|
};
|
|
|
|
|
|
$msg.keyup(onMessageKey).keydown(onMessageKey);
|