Permalink
Browse files

fix: [fleet] copy to clipboard

  • Loading branch information...
1 parent 4c2f6c2 commit 670653a56ee053c887c68d73c8db8dc097f4da22 @Diablohu committed Nov 18, 2016
View
@@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"animate.css": "^3.4.0",
+ "clipboard": "^1.5.15",
"jquery": "^2.2.0",
"kckit": "^0.2.4",
"kctip": "^0.4.1",
View
@@ -4792,9 +4792,14 @@ InfosFleet.modalExport = function (curval) {
if (!InfosFleet.elModalExport) {
InfosFleet.elModalExport = $('<div/>').append(InfosFleet.elModalExportTextarea = $('<textarea/>', {
'readonly': !0
- })).append($('<p class="note-codeusage"/>').html('* 该配置代码可用于<a href="http://www.kancolle-calc.net/deckbuilder.html">艦載機厨デッキビルダー</a>')).append($('<button class="button"/>').html('复制到剪切板').on('click', function () {
- node.clipboard.set(InfosFleet.elModalExportTextarea.val(), 'text');
- }));
+ })).append($('<p class="note-codeusage"/>').html('* 该配置代码可用于<a href="http://www.kancolle-calc.net/deckbuilder.html">艦載機厨デッキビルダー</a>'));
+
+ var btn = $('<button class="button">复制到剪切板</button>').appendTo(InfosFleet.elModalExport);
+ new Clipboard(btn[0], {
+ text: function text() {
+ return InfosFleet.elModalExportTextarea.val();
+ }
+ });
}
InfosFleet.elModalExportTextarea.val(curval || '');
View
Oops, something went wrong.
@@ -6093,9 +6093,14 @@ InfosFleet.modalExport = function (curval) {
if (!InfosFleet.elModalExport) {
InfosFleet.elModalExport = $('<div/>').append(InfosFleet.elModalExportTextarea = $('<textarea/>', {
'readonly': !0
- })).append($('<p class="note-codeusage"/>').html('* 该配置代码可用于<a href="http://www.kancolle-calc.net/deckbuilder.html">艦載機厨デッキビルダー</a>')).append($('<button class="button"/>').html('复制到剪切板').on('click', function () {
- node.clipboard.set(InfosFleet.elModalExportTextarea.val(), 'text');
- }));
+ })).append($('<p class="note-codeusage"/>').html('* 该配置代码可用于<a href="http://www.kancolle-calc.net/deckbuilder.html">艦載機厨デッキビルダー</a>'));
+
+ var btn = $('<button class="button">复制到剪切板</button>').appendTo(InfosFleet.elModalExport);
+ new Clipboard(btn[0], {
+ text: function text() {
+ return InfosFleet.elModalExportTextarea.val();
+ }
+ });
}
InfosFleet.elModalExportTextarea.val(curval || '');
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
@@ -9,4 +9,5 @@
// @koala-prepend "../../_/node_modules/pepjs/dist/pep.min.js"
// @koala-prepend "../../_/node_modules/localforage/dist/localforage.nopromises.min.js"
-// @koala-prepend "../../_/node_modules/kckit/dist/kckit.min.js"
+// @koala-prepend "../../_/node_modules/kckit/dist/kckit.min.js"
+// @koala-prepend "../../_/node_modules/clipboard/dist/clipboard.min.js"
@@ -20,10 +20,10 @@
<link rel="apple-touch-icon" href="/favicon.png"/>
<link rel="manifest" href="/manifest.json?20160101"/>
- <script type="text/javascript" src="/!/assets/libs.min.js?20161116"></script>
- <script type="text/javascript" src="/!/assets/js.min.js?20161116"></script>
+ <script type="text/javascript" src="/!/assets/libs.min.js?20161119"></script>
+ <script type="text/javascript" src="/!/assets/js.min.js?20161119"></script>
- <link rel="stylesheet" type="text/css" href="/!/assets/css.min.css?20161116"/>
+ <link rel="stylesheet" type="text/css" href="/!/assets/css.min.css?20161119"/>
</head>
@@ -819,12 +819,20 @@ InfosFleet.modalExport = function(curval){
.append(
$('<p class="note-codeusage"/>').html('* 该配置代码可用于<a href="http://www.kancolle-calc.net/deckbuilder.html">艦載機厨デッキビルダー</a>')
)
+ /*
.append(
$('<button class="button"/>').html('复制到剪切板')
.on('click', function(){
node.clipboard.set(InfosFleet.elModalExportTextarea.val(), 'text');
})
)
+ */
+ let btn = $('<button class="button">复制到剪切板</button>').appendTo(InfosFleet.elModalExport)
+ new Clipboard(btn[0], {
+ text: function() {
+ return InfosFleet.elModalExportTextarea.val();
+ }
+ });
}
InfosFleet.elModalExportTextarea.val(curval || '')
View
@@ -41,6 +41,7 @@
// @koala-prepend "../_/node_modules/sprintf-js/src/sprintf.js"
// @koala-prepend "../_/node_modules/pepjs/dist/pep.min.js"
// @koala-prepend "../_/node_modules/localforage/dist/localforage.nopromises.min.js"
-// @koala-prepend "../_/node_modules/kckit/dist/kckit.js"
+// @koala-prepend "../_/node_modules/kckit/dist/kckit.min.js"
+// @koala-prepend "../_/node_modules/clipboard/dist/clipboard.min.js"
// @koala-prepend "nw.js-base-framework/source/js-base/!last.js"

0 comments on commit 670653a

Please sign in to comment.