api-console-assets
Version:
This repo only exists to publish api console components to npm
67 lines (59 loc) • 2.49 kB
HTML
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<title>clipboard-copy demo</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../paper-input/paper-input.html">
<link rel="import" href="../../arc-icons/arc-icons.html">
<link rel="import" href="../clipboard-copy.html">
<style is="custom-style" include="demo-pages-shared-styles">
.vertical-section-container {
max-width: 600px;
}
</style>
</head>
<body unresolved>
<div class="vertical-section-container centered">
<h3>The `clipboard-copy`</h3>
<demo-snippet>
<template is="dom-bind">
<paper-input label="Text to copy" value="{{value}}"></paper-input>
<paper-icon-button icon="arc:content-copy"></paper-icon-button>
<clipboard-copy content="[[value]]"></clipboard-copy>
<script>
var resetButton = function() {
document.querySelector('paper-icon-button').icon = 'arc:content-copy';
};
document.querySelector('paper-icon-button').addEventListener('click', function(e) {
var button = Polymer.dom(e).localTarget;
if (document.querySelector('clipboard-copy').copy()) {
button.icon = 'arc:done';
} else {
button.icon = 'arc:error';
}
// Return to the copy button after a second.
setTimeout(function() {
resetButton();
}, 1000);
});
</script>
</template>
</demo-snippet>
</div>
</body>
</html>