selectList.module 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // $Id$
  3. //
  4. // jqplug.module
  5. //
  6. //
  7. //
  8. // Created by Bach on 2008-04.
  9. // Modified by bach on 2009-09-09
  10. // Copyright 2009 gui. All rights reserved.
  11. //
  12. /**
  13. * Implementation of hook_init().
  14. */
  15. function selectList_init() {
  16. // $activated = variable_get('jqplug', array());
  17. //
  18. // $match = false;
  19. // foreach($activated as $plug){
  20. // if(stripos($plug, "selectlist")){
  21. // $match = true;
  22. // break;
  23. // }
  24. // }
  25. //
  26. // if($match){
  27. // drupal_add_css(drupal_get_path('module', 'selectList').'/selectList.css');
  28. //
  29. // drupal_add_js("(function ($) { $('select[multiple], .selectlist').removeAttr('size').selectList();})(jQuery);", array('type'=>'inline', 'scope'=>'header', 'group'=>JS_DEFAULT));
  30. // }
  31. // $curr_uri = preg_replace('/\?.*$/', '', request_uri());
  32. // $curr_uri = preg_replace('/^(fr|en)/', '', ltrim($curr_uri, '/'));
  33. // dsm($curr_uri, '$curr_uri');
  34. // $curr_uri_parts = explode('/', ltrim($curr_uri, '/'));
  35. // dsm($curr_uri_parts, '$curr_uri_parts');
  36. //
  37. // if ($curr_uri_parts[0] == 'admin'
  38. // // || $curr_uri_parts[0] == 'batch'
  39. // // || $curr_uri_parts[0] == 'imce'
  40. // || (isset($curr_uri_parts[1]) && ($curr_uri_parts[1] == 'add'))
  41. // || (isset($curr_uri_parts[2]) && ($curr_uri_parts[2] == 'edit'))
  42. // ){
  43. //
  44. $mod_path = drupal_get_path('module', 'selectList');
  45. drupal_add_css($mod_path.'/selectList.css');
  46. drupal_add_js($mod_path.'/jquery.selectlist.pack.js', array('type'=>'file', 'scope'=>'header', 'group'=>JS_LIBRARY));
  47. drupal_add_js('jQuery(document).ready(function($) { $("select[multiple]:not(.autocomplete-deluxe-form), .selectlist").removeAttr("size").selectList(); });', array('type'=>'inline', 'scope'=>'header', 'group'=>JS_THEME));
  48. // }
  49. }