mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-02 22:11:54 +00:00
fix svg
This commit is contained in:
@@ -718,16 +718,21 @@ function tailSvg() {
|
||||
return '<svg width="9" height="16" viewBox="0 0 9 16" xmlns="http://www.w3.org/2000/svg"><path d="M9 0 L9 16 L0 16 Q9 11 9 0 Z" fill="currentColor"/></svg>';
|
||||
}
|
||||
|
||||
function simplexLogoSvg() {
|
||||
var darkBg = '<svg class="simplex-logo-dark-bg" viewBox="0 0 34 35" fill="none" xmlns="http://www.w3.org/2000/svg">'
|
||||
var _logoId = 0;
|
||||
var _svgParser = new DOMParser();
|
||||
|
||||
function appendSimplexLogo(el) {
|
||||
var n = _logoId++;
|
||||
var darkSvg = '<svg class="simplex-logo-dark-bg" viewBox="0 0 34 35" fill="none" xmlns="http://www.w3.org/2000/svg">'
|
||||
+ '<path fill-rule="evenodd" clip-rule="evenodd" d="M3.03 8.61l5.592 5.592 5.748-5.747 2.797 2.796-5.749 5.747 5.593 5.593-2.874 2.874-5.593-5.593-5.748 5.748L0 22.823l5.748-5.748L.155 11.483l2.874-2.874z" fill="white"/>'
|
||||
+ '<path fill-rule="evenodd" clip-rule="evenodd" d="M14.092 25.516l2.852-2.852-.001-.001 5.704-5.702-5.595-5.594h.001l-2.798-2.797L8.66 2.975l2.852-2.851 5.594 5.594L22.81.016l2.797 2.797-5.704 5.703 5.596 5.594 5.704-5.703 2.797 2.797-5.704 5.703 5.596 5.595-2.852 2.851-5.595-5.594-5.704 5.703 5.596 5.594-2.852 2.852-5.595-5.595-5.703 5.703-2.798-2.797 5.704-5.703z" fill="url(#sp-logo-grad-d)"/>'
|
||||
+ '<defs><linearGradient id="sp-logo-grad-d" x1="12.838" y1="-0.678" x2="9.544" y2="31.449" gradientUnits="userSpaceOnUse"><stop stop-color="#01F1FF"/><stop offset="1" stop-color="#0197FF"/></linearGradient></defs></svg>';
|
||||
var lightBg = '<svg class="simplex-logo-light-bg" viewBox="0 0 34 34" fill="none" xmlns="http://www.w3.org/2000/svg">'
|
||||
+ '<path fill-rule="evenodd" clip-rule="evenodd" d="M14.092 25.516l2.852-2.852-.001-.001 5.704-5.702-5.595-5.594h.001l-2.798-2.797L8.66 2.975l2.852-2.851 5.594 5.594L22.81.016l2.797 2.797-5.704 5.703 5.596 5.594 5.704-5.703 2.797 2.797-5.704 5.703 5.596 5.595-2.852 2.851-5.595-5.594-5.704 5.703 5.596 5.594-2.852 2.852-5.595-5.595-5.703 5.703-2.798-2.797 5.704-5.703z" fill="url(#sp-lg-d' + n + ')"/>'
|
||||
+ '<defs><linearGradient id="sp-lg-d' + n + '" x1="12.838" y1="-0.678" x2="9.544" y2="31.449" gradientUnits="userSpaceOnUse"><stop stop-color="#01F1FF"/><stop offset="1" stop-color="#0197FF"/></linearGradient></defs></svg>';
|
||||
var lightSvg = '<svg class="simplex-logo-light-bg" viewBox="0 0 34 34" fill="none" xmlns="http://www.w3.org/2000/svg">'
|
||||
+ '<path fill-rule="evenodd" clip-rule="evenodd" d="M3.03 8.594l5.592 5.592 5.748-5.748 2.797 2.797-5.749 5.747 5.593 5.593-2.874 2.874-5.593-5.593-5.748 5.748L0 22.807l5.748-5.748L.156 11.468l2.874-2.874z" fill="#023789"/>'
|
||||
+ '<path fill-rule="evenodd" clip-rule="evenodd" d="M14.092 25.5l2.851-2.851-.001-.001 5.704-5.702-5.595-5.594h.001l-2.798-2.797L8.66 2.96l2.851-2.852 5.595 5.595L22.81 0l2.797 2.797-5.704 5.703 5.596 5.594 5.704-5.703 2.797 2.797-5.704 5.703 5.596 5.595-2.852 2.851-5.595-5.594-5.704 5.703 5.596 5.595-2.852 2.851-5.595-5.594L5.386 34l-2.797-2.797 5.703-5.703z" fill="url(#sp-logo-grad-l)"/>'
|
||||
+ '<defs><linearGradient id="sp-logo-grad-l" x1="12.838" y1="-0.694" x2="9.543" y2="31.434" gradientUnits="userSpaceOnUse"><stop stop-color="#01F1FF"/><stop offset="1" stop-color="#0197FF"/></linearGradient></defs></svg>';
|
||||
return darkBg + lightBg;
|
||||
+ '<path fill-rule="evenodd" clip-rule="evenodd" d="M14.092 25.5l2.851-2.851-.001-.001 5.704-5.702-5.595-5.594h.001l-2.798-2.797L8.66 2.96l2.851-2.852 5.595 5.595L22.81 0l2.797 2.797-5.704 5.703 5.596 5.594 5.704-5.703 2.797 2.797-5.704 5.703 5.596 5.595-2.852 2.851-5.595-5.594-5.704 5.703 5.596 5.595-2.852 2.851-5.595-5.594L5.386 34l-2.797-2.797 5.703-5.703z" fill="url(#sp-lg-l' + n + ')"/>'
|
||||
+ '<defs><linearGradient id="sp-lg-l' + n + '" x1="12.838" y1="-0.694" x2="9.543" y2="31.434" gradientUnits="userSpaceOnUse"><stop stop-color="#01F1FF"/><stop offset="1" stop-color="#0197FF"/></linearGradient></defs></svg>';
|
||||
el.appendChild(document.importNode(_svgParser.parseFromString(darkSvg, 'image/svg+xml').documentElement, true));
|
||||
el.appendChild(document.importNode(_svgParser.parseFromString(lightSvg, 'image/svg+xml').documentElement, true));
|
||||
}
|
||||
|
||||
const FILE_ICON_SVG = `<svg class="simplex-preview-file-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14,2 14,8 20,8"/></svg>`;
|
||||
@@ -900,7 +905,8 @@ function renderHeader(channel, channelLink, subscriberCount) {
|
||||
if (channelLink) {
|
||||
const btn = document.createElement('a');
|
||||
btn.className = 'simplex-preview-join-btn';
|
||||
btn.innerHTML = 'Join' + simplexLogoSvg();
|
||||
btn.textContent = 'Join';
|
||||
appendSimplexLogo(btn);
|
||||
btn.href = channelLink;
|
||||
header.appendChild(btn);
|
||||
}
|
||||
@@ -944,7 +950,8 @@ function renderInfoContent(container, data, channelLink, subscriberCount, showAp
|
||||
openBtn.style.display = 'flex';
|
||||
openBtn.style.width = 'fit-content';
|
||||
openBtn.style.margin = '16px auto 0';
|
||||
openBtn.innerHTML = 'Join in SimpleX Chat' + simplexLogoSvg();
|
||||
openBtn.textContent = 'Join in SimpleX Chat';
|
||||
appendSimplexLogo(openBtn);
|
||||
openBtn.href = channelLink;
|
||||
container.appendChild(openBtn);
|
||||
}
|
||||
@@ -1089,7 +1096,8 @@ function renderMobileConversion(container, channelLink, showAppBadges) {
|
||||
|
||||
const openBtn = document.createElement('a');
|
||||
openBtn.className = 'simplex-preview-open-btn';
|
||||
openBtn.innerHTML = 'Join in SimpleX Chat' + simplexLogoSvg();
|
||||
openBtn.textContent = 'Join in SimpleX Chat';
|
||||
appendSimplexLogo(openBtn);
|
||||
openBtn.href = channelLink;
|
||||
container.appendChild(openBtn);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user