LinkStackOrg / LinkStack

LinkStack - the ultimate solution for creating a personalized & professional profile page. Showcase all your important links in one place, forget the limitation of one link on social media. Set up your personal site on your own server with just a few clicks.
https://linkstack.org
GNU Affero General Public License v3.0
2.3k stars 235 forks source link

Console errors on interaction on the demo page #174

Closed Ryuno-Ki closed 1 year ago

Ryuno-Ki commented 2 years ago

After creating a demo page, clicking the share link results in an error in the browser console:

toastBox is not defined.

Also, it appears to see jQuery ($ is not defined) present, which is not the case.

JulianPrieber commented 2 years ago

The toast box is something that got removed previously. As far as I can tell, this issue is fixed with new releases. In case that it isn't I'll make sure this gets fixed.

Also, it appears to see jQuery ($ is not defined) present, which is not the case.

This one I'm not sure about. It should be something in here: https://github.com/JulianPrieber/littlelink-custom/blob/main/littlelink/js/share.button.js

Ryuno-Ki commented 2 years ago

https://github.com/JulianPrieber/littlelink-custom/blob/3c4df6721c3faec1d20a0e2c4d946f12c8925663/littlelink/js/share.button.js#L65

Could be rewritten as:

document.querySelector('#share-share-button').addEventListener('click', () => {
  if (navigator.share) {
    navigator.share({
        title: '',
        text: '',
        url: '',
      })
      .then(() => console.log('Successful share'))
      .catch((error) => console.log('Error sharing', error));
  } else {
    console.log('Share not supported on this browser, do it the old way.');
  }
});

See also https://youmightnotneedjquery.com/#on

JulianPrieber commented 2 years ago

https://github.com/JulianPrieber/littlelink-custom/commit/604a0f631d880414c0924f3bf6bbdf950640d2c2

JulianPrieber commented 2 years ago

This problem only appears on Firefox. The share button opens the system default share dialog on Chrome, but Firefox does not support that.

chrome_d9qRIKykDr https://caniuse.com/?search=Navigator%20share