2020-03-16 14:09:46 +01:00
|
|
|
import {
|
|
|
|
AfterContentInit,
|
|
|
|
AfterViewInit,
|
|
|
|
Component,
|
|
|
|
ElementRef,
|
|
|
|
EventEmitter,
|
|
|
|
Input,
|
|
|
|
OnInit,
|
|
|
|
Output,
|
|
|
|
ViewChild
|
|
|
|
} from '@angular/core';
|
2017-12-19 13:53:46 +01:00
|
|
|
import {ActivatedRoute} from '@angular/router';
|
|
|
|
|
2020-03-16 14:09:46 +01:00
|
|
|
interface addthis {
|
|
|
|
layers: Refresh;
|
|
|
|
init: Function;
|
|
|
|
toolbox: Function;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Refresh {
|
|
|
|
refresh: Function;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare var addthis: addthis;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'addThis',
|
|
|
|
template: `
|
2020-03-16 14:09:46 +01:00
|
|
|
<p class="addthis_inline_share_toolbox"></p>
|
2017-12-19 13:53:46 +01:00
|
|
|
`
|
|
|
|
})
|
2020-03-16 14:09:46 +01:00
|
|
|
export class AddThisComponent implements OnInit {
|
|
|
|
@Output() event: EventEmitter<boolean> = new EventEmitter<boolean>();
|
|
|
|
|
|
|
|
constructor(private route: ActivatedRoute) {}
|
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
ngOnInit() {
|
2020-03-16 14:09:46 +01:00
|
|
|
this.route.queryParams.subscribe(data => {
|
2018-02-05 14:14:59 +01:00
|
|
|
if (typeof document !== 'undefined' && typeof addthis !== 'undefined') {
|
2020-03-16 14:09:46 +01:00
|
|
|
if(addthis.layers && addthis.layers.refresh) {
|
2017-12-19 13:53:46 +01:00
|
|
|
addthis.layers.refresh();
|
2020-03-16 14:09:46 +01:00
|
|
|
} else {
|
|
|
|
this.event.emit(false);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
2020-03-16 14:09:46 +01:00
|
|
|
} else {
|
|
|
|
this.event.emit(false);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
2020-03-16 14:09:46 +01:00
|
|
|
});
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
}
|