diff --git a/landingPages/landing-utils/addThis.component.ts b/landingPages/landing-utils/addThis.component.ts index 97310993..9753b1a0 100644 --- a/landingPages/landing-utils/addThis.component.ts +++ b/landingPages/landing-utils/addThis.component.ts @@ -1,6 +1,7 @@ import {Component, EventEmitter, Inject, OnInit, Output, RendererFactory2, ViewEncapsulation} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {DOCUMENT} from "@angular/common"; +import {Subscriber} from "rxjs"; interface addthis { layers: Refresh; @@ -17,20 +18,29 @@ declare var addthis: addthis; @Component({ selector: 'addThis', template: ` -
+
+
+ Do the share buttons not appear? Please make sure, any blocking addon is disabled, and then reload the page. +
` }) export class AddThisComponent implements OnInit { - sub; + subs=[]; + showWarning = false; constructor(private route: ActivatedRoute, @Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2) {} - ngOnDestroy() { - if(this.sub) { - this.sub.unsubscribe(); + public ngOnDestroy() { + for(let value of this.subs){ + if (value instanceof Subscriber) { + value.unsubscribe(); + } else if (value instanceof Function) { + value(); + } } } ngOnInit() { - this.sub = this.route.queryParams.subscribe(data => { + this.subs.push(this.route.queryParams.subscribe(data => { + this.showWarning = false; try { if (!this.document.getElementById('addThisScript') && typeof document !== 'undefined') { // console.log(" create script AddThis"); @@ -56,10 +66,16 @@ export class AddThisComponent implements OnInit { addthis.layers.refresh(); } } + this.subs.push(setTimeout(() => { + if(this.document.getElementById('addThis') && this.document.getElementById('addThis').innerText.length ==0){ + this.showWarning = true; + } + }, 2000)); + }catch (e) { // console.error(e) } - }); + })); } }