Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
parsagholipour committed Oct 6, 2022
1 parent e376a64 commit eaedcfa
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import TelegramDriver from "./lib/drivers/TelegramDriver";
import TelegramSvg from "*?raw";

if (document.location.pathname === '/vue') {
initVue()
initVue();
} else if (document.location.pathname === '/react') {
initReact()
initReact();
} else {
document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
<div>
Expand All @@ -35,13 +35,13 @@ if (document.location.pathname === '/vue') {
</div>
`
function customDriver(lang, options) {
this.lang = lang
this.options = options
this.buttonText = 'Telegram'
this.icon = '<svg style="transform:scale(0.83)" fill="currentColor" width="512px" height="512px" viewBox="-32 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg>'
this.backgroundColor = '#366a81'
this.backgroundHoverColor = '#0371aa'
this.textColor = '#fff'
this.lang = lang;
this.options = options;
this.buttonText = 'Telegram';
this.icon = '<svg style="transform:scale(0.83)" fill="currentColor" width="512px" height="512px" viewBox="-32 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg>';
this.backgroundColor = '#366a81';
this.backgroundHoverColor = '#0371aa';
this.textColor = '#fff';
this.textHoverColor = '#fff'
this.getLink = () => {
return 'http://google.com'
Expand All @@ -50,7 +50,7 @@ if (document.location.pathname === '/vue') {
// @ts-ignore
return this.lang[this.buttonText.replaceAll(' ', '_')] || this.buttonText;
}
this.rippleColor = '#ffffff75'
this.rippleColor = '#ffffff75';
}

Sharee.addDriver('tel', TelegramDriver)
Expand All @@ -59,33 +59,33 @@ if (document.location.pathname === '/vue') {
mode: 'dropdown',
lang: 'fa',
drivers: ['tel', 'tel2']
})
});

new Sharee(document.querySelector('#sharee-text')!, {
mode: 'text',
lang: 'fa'
})
});

new Sharee(document.querySelector('#sharee-normal')!, {
mode: 'normal',
lang: 'en'
})
});

new Sharee(document.querySelector('#sharee-normal-no-title')!, {
mode: 'normal',
lang: 'fa',
modeOptions: {
noTitle: true
}
})
});

new Sharee(document.body, {
mode: 'fixed',
lang: 'fa',
modeOptions: {
position: 'bottom-right'
}
})
});

new Sharee(document.body, {
mode: 'fixed',
Expand All @@ -94,5 +94,5 @@ if (document.location.pathname === '/vue') {
position: 'top-left',
noTitle: false
}
})
});
}

0 comments on commit eaedcfa

Please sign in to comment.