2017-03-13 17:48:32 -04:00
|
|
|
import $ from 'jquery';
|
2017-03-01 17:01:33 -05:00
|
|
|
|
2017-03-01 18:02:01 -05:00
|
|
|
// bootstrap jQuery plugins
|
2018-04-18 16:52:58 -04:00
|
|
|
import 'bootstrap';
|
2017-03-13 17:48:32 -04:00
|
|
|
|
|
|
|
// custom jQuery functions
|
|
|
|
$.fn.extend({
|
2018-10-24 15:17:03 -04:00
|
|
|
disable() {
|
|
|
|
return $(this)
|
|
|
|
.prop('disabled', true)
|
|
|
|
.addClass('disabled');
|
|
|
|
},
|
|
|
|
enable() {
|
|
|
|
return $(this)
|
|
|
|
.prop('disabled', false)
|
|
|
|
.removeClass('disabled');
|
|
|
|
},
|
2017-03-13 17:48:32 -04:00
|
|
|
});
|
2019-03-11 05:40:41 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
Starting with bootstrap 4.3.1, bootstrap sanitizes html used for tooltips / popovers.
|
|
|
|
This extends the default whitelists with more elements / attributes:
|
|
|
|
https://getbootstrap.com/docs/4.3/getting-started/javascript/#sanitizer
|
|
|
|
*/
|
|
|
|
const whitelist = $.fn.tooltip.Constructor.Default.whiteList;
|
|
|
|
|
|
|
|
const inputAttributes = ['value', 'type'];
|
|
|
|
|
|
|
|
const dataAttributes = [
|
|
|
|
'data-toggle',
|
|
|
|
'data-placement',
|
|
|
|
'data-container',
|
|
|
|
'data-title',
|
|
|
|
'data-class',
|
|
|
|
'data-clipboard-text',
|
|
|
|
'data-placement',
|
|
|
|
];
|
|
|
|
|
|
|
|
// Whitelisting data attributes
|
|
|
|
whitelist['*'] = [
|
|
|
|
...whitelist['*'],
|
|
|
|
...dataAttributes,
|
|
|
|
'title',
|
|
|
|
'width height',
|
|
|
|
'abbr',
|
|
|
|
'datetime',
|
|
|
|
'name',
|
|
|
|
'width',
|
|
|
|
'height',
|
|
|
|
];
|
|
|
|
|
|
|
|
// Whitelist missing elements:
|
|
|
|
whitelist.label = ['for'];
|
|
|
|
whitelist.button = [...inputAttributes];
|
|
|
|
whitelist.input = [...inputAttributes];
|
|
|
|
|
|
|
|
whitelist.tt = [];
|
|
|
|
whitelist.samp = [];
|
|
|
|
whitelist.kbd = [];
|
|
|
|
whitelist.var = [];
|
|
|
|
whitelist.dfn = [];
|
|
|
|
whitelist.cite = [];
|
|
|
|
whitelist.big = [];
|
|
|
|
whitelist.address = [];
|
|
|
|
whitelist.dl = [];
|
|
|
|
whitelist.dt = [];
|
|
|
|
whitelist.dd = [];
|
|
|
|
whitelist.abbr = [];
|
|
|
|
whitelist.acronym = [];
|
|
|
|
whitelist.blockquote = [];
|
|
|
|
whitelist.del = [];
|
|
|
|
whitelist.ins = [];
|
2020-05-21 17:08:31 -04:00
|
|
|
whitelist['gl-emoji'] = [
|
|
|
|
'data-name',
|
|
|
|
'data-unicode-version',
|
|
|
|
'data-fallback-src',
|
|
|
|
'data-fallback-sprite-class',
|
|
|
|
];
|
2019-03-11 05:40:41 -04:00
|
|
|
|
|
|
|
// Whitelisting SVG tags and attributes
|
|
|
|
whitelist.svg = ['viewBox'];
|
|
|
|
whitelist.use = ['xlink:href'];
|
|
|
|
whitelist.path = ['d'];
|