mirror of
https://github.com/mempool/mempool.git
synced 2025-04-23 23:10:45 +02:00
[square] create common function to inject square so we don't have c/p everywhere
This commit is contained in:
parent
d4074b3a0c
commit
8cec3c6e91
@ -3,6 +3,7 @@ import { TransactionStripped } from "@interfaces/node-api.interface";
|
||||
import { AmountShortenerPipe } from "@app/shared/pipes/amount-shortener.pipe";
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
const amountShortenerPipe = new AmountShortenerPipe();
|
||||
import { isDevMode } from '@angular/core';
|
||||
|
||||
export function isMobile(): boolean {
|
||||
return (window.innerWidth <= 767.98);
|
||||
@ -280,3 +281,21 @@ export function md5(inputString): string {
|
||||
}
|
||||
return rh(a)+rh(b)+rh(c)+rh(d);
|
||||
}
|
||||
|
||||
export function injectSquare(isProdDomain): void {
|
||||
if (!isProdDomain && !isDevMode()) {
|
||||
return;
|
||||
}
|
||||
if (window['Square']) {
|
||||
return;
|
||||
}
|
||||
let statsUrl = 'https://sandbox.web.squarecdn.com/v1/square.js';
|
||||
if (isProdDomain) {
|
||||
statsUrl = '/square/v1/square.js';
|
||||
}
|
||||
|
||||
(function(): void {
|
||||
const d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||
g.type='text/javascript'; g.src=statsUrl; s.parentNode.insertBefore(g, s);
|
||||
})();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user