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;
|
2018-10-03 16:12:42 +02:00
|
|
|
toolbox: Function;
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
interface refresh {
|
|
|
|
refresh: Function;
|
|
|
|
}
|
|
|
|
declare var addthis: addthis;
|
2018-10-03 16:12:42 +02:00
|
|
|
// declare var loadAddThis: any;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
//<addThis ></addThis>
|
|
|
|
@Component({
|
|
|
|
selector: 'addThis',
|
|
|
|
template: `
|
2018-06-01 14:28:49 +02:00
|
|
|
<p class="addthis_inline_share_toolbox"></p>
|
2017-12-19 13:53:46 +01:00
|
|
|
`
|
|
|
|
})
|
|
|
|
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{
|
2019-02-14 11:15:44 +01:00
|
|
|
//console.log("AddThis: try load");
|
2018-10-03 16:12:42 +02:00
|
|
|
// addthis.toolbox();
|
|
|
|
// addthis.init();
|
2017-12-19 13:53:46 +01:00
|
|
|
addthis.layers.refresh();
|
|
|
|
}catch (e) {
|
2018-10-03 16:12:42 +02:00
|
|
|
// console.log("AddThis may didn't load properly");
|
|
|
|
// try{
|
|
|
|
// addthis.init();
|
|
|
|
// addthis.layers.refresh();
|
|
|
|
// console.log("AddThis: one more");
|
|
|
|
// }catch (e) {
|
|
|
|
// console.log("AddThis error again");
|
|
|
|
// }
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
}
|
2018-10-03 16:12:42 +02:00
|
|
|
// if (typeof document !== 'undefined' ) {
|
|
|
|
// console.log("AddThis: try load");
|
|
|
|
// loadAddThis();
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
2017-12-19 13:53:46 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|