@@ -109,6 +109,26 @@ cat > index.html << 'EOF'
109109 font-size: 0.9rem;
110110 }
111111
112+ .copy-button {
113+ margin-top: 1rem;
114+ padding: 0.5rem 1rem;
115+ background: #119dff;
116+ color: white;
117+ border: none;
118+ border-radius: 4px;
119+ cursor: pointer;
120+ font-size: 0.9rem;
121+ transition: background 0.2s;
122+ }
123+
124+ .copy-button:hover {
125+ background: #0d7ec9;
126+ }
127+
128+ .copy-button.copied {
129+ background: #27ae60;
130+ }
131+
112132 .empty-state {
113133 background: white;
114134 border-radius: 8px;
@@ -126,13 +146,34 @@ cat > index.html << 'EOF'
126146 color: #95a5a6;
127147 }
128148 </style>
149+ <script>
150+ function copyEmbedCode(filename) {
151+ // Get the base URL dynamically from the current page
152+ const baseUrl = window.location.href.replace(/\/[^\/]*$/, '');
153+ const url = baseUrl + '/' + filename;
154+ const embedCode = '<iframe src="' + url + '" width="100%" height="600" frameborder="0"></iframe>';
155+
156+ navigator.clipboard.writeText(embedCode).then(function() {
157+ const button = event.target;
158+ const originalText = button.textContent;
159+ button.textContent = 'Copied!';
160+ button.classList.add('copied');
161+
162+ setTimeout(function() {
163+ button.textContent = originalText;
164+ button.classList.remove('copied');
165+ }, 2000);
166+ }).catch(function(err) {
167+ alert('Failed to copy: ' + err);
168+ });
169+ }
170+ </script>
129171</head>
130172<body>
131173 <div class="container">
132174 <header>
133175 <h1><span class="plotly-logo">Plotly</span> Chart Gallery</h1>
134- <p class="subtitle">Browse all interactive visualizations from Chart Studio</p>
135- <p class="powered-by">Powered by <a href="https://plotly.com/chart-studio/" target="_blank">Plotly Chart Studio</a></p>
176+ <p class="subtitle">Charts previously hosted on Plotly Chart Studio</p>
136177 </header>
137178
138179 <div class="chart-grid">
159200 <div class="chart-card">
160201 <a href="$filename ">$title </a>
161202 <div class="chart-name">$filename </div>
203+ <button class="copy-button" onclick="copyEmbedCode('$filename ')">Copy Embed Code</button>
162204 </div>
163205EOF
164206 done
0 commit comments