Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function initPopovers() {
const popoverElements = document.querySelectorAll("[data-toggle=\"popover\"]");
for (let i = 0; i < popoverElements.length; ++i) {
if (!popoverElements[i].Popover) {
// eslint-disable-next-line no-new
new Popover(popoverElements[i]);
}
}
}
ws.onclose = function() {
document.querySelector('#editor-connection-status').style.visibility = 'visible';
link.removeAllListeners('data');
};
};
// Load gist in editor
//
// on click of 'Load GitHub Gist' button, show modal asking for gist url or id
var Gister = require('./gister');
var g = new Gister();
var loadGistButton = document.querySelector('#load-gist');
var createGistButton = document.querySelector('#create-gist');
loadGistButton.addEventListener('click', g.loadGistModal.bind(g));
createGistButton.addEventListener('click', g.createGistModal.bind(g));
new bsn.Popover(createGistButton, {trigger: 'click'}); //handle 'create' not implemented yet
// Listen for gist instance to emit file events that we then put in the editor
g.on('file', function(file) {
cm.setValue(file);
});
// Buttons to scale editor font size up and down
var scaleFactor = 1.2;
var fontBigger = document.querySelector('.size-control.bigger');
fontBigger.addEventListener('click', function() {
scaleFontSize(cm.getWrapperElement(), scaleFactor);
cm.refresh();
cm.focus();
});
var fontSmaller = document.querySelector('.size-control.smaller');
Array.from(this.el.querySelectorAll('[data-title]')).forEach(el => {
new bootstrap.Popover(el, {
'trigger': _converse.view_mode === 'mobile' && 'click' || 'hover',
'dismissible': _converse.view_mode === 'mobile' && true || false,
'container': this.el.parentElement.parentElement.parentElement
})
});
},