added copy-to-clipboard feature
This commit is contained in:
parent
e944903f7e
commit
3cbaeb6809
|
@ -391,4 +391,13 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
|
|||
color: black;
|
||||
}
|
||||
|
||||
|
||||
.btn-copy {
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 2px;
|
||||
border: 2px solid #E4E4E4;
|
||||
color: #9b9b9b;
|
||||
margin-left: 5px;
|
||||
padding: 2px 6px;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('insight',
|
||||
['ngAnimate',
|
||||
'ngCookies',
|
||||
'ngResource',
|
||||
'ngRoute',
|
||||
'ui.bootstrap',
|
||||
'ui.route',
|
||||
'insight.system',
|
||||
'insight.socket',
|
||||
'insight.blocks',
|
||||
'insight.transactions',
|
||||
'monospaced.qrcode',
|
||||
'insight.address',
|
||||
'insight.search',
|
||||
'insight.status'
|
||||
angular.module('insight',[
|
||||
'ngAnimate',
|
||||
'ngResource',
|
||||
'ngRoute',
|
||||
'ui.bootstrap',
|
||||
'ui.route',
|
||||
'monospaced.qrcode',
|
||||
'insight.system',
|
||||
'insight.socket',
|
||||
'insight.blocks',
|
||||
'insight.transactions',
|
||||
'insight.address',
|
||||
'insight.search',
|
||||
'insight.status'
|
||||
]);
|
||||
|
||||
angular.module('insight.system', []);
|
||||
|
|
|
@ -1,25 +1,58 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('insight.address').directive('whenScrolled', ['$window', function($window) {
|
||||
return {
|
||||
link: function(scope, elm, attr) {
|
||||
var pageHeight, clientHeight, scrollPos;
|
||||
$window = angular.element($window);
|
||||
var ZeroClipboard = window.ZeroClipboard;
|
||||
|
||||
var handler = function() {
|
||||
pageHeight = window.document.documentElement.scrollHeight;
|
||||
clientHeight = window.document.documentElement.clientHeight;
|
||||
scrollPos = window.pageYOffset;
|
||||
angular.module('insight')
|
||||
.directive('whenScrolled', ['$window', function($window) {
|
||||
return {
|
||||
restric: 'A',
|
||||
link: function(scope, elm, attr) {
|
||||
var pageHeight, clientHeight, scrollPos;
|
||||
$window = angular.element($window);
|
||||
|
||||
if (pageHeight - (scrollPos + clientHeight) === 0) {
|
||||
scope.$apply(attr.whenScrolled);
|
||||
}
|
||||
};
|
||||
var handler = function() {
|
||||
pageHeight = window.document.documentElement.scrollHeight;
|
||||
clientHeight = window.document.documentElement.clientHeight;
|
||||
scrollPos = window.pageYOffset;
|
||||
|
||||
$window.on('scroll', handler);
|
||||
scope.$on('$destroy', function() {
|
||||
return $window.off('scroll', handler);
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
if (pageHeight - (scrollPos + clientHeight) === 0) {
|
||||
scope.$apply(attr.whenScrolled);
|
||||
}
|
||||
};
|
||||
|
||||
$window.on('scroll', handler);
|
||||
scope.$on('$destroy', function() {
|
||||
return $window.off('scroll', handler);
|
||||
});
|
||||
}
|
||||
};
|
||||
}])
|
||||
.directive('clipCopy', [function() {
|
||||
ZeroClipboard.config({
|
||||
moviePath: '../lib/zeroclipboard/ZeroClipboard.swf',
|
||||
trustedDomains: ['*'],
|
||||
allowScriptAccess: 'always',
|
||||
forceHandCursor: true
|
||||
});
|
||||
|
||||
return {
|
||||
restric: 'A',
|
||||
scope: { clipCopy: '=clipCopy' },
|
||||
link: function(scope, elm) {
|
||||
var clip = new ZeroClipboard(elm);
|
||||
|
||||
clip.on('load', function(client) {
|
||||
var onMousedown = function(client) {
|
||||
client.setText(scope.clipCopy);
|
||||
};
|
||||
|
||||
client.on('mousedown', onMousedown);
|
||||
|
||||
scope.$on('$destroy', function() {
|
||||
client.off('mousedown', onMousedown);
|
||||
client.unglue(elm);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="line-bot">
|
||||
<a href="/#!/tx/{{tx.txid}}">{{tx.txid}}</a>
|
||||
<a href="/#!/tx/{{tx.txid}}">{{tx.txid}}</a> <a href="#" class="btn-copy" clip-copy="tx.txid"><span class="glyphicon glyphicon-paperclip"></span></a>
|
||||
<a class="pull-right" style="margin-left:10px" data-ng-click="itemsExpanded = !itemsExpanded">
|
||||
<span class="glyphicon" data-ng-class="{'glyphicon-minus-sign': itemsExpanded, 'glyphicon-plus-sign': !itemsExpanded}" tooltip="Show/Hide items details" tooltip-placement="down"></span>
|
||||
<span class="glyphicon" data-ng-class="{'glyphicon-minus-sign': itemsExpanded, 'glyphicon-plus-sign': !itemsExpanded}" tooltip="Show/Hide items details" tooltip-placement="left"></span>
|
||||
</a>
|
||||
<span class="pull-right">{{tx.time * 1000 | date:'medium'}}</span>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue