36 lines
1.9 KiB
Bash
36 lines
1.9 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
STATIC="/home/slin/enduro-trails/prototype/static"
|
|
|
|
echo '=== Patching index.html ==='
|
|
|
|
# 1. Replace terrain button: rename title, change icon to motorcycle wheel
|
|
sed -i 's|<button class="map-btn" id="terrain-toggle" onclick="toggleTerrainPopup()" title="Рельеф">|<button class="map-btn" id="terrain-toggle" onclick="toggleTerrainPopup()" title="Эндуро">|' $STATIC/index.html
|
|
|
|
# 2. Replace mountain icon with motorcycle/enduro icon (simple wheel with spokes)
|
|
sed -i 's|<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 20h18"/><path d="m7 20-4-8 5-3 4 6 3-4 5 9"/></svg>|<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="3"/><path d="M12 3v6M12 15v6M3 12h6M15 12h6M5.6 5.6l4.3 4.3M14.1 14.1l4.3 4.3M5.6 18.4l4.3-4.3M14.1 9.9l4.3-4.3"/></svg>|' $STATIC/index.html
|
|
|
|
# 3. Replace popup title
|
|
sed -i 's|<div class="terrain-popup-title">.*</div>|<div class="terrain-popup-title">Эндуро</div>|' $STATIC/index.html
|
|
|
|
# 4. Add checkboxes for trails before closing </div> of terrain-popup
|
|
# First find the line with terrain-tri-cb closing label and add after it
|
|
sed -i '/<\/label>/{
|
|
# Only do this after terrain-tri-cb
|
|
/terrain-tri-cb/!b
|
|
a\ <hr style="margin:6px 0;border-color:rgba(128,128,128,0.3)">
|
|
a\ <label class="terrain-checkbox">
|
|
a\ <input type="checkbox" id="trails-track-cb" onchange="onTrailsCheckbox()" checked>
|
|
a\ <span>Грунтовки</span>
|
|
a\ </label>
|
|
a\ <label class="terrain-checkbox">
|
|
a\ <input type="checkbox" id="trails-path-cb" onchange="onTrailsCheckbox()" checked>
|
|
a\ <span>Тропы</span>
|
|
a\ </label>
|
|
}' $STATIC/index.html
|
|
|
|
echo 'index.html patched'
|
|
echo '=== Verifying ==='
|
|
sed -n '36,60p' $STATIC/index.html
|