Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Commit

Permalink
Add ability to specify custom link in modal footer
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpengi committed Nov 10, 2017
1 parent 7fc3aeb commit 35e5545
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
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">

This comment has been minimized.

Copy link
@lengocdiemvc

lengocdiemvc Dec 7, 2017

lengocdiemvc9

<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);

This comment has been minimized.

Copy link
@lengocdiemvc

lengocdiemvc Dec 7, 2017

bancatien.com

This comment has been minimized.

Copy link
@lengocdiemvc

lengocdiemvc Dec 7, 2017

thẻ cào


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;

This comment has been minimized.

Copy link
@lengocdiemvc

lengocdiemvc Dec 7, 2017

9999
9999

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);

This comment has been minimized.

Copy link
@lengocdiemvc

lengocdiemvc Dec 7, 2017

999

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

0 comments on commit 35e5545

Please sign in to comment.