diff --git a/src/main/twirl/main.scala.html b/src/main/twirl/main.scala.html index 9ff77d3..cdfa8ea 100644 --- a/src/main/twirl/main.scala.html +++ b/src/main/twirl/main.scala.html @@ -26,6 +26,7 @@ + - \ No newline at end of file + diff --git a/src/main/twirl/repo/tab.scala.html b/src/main/twirl/repo/tab.scala.html index 8a1d859..f645e00 100644 --- a/src/main/twirl/repo/tab.scala.html +++ b/src/main/twirl/repo/tab.scala.html @@ -30,9 +30,10 @@ Commits Tags@if(repository.tags.length > 0){ @repository.tags.length}
  • -
    +
    HTTP +
  • diff --git a/src/main/twirl/wiki/tab.scala.html b/src/main/twirl/wiki/tab.scala.html index abca145..3ce381b 100644 --- a/src/main/twirl/wiki/tab.scala.html +++ b/src/main/twirl/wiki/tab.scala.html @@ -6,9 +6,10 @@ Pages Wiki History
  • -
    +
    HTTP +
  • diff --git a/src/main/webapp/assets/common/js/gitbucket.js b/src/main/webapp/assets/common/js/gitbucket.js index c8160c9..b784342 100644 --- a/src/main/webapp/assets/common/js/gitbucket.js +++ b/src/main/webapp/assets/common/js/gitbucket.js @@ -8,5 +8,34 @@ $('img[data-toggle=tooltip]').tooltip(); $('a[data-toggle=tooltip]').tooltip(); + // copy to clipboard + (function() { + // Find ZeroClipboard.swf file URI from ZeroClipboard JavaScript file path. + // NOTE(tanacasino) I think this way is wrong... but i don't know correct way. + var moviePath = (function() { + var zclipjs = "ZeroClipboard.min.js"; + var scripts = document.getElementsByTagName("script"); + var i = scripts.length; + while(i--) { + var match = scripts[i].src.match(zclipjs + "$"); + if(match) { + return match.input.substr(0, match.input.length - 6) + 'swf'; + } + } + })(); + var clip = new ZeroClipboard($("#repository-url-copy"), { + moviePath: moviePath + }); + var title = $('#repository-url-copy').attr('title'); + clip.on('complete', function(client, args) { + $(clip.htmlBridge).attr('title', 'copied!').tooltip('fixTitle').tooltip('show'); + $(clip.htmlBridge).attr('title', title).tooltip('fixTitle'); + }); + $(clip.htmlBridge).tooltip({ + title: title, + placement: $('#repository-url-copy').attr('data-placement') + }); + })(); + prettyPrint(); }); diff --git a/src/main/webapp/assets/zclip/ZeroClipboard.min.js b/src/main/webapp/assets/zclip/ZeroClipboard.min.js new file mode 100644 index 0000000..32535fd --- /dev/null +++ b/src/main/webapp/assets/zclip/ZeroClipboard.min.js @@ -0,0 +1,8 @@ +/*! + * zeroclipboard + * The Zero Clipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie, and a JavaScript interface. + * Copyright 2012 Jon Rohan, James M. Greene, . + * Released under the MIT license + * http://jonrohan.github.com/ZeroClipboard/ + * v1.1.7 + */(function(){"use strict";var a=function(a,b){var c=a.style[b];a.currentStyle?c=a.currentStyle[b]:window.getComputedStyle&&(c=document.defaultView.getComputedStyle(a,null).getPropertyValue(b));if(c=="auto"&&b=="cursor"){var d=["a"];for(var e=0;e=0?"&":"?")+"nocache="+(new Date).getTime()},i=function(a){var b=[];return a.trustedDomains&&(typeof a.trustedDomains=="string"?b.push("trustedDomain="+a.trustedDomains):b.push("trustedDomain="+a.trustedDomains.join(","))),b.join("&")},j=function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c ';b=document.createElement("div"),b.id="global-zeroclipboard-html-bridge",b.setAttribute("class","global-zeroclipboard-container"),b.setAttribute("data-clipboard-ready",!1),b.style.position="absolute",b.style.left="-9999px",b.style.top="-9999px",b.style.width="15px",b.style.height="15px",b.style.zIndex="9999",b.innerHTML=c,document.body.appendChild(b)}a.htmlBridge=b,a.flashBridge=document["global-zeroclipboard-flash-bridge"]||b.children[0].lastElementChild};l.prototype.resetBridge=function(){this.htmlBridge.style.left="-9999px",this.htmlBridge.style.top="-9999px",this.htmlBridge.removeAttribute("title"),this.htmlBridge.removeAttribute("data-clipboard-text"),f(m,this.options.activeClass),m=null,this.options.text=null},l.prototype.ready=function(){var a=this.htmlBridge.getAttribute("data-clipboard-ready");return a==="true"||a===!0},l.prototype.reposition=function(){if(!m)return!1;var a=g(m);this.htmlBridge.style.top=a.top+"px",this.htmlBridge.style.left=a.left+"px",this.htmlBridge.style.width=a.width+"px",this.htmlBridge.style.height=a.height+"px",this.htmlBridge.style.zIndex=a.zIndex+1,this.setSize(a.width,a.height)},l.dispatch=function(a,b){l.prototype._singleton.receiveEvent(a,b)},l.prototype.on=function(a,b){var c=a.toString().split(/\s/g);for(var d=0;d