summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Auditor2012-02-24 13:10:34 (GMT)
committer Stefan Auditor2012-02-24 13:10:34 (GMT)
commit3424479a33270a96c9f11e11ff6683e2cd693f1a (patch)
tree216dfb960d6fd2796c48f9cd5d95f166371eb512
parente245577b913127ef661e203f723b69fce0789635 (diff)
by sanduhrs: Moving CSS loading to the info file.
-rw-r--r--adaptive_image.info4
-rw-r--r--adaptive_image.module7
2 files changed, 8 insertions, 3 deletions
diff --git a/adaptive_image.info b/adaptive_image.info
index 9642907..5a9e793 100644
--- a/adaptive_image.info
+++ b/adaptive_image.info
@@ -2,4 +2,6 @@ name = Adaptive Image
description = Support for adaptive images.
core = 7.x
-dependencies[] = image \ No newline at end of file
+dependencies[] = image
+
+stylesheets[all][] = css/adaptive-image.css \ No newline at end of file
diff --git a/adaptive_image.module b/adaptive_image.module
index e053e21..f0a545d 100644
--- a/adaptive_image.module
+++ b/adaptive_image.module
@@ -13,8 +13,12 @@
* Implements hook_init().
*/
function adaptive_image_init() {
+ // According to the documentation of hook_init() it should not be used to
+ // load JS or CSS. The CSS case has been moved to the info file. But the JS is
+ // here by intention, as we want it inline to prevent wait time while loading
+ // the script
+
// No need for drupal behaviours, jquery compatibility wrapper nor ready event
- // This is inline to prevent wait time while loading the script
$js = "document.cookie = 'adaptive_image=' + Math.max(screen.width, screen.height) + '; path=/';";
drupal_add_js($js,
// First-come, first-served
@@ -26,7 +30,6 @@ function adaptive_image_init() {
'weight' => -500,
)
);
- drupal_add_css(drupal_get_path('module', 'adaptive_image') . '/css/adaptive-image.css');
}
/**