-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1515410-drupal_add_js.patch
33 lines (33 loc) · 1.06 KB
/
1515410-drupal_add_js.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
index 2cbf882..4fed4dc 100644
--- a/chartbeat.module
+++ b/chartbeat.module
@@ -50,13 +50,17 @@ function chartbeat_init() {
* Implements hook_page_alter().
*/
function chartbeat_page_alter(&$page) {
+ if (path_is_admin(current_path())) {
+ return;
+ }
+
$uid = variable_get('chartbeat_uid', '');
if (!empty($uid)) {
$output = <<<EOT
-<script type="text/javascript">
- var _sf_async_config=Drupal.settings.chartbeat;
+ var _sf_async_config;
(function(){
function loadChartbeat() {
+ var _sf_async_config=Drupal.settings.chartbeat;
window._sf_endpt=(new Date()).getTime();
var e = document.createElement('script');
e.setAttribute('language', 'javascript');
@@ -70,8 +74,7 @@ function chartbeat_page_alter(&$page) {
window.onload = (typeof window.onload != 'function') ?
loadChartbeat : function() { oldonload(); loadChartbeat(); };
})();
-</script>
EOT;
- $page['page_bottom']['chartbeat'] = array('#markup' => $output);
+ drupal_add_js($output, array('type' => 'inline', 'scope' => 'footer'));
}
}