mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
sec: Fixed unsafe jquery plugin
This commit is contained in:
parent
852f282b03
commit
1e91efc16c
1 changed files with 5 additions and 4 deletions
9
src/static/js/vendors/farbtastic.ts
vendored
9
src/static/js/vendors/farbtastic.ts
vendored
|
@ -35,7 +35,7 @@ $._farbtastic = function (container, options) {
|
||||||
fb.linkTo = function (callback) {
|
fb.linkTo = function (callback) {
|
||||||
// Unbind previous nodes
|
// Unbind previous nodes
|
||||||
if (typeof fb.callback == 'object') {
|
if (typeof fb.callback == 'object') {
|
||||||
$(fb.callback).off('keyup').on('keyup', fb.updateValue);
|
$(document.body).find(fb.callback).off('keyup').on('keyup', fb.updateValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset color
|
// Reset color
|
||||||
|
@ -46,7 +46,7 @@ $._farbtastic = function (container, options) {
|
||||||
fb.callback = callback;
|
fb.callback = callback;
|
||||||
}
|
}
|
||||||
else if (typeof callback == 'object' || typeof callback == 'string') {
|
else if (typeof callback == 'object' || typeof callback == 'string') {
|
||||||
fb.callback = $(callback);
|
fb.callback = $(document.body).find(callback);
|
||||||
fb.callback.on('keyup', fb.updateValue);
|
fb.callback.on('keyup', fb.updateValue);
|
||||||
if (fb.callback[0].value) {
|
if (fb.callback[0].value) {
|
||||||
fb.setColor(fb.callback[0].value);
|
fb.setColor(fb.callback[0].value);
|
||||||
|
@ -357,13 +357,14 @@ $._farbtastic = function (container, options) {
|
||||||
// Linked elements or callback
|
// Linked elements or callback
|
||||||
if (typeof fb.callback == 'object') {
|
if (typeof fb.callback == 'object') {
|
||||||
// Set background/foreground color
|
// Set background/foreground color
|
||||||
$(fb.callback).css({
|
$(document.body).find(fb.callback).css({
|
||||||
backgroundColor: fb.color,
|
backgroundColor: fb.color,
|
||||||
color: fb.invert ? '#fff' : '#000'
|
color: fb.invert ? '#fff' : '#000'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Change linked value
|
// Change linked value
|
||||||
$(fb.callback).each(function() {
|
$(document.body).find(fb.callback).each(function() {
|
||||||
if ((typeof this.value == 'string') && this.value != fb.color) {
|
if ((typeof this.value == 'string') && this.value != fb.color) {
|
||||||
this.value = fb.color;
|
this.value = fb.color;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue