1 |
2c8c2b87
|
Assos Assos
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
85ad3d82
|
Assos Assos
|
|
6 |
2c8c2b87
|
Assos Assos
|
(function ($) {
|
7 |
85ad3d82
|
Assos Assos
|
Drupal.behaviors.addthis = {
|
8 |
2c8c2b87
|
Assos Assos
|
scriptLoaded: false,
|
9 |
|
|
|
10 |
85ad3d82
|
Assos Assos
|
attach: function(context, settings) {
|
11 |
4543c6c7
|
Assos Assos
|
|
12 |
2c8c2b87
|
Assos Assos
|
|
13 |
|
|
|
14 |
|
|
if (!this.isConfigLoaded() && this.isSettingsLoaded()) {
|
15 |
|
|
|
16 |
|
|
this.initConfig();
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
if (!this.scriptLoaded) {
|
20 |
|
|
this.loadDomready();
|
21 |
85ad3d82
|
Assos Assos
|
}
|
22 |
|
|
}
|
23 |
2c8c2b87
|
Assos Assos
|
|
24 |
|
|
|
25 |
|
|
else if(!this.isConfigLoaded() && !this.isSettingsLoaded()) {
|
26 |
|
|
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
if (context != window.document) {
|
31 |
|
|
Drupal.behaviors.addthis.ajaxLoad(context, settings);
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
},
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
isSettingsLoaded: function () {
|
38 |
|
|
if (typeof Drupal.settings.addthis == 'undefined') {
|
39 |
|
|
return false;
|
40 |
|
|
}
|
41 |
|
|
return true;
|
42 |
|
|
},
|
43 |
4543c6c7
|
Assos Assos
|
|
44 |
2c8c2b87
|
Assos Assos
|
|
45 |
|
|
isConfigLoaded: function() {
|
46 |
|
|
if (typeof addthis_config == 'undefined' || typeof addthis_share == 'undefined') {
|
47 |
|
|
return false;
|
48 |
|
|
}
|
49 |
|
|
return true;
|
50 |
|
|
},
|
51 |
|
|
|
52 |
|
|
initConfig: function () {
|
53 |
|
|
addthis_config = Drupal.settings.addthis.addthis_config;
|
54 |
|
|
addthis_share = Drupal.settings.addthis.addthis_share;
|
55 |
|
|
},
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
loadDomready: function() {
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
if (!this.scriptLoaded &&
|
62 |
|
|
this.isConfigLoaded() &&
|
63 |
|
|
Drupal.settings.addthis.domready) {
|
64 |
|
|
$.getScript(Drupal.settings.addthis.widget_url, Drupal.behaviors.addthis.scriptReady);
|
65 |
|
|
}
|
66 |
|
|
},
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
scriptReady: function () {
|
70 |
|
|
this.scriptLoaded = true;
|
71 |
|
|
},
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
ajaxLoad: function(context, settings) {
|
75 |
|
|
if (typeof window.addthis != 'undefined' &&
|
76 |
|
|
typeof window.addthis.toolbox == 'function')
|
77 |
|
|
{
|
78 |
|
|
window.addthis.toolbox('.addthis_toolbox');
|
79 |
|
|
}
|
80 |
85ad3d82
|
Assos Assos
|
}
|
81 |
2c8c2b87
|
Assos Assos
|
|
82 |
|
|
};
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
if (Drupal.behaviors.addthis.isConfigLoaded()) {
|
86 |
|
|
addthis_config = Drupal.settings.addthis.addthis_config;
|
87 |
|
|
addthis_share = Drupal.settings.addthis.addthis_share;
|
88 |
4543c6c7
|
Assos Assos
|
}
|
89 |
85ad3d82
|
Assos Assos
|
|
90 |
2c8c2b87
|
Assos Assos
|
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
$(document).ready(function() {
|
95 |
|
|
Drupal.behaviors.addthis.loadDomready();
|
96 |
|
|
});
|
97 |
|
|
|
98 |
85ad3d82
|
Assos Assos
|
}(jQuery)); |