forked from forgejo/forgejo
parent
2a931937a8
commit
a2f13eae55
10 changed files with 79 additions and 46 deletions
|
@ -18,7 +18,7 @@ function initCommentPreviewTab($form) {
|
|||
var $preview_tab = $form.find('.tab.segment[data-tab="' + $tab_menu.data('preview') + '"]');
|
||||
$preview_tab.html(data);
|
||||
emojify.run($preview_tab[0]);
|
||||
$('pre code', $preview_tab[0]).each(function(i, block) {
|
||||
$('pre code', $preview_tab[0]).each(function (i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
}
|
||||
|
@ -322,8 +322,7 @@ function initRepository() {
|
|||
};
|
||||
$('#edit-title').click(editTitleToggle);
|
||||
$('#cancel-edit-title').click(editTitleToggle);
|
||||
$('#save-edit-title').click(editTitleToggle).
|
||||
click(function () {
|
||||
$('#save-edit-title').click(editTitleToggle).click(function () {
|
||||
if ($edit_input.val().length == 0 ||
|
||||
$edit_input.val() == $issue_title.text()) {
|
||||
$edit_input.val($issue_title.text());
|
||||
|
@ -385,7 +384,7 @@ function initRepository() {
|
|||
} else {
|
||||
$render_content.html(data.content);
|
||||
emojify.run($render_content[0]);
|
||||
$('pre code', $render_content[0]).each(function(i, block) {
|
||||
$('pre code', $render_content[0]).each(function (i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
}
|
||||
|
@ -521,10 +520,8 @@ function initOrganization() {
|
|||
}
|
||||
}
|
||||
|
||||
function initUser() {
|
||||
if ($('.user').length == 0) {
|
||||
return;
|
||||
}
|
||||
function initUserSettings() {
|
||||
console.log('initUserSettings');
|
||||
|
||||
// Options
|
||||
if ($('.user.settings.profile').length > 0) {
|
||||
|
@ -796,10 +793,7 @@ $(document).ready(function () {
|
|||
|
||||
// Show exact time
|
||||
$('.time-since').each(function () {
|
||||
$(this).addClass('poping up').
|
||||
attr('data-content', $(this).attr('title')).
|
||||
attr('data-variation', 'inverted tiny').
|
||||
attr('title', '');
|
||||
$(this).addClass('poping up').attr('data-content', $(this).attr('title')).attr('data-variation', 'inverted tiny').attr('title', '');
|
||||
});
|
||||
|
||||
// Semantic UI modules.
|
||||
|
@ -879,8 +873,8 @@ $(document).ready(function () {
|
|||
ignore_emoticons: true
|
||||
});
|
||||
var hasEmoji = document.getElementsByClassName('has-emoji');
|
||||
for (var i = 0; i < hasEmoji.length; i++) {
|
||||
emojify.run(hasEmoji[i]);
|
||||
for (var i = 0; i < hasEmoji.length; i++) {
|
||||
emojify.run(hasEmoji[i]);
|
||||
}
|
||||
|
||||
// Clipboard JS
|
||||
|
@ -928,6 +922,14 @@ $(document).ready(function () {
|
|||
$('.show-modal.button').click(function () {
|
||||
$($(this).data('modal')).modal('show');
|
||||
});
|
||||
$('.delete-post.button').click(function(){
|
||||
var $this = $(this);
|
||||
$.post($this.data('request-url'),{
|
||||
"_csrf": csrf
|
||||
}).done(function(){
|
||||
window.location.href = $this.data('done-url');
|
||||
});
|
||||
});
|
||||
|
||||
// Set anchor.
|
||||
$('.markdown').each(function () {
|
||||
|
@ -953,15 +955,25 @@ $(document).ready(function () {
|
|||
searchUsers();
|
||||
searchRepositories();
|
||||
|
||||
|
||||
initCommentForm();
|
||||
initInstall();
|
||||
initRepository();
|
||||
initWiki();
|
||||
initOrganization();
|
||||
initUser();
|
||||
initWebhook();
|
||||
initAdmin();
|
||||
|
||||
var routes = {
|
||||
'div.user.settings': initUserSettings
|
||||
};
|
||||
|
||||
var selector;
|
||||
for (selector in routes) {
|
||||
if ($(selector).length > 0) {
|
||||
routes[selector]();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(window).load(function () {
|
||||
|
@ -1053,11 +1065,12 @@ $(window).load(function () {
|
|||
case 'ssh':
|
||||
if ($('#repo-clone-ssh').click().length === 0) {
|
||||
$('#repo-clone-https').click();
|
||||
};
|
||||
}
|
||||
;
|
||||
break;
|
||||
default:
|
||||
$('#repo-clone-https').click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue