You are here

README.txt in Code per Node 6

Same filename and directory in other branches
  1. 7 README.txt
Code-per-Node
-------------
This module allows arbitrary amounts of CSS or JS to be added to nodes and
blocks.


Features
------------------------------------------------------------------------------
The primary features include:

* CSS and JS may be added to any node, with an optional wrapper to make the code
  simpler.

* CSS and JS may be added to any block, with an optional wrapper to make the
  code simpler.

* Control over whether the CSS and JS output is aggregated with other files.

* Optional global CSS and JS that will be loaded on all non-admin pages.

* Syntax highlighting for both CSS and JS using the CodeMirror library.

* Optional support for Libraries API to control the location of the CodeMirror
  library.


Installation
------------------------------------------------------------------------------
The module should be installed and enabled in the usual way.

If needed, the CodeMirror library (v2.1 or a newer v2.x release) should be
downloaded from http://codemirror.net/, extracted and placed in:
  sites/all/libraries/codemirror


Configuration
------------------------------------------------------------------------------
 1. On the User Permissions administration page ("Administer >> Users
    >> Permissions") you need to assign:

    - The "edit CSS per node" permission to the roles that are allowed to add
      custom CSS for individual nodes.

    - The "edit JS per node" permission to the roles that are allowed to add
      custom JavaScript for individual nodes.

    - The "edit CSS per block" permission to the roles that are allowed to add
      custom CSS for individual blocks.

    - The "edit JS per block" permission to the roles that are allowed to add
      custom JavaScript for individual blocks.

 2. The main admininistrative page controls the site-wide settings, including
    the location of the custom files, whether aggregation is enabled, customize
    the code wrappers, and global CSS & JS:
      admin/settings/cpn

 3. Each content type can have the CSS & JS enabled on their respective edit
    page, along with custom code that will be loaded on each node page of that
    type.

 4. Each node add & edit page, belonging to the content type(s) enabled in step
    3 above, will have a new section called "CSS & JavaScript" containing the
    fields for entering the code.


SECURITY WARNING
------------------------------------------------------------------------------
BE VERY CAREFUL with the user roles that are granted access to insert custom CSS
and JS, THERE IS NO SECURITY FILTERING APPLIED to the code so only grant access
to it to people who are trusted.


Troubleshooting / Tips
------------------------------------------------------------------------------
* The CSS and JS will be automatically loaded on the appropriate pages, however
  nothing is added to make the CSS or JS only affect the elements of that node
  or block, so the code should be handled accordingly.
* The CSS and JS wrapper options can be used to simplify the code that is
  necessary for each node or block, e.g. the following would allow all JS code
  to be written to just use the simpler $() syntax for JS selection:
    (function ($) {
    [code]
    })(jQuery);
* The global CSS/JS options are meant for temporary adhoc changes, they are not
  a replacement for properly built code added to the site's theme.


Credits / Contact
------------------------------------------------------------------------------
Originally build by joelstein [1], Rob Loach [2] contributed on the D7 port.

Currently maintained by Damien McKenna [3].

Continued development is sponsored by Mediacurrent [4].

The best way to contact the authors is to submit an issue, be it a support
request, a feature request or a bug report, in the project issue queue:
  http://drupal.org/project/issues/metatag


References
------------------------------------------------------------------------------
1: http://drupal.org/user/61114
2: http://drupal.org/user/36598
3: http://drupal.org/user/108450
4: http://www.mediacurrent.com/

File

README.txt
View source
  1. Code-per-Node
  2. -------------
  3. This module allows arbitrary amounts of CSS or JS to be added to nodes and
  4. blocks.
  5. Features
  6. ------------------------------------------------------------------------------
  7. The primary features include:
  8. * CSS and JS may be added to any node, with an optional wrapper to make the code
  9. simpler.
  10. * CSS and JS may be added to any block, with an optional wrapper to make the
  11. code simpler.
  12. * Control over whether the CSS and JS output is aggregated with other files.
  13. * Optional global CSS and JS that will be loaded on all non-admin pages.
  14. * Syntax highlighting for both CSS and JS using the CodeMirror library.
  15. * Optional support for Libraries API to control the location of the CodeMirror
  16. library.
  17. Installation
  18. ------------------------------------------------------------------------------
  19. The module should be installed and enabled in the usual way.
  20. If needed, the CodeMirror library (v2.1 or a newer v2.x release) should be
  21. downloaded from http://codemirror.net/, extracted and placed in:
  22. sites/all/libraries/codemirror
  23. Configuration
  24. ------------------------------------------------------------------------------
  25. 1. On the User Permissions administration page ("Administer >> Users
  26. >> Permissions") you need to assign:
  27. - The "edit CSS per node" permission to the roles that are allowed to add
  28. custom CSS for individual nodes.
  29. - The "edit JS per node" permission to the roles that are allowed to add
  30. custom JavaScript for individual nodes.
  31. - The "edit CSS per block" permission to the roles that are allowed to add
  32. custom CSS for individual blocks.
  33. - The "edit JS per block" permission to the roles that are allowed to add
  34. custom JavaScript for individual blocks.
  35. 2. The main admininistrative page controls the site-wide settings, including
  36. the location of the custom files, whether aggregation is enabled, customize
  37. the code wrappers, and global CSS & JS:
  38. admin/settings/cpn
  39. 3. Each content type can have the CSS & JS enabled on their respective edit
  40. page, along with custom code that will be loaded on each node page of that
  41. type.
  42. 4. Each node add & edit page, belonging to the content type(s) enabled in step
  43. 3 above, will have a new section called "CSS & JavaScript" containing the
  44. fields for entering the code.
  45. SECURITY WARNING
  46. ------------------------------------------------------------------------------
  47. BE VERY CAREFUL with the user roles that are granted access to insert custom CSS
  48. and JS, THERE IS NO SECURITY FILTERING APPLIED to the code so only grant access
  49. to it to people who are trusted.
  50. Troubleshooting / Tips
  51. ------------------------------------------------------------------------------
  52. * The CSS and JS will be automatically loaded on the appropriate pages, however
  53. nothing is added to make the CSS or JS only affect the elements of that node
  54. or block, so the code should be handled accordingly.
  55. * The CSS and JS wrapper options can be used to simplify the code that is
  56. necessary for each node or block, e.g. the following would allow all JS code
  57. to be written to just use the simpler $() syntax for JS selection:
  58. (function ($) {
  59. [code]
  60. })(jQuery);
  61. * The global CSS/JS options are meant for temporary adhoc changes, they are not
  62. a replacement for properly built code added to the site's theme.
  63. Credits / Contact
  64. ------------------------------------------------------------------------------
  65. Originally build by joelstein [1], Rob Loach [2] contributed on the D7 port.
  66. Currently maintained by Damien McKenna [3].
  67. Continued development is sponsored by Mediacurrent [4].
  68. The best way to contact the authors is to submit an issue, be it a support
  69. request, a feature request or a bug report, in the project issue queue:
  70. http://drupal.org/project/issues/metatag
  71. References
  72. ------------------------------------------------------------------------------
  73. 1: http://drupal.org/user/61114
  74. 2: http://drupal.org/user/36598
  75. 3: http://drupal.org/user/108450
  76. 4: http://www.mediacurrent.com/