Skip to content

Commit 202cf62

Browse files
committed
General updates
1 parent 02d7e73 commit 202cf62

File tree

4 files changed

+78
-8
lines changed

4 files changed

+78
-8
lines changed

.github/scripts/generate-index.sh

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,23 +109,43 @@ cat > index.html << 'EOF'
109109
font-size: 0.9rem;
110110
}
111111
112-
.copy-button {
112+
.button-group {
113113
margin-top: 1rem;
114+
display: flex;
115+
gap: 0.5rem;
116+
}
117+
118+
.btn {
114119
padding: 0.5rem 1rem;
115-
background: #119dff;
116-
color: white;
117120
border: none;
118121
border-radius: 4px;
119122
cursor: pointer;
120123
font-size: 0.9rem;
121124
transition: background 0.2s;
125+
text-decoration: none;
126+
display: inline-block;
127+
text-align: center;
122128
}
123129
124-
.copy-button:hover {
130+
.btn-primary {
131+
background: #119dff;
132+
color: white;
133+
}
134+
135+
.btn-primary:hover {
125136
background: #0d7ec9;
126137
}
127138
128-
.copy-button.copied {
139+
.btn-secondary {
140+
background: #95a5a6;
141+
color: white;
142+
}
143+
144+
.btn-secondary:hover {
145+
background: #7f8c8d;
146+
}
147+
148+
.btn.copied {
129149
background: #27ae60;
130150
}
131151
@@ -200,7 +220,10 @@ else
200220
<div class="chart-card">
201221
<a href="$filename">$title</a>
202222
<div class="chart-name">$filename</div>
203-
<button class="copy-button" onclick="copyEmbedCode('$filename')">Copy Embed Code</button>
223+
<div class="button-group">
224+
<a href="$filename" class="btn btn-primary">View Chart</a>
225+
<button class="btn btn-secondary" onclick="copyEmbedCode('$filename')">Copy Embed Code</button>
226+
</div>
204227
</div>
205228
EOF
206229
done

.github/scripts/inject-css.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# Inject CSS to hide Plotly Chart Studio links in all chart HTML files
4+
5+
cd charts
6+
7+
for file in *.html; do
8+
# Skip index.html
9+
if [ "$file" = "index.html" ]; then
10+
continue
11+
fi
12+
13+
# Check if file exists and is not empty
14+
if [ ! -f "$file" ] || [ ! -s "$file" ]; then
15+
continue
16+
fi
17+
18+
# Check if CSS hasn't already been injected
19+
if grep -q "hide-plotly-link-injection" "$file"; then
20+
continue
21+
fi
22+
23+
# Inject CSS before the closing </head> tag to hide the Chart Studio link
24+
sed -i.bak '/<\/head>/i\
25+
<style class="hide-plotly-link-injection">\
26+
/* Hide Chart Studio export link */\
27+
a[href*="chart-studio.plotly.com"],\
28+
a[data-title*="chart-studio"],\
29+
.modebar-btn[data-title*="Produced with Plotly"],\
30+
.modebar-btn[data-title*="Edit chart"],\
31+
.js-plotly-plot .plotly a.modebar-btn[data-title="Produced with Plotly"] {\
32+
display: none !important;\
33+
}\
34+
</style>
35+
' "$file"
36+
37+
# Remove backup file
38+
rm -f "${file}.bak"
39+
40+
echo "Injected CSS into $file"
41+
done

.github/workflows/deploy-pages.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ jobs:
2525
- name: Checkout
2626
uses: actions/checkout@v4
2727

28+
- name: Inject CSS to hide Chart Studio links
29+
run: |
30+
chmod +x .github/scripts/inject-css.sh
31+
.github/scripts/inject-css.sh
32+
2833
- name: Generate index page
2934
run: |
3035
chmod +x .github/scripts/generate-index.sh

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ Perfect for sharing interactive Plotly visualizations with your team or embeddin
1515
### Step 1: Create Your Own Copy
1616

1717
1. At the top of this page on GitHub, click the green **"Use this template"** button
18-
2. Give your project a name (like "my-plotly-charts")
19-
3. Click **"Create repository"**
18+
2. Select **"Create a new repository"**
19+
3. Give your project a name (like "my-plotly-charts")
20+
4. Click **"Create repository"**
2021

2122
### Step 2: Export Your Charts from Chart Studio
2223

0 commit comments

Comments
 (0)