Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Legacy Sheet Sanitization

From Roll20 Wiki

(Redirected from Legacy Sanitisation)
Jump to: navigation, search


Legacy Sheet Sanitization ( or LCS, Legacy Character Sheets) refers to the older and more restricted framework/method used for creating custom character sheets that was the only mode for sheets until March 2021 when CSE was revealed.


Considering the Community Sheet Repository consists of +850 character sheets, which have been created between 2015 & 2021, a majority of them will likely remain Legacy Sheets for a good while, so looking at existing sheets. Most or all sheet examples on the wiki are made for Legacy Sheets, unless otherwise stated.

Character Sheet Enhancement(CSE) is the new sheet creation method released March 2021, with new features and less restrictions than Legacy Sheets. Legacy Sheets are not compatible with CSE straight away, and need to be adjusted first. Check the CSE page for more info.

Contents


Using a Legacy Sheet

If you copy the source code of a Legacy sheet and save it either using the Sheet Editor, you need to check the box for "legacy sanitation", otherwise the editor assumes you have CSE-compatible code.

Check the box if you want to use (older) legacy code.

Using the Sheet Sandbox, you need to add a sheet.json-file that includes the "legacy":true line. See more on Sheet_Sandbox#Sheet.json_Editor


Legacy Sheet Restrictions

See Also BCS/Bugs for newly reported issues & bugs.

HTML:

In the Roll20, the character sheet code is basically wrapped inside a giant <form> tag(so don't use it).

  • Id attributes cannot be used. (Any ID attributes on one character's sheet would affect another character's sheet in the same campaign when opened)
  • Any DOM functionalities can't be used
  • Do not use Root HTML elements such as <html> <head>, <title>, or <body> which are used to in your HTML. Doing so will prevent your character sheet from loading in the virtual tabletop.
  • HTML Elements that doesn't work: <section>, <header>, <footer>, <a>, <meter>, <progress>, <datalist>, <details>, <summary>. Trying to add any of these to a sheet will either result in Roll20 removing them or behave like they are a <div>.
  • Attribute names are case-insensitive when checked for uniqueness. All <input>, <select>, <textarea> etc. should have unique attribute names if intended to be independent. Two inputs with same attr name will mirror each other and update if the other one is changed.
  • To create a section where you can dynamically add new entries, the Repeating Sections method is used through the <fieldset> element.
  • <input>(inputs) and <button>(Button) elements are restricted to a limited number of types. This is likely true with other elements.
  • All CSS classes referenced in the HTML that don't start with attr_, repeating_, roll_ or sheet-, will be prefixed with sheet- automatically when rendered in Roll20. The sheet- prefix is only required on the CSS file, except for roll templates which needs them in the html.
  • All images will be passed through the Roll20 image proxy to prevent security attacks. This should be largely transparent to you and shouldn't affect anything, but it's something to be aware of.
  • <svg>-tag isn't supported directly, but there are ways to use .svg files, Example
  • All attributes in Roll Templates need to be written with double quotes, as single quotes results in roll template code being completely ignored.
  • You can't refer to external CSS stylesheets, everything need to be on the CSS file


CSS:

  • In the CSS file, all general classes should have a start with a sheet- prefix for Roll20 to read them.
  • Media queries can't currently be utilized
  • Do not use .sheet-new-window as a CSS class name, as Roll20 already uses it and will block you from trying to override it. Forum thread
  • Roll20 have some predefined CSS classes for it's custom row/column system and other default, so very generic class names like: .sheet-row, .sheet-col, 3colrow, 2colrow and .sheet-character is best to be avoided.
  • Repeating Sections Restrictions
  • Default Fonts: The following fonts can be accessed by default: Arial, Patrick Hand, Contrail One, Shadows Into Light and Candal
  • Google Fonts: can be used with the @import-function [Note: If you use @import with Google’s own generated URL, you may see the following error: Potential CSS security violation; character sheet template styling thrown out. To work around this issue, change css2?family to css?family in the URL (i.e., remove the “2”).]
  • You can't refer to external CSS stylesheets, everying need to be on the CSS file


JavaScript: (Main Article: Sheetworkers)

Many JavaScript functions or functionalities can't be used within Roll20, and everything and one should check existing sheet for user-cases, if you're attempting to do any slightly more advanced data-handling.

Only Use Classes, not IDs

You should not use IDs on your tags (for example, DO NOT do <input type='text' id='name' />). Since there are multiple copies of each sheet in the DOM at once, using an ID is incorrect since IDs should only be used on unique elements.

This does mean that you cannot utilize ID-linked <label> elements (eg, <label for="my_id">My Label Text</label>). You can place elements inside the label to link them together (eg, <label>Label Text <input ... /></label>), although that can come at the expense of some flexibility in your CSS.


Migrating from LCS to CSE

Tips from Scott C. - link(Forum)

Here's my simple(ish) guide to converting to CSE:

  • swap legacy flag to false (in the sheet.json
  • If your CSS classes in HTML don't have the sheet- prefix on them, remove them from your css file, except for anything that impacts Roll Templates)
  • Add .ui-dialog .tab-content .charsheet to the start of ALL your CSS that impacts the character sheet itself. This will ensure that your styling overrides the Roll20 default styling while still operating from the same "base" specificity level.
  • If you had any styling that affected both the Roll Templates and the sheet, make sure to do both of the above

That should resolve 99% of the issues.

Related Pages