Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Stylus adding CSS into LimeSurvey email templates

  • LeshyNL
  • LeshyNL's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 1 month ago #212503 by LeshyNL
After updating to LimeSurvey 3.25.12, I have the weirdest issue. There does not really seem to be a forum most suitable for this – apologies if it should have gone into a different subforum.

I use Firefox and use the browser extension Stylus. This allows you to create a custom stylesheet to apply or override styles on specific webpages. Note that I do not use it for any of our LimeSurvey pages, nor the admin section. However, the CSS from my custom stylesheet is now appearing in the admin notification emails that I receive from LimeSurvey. Yes, that's right - my admin notifications now end in a big chunk of CSS that is not related to LimeSurvey at all.

I believe that this now suddenly occurs due to a recent change in LimeSurvey, as I have noticed the email templates are now a full HTML document, including html, head, and body tags; this was previously not the case. Stylus seems to add its styles to the source of a webpage by adding a style tag after the body element of the page you are viewing, which includes the custom CSS that you have entered. For some reason, it also triggers on the body element in the email template WYSIWYG editor, even when 'Turn all styles off' is checked in the Stylus settings and no stylings should be getting applied anywhere.

Obviously nothing shows up in the email template WYSIWYG editor in LimeSurvey, but as soon as I open the source view, I indeed see
Code:
...email content...
</body>
<style class="stylus" id="stylus-1" type="text/css">
...lots of CSS...
</style>
</html>

At some point, the commenting/uncommenting in the lengthy stylesheet breaks and about half the contents end up being dumped plain-text into the emails. I am now looking at an email for which the template ends in {ANSWERTABLE} and it goes
Code:
...
Please tell us if you think there any relevant aspects that were not covered in this questionnaire, but that you would consider important to communicate to us?     Test
.se-institution svg, .se-member svg, .se-general svg, .se-external svg, .se-press svg, .se-vendor svg .se-member::before { background-image: url("data:image/svg+xml,"); } .se-institution::before { top: 0.375em; left: 0.25em; width: 1.25em; height: 1.25em;} .se-general::before { background-image: url("data:image/svg+xml,"); } .se-vendor::before { background-image: url("data:image/svg+xml,"); background-size: 60%; }
...

I am not even sure whether this is a LimeSurvey or a Stylus issue, but it is absolutely weird. Also pretty inconvenient, as it means I have to use a different browser for LimeSurvey now as even turning off the extension does not prevent this from happening.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 1 month ago #212507 by holch
This is defeninitely a Stylus problem, as it is Stylus that is injecting code into things it shouldn't inject to. I don't know the Stylus extension and thus I don't know how it works. But an extension like this should have an option to exclude websites from this.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: LeshyNL
The topic has been locked.
  • LeshyNL
  • LeshyNL's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 1 month ago #212513 by LeshyNL
Yes, I figured as much. I thought I would share at any rate, just in case anyone else ever ran into the same - or similar - issue.

Essentially, if some external plugin does something to the body tag of the document, it may now also be doing this to the email templates in LimeSurvey with unintended consequences.

I did now find there was a typo in the domain list that the custom stylesheet should apply to, which meant that Stylus was indeed incorrectly attempting to apply the styles to the LimeSurvey admin page (and therefore also the email templates). Oddly, it was still doing this despite the 'Turn off all styles' setting having been turned on - but that is indeed not a LimeSurvey issue.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose