Skip to content
Snippets Groups Projects
Commit c64a64b4 authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

remove IG sync tool, add pre-commit hooks

parent 7753df9a
No related branches found
No related tags found
No related merge requests found
Pipeline #13600 failed
shared/static/shared/instagram.webp

38 KiB

......@@ -77,27 +77,6 @@
</div>
</li>
<li class="card">
<a href="{% url "instagram_token:index" %}" target="_blank">
<img
src="{% static "shared/instagram.webp" %}"
alt="Kalkulačka přístupových tokenů do Instagramu"
class="w-full h-48 object-cover"
>
</a>
<div class="p-4">
<h2 class="mb-2 text-xl font-bold">
<a href="{% url "instagram_token:index" %}" target="_blank">
Kalkulačka přístupových tokenů do Instagramu
</a>
</h2>
<div class="font-light text-sm break-words">
Přihlášením svým účtem získáš přístupové údaje, které můžeš využít pro
synchronizaci obsahu na domovské stránce pirati.cz.
</div>
</div>
</li>
<li class="card">
<a href="{% url "asset_server_resize:index" %}">
<img
......
......@@ -2,8 +2,6 @@ from django.shortcuts import render
# Create your views here.
def index(request):
return render(
request,
"shared/index.html"
)
return render(request, "shared/index.html")
......@@ -8,7 +8,7 @@ $(window).ready(
event.preventDefault();
const form = $("#asset-info-form")[0];
if (!form.checkValidity()) {
form.reportValidity();
return;
......
......@@ -67,17 +67,17 @@ const generateSignature = () => {
<strong style="font-size:13pt;font-weight:bold">${name}</strong>`;
func = escapeHTML(func);
let funcMultiline = "";
for (const line of func.split("\n")) {
funcMultiline += `${line}<br>`;
}
if (func !== "") {
result += `<br>${funcMultiline}`;
}
result += "</div>";
}
......@@ -85,44 +85,44 @@ const generateSignature = () => {
let email = escapeHTML($("#email").val());
let phone = escapeHTML($("#phone").val());
let web = escapeHTML($("#web").val());
let mastodon = escapeHTML($("#mastodon").val());
let twitter = escapeHTML($("#twitter").val());
let instagram = escapeHTML($("#instagram").val());
let linkedin = escapeHTML($("#linkedin").val());
let fejsbuk = escapeHTML($("#fejsbuk").val());
const containsExternalLinks = (web !== "" || mastodon !== "" || twitter !== "" || instagram !== "" || linkedin !== "" || fejsbuk !== "");
if (email !== "" || phone !== "" || containsExternalLinks) {
result += "<div style=\"margin-bottom:0.75em;line-height:1.1em\">";
if (email !== "") {
result += `<div style="margin-bottom:0.25em">
<img style="display:inline-block" src="${(!useExternalImages) ? emailDataURL : emailImageURL}" title="E-mail" width="15">&nbsp;&nbsp;
<span style="color:black">${email}</span>
</div>`;
}
if (phone !== "") {
phone = phone.replace(" ", "");
let phoneGroups = phone.match(/.?.?.?/g);
const formattedBasePhone = phoneGroups.join(" ");
const prefix = $("#phone-prefix").val();
result += `<div style="margin-bottom:0.25em">
<img style="display:inline-block" src="${(!useExternalImages) ? phoneDataURL : phoneImageURL}" title="Telefonní číslo" width="11">&nbsp;&nbsp;
<span style="color:black">${prefix}&nbsp;${formattedBasePhone}</span>
</div>`;
}
if (containsExternalLinks) {
result += "<div style=\"margin-top:1.25em;display:flex;column-gap:0.2em\">";
}
if (web !== "") {
result += `<a href="${web}">
<img
......@@ -133,7 +133,7 @@ const generateSignature = () => {
>
</a>`;
}
if (mastodon !== "") {
result += `<a href="${mastodon}">
<img
......@@ -144,7 +144,7 @@ const generateSignature = () => {
>
</a>`;
}
if (twitter !== "") {
result += `<a href="${twitter}">
<img
......@@ -155,7 +155,7 @@ const generateSignature = () => {
>
</a>`;
}
if (instagram !== "") {
result += `<a
href="${instagram}"
......@@ -168,7 +168,7 @@ const generateSignature = () => {
>
</a>`;
}
if (linkedin !== "") {
result += `<a href="${linkedin}">
<img
......@@ -179,7 +179,7 @@ const generateSignature = () => {
>
</a>`;
}
if (fejsbuk !== "") {
result += `<a href="${fejsbuk}">
<img
......@@ -190,12 +190,12 @@ const generateSignature = () => {
>
</a>`;
}
if (containsExternalLinks) {
result += "</div>";
}
result += "</div>";
}
......@@ -209,15 +209,15 @@ const generateSignature = () => {
</div>
</div>
</div>`;
result = result.replace(/\s\s+|\n|\r\n/g, " ").replace(/> </g, "><").replace(/;\s+/g, ";");
if (result.length > 10000) {
$("#gmail-warning").removeClass("hidden");
} else if (!$("#gmail-warning").hasClass("hidden")) {
$("#gmail-warning").addClass("hidden");
}
$("#preview").html(result);
$("#content").val(result);
}
......@@ -230,22 +230,22 @@ $(window).ready(
"click",
event => {
const form = $("#source")[0];
if (!form.checkValidity()) {
form.reportValidity();
return;
}
generateSignature();
}
);
$("#copy").on(
"click",
event => {
if (navigator.clipboard.write) {
// Chromium
const type = "text/html";
const blob = new Blob([$("#content").val()], { type });
const data = [new window.ClipboardItem({ [type]: blob })];
......@@ -264,18 +264,18 @@ $(window).ready(
);
} else {
// Firefox
try {
selectHTML("preview");
document.execCommand("copy");
alertify.success(
"Zkopírováno do schránky."
);
} catch (exception) {
console.log("Error copying: ", exception);
alertify.error(
"Chyba při kopírování do schránky. Prosím, zkopíruj text manuálně."
);
......
......@@ -43,7 +43,7 @@ $(window).ready(
// Keep user-defined ordering. This is imperative!
// http://github.com/select2/select2/issues/3106 - Thanks to kevin-brown!
const element = $(event.params.data.element);
element.detach();
$(this).append(element);
$(this).trigger("change");
......
......@@ -15,6 +15,6 @@ module.exports = {
},
},
plugins: [
require("@tailwindcss/typography"),
require("@tailwindcss/typography"),
],
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment