From 182003aa417ba67661c6743e0fabe6e1f67efd1c Mon Sep 17 00:00:00 2001 From: Paolo Borelli Date: Thu, 23 Apr 2015 13:58:57 +0200 Subject: Add PAM authentication --- public/ng/js/gogs.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'public/ng/js/gogs.js') diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index c5fd719c..7ffef8af 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -753,10 +753,17 @@ function initAdmin() { if (v == 2) { $('.ldap').toggleShow(); $('.smtp').toggleHide(); + $('.pam').toggleHide(); } if (v == 3) { $('.smtp').toggleShow(); $('.ldap').toggleHide(); + $('.pam').toggleHide(); + } + if (v == 4) { + $('.pam').toggleShow(); + $('.smtp').toggleHide(); + $('.ldap').toggleHide(); } }); -- cgit v1.2.3 From eebcbf9d3438a9910dee56fd76ab624726eb207c Mon Sep 17 00:00:00 2001 From: Fernando San Julián Date: Mon, 3 Aug 2015 21:27:15 +0200 Subject: add clipboard API support --- public/js/app.js | 78 ++++++++++++++++++++++++++++++++++------------------ public/ng/js/gogs.js | 68 +++++++++++++++++++++++++++++++-------------- 2 files changed, 100 insertions(+), 46 deletions(-) (limited to 'public/ng/js/gogs.js') diff --git a/public/js/app.js b/public/js/app.js index 6208dbed..3dbf29c1 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -269,36 +269,62 @@ var Gogits = {}; if ($(selector).hasClass('js-copy-bind')) { return; } - $(selector).zclip({ - path: "/js/ZeroClipboard.swf", - copy: function () { - var t = $(this).data("copy-val"); - var to = $($(this).data("copy-from")); - var str = ""; - if (t == "txt") { - str = to.text(); - } - if (t == 'val') { - str = to.val(); - } - if (t == 'html') { - str = to.html(); - } - return str; - }, - afterCopy: function () { + + if ( document.documentElement.classList.contains("is-copy-enabled") ) { + + $(selector).click(function(event) { var $this = $(this); - $this.tooltip('hide') - .attr('data-original-title', 'Copied OK'); + + var cfrom = $this.attr('data-copy-from'); + $(cfrom).select(); + document.execCommand('copy'); + getSelection().removeAllRanges(); + + $this.tipsy("hide").attr('original-title', $this.data('after-title')); setTimeout(function () { - $this.tooltip("show"); + $this.tipsy("show"); }, 200); setTimeout(function () { - $this.tooltip('hide') - .attr('data-original-title', 'Copy to Clipboard'); - }, 3000); - } - }).addClass("js-copy-bind"); + $this.tipsy('hide').attr('original-title', $this.data('original-title')); + }, 2000); + + this.blur(); + return; + }); + + $(selector).addClass("js-copy-bind"); + + } else { + + $(selector).zclip({ + path: Gogs.AppSubUrl + "/js/ZeroClipboard.swf", + copy: function () { + var t = $(this).data("copy-val"); + var to = $($(this).data("copy-from")); + var str = ""; + if (t == "txt") { + str = to.text(); + } + if (t == 'val') { + str = to.val(); + } + if (t == 'html') { + str = to.html(); + } + return str; + }, + afterCopy: function () { + var $this = $(this); + $this.tipsy("hide").attr('original-title', $this.data('after-title')); + setTimeout(function () { + $this.tipsy("show"); + }, 200); + setTimeout(function () { + $this.tipsy('hide').attr('original-title', $this.data('original-title')); + }, 2000); + } + }).addClass("js-copy-bind"); + } } // api working diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index 7ffef8af..38b34c61 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -333,25 +333,17 @@ var Gogs = {}; if ($(selector).hasClass('js-copy-bind')) { return; } - $(selector).zclip({ - path: Gogs.AppSubUrl + "/js/ZeroClipboard.swf", - copy: function () { - var t = $(this).data("copy-val"); - var to = $($(this).data("copy-from")); - var str = ""; - if (t == "txt") { - str = to.text(); - } - if (t == 'val') { - str = to.val(); - } - if (t == 'html') { - str = to.html(); - } - return str; - }, - afterCopy: function () { + + if ( document.documentElement.classList.contains("is-copy-enabled") ) { + + $(selector).click(function(event) { var $this = $(this); + + var cfrom = $this.attr('data-copy-from'); + $(cfrom).select(); + document.execCommand('copy'); + getSelection().removeAllRanges(); + $this.tipsy("hide").attr('original-title', $this.data('after-title')); setTimeout(function () { $this.tipsy("show"); @@ -359,8 +351,44 @@ var Gogs = {}; setTimeout(function () { $this.tipsy('hide').attr('original-title', $this.data('original-title')); }, 2000); - } - }).addClass("js-copy-bind"); + + this.blur(); + return; + }); + + $(selector).addClass("js-copy-bind"); + + } else { + + $(selector).zclip({ + path: Gogs.AppSubUrl + "/js/ZeroClipboard.swf", + copy: function () { + var t = $(this).data("copy-val"); + var to = $($(this).data("copy-from")); + var str = ""; + if (t == "txt") { + str = to.text(); + } + if (t == 'val') { + str = to.val(); + } + if (t == 'html') { + str = to.html(); + } + return str; + }, + afterCopy: function () { + var $this = $(this); + $this.tipsy("hide").attr('original-title', $this.data('after-title')); + setTimeout(function () { + $this.tipsy("show"); + }, 200); + setTimeout(function () { + $this.tipsy('hide').attr('original-title', $this.data('original-title')); + }, 2000); + } + }).addClass("js-copy-bind"); + } } })(jQuery); -- cgit v1.2.3