lint: Clean up the code in pad.html

This commit is contained in:
Richard Hansen 2021-08-13 22:42:30 -04:00
parent c1ea2ddccc
commit 283c04aca9

View file

@ -455,51 +455,49 @@
<!-- Bootstrap page --> <!-- Bootstrap page -->
<script type="text/javascript"> <script type="text/javascript">
// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt // @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt
var clientVars = { (() => {
'use strict';
window.clientVars = {
// This is needed to fetch /pluginfw/plugin-definitions.json, which happens before the // This is needed to fetch /pluginfw/plugin-definitions.json, which happens before the
// server sends the CLIENT_VARS message. // server sends the CLIENT_VARS message.
randomVersionString: <%-JSON.stringify(settings.randomVersionString)%>, randomVersionString: <%-JSON.stringify(settings.randomVersionString)%>,
}; };
(function () { const pathComponents = location.pathname.split('/');
var pathComponents = location.pathname.split('/');
// Strip 'p' and the padname from the pathname and set as baseURL // Strip 'p' and the padname from the pathname and set as baseURL
var baseURL = pathComponents.slice(0,pathComponents.length-2).join('/') + '/'; const baseURL = `${pathComponents.slice(0, pathComponents.length - 2).join('/')}/`;
require.setRootURI(baseURL + "javascripts/src"); require.setRootURI(`${baseURL}javascripts/src`);
require.setLibraryURI(baseURL + "javascripts/lib"); require.setLibraryURI(`${baseURL}javascripts/lib`);
require.setGlobalKeyPath("require"); require.setGlobalKeyPath('require');
$ = jQuery = require('ep_etherpad-lite/static/js/rjquery').jQuery; // Expose jQuery #HACK // Expose jQuery #HACK
browser = require('ep_etherpad-lite/static/js/vendors/browser'); window.$ = window.jQuery = require('ep_etherpad-lite/static/js/rjquery').jQuery;
window.browser = require('ep_etherpad-lite/static/js/vendors/browser');
var plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins'); const plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins');
var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks'); const hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
plugins.baseURL = baseURL; plugins.baseURL = baseURL;
plugins.update(function () { plugins.update(() => {
// Mechanism for tests to register hook functions (install fake plugins). // Mechanism for tests to register hook functions (install fake plugins).
window._postPluginUpdateForTestingDone = false; window._postPluginUpdateForTestingDone = false;
if (window._postPluginUpdateForTesting != null) window._postPluginUpdateForTesting(); if (window._postPluginUpdateForTesting != null) window._postPluginUpdateForTesting();
window._postPluginUpdateForTestingDone = true; window._postPluginUpdateForTestingDone = true;
// Call documentReady hook $(() => hooks.aCallAll('documentReady'));
$(function() { const pad = require('ep_etherpad-lite/static/js/pad');
hooks.aCallAll('documentReady');
});
var pad = require('ep_etherpad-lite/static/js/pad');
pad.baseURL = baseURL; pad.baseURL = baseURL;
pad.init(); pad.init();
}); });
/* TODO: These globals shouldn't exist. */ // TODO: These globals shouldn't exist.
pad = require('ep_etherpad-lite/static/js/pad').pad; window.pad = require('ep_etherpad-lite/static/js/pad').pad;
chat = require('ep_etherpad-lite/static/js/chat').chat; window.chat = require('ep_etherpad-lite/static/js/chat').chat;
padeditbar = require('ep_etherpad-lite/static/js/pad_editbar').padeditbar; window.padeditbar = require('ep_etherpad-lite/static/js/pad_editbar').padeditbar;
padimpexp = require('ep_etherpad-lite/static/js/pad_impexp').padimpexp; window.padimpexp = require('ep_etherpad-lite/static/js/pad_impexp').padimpexp;
require('ep_etherpad-lite/static/js/skin_variants');
}()); require('ep_etherpad-lite/static/js/skin_variants');
})();
// @license-end // @license-end
</script> </script>
<div style="display:none"><a href="/javascript" data-jslicense="1">JavaScript license information</a></div> <div style="display:none"><a href="/javascript" data-jslicense="1">JavaScript license information</a></div>