2017-12-19 13:53:46 +01:00
|
|
|
import {Component, ElementRef, Input} from '@angular/core';
|
|
|
|
import {ActivatedRoute} from '@angular/router';
|
|
|
|
|
|
|
|
interface addthis {
|
|
|
|
layers: refresh;
|
|
|
|
init: Function;
|
|
|
|
}
|
|
|
|
interface refresh {
|
|
|
|
refresh: Function;
|
|
|
|
}
|
|
|
|
declare var addthis: addthis;
|
|
|
|
|
|
|
|
//<addThis ></addThis>
|
|
|
|
@Component({
|
|
|
|
selector: 'addThis',
|
|
|
|
template: `
|
|
|
|
<div class="addthis_inline_share_toolbox"></div>
|
|
|
|
`
|
|
|
|
})
|
|
|
|
export class AddThisComponent {
|
|
|
|
private sub:any;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private route: ActivatedRoute) {
|
|
|
|
|
|
|
|
}
|
|
|
|
ngOnInit() {
|
|
|
|
this.sub = this.route.queryParams.subscribe(data => {
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
if (typeof document !== 'undefined' && typeof addthis !== 'undefined') {
|
2017-12-19 13:53:46 +01:00
|
|
|
try{
|
|
|
|
addthis.init();
|
|
|
|
addthis.layers.refresh();
|
|
|
|
}catch (e) {
|
2018-02-05 14:14:59 +01:00
|
|
|
console.log("AddThis may didn't load properly");
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|