summaryrefslogtreecommitdiffstats
path: root/public/js/gogs.js
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-03-05 00:51:51 -0500
committerUnknwon <u@gogs.io>2016-03-05 00:51:51 -0500
commita2f13eae559c71d35662b7767a8b8347a26eb53e (patch)
tree35a02d0e6afaf1d9269dc9cee10b478d6c847560 /public/js/gogs.js
parent2a931937a8a92d5b1f3bca9e9cf4cbe23c862ce9 (diff)
downloadgitea-a2f13eae559c71d35662b7767a8b8347a26eb53e.tar.gz
gitea-a2f13eae559c71d35662b7767a8b8347a26eb53e.zip
#1157 some avatar setting changes
- Allow to delete current avatar
Diffstat (limited to 'public/js/gogs.js')
-rw-r--r--public/js/gogs.js49
1 files changed, 31 insertions, 18 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js
index c4b4668f9c..cad4ba75b2 100644
--- a/public/js/gogs.js
+++ b/public/js/gogs.js
@@ -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;
}
}
-});
+}); \ No newline at end of file