Skip to content
This repository was archived by the owner on Oct 18, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ you can pass some properties in to customize the default behavior.
* Prevents the widget iframe from loading Google Analytics. Defaults to false.
*/
disableGoogleAnalytics: false, // @type {boolean}

/*
* To add a custom link to the modal footer.
*/
custom_disclaimer_link: {
text: 'Link text', // @type {string} link text
href: 'http://battleforthenet.com/' // @type {string} link href attribute
},

/*
* Always show the widget. Useful for testing.
Expand Down
2 changes: 1 addition & 1 deletion src/iframe/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h1 id="headline"></h1>
</button>
</form>

<div class="disclaimer">
<div id="disclaimer" class="disclaimer">
<p>We will only use your phone number to connect this call. <a href="https://www.battleforthenet.com/privacy/" target="_blank">Privacy policy</a>. <a href="https://github.com/fightforthefuture/battleforthenet-widget#how-to-install-the-widget" target="_blank">Get the code</a>. Not in the US? <a class="donate" href="https://donate.fightforthefuture.org/" target="_blank">Donate</a>.</p>
</div>
</section>
Expand Down
14 changes: 14 additions & 0 deletions src/iframe/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@
return themeObj;
}

function addCustomDisclaimerLink(link) {
var p = document.createElement('p');
var a = document.createElement('a');
a.setAttribute('href', link.href);
a.setAttribute('target', '_blank');
a.textContent = link.text;
p.appendChild(a);

document.getElementById("disclaimer").appendChild(p);
}

function renderContent(theme) {
document.body.classList.add(theme.className);

Expand Down Expand Up @@ -192,6 +203,9 @@
}

renderContent.call(this, getTheme(this.options.theme));
if (this.options.custom_disclaimer_link) {
addCustomDisclaimerLink(this.options.custom_disclaimer_link);
}

var org = getOrg(this.options.org);
var donateLinks = document.querySelectorAll('a.donate');
Expand Down
1 change: 1 addition & 0 deletions src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
if (typeof _bftn_options.delay == "undefined") _bftn_options.delay = 1000;
if (typeof _bftn_options.debug == "undefined") _bftn_options.debug = false;
if (typeof _bftn_options.date == "undefined") _bftn_options.date = new Date(2017, 10 /* Zero-based month */, 23);
if (typeof _bftn_options.custom_disclaimer_link == "undefined") _bftn_options.custom_disclaimer_link = null;
if (typeof _bftn_options.viewCookieExpires == "undefined") _bftn_options.viewCookieExpires = 1;
if (typeof _bftn_options.actionCookieExpires == "undefined") _bftn_options.actionCookieExpires = 7;
if (typeof _bftn_options.always_show_widget == "undefined") _bftn_options.always_show_widget = false;
Expand Down