LD-FDPI/site/make_card_clickable.py

36 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from pathlib import Path
p = Path('/opt/tylorindar-safelink/static/index.html')
t = p.read_text(encoding='utf-8')
css = '''
/* LD FDPI detail card */
.ld-app-card { cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease; }
.ld-app-card:hover { border-color: rgba(143,227,245,.45); box-shadow: 0 16px 40px rgba(0,0,0,.28); }
.ld-app-stretch { position: absolute; inset: 0; z-index: 1; border-radius: 16px; }
.ld-app-card .ld-app-btn, .ld-app-card .ld-app-actions { position: relative; z-index: 2; }
.ld-app-btn-detail { background: rgba(143,227,245,.08); border-color: rgba(143,227,245,.28); color: #bdeff8; }
.ld-app-btn-detail:hover { background: rgba(143,227,245,.14); }
'''
if '.ld-app-stretch' not in t:
t = t.replace('</style>', css + '</style>', 1)
needle = '<article class="ld-app-card">'
if needle in t and 'class="ld-app-stretch"' not in t:
t = t.replace(
needle,
needle + '\n <a class="ld-app-stretch" href="/ld-fdpi" aria-label="LD FDPI detaylı özellikler"></a>',
1,
)
needle2 = '<span class="ld-app-updated" data-ldapp="ld-fdpi">'
if needle2 in t and 'ld-app-btn-detail' not in t:
t = t.replace(
needle2,
'<a class="ld-app-btn ld-app-btn-detail" href="/ld-fdpi">Detayları Gör →</a>' + needle2,
1,
)
p.write_text(t, encoding='utf-8')
print('card clickable/detail link added')