Manually instantiate jscolor to avoid csp errors

Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/11535/head
Julius Härtl 8 years ago
parent 1034efd640
commit 4f19466108
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
  1. 4
      apps/theming/js/settings-admin.js
  2. 2
      apps/theming/templates/settings-admin.php

@ -106,6 +106,10 @@ function hideUndoButton(setting, value) {
$(document).ready(function () {
$('#theming [data-toggle="tooltip"]').tooltip();
// manually instantiate jscolor to work around new Function call which violates strict CSP
var colorElement = $('#theming-color')[0];
var jscolor = new window.jscolor(colorElement, {hash: true});
$('#theming .theme-undo').each(function() {
var setting = $(this).data('setting');
var value = $('#theming-'+setting).val();

@ -62,7 +62,7 @@ style('theming', 'settings-admin');
<div>
<label>
<span><?php p($l->t('Color')) ?></span>
<input id="theming-color" type="text" class="jscolor" data-jscolor="{hash:true}" maxlength="7" value="<?php p($_['color']) ?>" />
<input id="theming-color" type="text" maxlength="7" value="<?php p($_['color']) ?>" />
<div data-setting="color" data-toggle="tooltip" data-original-title="<?php p($l->t('Reset to default')); ?>" class="theme-undo icon icon-history"></div>
</label>
</div>

Loading…
Cancel
Save