avoid pad_utils in pad.html

allow-global-etherpadHooks
webzwo0i 2021-02-17 23:16:23 +01:00 committed by John McLear
parent 9675a584ce
commit a77994ab6e
1 changed files with 7 additions and 8 deletions

View File

@ -444,20 +444,19 @@
<script type="text/javascript" src="../static/js/require-kernel.js?v=<%=settings.randomVersionString%>"></script> <script type="text/javascript" src="../static/js/require-kernel.js?v=<%=settings.randomVersionString%>"></script>
<!-- Include pad_utils manually -->
<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/pad_utils.js?callback=require.define&v=<%=settings.randomVersionString%>"></script>
<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
(function() { (function() {
// Display errors on page load to the user // Display errors on page load to the user
// (Gets overridden by padutils.setupGlobalExceptionHandler) // (Gets overridden by padutils.setupGlobalExceptionHandler)
var originalHandler = window.onerror; const originalHandler = window.onerror;
window.onerror = function(msg, url, line) { window.onerror = function(msg, url, line) {
var box = document.getElementById('editorloadingbox'); const box = document.getElementById('editorloadingbox');
box.innerHTML = '<p><b>An error occurred while loading the pad</b></p>' const cleanMessage = msg.replace(/[^0-9a-zA-Z=\.?&:\/]+/,'');
+ '<p><b>'+msg+'</b> ' const cleanSource = url.replace(/[^0-9a-zA-Z=\.?&:\/]+/,'');
+ '<small>in '+ padutils.escapeHTML(url) +' (line '+ line +')</small></p>'; const cleanLine = parseInt(line);
box.innerText = `An error occurred while loading the pad\n${cleanMessage} in
${cleanSource} at line ${cleanLine}`
// call original error handler // call original error handler
if(typeof(originalHandler) == 'function') originalHandler.call(null, arguments); if(typeof(originalHandler) == 'function') originalHandler.call(null, arguments);
}; };