diff --git a/js/copySnippets.js b/js/copySnippets.js
index 11aba1e..6cb844b 100644
--- a/js/copySnippets.js
+++ b/js/copySnippets.js
@@ -1,26 +1,43 @@
window.Spring = window.Spring || {};
-ZeroClipboard.setDefaults( { moviePath: siteBaseUrl + '/js/ZeroClipboard.swf' } );
-
$(document).ready(function() {
Spring.configureCopyButtons();
});
Spring.configureCopyButtons = function() {
- if (ZeroClipboard.detectFlashSupport()) {
- $("pre.highlight").each(function(index) {
- Spring.buildCopyButton($(this), index);
- }
- );
- }
+
+ $("pre.highlight").each(function(index) {
+ Spring.buildCopyButton($(this), index);
+ }
+ );
+ var errorMessage = function() {
+ if (/Mac/i.test(navigator.userAgent)) {
+ return 'Press Cmd-C to Copy';
+ }
+ else {
+ return 'Press Ctrl-C to Copy';
+ }
+ };
+ var snippets = new Clipboard('.copy-button');
+ snippets.on('success', function(e) {
+ e.clearSelection();
+ Spring.showTooltip(e.trigger, "Copied!");
+ });
+ snippets.on('error', function(e) {
+ Spring.showTooltip(e.trigger, errorMessage());
+ });
+}
+
+Spring.showTooltip = function(elem, message) {
+ $(elem).tooltip({placement:'right', title:message});
+ $(elem).tooltip('show');
+ setTimeout(function(){$(elem).tooltip('destroy');},1000);
}
Spring.buildCopyButton = function (preEl, id) {
- var codeBlockId = "code-block-"+ id;
+ var codeBlockId = "code-block-"+ id;
var copyButtonId = "copy-button-" + id;
preEl.attr('id', codeBlockId);
- var button = $('');
+ var button = $('');
preEl.before(button);
- var zero = new ZeroClipboard(button);
- $(zero.htmlBridge).tooltip({title: "copy to clipboard", placement: 'bottom'});
}
diff --git a/js/projectDocumentationWidget.js b/js/projectDocumentationWidget.js
index cdfc3ee..42d25f9 100644
--- a/js/projectDocumentationWidget.js
+++ b/js/projectDocumentationWidget.js
@@ -104,7 +104,7 @@ Spring.SnippetView = Backbone.View.extend({
},
render: function () {
- this.model.bootVersion = this.model.version.indexOf("Dalston")!=-1 ? "1.5.1.BUILD-SNAPSHOT" :
+ this.model.bootVersion = this.model.version.indexOf("Dalston")!=-1 ? "1.5.2.RELEASE" :
this.model.version.indexOf("Camden")!=-1 ? "1.4.4.RELEASE" :
this.model.version.indexOf("Brixton")!=-1 ? "1.3.8.RELEASE" :
"1.2.8.RELEASE";