From ae6a95044c66d54194bcdddfef3f644a01a36734 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 27 Aug 2014 20:05:30 -0300 Subject: [PATCH 1/3] concat js files to one file. Compress all js files in production --- Gruntfile.js | 10 ++++++++-- index.html | 8 -------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 747f418a7..74e5a5176 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -79,6 +79,8 @@ module.exports = function(grunt) { concat: { vendors: { src: [ + 'lib/mousetrap/mousetrap.min.js', + 'js/shell.js', // shell must be loaded before moment due to the way moment loads in a commonjs env 'lib/moment/min/moment.min.js', 'lib/qrcode-generator/js/qrcode.js', 'lib/peer.js', @@ -113,7 +115,9 @@ module.exports = function(grunt) { 'js/filters.js', 'js/routes.js', 'js/services/*.js', - 'js/controllers/*.js' + 'js/controllers/*.js', + 'js/mobile.js', // PLACEHOLDER: CORDOVA SRIPT + 'js/init.js' ], dest: 'js/copayMain.js' } @@ -136,7 +140,9 @@ module.exports = function(grunt) { }, prod: { files: { - 'js/copayMain.js': ['js/copayMain.js'] + 'js/copayMain.js': ['js/copayMain.js'], + 'lib/angularjs-all.js': ['lib/angularjs-all.js'], + 'lib/vendors.js': ['lib/vendors.js'] } } } diff --git a/index.html b/index.html index f3a30b346..3614211e2 100644 --- a/index.html +++ b/index.html @@ -53,10 +53,6 @@ - - - - @@ -65,9 +61,5 @@ - - - - From c7d2c8445b6aed204bdc2ac2eba53ac790441a9f Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 28 Aug 2014 14:59:19 -0300 Subject: [PATCH 2/3] Downgrade of zeroclipboard plugin to make compatible with Grunt --- Gruntfile.js | 3 ++- bower.json | 2 +- index.html | 1 - js/directives.js | 19 ++++++++++--------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 74e5a5176..86220b39f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -92,7 +92,8 @@ module.exports = function(grunt) { 'lib/socket.io-client/socket.io.js', 'lib/sjcl.js', 'lib/ios-imagefile-megapixel/megapix-image.js', - 'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js' + 'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js', + 'lib/zeroclipboard/ZeroClipboard.min.js' ], dest: 'lib/vendors.js' }, diff --git a/bower.json b/bower.json index ce49fc3c1..2d0777456 100644 --- a/bower.json +++ b/bower.json @@ -21,7 +21,7 @@ "angular-moment": "~0.7.1", "socket.io-client": ">=1.0.0", "mousetrap": "1.4.6", - "zeroclipboard": "~2.1.6", + "zeroclipboard": "~1.3.5", "ng-idle": "*" }, "resolutions": { diff --git a/index.html b/index.html index 3614211e2..88cc747b2 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,6 @@ - diff --git a/js/directives.js b/js/directives.js index 8396cc4d1..c3ab76283 100644 --- a/js/directives.js +++ b/js/directives.js @@ -257,7 +257,7 @@ angular.module('copayApp.directives') }) .directive('clipCopy', function() { ZeroClipboard.config({ - moviePath: '/lib/zeroclipboard/dist/ZeroClipboard.swf', + moviePath: '/lib/zeroclipboard/ZeroClipboard.swf', trustedDomains: ['*'], allowScriptAccess: 'always', forceHandCursor: true @@ -271,23 +271,24 @@ angular.module('copayApp.directives') link: function(scope, elm) { var client = new ZeroClipboard(elm); - client.on('ready', function(event) { - client.on('copy', function(event) { - event.clipboardData.setData('text/plain', scope.clipCopy); - }); + client.on('load', function(client) { - client.on('aftercopy', function(event) { + client.on('datarequested', function(client) { + client.setText(scope.clipCopy); + } ); + + client.on('complete', function(client, args) { elm.removeClass('btn-copy').addClass('btn-copied').html('Copied!'); setTimeout(function() { elm.addClass('btn-copy').removeClass('btn-copied').html(''); - }, 1000); + }, 1000); }); }); - client.on('error', function(event) { - console.log('ZeroClipboard error of type "' + event.name + '": ' + event.message); + client.on('wrongflash noflash', function() { ZeroClipboard.destroy(); }); + } }; }); From 5d5bdd0efd6ff8f47834cd6a95c57b61db6b297c Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 28 Aug 2014 15:06:11 -0300 Subject: [PATCH 3/3] updated --- js/directives.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/directives.js b/js/directives.js index c3ab76283..21c7833a9 100644 --- a/js/directives.js +++ b/js/directives.js @@ -281,7 +281,7 @@ angular.module('copayApp.directives') elm.removeClass('btn-copy').addClass('btn-copied').html('Copied!'); setTimeout(function() { elm.addClass('btn-copy').removeClass('btn-copied').html(''); - }, 1000); + }, 1000); }); });