mirror of https://github.com/xwiki-labs/cryptpad
flag potentially risky DOM queries
This commit is contained in:
parent
1a18eafb7f
commit
448eac2360
|
@ -814,7 +814,7 @@ define([
|
|||
return;
|
||||
}
|
||||
$div.find('.cp-support-list-ticket').hide();
|
||||
$div.find('.cp-support-list-ticket[data-cat="'+key+'"]').show();
|
||||
$div.find('.cp-support-list-ticket[data-cat="'+key+'"]').show(); // XXX
|
||||
}, true);
|
||||
$drop.setValue('all');
|
||||
|
||||
|
@ -927,7 +927,7 @@ define([
|
|||
var cols = [$col1, $col2, $col3, $col4];
|
||||
[orderPremium, orderNormal, orderAnswered, orderClosed].forEach(function (list, j) {
|
||||
list.forEach(function (id, i) {
|
||||
var $t = $div.find('[data-id="'+id+'"]');
|
||||
var $t = $div.find('[data-id="'+id+'"]'); // XXX
|
||||
var d = getTicketData(id);
|
||||
$t.css('order', i).appendTo(cols[j]);
|
||||
updateTicketDetails($t, d.premium);
|
||||
|
@ -943,7 +943,7 @@ define([
|
|||
var reorder = Util.throttle(_reorder, 150);
|
||||
|
||||
var to = Util.throttle(function () {
|
||||
var $ticket = $div.find('.cp-support-list-ticket[data-id="'+linkedId+'"]');
|
||||
var $ticket = $div.find('.cp-support-list-ticket[data-id="'+linkedId+'"]'); // XXX
|
||||
$ticket.addClass('cp-support-open');
|
||||
$ticket[0].scrollIntoView();
|
||||
linkedId = undefined;
|
||||
|
@ -962,8 +962,8 @@ define([
|
|||
var msg = data.content.msg;
|
||||
var hash = data.content.hash;
|
||||
var content = msg.content;
|
||||
var id = content.id;
|
||||
var $ticket = $div.find('.cp-support-list-ticket[data-id="'+id+'"]');
|
||||
var id = content.id.replace(/"/g, '\\"');
|
||||
var $ticket = $div.find('.cp-support-list-ticket[data-id="'+id+'"]'); // XXX
|
||||
|
||||
hashesById[id] = hashesById[id] || [];
|
||||
if (hashesById[id].indexOf(hash) === -1) {
|
||||
|
@ -1288,7 +1288,7 @@ define([
|
|||
|
||||
// Remove a textarea
|
||||
var removeLang = function (l) {
|
||||
$container.find('.cp-broadcast-lang[data-lang="'+l+'"]').remove();
|
||||
$container.find('.cp-broadcast-lang[data-lang="'+l+'"]').remove(); // XXX
|
||||
|
||||
var hasDefault = $container.find('.cp-broadcast-lang .cp-checkmark input:checked').length;
|
||||
if (!hasDefault) {
|
||||
|
@ -1320,7 +1320,7 @@ define([
|
|||
|
||||
// Add a textarea
|
||||
var addLang = function (l) {
|
||||
if ($container.find('.cp-broadcast-lang[data-lang="'+l+'"]').length) { return; }
|
||||
if ($container.find('.cp-broadcast-lang[data-lang="'+l+'"]').length) { return; } // XXX
|
||||
var preview = h('button.btn.btn-secondary', Messages.broadcast_preview);
|
||||
$(preview).click(function () {
|
||||
onPreview(l);
|
||||
|
|
|
@ -636,7 +636,7 @@ define([
|
|||
if (teamId === 0) { return; }
|
||||
data.hidden = !data.hidden;
|
||||
if (APP.$calendars) {
|
||||
APP.$calendars.find('[data-uid="'+id+'"]').toggleClass('cp-active', !data.hidden);
|
||||
APP.$calendars.find('[data-uid="'+id+'"]').toggleClass('cp-active', !data.hidden); // XXX
|
||||
} else {
|
||||
$(calendar).toggleClass('cp-active', !data.hidden);
|
||||
}
|
||||
|
@ -1043,7 +1043,7 @@ define([
|
|||
var unitValue = (unit === "minutes") ? 1 : (unit === "hours" ? 60 : (60*24));
|
||||
var del = h('button.btn.btn-danger-outline.small.fa.fa-times');
|
||||
var minutes = value * unitValue;
|
||||
if ($list.find('[data-minutes="'+minutes+'"]').length) { return; }
|
||||
if ($list.find('[data-minutes="'+minutes+'"]').length) { return; } // XXX
|
||||
var span = h('span.cp-notif-entry', {
|
||||
'data-minutes': minutes
|
||||
}, [
|
||||
|
|
|
@ -204,7 +204,7 @@ define([
|
|||
var name = $(inputFilter).val().trim().replace(/"/g, '').toLowerCase();
|
||||
$div.find('.cp-usergrid-user').show();
|
||||
if (name) {
|
||||
$div.find('.cp-usergrid-user:not(.cp-selected):not([data-name*="'+name+'"])').hide();
|
||||
$div.find('.cp-usergrid-user:not(.cp-selected):not([data-name*="'+name+'"])').hide(); // XXX
|
||||
}
|
||||
};
|
||||
$(inputFilter).on('keydown keyup change', redraw);
|
||||
|
@ -1521,7 +1521,7 @@ define([
|
|||
$innerblock.show();
|
||||
$innerblock.find('.cp-dropdown-element-active').removeClass('cp-dropdown-element-active');
|
||||
if (config.isSelect && value) {
|
||||
var $val = $innerblock.find('[data-value="'+value+'"]');
|
||||
var $val = $innerblock.find('[data-value="'+value+'"]'); // XXX
|
||||
setActive($val);
|
||||
try {
|
||||
$innerblock.scrollTop($val.position().top + $innerblock.scrollTop());
|
||||
|
@ -1608,7 +1608,7 @@ define([
|
|||
window.clearTimeout(to);
|
||||
var c = String.fromCharCode(e.which);
|
||||
pressed += c;
|
||||
var $value = $innerblock.find('[data-value^="'+pressed+'"]:first');
|
||||
var $value = $innerblock.find('[data-value^="'+pressed+'"]:first'); // XXX
|
||||
if ($value.length) {
|
||||
setActive($value);
|
||||
$innerblock.scrollTop($value.position().top + $innerblock.scrollTop());
|
||||
|
@ -1620,7 +1620,7 @@ define([
|
|||
|
||||
$container.setValue = function (val, name, sync) {
|
||||
value = val;
|
||||
var $val = $innerblock.find('[data-value="'+val+'"]');
|
||||
var $val = $innerblock.find('[data-value="'+val+'"]'); // XXX
|
||||
var textValue = name || $val.text() || val;
|
||||
var f = function () {
|
||||
$button.find('.cp-dropdown-button-title').text(textValue);
|
||||
|
@ -2407,7 +2407,7 @@ define([
|
|||
teamValue = $(this).attr('data-id');
|
||||
});
|
||||
if (privateData.storeInTeam) {
|
||||
$team.find('[data-id="'+privateData.storeInTeam+'"]').addClass('cp-selected');
|
||||
$team.find('[data-id="'+privateData.storeInTeam+'"]').addClass('cp-selected'); // XXX
|
||||
teamValue = privateData.storeInTeam;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ define([
|
|||
editor.setOption('mode', mode);
|
||||
}
|
||||
if (exp.$language) {
|
||||
var name = exp.$language.find('a[data-value="' + mode + '"]').text() || undefined;
|
||||
var name = exp.$language.find('a[data-value="' + mode + '"]').text() || undefined; // XXX
|
||||
name = name ? Messages.languageButton + ' ('+name+')' : Messages.languageButton;
|
||||
exp.$language.setValue(mode, name);
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ define([
|
|||
var $head = $(window.document.head);
|
||||
|
||||
var themeLoaded = exp.themeLoaded = function (theme) {
|
||||
return $head.find('link[href*="'+theme+'"]').length;
|
||||
return $head.find('link[href*="'+theme+'"]').length; // XXX
|
||||
};
|
||||
|
||||
var loadTheme = exp.loadTheme = function (theme) {
|
||||
|
|
|
@ -120,7 +120,7 @@ define([
|
|||
if (queue.inProgress) { return; }
|
||||
queue.inProgress = true;
|
||||
|
||||
var $row = $table.find('tr[id="'+id+'"]');
|
||||
var $row = $table.find('tr[id="'+id+'"]'); // XXX
|
||||
|
||||
$row.find('.cp-fileupload-table-cancel').addClass('success').html('').append(h('span.fa.fa-minus'));
|
||||
var $pv = $row.find('.cp-fileupload-table-progress-value');
|
||||
|
@ -627,7 +627,7 @@ define([
|
|||
queue.inProgress = true;
|
||||
var id = file.id;
|
||||
|
||||
var $row = $table.find('tr[id="'+id+'"]');
|
||||
var $row = $table.find('tr[id="'+id+'"]'); // XXX
|
||||
var $pv = $row.find('.cp-fileupload-table-progress-value');
|
||||
var $pb = $row.find('.cp-fileupload-table-progressbar');
|
||||
var $link = $row.find('.cp-fileupload-table-link');
|
||||
|
|
|
@ -1894,7 +1894,7 @@ define([
|
|||
setValue: function (val) {
|
||||
this.reset();
|
||||
Object.keys(val || {}).forEach(function (uid) {
|
||||
$(tag).find('[name="'+uid+'"]').each(function (i, el) {
|
||||
$(tag).find('[name="'+uid+'"]').each(function (i, el) { // XXX
|
||||
if ($(el).data('val') !== val[uid]) { return; }
|
||||
$(el).prop('checked', true);
|
||||
});
|
||||
|
@ -2174,7 +2174,7 @@ define([
|
|||
this.reset();
|
||||
Object.keys(val || {}).forEach(function (uid) {
|
||||
if (!Array.isArray(val[uid])) { return; }
|
||||
$(tag).find('[data-uid="'+uid+'"] input').each(function (i, el) {
|
||||
$(tag).find('[data-uid="'+uid+'"] input').each(function (i, el) { // XXX
|
||||
if (val[uid].indexOf($(el).data('val')) === -1) { return; }
|
||||
$(el).prop('checked', true);
|
||||
});
|
||||
|
@ -3598,7 +3598,7 @@ define([
|
|||
new: true
|
||||
}, function () {
|
||||
removeQuestion(content, uid);
|
||||
$('.cp-form-block[data-id="'+uid+'"]').remove();
|
||||
$('.cp-form-block[data-id="'+uid+'"]').remove(); // XXX
|
||||
framework.localChange();
|
||||
updateAddInline();
|
||||
});
|
||||
|
@ -3804,9 +3804,9 @@ define([
|
|||
getSections(content).forEach(function (uid) {
|
||||
var block = content.form[uid];
|
||||
if (!block.opts || !Array.isArray(block.opts.questions)) { return; }
|
||||
var $block = $container.find('.cp-form-block[data-id="'+uid+'"] .cp-form-section-sortable');
|
||||
var $block = $container.find('.cp-form-block[data-id="'+uid+'"] .cp-form-section-sortable'); // XXX
|
||||
block.opts.questions.forEach(function (_uid) {
|
||||
$container.find('.cp-form-block[data-id="'+_uid+'"]').appendTo($block);
|
||||
$container.find('.cp-form-block[data-id="'+_uid+'"]').appendTo($block); // XXX
|
||||
});
|
||||
});
|
||||
updateAddInline();
|
||||
|
@ -3819,14 +3819,14 @@ define([
|
|||
if (!temp) { return true; }
|
||||
var block = content.form[uid];
|
||||
if (!block.opts || !Array.isArray(block.opts.questions)) { return; }
|
||||
var $block = $container.find('.cp-form-block[data-id="'+uid+'"] .cp-form-section-sortable');
|
||||
var $block = $container.find('.cp-form-block[data-id="'+uid+'"] .cp-form-section-sortable'); // XXX
|
||||
|
||||
if (temp && temp[uid]) {
|
||||
var tmp = temp[uid];
|
||||
var u = tmp.uid;
|
||||
var t = tmp.type;
|
||||
var $c = $block.closest('.cp-form-block').find('.cp-form-condition[data-uid="'+u+'"]');
|
||||
var $b = $c.find('[data-drop="'+t+'"]').find('button');
|
||||
var $c = $block.closest('.cp-form-block').find('.cp-form-condition[data-uid="'+u+'"]'); // XXX
|
||||
var $b = $c.find('[data-drop="'+t+'"]').find('button'); // XXX
|
||||
var pos = $b && $b.length && $b[0].getBoundingClientRect().y;
|
||||
// If we know the old position of the button and the new one, we can fix the scroll
|
||||
// accordingly
|
||||
|
@ -3849,8 +3849,8 @@ define([
|
|||
if (opts.type !== "time") { return; }
|
||||
var tmp = temp[uid];
|
||||
if (!tmp || !tmp.cursor || !tmp.cursor.flatpickr) { return; }
|
||||
var $block = $container.find('.cp-form-block[data-id="'+uid+'"]');
|
||||
var $i = $block.find('.flatpickr-input[value="'+tmp.cursor.val+'"]');
|
||||
var $block = $container.find('.cp-form-block[data-id="'+uid+'"]'); // XXX
|
||||
var $i = $block.find('.flatpickr-input[value="'+tmp.cursor.val+'"]'); // XXX
|
||||
if (!$i.length) { return; }
|
||||
APP.afterScroll = function () {
|
||||
$i[0]._flatpickr.open();
|
||||
|
@ -3899,7 +3899,7 @@ define([
|
|||
}
|
||||
var show = checkCondition(block);
|
||||
block.opts.questions.forEach(function (_uid) {
|
||||
$container.find('.cp-form-block[data-id="'+_uid+'"]').toggle(show);
|
||||
$container.find('.cp-form-block[data-id="'+_uid+'"]').toggle(show); // XXX
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1118,12 +1118,12 @@ define([
|
|||
try {
|
||||
var id = kanban.inEditMode;
|
||||
var newBoard;
|
||||
var $el = $container.find('[data-id="'+id+'"]');
|
||||
var $el = $container.find('[data-id="'+id+'"]'); // XXX
|
||||
if (id === "new") {
|
||||
$el = $container.find('.kanban-item.new-item');
|
||||
newBoard = $el.closest('.kanban-board').attr('data-id');
|
||||
} else if (!$el.length) {
|
||||
$el = $container.find('[data-eid="'+id+'"]');
|
||||
$el = $container.find('[data-eid="'+id+'"]'); // XXX
|
||||
}
|
||||
var isTop = $el && $el.hasClass('item-top');
|
||||
if (!$el.length) { return; }
|
||||
|
@ -1171,9 +1171,9 @@ define([
|
|||
}
|
||||
|
||||
// Edit a board title or a card title
|
||||
var $el = $container.find('.kanban-board[data-id="'+id+'"]');
|
||||
var $el = $container.find('.kanban-board[data-id="'+id+'"]'); // XXX
|
||||
if (!$el.length) {
|
||||
$el = $container.find('.kanban-item[data-eid="'+id+'"]');
|
||||
$el = $container.find('.kanban-item[data-eid="'+id+'"]'); // XXX
|
||||
}
|
||||
if (!$el.length) { return; }
|
||||
|
||||
|
@ -1306,7 +1306,7 @@ define([
|
|||
|
||||
// Add new cursor
|
||||
var avatar = getAvatar(cursor);
|
||||
var $item = $('.kanban-item[data-eid="'+cursor.item+'"]');
|
||||
var $item = $('.kanban-item[data-eid="'+cursor.item+'"]'); // XXX
|
||||
if ($item.length) {
|
||||
remoteCursors[id] = cursor;
|
||||
$item.find('.cp-kanban-cursors').append(avatar);
|
||||
|
|
|
@ -486,7 +486,7 @@
|
|||
self.options.boards.items = self.options.boards.items || {};
|
||||
self.options.boards.items[element.id] = element;
|
||||
|
||||
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag');
|
||||
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag'); // XXX
|
||||
board.appendChild(getElementNode(element));
|
||||
// send event that board has changed
|
||||
self.onChange();
|
||||
|
@ -494,7 +494,7 @@
|
|||
};
|
||||
|
||||
this.addForm = function (boardID, formItem) {
|
||||
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag');
|
||||
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag'); // XXX
|
||||
board.appendChild(formItem);
|
||||
return self;
|
||||
};
|
||||
|
@ -650,7 +650,7 @@
|
|||
// Remove all boards
|
||||
for (var i in this.options.boards.list) {
|
||||
var boardkey = this.options.boards.list[i];
|
||||
scroll[boardkey] = $('.kanban-board[data-id="'+boardkey+'"] .kanban-drag').scrollTop();
|
||||
scroll[boardkey] = $('.kanban-board[data-id="'+boardkey+'"] .kanban-drag').scrollTop(); // XXX
|
||||
this.removeBoard(boardkey);
|
||||
}
|
||||
this.options.boards = boards;
|
||||
|
@ -660,18 +660,18 @@
|
|||
// Preserve scroll
|
||||
this.options.boards.list.forEach(function (id) {
|
||||
if (!scroll[id]) { return; }
|
||||
$('.kanban-board[data-id="'+id+'"] .kanban-drag').scrollTop(scroll[id]);
|
||||
$('.kanban-board[data-id="'+id+'"] .kanban-drag').scrollTop(scroll[id]); // XXX
|
||||
});
|
||||
$el.scrollLeft(scrollLeft);
|
||||
}
|
||||
|
||||
this.findBoard = function (id) {
|
||||
var el = self.element.querySelector('[data-id="' + id + '"]');
|
||||
var el = self.element.querySelector('[data-id="' + id + '"]'); // XXX
|
||||
return el;
|
||||
}
|
||||
|
||||
this.findElement = function (id) {
|
||||
var el = self.element.querySelector('[data-eid="' + id + '"]');
|
||||
var el = self.element.querySelector('[data-eid="' + id + '"]'); // XXX
|
||||
return el;
|
||||
}
|
||||
|
||||
|
@ -681,13 +681,13 @@
|
|||
}
|
||||
|
||||
this.getBoardElements = function (id) {
|
||||
var board = self.element.querySelector('[data-id="' + id + '"] .kanban-drag');
|
||||
var board = self.element.querySelector('[data-id="' + id + '"] .kanban-drag'); // XXX
|
||||
return (board.childNodes);
|
||||
}
|
||||
|
||||
this.removeElement = function (el) {
|
||||
if (typeof (el) === 'string')
|
||||
el = self.element.querySelector('[data-eid="' + el + '"]');
|
||||
el = self.element.querySelector('[data-eid="' + el + '"]'); // XXX
|
||||
el.remove();
|
||||
|
||||
// send event that board has changed
|
||||
|
@ -700,7 +700,7 @@
|
|||
var id;
|
||||
if (typeof (board) === 'string' || typeof (board) === "number") {
|
||||
id = board;
|
||||
board = self.element.querySelector('[data-id="' + board + '"]');
|
||||
board = self.element.querySelector('[data-id="' + board + '"]'); // XXX
|
||||
} else if (board) {
|
||||
id = board.id;
|
||||
}
|
||||
|
@ -712,7 +712,7 @@
|
|||
}
|
||||
|
||||
// Remove duplicates
|
||||
if (id) { $(self.element).find('.kanban-board[data-id="' + board + '"]').remove(); }
|
||||
if (id) { $(self.element).find('.kanban-board[data-id="' + board + '"]').remove(); } // XXX
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -609,7 +609,7 @@ define([
|
|||
self.options.boards.items = self.options.boards.items || {};
|
||||
self.options.boards.items[element.id] = element;
|
||||
|
||||
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag');
|
||||
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag'); // XXX
|
||||
if (before) {
|
||||
board.insertBefore(getElementNode(element), board.firstChild);
|
||||
} else {
|
||||
|
@ -621,7 +621,7 @@ define([
|
|||
};
|
||||
|
||||
this.addForm = function (boardID, formItem, isTop) {
|
||||
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag');
|
||||
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag'); // XXX
|
||||
if (isTop) {
|
||||
board.insertBefore(formItem, board.firstChild);
|
||||
} else {
|
||||
|
@ -805,7 +805,7 @@ define([
|
|||
// Remove all boards
|
||||
for (var i in list) {
|
||||
var boardkey = list[i];
|
||||
scroll[boardkey] = $('.kanban-board[data-id="'+boardkey+'"] .kanban-drag').scrollTop();
|
||||
scroll[boardkey] = $('.kanban-board[data-id="'+boardkey+'"] .kanban-drag').scrollTop(); // XXX
|
||||
self.removeBoard(boardkey);
|
||||
}
|
||||
|
||||
|
@ -815,7 +815,7 @@ define([
|
|||
// Preserve scroll
|
||||
self.options._boards.list.forEach(function (id) {
|
||||
if (!scroll[id]) { return; }
|
||||
$('.kanban-board[data-id="'+id+'"] .kanban-drag').scrollTop(scroll[id]);
|
||||
$('.kanban-board[data-id="'+id+'"] .kanban-drag').scrollTop(scroll[id]); // XXX
|
||||
});
|
||||
$el.scrollLeft(scrollLeft);
|
||||
};
|
||||
|
@ -868,7 +868,7 @@ define([
|
|||
var id;
|
||||
if (typeof (board) === 'string' || typeof (board) === "number") {
|
||||
id = board;
|
||||
board = self.element.querySelector('[data-id="' + board + '"]');
|
||||
board = self.element.querySelector('[data-id="' + board + '"]'); // XXX
|
||||
} else if (board) {
|
||||
id = board.id;
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ define([
|
|||
}
|
||||
|
||||
// Remove duplicates
|
||||
if (id) { $(self.element).find('.kanban-board[data-id="' + board + '"]').remove(); }
|
||||
if (id) { $(self.element).find('.kanban-board[data-id="' + board + '"]').remove(); } // XXX
|
||||
|
||||
return self;
|
||||
};
|
||||
|
|
|
@ -536,7 +536,7 @@ define([
|
|||
if (!obj || !Array.isArray(obj.m)) { return; }
|
||||
|
||||
// Get the value of the commented text
|
||||
var res = Env.$inner.find('comment[data-uid="' + key + '"]').toArray();
|
||||
var res = Env.$inner.find('comment[data-uid="' + key + '"]').toArray(); // XXX
|
||||
var value = res.map(function(el) {
|
||||
return el.innerText;
|
||||
}).join('\n');
|
||||
|
@ -584,8 +584,8 @@ define([
|
|||
var focusContent = function() {
|
||||
// Add class "active"
|
||||
Env.$inner.find('comment.active').removeClass('active');
|
||||
Env.$inner.find('comment[data-uid="' + key + '"]').addClass('active');
|
||||
var $last = Env.$inner.find('comment[data-uid="' + key + '"]').last();
|
||||
Env.$inner.find('comment[data-uid="' + key + '"]').addClass('active'); // XXX
|
||||
var $last = Env.$inner.find('comment[data-uid="' + key + '"]').last(); // XXX
|
||||
|
||||
// Scroll into view
|
||||
if (!$last.length) { return; }
|
||||
|
@ -659,7 +659,7 @@ define([
|
|||
|
||||
if (Env.mobile && Env.current) {
|
||||
Env.$container.find('.cp-comment-container[data-uid]').hide();
|
||||
Env.$container.find('.cp-comment-container[data-uid="' + Env.current + '"]').show();
|
||||
Env.$container.find('.cp-comment-container[data-uid="' + Env.current + '"]').show(); // XXX
|
||||
}
|
||||
|
||||
Env.$container.show();
|
||||
|
@ -965,10 +965,10 @@ define([
|
|||
Env.current = uid;
|
||||
Env.$container.find('.cp-comment-container[data-uid]').hide();
|
||||
setTimeout(function () {
|
||||
Env.$container.find('.cp-comment-container[data-uid="' + uid + '"]').show().click();
|
||||
Env.$container.find('.cp-comment-container[data-uid="' + uid + '"]').show().click(); // XXX
|
||||
});
|
||||
} else {
|
||||
Env.$container.find('.cp-comment-container[data-uid="' + uid + '"]').click();
|
||||
Env.$container.find('.cp-comment-container[data-uid="' + uid + '"]').click(); // XXX
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ define([
|
|||
var blob = Util.find(el, ['_mediaObject','_blob', 'content']);
|
||||
if (!blob) { return; }
|
||||
Util.blobToImage(blob, waitFor(function (imgSrc) {
|
||||
$clone.find('media-tag[src="' + $(el).attr('src') + '"] img')
|
||||
$clone.find('media-tag[src="' + $(el).attr('src') + '"] img') // XXX
|
||||
.attr('src', imgSrc);
|
||||
$clone.find('media-tag').parent()
|
||||
.find('.cke_widget_drag_handler_container').remove();
|
||||
|
|
|
@ -191,32 +191,32 @@ define([
|
|||
|
||||
var enableColumn = APP.enableColumn = function (id, table) {
|
||||
table = table || $('body');
|
||||
var $input = $(table).find('input[disabled="disabled"][data-rt-id^="' + id + '"]')
|
||||
var $input = $(table).find('input[disabled="disabled"][data-rt-id^="' + id + '"]') // XXX
|
||||
.removeAttr('disabled');
|
||||
$input.closest('td').addClass('cp-app-poll-table-editing');
|
||||
$(table).find('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').addClass('fa-unlock')
|
||||
$(table).find('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').addClass('fa-unlock') // XXX
|
||||
.removeClass('fa-lock').attr('title', Messages.poll_unlocked);
|
||||
};
|
||||
var disableColumn = function (id) {
|
||||
var $input = $('input[data-rt-id^="' + id + '"]')
|
||||
var $input = $('input[data-rt-id^="' + id + '"]') // XXX
|
||||
.attr('disabled', 'disabled');
|
||||
$input.closest('td').removeClass('cp-app-poll-table-editing');
|
||||
$('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').addClass('fa-lock')
|
||||
$('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').addClass('fa-lock') // XXX
|
||||
.removeClass('fa-unlock').attr('title', Messages.poll_locked);
|
||||
};
|
||||
var enableRow = APP.enableRow = function (id, table) {
|
||||
table = table || $('body');
|
||||
var $input = $(table).find('input[disabled="disabled"][data-rt-id="' + id + '"]')
|
||||
var $input = $(table).find('input[disabled="disabled"][data-rt-id="' + id + '"]') // XXX
|
||||
.removeAttr('disabled');
|
||||
$input.closest('td').addClass('cp-app-poll-table-editing');
|
||||
$(table).find('span.cp-app-poll-table-edit[data-rt-id="' + id + '"]')
|
||||
$(table).find('span.cp-app-poll-table-edit[data-rt-id="' + id + '"]') // XXX
|
||||
.css('visibility', 'hidden');
|
||||
};
|
||||
var disableRow = function (id) {
|
||||
var $input = $('input[type="text"][data-rt-id="' + id + '"]')
|
||||
var $input = $('input[type="text"][data-rt-id="' + id + '"]') // XXX
|
||||
.attr('disabled', 'disabled');
|
||||
$input.closest('td').removeClass('cp-app-poll-table-editing');
|
||||
$('span.cp-app-poll-table-edit[data-rt-id="' + id + '"]').css('visibility', 'visible');
|
||||
$('span.cp-app-poll-table-edit[data-rt-id="' + id + '"]').css('visibility', 'visible'); // XXX
|
||||
};
|
||||
|
||||
var unlockElements = function () {
|
||||
|
@ -249,11 +249,11 @@ define([
|
|||
var updateTableButtons = function () {
|
||||
var uncomColId = APP.uncommitted.content.colsOrder[0];
|
||||
var uncomRowId = APP.uncommitted.content.rowsOrder[0];
|
||||
var $createOption = $('tbody input[data-rt-id="' + uncomRowId+'"]')
|
||||
var $createOption = $('tbody input[data-rt-id="' + uncomRowId+'"]') // XXX
|
||||
.closest('td').find('> div');
|
||||
$createOption.find('#cp-app-poll-create-option').remove();
|
||||
$createOption.append(APP.$createRow);
|
||||
var $createUser = $('thead input[data-rt-id="' + uncomColId + '"]')
|
||||
var $createUser = $('thead input[data-rt-id="' + uncomColId + '"]') // XXX
|
||||
.closest('td');
|
||||
$createUser.find('#cp-app-poll-create-user').remove();
|
||||
$createUser.prepend(APP.$createCol);
|
||||
|
@ -323,8 +323,8 @@ define([
|
|||
var setFocus = function (obj) {
|
||||
var el;
|
||||
if (document.body.contains(obj.el)) { el = obj.el; }
|
||||
else if($('input[data-rt-id="' + obj.id + '"]').length) {
|
||||
el = $('input[data-rt-id="' + obj.id + '"]')[0];
|
||||
else if($('input[data-rt-id="' + obj.id + '"]').length) { // XXX
|
||||
el = $('input[data-rt-id="' + obj.id + '"]')[0]; // XXX
|
||||
}
|
||||
else { return; }
|
||||
el.focus();
|
||||
|
@ -346,11 +346,11 @@ define([
|
|||
// Fix autocomplete bug:
|
||||
displayedObj.content.rowsOrder.forEach(function (rowId) {
|
||||
if (f.id === rowId) { return; }
|
||||
$('input[data-rt-id="' + rowId +'"]').val(displayedObj.content.rows[rowId] || '');
|
||||
$('input[data-rt-id="' + rowId +'"]').val(displayedObj.content.rows[rowId] || ''); // XXX
|
||||
});
|
||||
displayedObj.content.colsOrder.forEach(function (colId) {
|
||||
if (f.id === colId) { return; }
|
||||
$('input[data-rt-id="' + colId +'"]')
|
||||
$('input[data-rt-id="' + colId +'"]') // XXX
|
||||
.val(displayedObj.content.cols[colId] || '');
|
||||
});
|
||||
updateDisplayedTable();
|
||||
|
@ -469,7 +469,7 @@ define([
|
|||
});
|
||||
} else if (isEdit) {
|
||||
unlockRow(id, function () {
|
||||
$('input[data-rt-id="' + id + '"]').focus();
|
||||
$('input[data-rt-id="' + id + '"]').focus(); // XXX
|
||||
});
|
||||
}
|
||||
} else if (type === 'col') {
|
||||
|
@ -485,7 +485,7 @@ define([
|
|||
handleBookmark(id);
|
||||
} else if (isLock && isLocked) {
|
||||
unlockColumn(id, function () {
|
||||
$('input[data-rt-id="' + id + '"]').focus();
|
||||
$('input[data-rt-id="' + id + '"]').focus(); // XXX
|
||||
});
|
||||
} else if (isLock) {
|
||||
lockColumn(id);
|
||||
|
@ -914,7 +914,7 @@ define([
|
|||
mergeUncommitted(proxy, uncommittedCopy, true);
|
||||
change(null, null, null, null, function() {
|
||||
var newId = APP.uncommitted.content.rowsOrder[0];
|
||||
$('input[data-rt-id="' + newId + '"]').focus();
|
||||
$('input[data-rt-id="' + newId + '"]').focus(); // XXX
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -463,12 +463,12 @@ var Renderer = function (APP) {
|
|||
|
||||
// Enable input for the userid column
|
||||
APP.enableColumn(userid, table);
|
||||
$(table).find('input[disabled="disabled"][data-rt-id^="' + userid + '"]')
|
||||
$(table).find('input[disabled="disabled"][data-rt-id^="' + userid + '"]') // XXX
|
||||
.attr('placeholder', Messages.poll_userPlaceholder);
|
||||
$(table).find('.cp-app-poll-table-lock[data-rt-id="' + userid + '"]').remove();
|
||||
$(table).find('[data-rt-id^="' + userid + '"]').closest('td')
|
||||
$(table).find('.cp-app-poll-table-lock[data-rt-id="' + userid + '"]').remove(); // XXX
|
||||
$(table).find('[data-rt-id^="' + userid + '"]').closest('td') // XXX
|
||||
.addClass("cp-app-poll-table-own");
|
||||
$(table).find('.cp-app-poll-table-bookmark[data-rt-id="' + userid + '"]')
|
||||
$(table).find('.cp-app-poll-table-bookmark[data-rt-id="' + userid + '"]') // XXX
|
||||
.css('visibility', '')
|
||||
.addClass('cp-app-poll-table-bookmark-full')
|
||||
.attr('title', Messages.poll_bookmarked_col);
|
||||
|
@ -477,22 +477,22 @@ var Renderer = function (APP) {
|
|||
APP.uncommitted.content.colsOrder.forEach(function(id) {
|
||||
// Enable the checkboxes for the uncommitted column
|
||||
APP.enableColumn(id, table);
|
||||
$(table).find('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').remove();
|
||||
$(table).find('.cp-app-poll-table-remove[data-rt-id="' + id + '"]').remove();
|
||||
$(table).find('.cp-app-poll-table-bookmark[data-rt-id="' + id + '"]').remove();
|
||||
$(table).find('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').remove(); // XXX
|
||||
$(table).find('.cp-app-poll-table-remove[data-rt-id="' + id + '"]').remove(); // XXX
|
||||
$(table).find('.cp-app-poll-table-bookmark[data-rt-id="' + id + '"]').remove(); // XXX
|
||||
|
||||
$(table).find('td.cp-app-poll-table-uncommitted .cover')
|
||||
.addClass("cp-app-poll-table-uncommitted");
|
||||
var $uncommittedCol = $(table).find('[data-rt-id^="' + id + '"]').closest('td');
|
||||
var $uncommittedCol = $(table).find('[data-rt-id^="' + id + '"]').closest('td'); // XXX
|
||||
$uncommittedCol.addClass("cp-app-poll-table-uncommitted");
|
||||
});
|
||||
APP.uncommitted.content.rowsOrder.forEach(function(id) {
|
||||
// Enable the checkboxes for the uncommitted column
|
||||
APP.enableRow(id, table);
|
||||
$(table).find('.cp-app-poll-table-edit[data-rt-id="' + id + '"]').remove();
|
||||
$(table).find('.cp-app-poll-table-remove[data-rt-id="' + id + '"]').remove();
|
||||
$(table).find('.cp-app-poll-table-edit[data-rt-id="' + id + '"]').remove(); // XXX
|
||||
$(table).find('.cp-app-poll-table-remove[data-rt-id="' + id + '"]').remove(); // XXX
|
||||
|
||||
$(table).find('[data-rt-id="' + id + '"]').closest('tr')
|
||||
$(table).find('[data-rt-id="' + id + '"]').closest('tr') // XXX
|
||||
.addClass("cp-app-poll-table-uncommitted");
|
||||
});
|
||||
};
|
||||
|
@ -503,10 +503,10 @@ var Renderer = function (APP) {
|
|||
var updateTableButtons = function (table) {
|
||||
var uncomColId = APP.uncommitted.content.colsOrder[0];
|
||||
var uncomRowId = APP.uncommitted.content.rowsOrder[0];
|
||||
var $createOption = $(table).find('tbody input[data-rt-id="' + uncomRowId+'"]')
|
||||
var $createOption = $(table).find('tbody input[data-rt-id="' + uncomRowId+'"]') // XXX
|
||||
.closest('td').find('> div');
|
||||
$createOption.append(APP.$createRow);
|
||||
var $createUser = $(table).find('thead input[data-rt-id="' + uncomColId + '"]')
|
||||
var $createUser = $(table).find('thead input[data-rt-id="' + uncomColId + '"]') // XXX`
|
||||
.closest('td');
|
||||
$createUser.prepend(APP.$createCol);
|
||||
|
||||
|
@ -534,7 +534,7 @@ var Renderer = function (APP) {
|
|||
}
|
||||
APP.count[rId] = count;
|
||||
var h = $tr.height() || 28;
|
||||
$(table).find('[data-rt-count-id="' + rId + '"]')
|
||||
$(table).find('[data-rt-count-id="' + rId + '"]') // XXX
|
||||
.text(count)
|
||||
.css({
|
||||
'height': h+'px',
|
||||
|
@ -542,9 +542,9 @@ var Renderer = function (APP) {
|
|||
});
|
||||
});
|
||||
winner.ids.forEach(function (rId) {
|
||||
$(table).find('[data-rt-id="' + rId + '"]').closest('td')
|
||||
$(table).find('[data-rt-id="' + rId + '"]').closest('td') // XXX
|
||||
.addClass('cp-app-poll-table-winner');
|
||||
$(table).find('[data-rt-count-id="' + rId + '"]')
|
||||
$(table).find('[data-rt-count-id="' + rId + '"]') // XXX
|
||||
.addClass('cp-app-poll-table-winner');
|
||||
});
|
||||
};
|
||||
|
|
|
@ -145,16 +145,16 @@ define([
|
|||
$block.append(button);
|
||||
var save = h('button.btn.btn-primary', Messages.settings_save);
|
||||
var text = h('input');
|
||||
var code = h('div.cp-app-profile-link-code', [
|
||||
var code = h('div.cp-app-profile-link-code', [ // XXX
|
||||
text,
|
||||
save
|
||||
]);
|
||||
var div = h('div.cp-app-profile-link-edit', [
|
||||
var div = h('div.cp-app-profile-link-edit', [ // XXX
|
||||
code
|
||||
]);
|
||||
$block.append(div);
|
||||
$(button).click(function () {
|
||||
$(text).val(APP.$link.attr('href'));
|
||||
$(text).val(APP.$link.attr('href')); // XXX
|
||||
$(code).css('display', 'flex');
|
||||
APP.editor.refresh();
|
||||
$(button).hide();
|
||||
|
|
|
@ -107,7 +107,7 @@ define([
|
|||
var hash = data.content.hash;
|
||||
var content = msg.content;
|
||||
var id = content.id;
|
||||
var $ticket = $div.find('.cp-support-list-ticket[data-id="'+id+'"]');
|
||||
var $ticket = $div.find('.cp-support-list-ticket[data-id="'+id+'"]'); // XXX
|
||||
|
||||
hashesById[id] = hashesById[id] || [];
|
||||
if (hashesById[id].indexOf(hash) === -1) {
|
||||
|
|
|
@ -275,7 +275,7 @@ define([
|
|||
var metadataMgr = common.getMetadataMgr();
|
||||
var privateData = metadataMgr.getPrivateData();
|
||||
|
||||
var ticketTitle = content.title + ' (#' + content.id + ')';
|
||||
var ticketTitle = content.title + ' (#' + content.id + ')'; // XXX id is not validated in any way
|
||||
var ticketCategory;
|
||||
var answer = h('button.btn.btn-primary.cp-support-answer', Messages.support_answer);
|
||||
var close = h('button.btn.btn-danger.cp-support-close', Messages.support_close);
|
||||
|
|
Loading…
Reference in New Issue