Skip to content

Commit

Permalink
update readme and script
Browse files Browse the repository at this point in the history
  • Loading branch information
justmarkup committed Jan 21, 2019
1 parent 9d4a26b commit 06924b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Demos

Author: Michael Scharnagl @justmarkup

Transforming a link to a login page to a button opening the login form in an overlay
------------
* Demo: http://justmarkup.github.io/demos/link-to-button
* Article: https://justmarkup.com/log/?p=3432&preview=true

Enhancing a login form – from basic to validation to reveal password
------------
* Demo: https://enhance-login-form.glitch.me/login
Expand Down
18 changes: 8 additions & 10 deletions link-to-button/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
var dialogContent = document.querySelector('[data-dialog-content]');
window.dialog = false;

dialogOpener.outerHTML = `
<button data-link="${dialogOpener.href}" class="link-like">
${dialogOpener.textContent}
</button>
`;

dialogOpener = document.querySelector('[data-link="' + dialogOpener.href + '"]')

if (!window.dialog) {
var dialogElement = document.getElementById('dialog');
var mainEl = document.querySelector('#content');
Expand All @@ -31,11 +23,17 @@
});
}

dialogOpener.outerHTML = `
<button data-link="${dialogOpener.href}" class="link-like">
${dialogOpener.textContent}
</button>
`;

dialogOpener = document.querySelector('[data-link="' + dialogOpener.href + '"]');

dialogOpener.addEventListener('click', function(ev) {
var link = this.dataset.link ? this.dataset.link : false;

console.log('click', link);

if (link) {

fetch(link)
Expand Down

0 comments on commit 06924b0

Please sign in to comment.