dnet40/modules/uoa-services-library/branches/mergeResultLandingPages/ng-openaire-library/src/app/landingPages/landing-utils/addThis.component.ts @ 56958
1 |
import {Component, ElementRef, Input} from '@angular/core'; |
---|---|
2 |
import {ActivatedRoute} from '@angular/router'; |
3 |
|
4 |
interface addthis { |
5 |
layers: refresh; |
6 |
init: Function; |
7 |
toolbox: Function; |
8 |
}
|
9 |
interface refresh { |
10 |
refresh: Function; |
11 |
}
|
12 |
declare var addthis: addthis; |
13 |
// declare var loadAddThis: any;
|
14 |
|
15 |
//<addThis ></addThis>
|
16 |
@Component({ |
17 |
selector: 'addThis', |
18 |
template: ` |
19 |
<p class="addthis_inline_share_toolbox"></p>
|
20 |
`
|
21 |
})
|
22 |
export class AddThisComponent { |
23 |
private sub:any; |
24 |
|
25 |
|
26 |
constructor(private route: ActivatedRoute) { |
27 |
|
28 |
}
|
29 |
ngOnInit() { |
30 |
this.sub = this.route.queryParams.subscribe(data => { |
31 |
|
32 |
if (typeof document !== 'undefined' && typeof addthis !== 'undefined') { |
33 |
try{ |
34 |
//console.log("AddThis: try load");
|
35 |
// addthis.toolbox();
|
36 |
// addthis.init();
|
37 |
addthis.layers.refresh(); |
38 |
}catch (e) { |
39 |
// console.log("AddThis may didn't load properly");
|
40 |
// try{
|
41 |
// addthis.init();
|
42 |
// addthis.layers.refresh();
|
43 |
// console.log("AddThis: one more");
|
44 |
// }catch (e) {
|
45 |
// console.log("AddThis error again");
|
46 |
// }
|
47 |
}
|
48 |
}
|
49 |
// if (typeof document !== 'undefined' ) {
|
50 |
// console.log("AddThis: try load");
|
51 |
// loadAddThis();
|
52 |
//
|
53 |
//
|
54 |
// }
|
55 |
});
|
56 |
|
57 |
}
|
58 |
|
59 |
|
60 |
}
|