diff --git a/snappass/static/css/custom.css b/snappass/static/css/custom.css new file mode 100644 index 0000000..deda990 --- /dev/null +++ b/snappass/static/css/custom.css @@ -0,0 +1,4 @@ +input[readonly].readonly-text { + background-color: #fff; + cursor: text; +} \ No newline at end of file diff --git a/snappass/static/scripts/clipboard_button.js b/snappass/static/scripts/clipboard_button.js new file mode 100644 index 0000000..2502e1c --- /dev/null +++ b/snappass/static/scripts/clipboard_button.js @@ -0,0 +1,31 @@ +(function(){ + + var targetButtonSelector = '#copy-clipboard-btn' + var clipboard = new Clipboard(targetButtonSelector); + + var copyError = function(e) { + var key; + if (/Mac/i.test(navigator.userAgent)) { + key = '⌘'; + } else { + key = 'Ctrl'; + } + $(e.trigger).attr('title', "Press " + key + "-C to copy" ) + .tooltip('fixTitle') + .tooltip('show'); + }; + + var copySuccess = function(e) { + $(e.trigger).attr('title', 'Copied!') + .tooltip('fixTitle') + .tooltip('show'); + e.clearSelection(); + + }; + + clipboard.on('success', copySuccess); + clipboard.on('error', copyError); + + $(targetButtonSelector).tooltip(); + +})(); \ No newline at end of file diff --git a/snappass/templates/base.html b/snappass/templates/base.html index 11fe82e..468e416 100644 --- a/snappass/templates/base.html +++ b/snappass/templates/base.html @@ -4,6 +4,8 @@ Send Password + +