diff --git a/search_krumo.info b/search_krumo.info index b16f8c7..91dc777 100644 --- a/search_krumo.info +++ b/search_krumo.info @@ -1,6 +1,5 @@ name = Search Krumo description = Makes it possible to search through Devels krumo's. core = 7.x -stylesheets[all][] = search_krumo.css package = Development dependencies[] = devel diff --git a/search_krumo.module b/search_krumo.module index 437d0ba..7715806 100755 --- a/search_krumo.module +++ b/search_krumo.module @@ -25,28 +25,18 @@ function sdpm($input, $name = NULL) { } /** - * Implements hook_init(). - */ -function search_krumo_init() { - // We add the search_krumo JavaScript on every page. - // If it's not necessary it is removed in hook_js_alter. - add_search_krumo(); -} - -/** * Implements hook_js_alter(). * * With this function we check if there is a krumo present. If there is we can - * leave our own Javascript, otherwise our Javascript is not needed either. + * add our own JavaScript and CSS. */ function search_krumo_js_alter(&$javascript) { - // This is the path for the Devel krumo Javascript. + // This is the path for the Devel krumo JavaScript. $devel_js_path = drupal_get_path('module', 'devel') . '/devel_krumo_path.js'; - // When Devel krumo Javascript is not present, remove Search Krumo Javascript. - if (!isset($javascript[$devel_js_path])) { - unset($javascript[drupal_get_path('module', 'search_krumo') . '/search_krumo.search.js']); - unset($javascript[drupal_get_path('module', 'search_krumo') . '/search_krumo.trail.js']); + // When Devel krumo JavaScript is present add Search Krumo JavaScript. + if (isset($javascript[$devel_js_path])) { + add_search_krumo(); } } @@ -58,6 +48,7 @@ function search_krumo_js_alter(&$javascript) { function add_search_krumo() { drupal_add_js(drupal_get_path('module', 'search_krumo') . '/search_krumo.search.js'); drupal_add_js(drupal_get_path('module', 'search_krumo') . '/search_krumo.trail.js'); + drupal_add_css(drupal_get_path('module', 'search_krumo') . '/search_krumo.css'); } /**