Skip to content
Snippets Groups Projects
Commit 7501a0fa authored by Tomáš Hozman's avatar Tomáš Hozman
Browse files

added spolu base

parent f5849612
Branches
No related tags found
No related merge requests found
Showing
with 236 additions and 0 deletions
File added
File added
File added
File added
File added
File added
File added
File added
/*
* Thanks to majodev for their Google webfont helper!
*/
/* montserrat-300 - latin-ext_latin */
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: light;
src: local(''),
url('./montserrat-v25-latin-ext_latin-300.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('./montserrat-v25-latin-ext_latin-300.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* montserrat-regular - latin-ext_latin */
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: regular;
src: local(''),
url('./montserrat-v25-latin-ext_latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('./montserrat-v25-latin-ext_latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* montserrat-600 - latin-ext_latin */
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: bold;
src: local(''),
url('./montserrat-v25-latin-ext_latin-600.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('./montserrat-v25-latin-ext_latin-600.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* montserrat-900 - latin-ext_latin */
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: bolder;
src: local(''),
url('./montserrat-v25-latin-ext_latin-900.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('./montserrat-v25-latin-ext_latin-900.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
generator/static/images/spolu/backgrounds/1.png

1.92 MiB

generator/static/images/spolu/backgrounds/2.png

1.8 MiB

generator/static/images/spolu/backgrounds/3.png

2.14 MiB

generator/static/images/spolu/backgrounds/4.png

2.25 MiB

generator/static/images/spolu/backgrounds/5.png

1.68 MiB

generator/static/images/spolu/logo.png

18.6 KiB

class Template {
// The base class for all templates, including some abstract properties.
constructor(canvas, context = null) {
if (typeof(canvas) === "string") {
this.canvas = document.getElementById(canvas);
} else {
this.canvas = canvas;
}
if (context === null) {
this.context = this.canvas.getContext("2d");
} else {
this.context = context;
}
}
changeableAttributes = [];
colors = {};
async redrawCanvas() {
throw new Error("This function is not implemented.");
}
}
class PrimaryLocalizationTextBackgroundImageTemplate extends Template {
changeableAttributes = [
"primaryText",
"localizationText",
"backgroundImageSource"
];
primaryText = "";
localizationText = "";
backgroundImageSources = [
"/static/images/spolu/backgrounds/1.png",
];
backgroundImage = null;
async setPrimaryText(text, redraw = true) {
this.primaryText = true;
if (redraw) await this.redrawCanvas();
}
async setLocalizationText(text, redraw = true) {
this.localizationText = true;
if (redraw) await this.redrawCanvas();
}
async setBackgroundImageSource(source, redraw = true) {
this.backgroundImage = new Image();
const backgroundImageLoadPromise = new Promise(
resolve => {
this.backgroundImage.onload = function() {
resolve();
}
}
);
this.backgroundImage.src = source;
if (redraw) await this.redrawCanvas();
}
async pickRandomBackgroundImage() {
// https://stackoverflow.com/a/4550514
// Thanks to Jacob Relkin and jakanz!
await this.setBackgroundImageSource(
this.backgroundImageSources[Math.floor(Math.random() * this.backgroundImageSources.length)]
);
}
}
class BasicClaimTemplate extends PrimaryLocalizationTextBackgroundImageTemplate {
colors = {
headerBackground: "#fed929",
header: "#03034d",
primaryTextBackground: "#ffffff",
primaryText: "#03034d",
localizationText: "#ffffff"
};
async redrawCanvas() {
}
}
class PersonQuoteTemplate extends PrimaryLocalizationTextBackgroundImageTemplate {
changeableAttributes = PrimaryLocalizationTextBackgroundImageTemplate.changeableAttributes.concat([
"nameText"
]);
colors = {
primaryTextBackground: "#ffffff",
primaryText: "#03034d",
nameBackground: "#fed929",
nameText: "#03034d",
localizationText: "#ffffff"
};
nameText = "";
async redrawCanvas() {
}
async setNameText(text, redraw = true) {
this.nameText = true;
if (redraw) await this.redrawCanvas();
}
}
<!DOCTYPE html>
<html lang="cs">
<head>
<title>Generátor SPOLU kampaně</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script
type="text/javascript"
src="{{ url_for('static', filename='js/jquery.js') }}"
></script>
<script
type="text/javascript"
src="{{ url_for('static', filename='js/spolu/template.js') }}"
></script>
<script
type="text/javascript"
src="{{ url_for('static', filename='js/spolu/ui.js') }}"
></script>
<link
rel="stylesheet"
href="{{ url_for('static', filename='fonts/montserrat/style.css') }}"
>
<link
rel="stylesheet"
href="{{ url_for('static', filename='css/spolu.css') }}"
>
<link
rel="icon"
href="{{ url_for('static', filename='images/badges/default-light.png') }}"
type="image/png"
>
</head>
<body>
<header>
</header>
<main>
<canvas
id="spolu-canvas"
width="2000"
height="2000"
></canvas>
</main>
<footer>
<small>
<span>
Generátor s ♥ vytvořil <a
href="https://toho.neocities.org"
target="_blank"
rel="noopener noreferrer nofollow"
>Tomáš Valenta</a>
</span>
<span>
pod svobodnou licencí <a
href="https://www.gnu.org/licenses/agpl-3.0.en.html"
target="_blank"
rel="noopener noreferrer nofollow"
>AGPLv3</a>.
</span>
</small>
</footer>
</body>
</html>
......@@ -341,3 +341,8 @@ def view_avatar_generator_with_localization(
icon_height_multiplier=icon_height_multiplier,
icon_offset_bottom_multiplier=icon_offset_bottom_multiplier
), http.client.OK
@generator_blueprint.route("/spolu")
def view_spolu_version() -> typing.Tuple[flask.Response, int]:
return flask.render_template("spolu.html"), http.client.OK
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment