File: donate.js

package info (click to toggle)
surgescript 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,200 kB
  • sloc: ansic: 15,748; sh: 61; javascript: 38; makefile: 13
file content (32 lines) | stat: -rw-r--r-- 1,139 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
document.addEventListener('DOMContentLoaded', function() {
    const script = document.createElement('script');

    script.addEventListener('load', function() {
        kofiWidgetOverlay.draw('alemart', {
            'type': 'floating-chat',
            'floating-chat.donateButton.text': 'Support me',
            'floating-chat.donateButton.background-color': '#4051b5',
            'floating-chat.donateButton.text-color': 'white'
        });
    });

    script.addEventListener('error', function(e) {
        console.log(`Can't load the Ko-fi widget`, e);
    });

    script.type = 'text/javascript';
    script.async = true;
    script.src = 'https://storage.ko-fi.com/cdn/scripts/overlay-widget.js';

    document.body.appendChild(script);

    const style = document.createElement('style');
    style.appendChild(document.createTextNode(`
        .floatingchat-container-wrap, .floatingchat-container-wrap-mobi,
        .floating-chat-kofi-popup-iframe, .floating-chat-kofi-popup-iframe-mobi {
            right: 16px !important;
            left: initial !important;
        }
    `));
    document.head.appendChild(style);
});