@proca/widget
Version:
Proca is an open-source campaign toolkit designed to empower activists and organisations in their digital advocacy efforts. It provides a flexible and customisable platform for creating and managing online petitions, email campaigns, and other forms of di
241 lines (224 loc) • 9.58 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta property="og:image" content="https://placekitten.com/540/284" />
<title><%= campaign %> widget for <%= organisation %></title>
<meta name="twitter:title" content="Sign the ECI" />
<meta name="description" content="Sign the ECI!" />
<meta name="twitter:description" content="Sign the ECI" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@eucampaign" />
<meta name="twitter:image" content="%PUBLIC_URL%/logo.png" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script>
<style>
html {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
nope.font-family: "Courier New", Courier, "Lucida Sans Typewriter",
"Lucida Typewriter", monospace;
}
#help.hidden, #widget-demo.hidden {
display:none;
}
</style>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
-->
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<minimal-style style="display: none">
.proca-widget, #signature-form {max-width:600px;min-width:300px} .row{
display: flex; flex-direction: row; flex-wrap: wrap; width:100%; } .col{
display: flex; flex-direction: column; flex-basis: 100%; padding:0 10px;
flex:1; } pre {background:#dede; padding: 10px}
</minimal-style>
<style>
body {
padding-top: 5rem;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand eci-title" href="#">ECI</a>
<div class="navbar-nav mr-auto"></div>
<div
class="btn-group btn-group-sm"
role="toolbar"
aria-label="Actions for the webmasters"
>
<button
class="proca-next btn btn-secondary"
title="skip to the next action"
onClick="proca.go()"
>
⏵
</button>
<button
id="btn-help"
title="How to embed this into your website?"
class="btn btn-secondary"
onClick="toggleHelp()"
>
?
</button>
</div>
</div>
</nav>
<noscript
>You need to enable JavaScript to participate to this campaign.</noscript
>
<div id="root" class="container">
<h2 class="eci-name">...</h2>
<div class="row" id="widget-demo">
<div class="col">
<div class="alert alert-info" role="alert">
<h3 class="eci-title">...</h3>
<div class="eci-description"></div>
<div class="eci-more"></div>
</div>
</div>
<div class="col">
<div class="proca-widget" id="widget-demo">
</div>
</div>
</div>
<div class="row" id="help">
<div class="col alert alert-info">
<h2>Are you working for this organisation?</h2>
<p>Adding this widget on your website is simple!</p>
<p>
We recommend that you run the widget on your website’s homepage.
However, if you prefer, you can run it on a specific campaign or
other relevant page. For the final version, it's better to have a
memorable url, as it will hopefully be widely shared.
</p>
<p>
You simply need to copy paste in your website editor, for instance
wordpress
</p>
<pre class="dynamic">
<script id="proca" src="https://%widget_path%"></script>
<div class="proca-widget">
</div>
<h3 class="eci-title">...</h3>
<div class="eci-description"></div>
<div class="eci-more"></div>
</pre>
<p>
<i
>You can put the first line wherever you want, the other lines has
to be where you want the form to be displayed</i
>
</p>
◦
<p>
Please do <b>NOT</b> test the widget on a live page – we don’t want
people trying to sign before we go live!
<br />
In order to be compliant with the EU Regulation, you must put the
title, text and "more" button, these are the elements with
eci-title, eci-description and eci-more classes.
<br />
We recommend that you put them in two columns, and that's what the
code above does – but it is ultimately up to you.<br />
One block (composed of the eci-title, eci-description and eci-more
classes) will be the official text of our ECI, which will be
displayed in the language that you have chosen for your widget.
Legally, this official text <b>must</b> be displayed alongside the
signing part of the widget. You are free to use different layouts,
for instance here we use "h3" for the title of the ECI, and you can
put other elements for styling differently (in the example above, we
put the eci text on a blue background), as long as all the 3
elements (title, text and "more" are displayed.
<br />
The other div with the class proca-widget can be empty, and will
contain signing section, which first gives people an option to be
kept updated on progress, secondly the ECI signing itself (this
information is never seen by us or any campaign partners), and
thirdly the opportunity to share. <br />
you can see an example of the widget and the steps above.
</p>
</div>
</div>
</div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script>
var params = {};
function display() {
var variants = ["standard", "filled", "outlined"];
var urlParams = new URLSearchParams(window.location.search);
var widget_path =
window.location.hostname +
window.location.pathname.replace("/index.html", "");
var widget_shortcode = window.location.pathname
.replace("/index.html", "")
.replace("/d/", "");
for (let d of document.getElementsByClassName("dynamic")) {
d.innerHTML = d.innerHTML.replace("%widget_path%", widget_path);
d.innerHTML = d.innerHTML.replace(
"%widget_shortcode%",
widget_shortcode
);
}
// if (urlParams.get("variant")) {
// params.variant = urlParams.get("variant");
// }
if (urlParams.get("actionPage"))
params.actionPage = urlParams.get("actionPage");
// params.loader = urlParams.get("proca_loader");
proca.Widget(params);
}
if (typeof proca === "object") {
//not used on dev
display();
} else {
console.log("DEV MODE");
window.addEventListener("DOMContentLoaded", function () {
display();
});
}
</script>
</script>
<script>
// example of how to be informed of changes in the widget and modify the journey
window.addEventListener("proca", function (e) {
console.log(e.type, e.detail);
});
window.addEventListener("proca", function (e) {
if (e.detail.message === "init") {
const help = document.getElementById("help");
help.classList.toggle('hidden');
//widget-example
}
});
function toggleHelp () {
let help = document.getElementById("help");
help.classList.toggle('hidden');
let widget = document.getElementById("widget-demo");
widget.classList.toggle('hidden');
}
</script>
</body>
</html>