Use template replacer instead of JS (except webshop)

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2024-06-07 11:49:05 +08:00
parent 85f30cc269
commit b507cf5d79
25 changed files with 34 additions and 52 deletions

View File

@ -11,4 +11,4 @@ highlight_code = true
[extra]
author = "M-Labs"
simulate_intl_domain = false
domain = "m-labs.hk"

View File

@ -18,4 +18,4 @@ Selling drinks is not our main business and only a service we do to other Club M
* In case of any dispute, the seller is always right.
Contact: <a href="mailto:sb@m-labs.hk" class="domain-sub">sb@m-labs.hk</a>
Contact: [sb@DOMAINNAME](mailto:sb@DOMAINNAME)

View File

@ -83,5 +83,5 @@ Now is your chance to work on top-notch science and technology projects that get
{% layout_centered_content() %}
##### Contact us at <a href="mailto:jobs@m-labs.hk" class="domain-sub">jobs@m-labs.hk</a> or [jobs@m-labs.ph](mailto:jobs@m-labs.ph)!
##### Contact us at [jobs@DOMAINNAME](mailto:jobs@DOMAINNAME) or [jobs@m-labs.ph](mailto:jobs@m-labs.ph)!
{% end %}

View File

@ -62,7 +62,7 @@ The <a href="https://github.com/quartiq/stabilizer" target="_blank" rel="noopene
<div class="col-12 col-md-4">
<p>
To purchase this controller, email <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>. We also offer firmware customizations and development of new features. Note that features that are not implemented in the open source code above (e.g. control from Kasli) are not supported unless purchased separately.
To purchase this controller, email <a href="mailto:sales@DOMAINNAME">sales@DOMAINNAME</a>. We also offer firmware customizations and development of new features. Note that features that are not implemented in the open source code above (e.g. control from Kasli) are not supported unless purchased separately.
</p>
</div>

View File

@ -19,7 +19,7 @@ ARTIQ and the related components that we are developing ([Migen/MiSoC](/gateware
{% layout_funding(position="center", title="Sponsors") %}
We acknowledge support from our partners below. Please get in touch (<a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>) if you also want to move ARTIQ forward!
We acknowledge support from our partners below. Please get in touch ([sales@DOMAINNAME](mailto:sales@DOMAINNAME)) if you also want to move ARTIQ forward!
{% end %}

View File

@ -114,7 +114,7 @@ template = "page.html"
**Sinara hardware purchases, ports to your hardware, feature development, technical support, bugfixing**
contact <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>
contact [sales@DOMAINNAME](mailto:sales@DOMAINNAME)
We welcome inquiries from research groups of all sizes.<br>[See what has been funded before](/experiment-control/funding)
@ -237,6 +237,6 @@ We welcome inquiries from research groups of all sizes.<br>[See what has been fu
</div>
{% layout_div(css="col-12 text-center") %}
Want your project listed here? Write to <a href="mailto:sb@m-labs.hk" class="domain-sub">sb@m-labs.hk</a>.
Want your project listed here? Write to [sb@DOMAINNAME](mailto:sb@DOMAINNAME).
{% end %}

View File

@ -14,7 +14,7 @@ The first ARTIQ core devices used hardware built in-house by physicists (based o
The Sinara hardware is in active development, and the latest information is available <a href="https://github.com/sinara-hw" target="_blank" rel="noopener noreferrer">on the wiki of each project's page</a>. Most of the hardware engineering is done at the <a href="https://www.ise.pw.edu.pl/" target="_blank" rel="noopener noreferrer">Institute for Electronics Systems</a> at the Warsaw University of Technology.
Kasli and EEMs can be ordered now. We can deliver a rack-mountable crate that contains all the cards, is fully tested, and is ready to be connected to your experiment and computer network. Use our [web-based configuration and ordering tool](../place-order), or contact <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a> with your requirements, and we will establish a quote.
Kasli and EEMs can be ordered now. We can deliver a rack-mountable crate that contains all the cards, is fully tested, and is ready to be connected to your experiment and computer network. Use our [web-based configuration and ordering tool](../place-order), or contact <a href="mailto:sales@DOMAINNAME">sales@DOMAINNAME</a> with your requirements, and we will establish a quote.
{% end %}
@ -297,7 +297,7 @@ The 4624 AWG "Phaser" is a quad channel 1.25 GS/s RF generator card with dual IQ
We can deliver a rack-mountable crate that contains all the cards, is fully tested, and is ready to be connected to your experiment and computer network. The lead time can be as short as a few working days and we will provide assistance to help you set up your new equipment with ARTIQ via the online helpdesk. Using our AFWS tool, you can keep the firmware of your M-Labs devices up-to-date easily, and benefit from the new features we continuously develop into ARTIQ.
Use our [web-based configuration and ordering tool](../place-order), or contact <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a> with your requirements, and we will establish a quote.
Use our [web-based configuration and ordering tool](../place-order), or contact <a href="mailto:sales@DOMAINNAME">sales@DOMAINNAME</a> with your requirements, and we will establish a quote.
{% end %}

View File

@ -30,7 +30,7 @@ Built on the <a href="/gateware/migen/">MiSoC and Migen</a> technologies that or
The Mixxeo supported mixing from two DVI or HDMI sources up to 720p60, with crossfade, fade to black and potentially other effects with a latency of less than two frames.
<b>Status (Aug 2014)</b> - Main board and gateware have been <a href="/images/mixxeo_result.jpg">mostly functional</a> for a while, mechanical design and manufacturing for the case/mechatronics are progressing slowly. If you have the skills and would like to help out, email <a href="mailto:sb@m-labs.hk" class="domain-sub">sb@m-labs.hk</a> or the mailing list.
<b>Status (Aug 2014)</b> - Main board and gateware have been <a href="/images/mixxeo_result.jpg">mostly functional</a> for a while, mechanical design and manufacturing for the case/mechatronics are progressing slowly. If you have the skills and would like to help out, email [sb@DOMAINNAME](mailto:sb@DOMAINNAME) or the mailing list.
<center><img src="/images/mixxeo_menu.png"><br /><br /><img src="/images/mixxeo_board.jpg" class="picimg"></center>

View File

@ -26,6 +26,6 @@ smoltcp achieves <a href="https://github.com/smoltcp-rs/smoltcp#examplesbenchmar
The source code is available <a href="https://github.com/smoltcp-rs/smoltcp" rel="noopener noreferrer">on GitHub</a>.
**Commercial support for smoltcp is available.** Email <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>.
**Commercial support for smoltcp is available.** Email [sales@DOMAINNAME](mailto:sales@DOMAINNAME).
{% end %}

View File

@ -43,25 +43,7 @@
<link href="{{ get_url(path='favicon.ico', cachebust=true) }}" rel="icon" type="image/x-icon">
{% block styles %}{% endblock %}
<script>
function substituteDomain () {
{% if config.extra.simulate_intl_domain %}
const isIntl = true;
{% else %}
const isIntl = window.location.hostname === "m-labs-intl.com";
{% endif %}
if (isIntl) {
let selected = document.querySelectorAll(".domain-sub");
for (element of selected) {
const code = element.innerHTML;
element.innerHTML = code.replaceAll("m-labs.hk", "m-labs-intl.com");
}
}
}
addEventListener("DOMContentLoaded", (event) => {substituteDomain()});
addEventListener("load", (event) => {substituteDomain()});
</script>
</head>
<body>

View File

@ -5,7 +5,7 @@
<h5 class="pb-3">Sales inquiries</h5>
<p>
To purchase ARTIQ Sinara hardware, software and gateware development services, or to enter a technical support agreement, write to <a href="mailto:sales@m-labs.hk" class="domain-sub">sales@m-labs.hk</a>.
To purchase ARTIQ Sinara hardware, software and gateware development services, or to enter a technical support agreement, write to <a href="mailto:sales@{{config.extra.domain}} class="domain-sub">sales@{{config.extra.domain}}</a>.
</p>
</div>
@ -15,7 +15,7 @@
<h5 class="pb-3">Commercial technical support</h5>
<p>
If you need help setting up ARTIQ hardware purchased from us, or if you have a commercial technical support agreement with us, email us anytime at <a href="mailto:helpdesk@m-labs.hk" class="domain-sub">helpdesk@m-labs.hk</a>.
If you need help setting up ARTIQ hardware purchased from us, or if you have a commercial technical support agreement with us, email us anytime at <a href="mailto:helpdesk@{{config.extra.domain}}" class="domain-sub">helpdesk@{{config.extra.domain}}</a>.
</p>
<h5 class="pb-3">Community support</h5>

View File

@ -57,7 +57,7 @@
{% block main_content %}
{% if page and page.content %}
{{ page.content | safe }}
{{ page.content | replace(from="DOMAINNAME", to=config.extra.domain) | safe }}
{% endif %}
{% endblock %}

View File

@ -7,7 +7,7 @@
<div class="row">
{% block main_content %}
{% if page and page.content %}
{{ page.content | safe }}
{{ page.content | replace(from="DOMAINNAME", to=config.extra.domain) | safe }}
{% endif %}
<div class="container">
<div class="row row-cols-1 row-cols-md-3 g-4">

View File

@ -12,7 +12,7 @@
<div class="col-12 text-center mb-lg-5">
{% if section.extra.title %}
<h1>{{ section.extra.title | markdown | safe }}</h1>
<h1>{{ section.extra.title | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}</h1>
{% endif %}
<img src="{{ get_url(path='images/ion@2x.png', cachebust=true) }}" width="100" align="ion">

View File

@ -1,3 +1,3 @@
<div>
{{ body | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | safe }}
</div>

View File

@ -18,7 +18,7 @@
{% endif %}
<div {% if sameheight %}style="min-height: {{ sameheight }}px"{% endif%}>
{{ body | markdown | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
</div>
</div>
@ -32,7 +32,7 @@
</div>
{% endif %}
{{ body | markdown | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
</div>

View File

@ -4,11 +4,11 @@
{% if card %}
<div class="card shadow py-4 px-3">
{{ body | markdown | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
</div>
{% else %}
<div>
{{ body | markdown | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
</div>
{% endif %}

View File

@ -1,5 +1,5 @@
<div class="text-center {% if css %}{{ css }}{% endif %}">
{{ body | markdown | safe}}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
</div>

View File

@ -1,5 +1,5 @@
<div class="{% if css %}{{ css }}{% else %}col-12{% endif %}">
{{ body | markdown | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
</div>

View File

@ -11,14 +11,14 @@
</div>
<div class="col-md-8">
<div class="card-body">
{% if title %}<h5 class="card-title">{{ title | markdown | safe }}</h5>{% endif %}
{% if title %}<h5 class="card-title">{{ title | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}</h5>{% endif %}
{% if icon %}
<span class="badge bg-transparent position-absolute top-0 start-100 translate-middle-x">
<img src="{{ icon }}" alt="{{ icon }}" class="rounded"
style="height: 2rem;"/>
</span>
{% endif %}
<p class="card-text">{{ body | markdown | safe }}</p>
<p class="card-text">{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}</p>
</div>
</div>
</div>
@ -37,7 +37,7 @@
style="height: 2rem;"/>
</span>
{% endif %}
<p class="card-text">{{ body | markdown | safe }}</p>
<p class="card-text">{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}</p>
</div>
</div>
<div class="col-md-4 funding-logo-end d-flex p-1 justify-content-center">
@ -56,8 +56,8 @@
<div class="row g-0">
<div class="col-md-12">
<div class="card-body">
{% if title %}<h4 class="card-title text-center">{{ title | markdown | safe }}</h4>{% endif %}
<p class="card-text">{{ body | markdown | safe }}</p>
{% if title %}<h4 class="card-title text-center">{{ title | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}</h4>{% endif %}
<p class="card-text">{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}</p>
</div>
</div>
</div>

View File

@ -4,7 +4,7 @@
<div class="slideshow-container">
{{ body | markdown | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
<a class="prev" onclick="plusSlides(-1, '{{ slideName }}', '{{ dotName }}')">&#10094;</a>
<a class="next" onclick="plusSlides(1, '{{ slideName }}', '{{ dotName }}')">&#10095;</a>

View File

@ -1,5 +1,5 @@
<div class="{% if css %}{{ css }}{% else %}row d-flex align-items-center mt-5 mb-5{% endif %}">
{{ body | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | safe }}
</div>

View File

@ -3,7 +3,7 @@
<img src="{{ get_url(path=src, cachebust=true) }}" width="40px" height="40px">
<p class="pe-3">
{{ body | markdown | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
</p>
</div>

View File

@ -4,7 +4,7 @@
<div class="col-12 col-md-6">
{{ body | markdown | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
</div>
@ -40,7 +40,7 @@
<div class="col-12 col-md-6 order-1 order-md-2">
{{ body | markdown | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | markdown | safe }}
</div>

View File

@ -2,7 +2,7 @@
<div class="col-12 d-flex flex-column flex-lg-row justify-content-center {% if two %}justify-content-md-between{% else %}justify-content-md-center{% endif %} align-items-center">
{{ body | safe }}
{{ body | replace(from="DOMAINNAME", to=config.extra.domain) | safe }}
</div>