diff options
Diffstat (limited to 'public/js/app.js')
-rw-r--r-- | public/js/app.js | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/public/js/app.js b/public/js/app.js index 94e38cc134..58633718fc 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -43,7 +43,15 @@ var Gogits = { Gogits.initTabs = function () { var $tabs = $('[data-init=tabs]'); $tabs.find("li:eq(0) a").tab("show"); + }; + + // render markdown + Gogits.renderMarkdown = function () { + var $pre = $('.markdown').find('pre > code').parent(); + $pre.addClass("prettyprint"); + prettyPrint(); } + })(jQuery); // ajax utils @@ -70,6 +78,7 @@ function initCore() { Gogits.initTooltips(); Gogits.initTabs(); Gogits.initModals(); + Gogits.renderMarkdown(); } function initRegister() { @@ -98,14 +107,14 @@ function initRegister() { }); } -function initUserSetting(){ +function initUserSetting() { $('#gogs-ssh-keys .delete').confirmation({ singleton: true, - onConfirm: function(e, $this){ - Gogits.ajaxDelete("",{"id":$this.data("del")},function(json){ - if(json.ok){ + onConfirm: function (e, $this) { + Gogits.ajaxDelete("", {"id": $this.data("del")}, function (json) { + if (json.ok) { window.location.reload(); - }else{ + } else { alert(json.err); } }); @@ -113,11 +122,15 @@ function initUserSetting(){ }); } -;(function($){ - // on Dom Ready - $(function(){ - var $pre = $('.markdown').find('pre > code').parent(); - $pre.addClass("prettyprint"); - prettyPrint(); +(function ($) { + $(function () { + initCore(); + var body = $("#gogs-body"); + if (body.data("page") == "user-signup") { + initRegister(); + } + if (body.data("page") == "user") { + initUserSetting(); + } }); })(jQuery); |