From 89fe19f3c63f67238aafb18b5356d32d6e4d8b51 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Wed, 12 Feb 2014 00:25:29 -0500 Subject: [PATCH] nitdoc: migrate clipboard to jQuery.UI widget Signed-off-by: Alexandre Terrasa --- share/nitdoc/js/plugins/clipboard.js | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/share/nitdoc/js/plugins/clipboard.js b/share/nitdoc/js/plugins/clipboard.js index 1d12b85..8432174 100644 --- a/share/nitdoc/js/plugins/clipboard.js +++ b/share/nitdoc/js/plugins/clipboard.js @@ -19,36 +19,36 @@ /* * Nitdoc Clipboard * - * Allow user to copy signatures to clipboard + * Allow user to copy signatures to clipboard with ZeroClipboard flahs plugin + * See: https://github.com/zeroclipboard/ZeroClipboard */ define([ "jquery", + "jQueryUI", "ZeroClipboard" -], function($, ZeroClipboard) { - +], function($, ui, ZeroClipboard) { //FIXME mouseover makes button disappear - var Clipboard = { - // Allow user to copy signatures to clipboard with ZeroClipboard flahs plugin - // See: https://github.com/zeroclipboard/ZeroClipboard - enable: function(copySelector) { - $(copySelector).each(function() { - var btn = $(document.createElement("button")) - .addClass("nitdoc-ui-copy") - .attr("data-clipboard-text", $(this).attr("data-untyped-signature")) + $.widget("nitdoc.clipboard", { + options: { + btnClass: "nitdoc-ui-copy", + btnImage: "./resources/icons/copy.png", + dataKey: "data-untyped-signature", + zeroConfig: { + moviePath: "./ZeroClipboard.swf" + } + }, + + _create: function() { + this.btn = $("