You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. document.addEventListener('DOMContentLoaded', () => {
  2. //
  3. // Open links in a new window
  4. //
  5. document.querySelectorAll('a._blank').forEach(link => {
  6. link.target = '_blank';
  7. });
  8. //
  9. // Support button
  10. //
  11. if(document.getElementById('splash'))
  12. return;
  13. const sponsor = document.createElement('a');
  14. const heart = document.createElement('img');
  15. const text = document.createTextNode('Support me');
  16. heart.src = 'https://github.githubassets.com/images/icons/emoji/unicode/2764.png';
  17. heart.style.width = '24px';
  18. heart.style.paddingRight = '8px';
  19. heart.classList.add('gemoji', 'heart');
  20. sponsor.href = 'https://github.com/sponsors/alemart';
  21. sponsor.target = '_blank';
  22. sponsor.role = 'button';
  23. sponsor.style.display = 'flex';
  24. sponsor.style.alignItems = 'center';
  25. sponsor.style.position = 'fixed';
  26. sponsor.style.right = '16px';
  27. sponsor.style.bottom = '16px';
  28. sponsor.style.padding = '0 20px';
  29. sponsor.style.height = '48px';
  30. sponsor.style.color = 'var(--md-primary-fg-color)';
  31. sponsor.style.backgroundColor = 'var(--md-primary-bg-color)';
  32. sponsor.style.fontWeight = 'bold';
  33. sponsor.style.fontSize = '16px';
  34. sponsor.style.fontFamily = 'var(--md-text-font) sans-serif';
  35. sponsor.style.cursor = 'pointer';
  36. sponsor.style.borderWidth = '2px';
  37. sponsor.style.borderStyle = 'solid';
  38. sponsor.style.borderColor = 'var(--md-primary-fg-color)';
  39. sponsor.style.borderRadius = '100px';
  40. sponsor.style.transition = 'color 125ms,background-color 125ms,border-color 125ms';
  41. sponsor.addEventListener('pointerenter', () => {
  42. sponsor.style.backgroundColor = 'var(--md-accent-fg-color)';
  43. sponsor.style.borderColor = 'var(--md-accent-fg-color)';
  44. sponsor.style.color = 'var(--md-accent-bg-color)';
  45. });
  46. sponsor.addEventListener('pointerleave', () => {
  47. sponsor.style.backgroundColor = 'var(--md-primary-bg-color)';
  48. sponsor.style.borderColor = 'var(--md-primary-fg-color)';
  49. sponsor.style.color = 'var(--md-primary-fg-color)';
  50. });
  51. sponsor.appendChild(heart);
  52. sponsor.appendChild(text);
  53. document.body.appendChild(sponsor);
  54. });