mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
Minifying can be disabled for debugging now
This commit is contained in:
parent
f871602754
commit
83829759e9
3 changed files with 25 additions and 3 deletions
|
@ -231,9 +231,17 @@ exports.padJS = function(req, res)
|
||||||
//minifying is disabled, so load the files with jquery
|
//minifying is disabled, so load the files with jquery
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
res.write("function loadjsfile(filename){\n"+
|
||||||
|
"var fileref=document.createElement('script');\n"+
|
||||||
|
"fileref.setAttribute('type','text/javascript');\n"+
|
||||||
|
"var path = 'static/js/' + filename;\n"+
|
||||||
|
"fileref.setAttribute('src', path);\n" +
|
||||||
|
"document.getElementsByTagName('head')[0].appendChild(fileref);\n" +
|
||||||
|
"}\n");
|
||||||
|
|
||||||
for(var i in jsFiles)
|
for(var i in jsFiles)
|
||||||
{
|
{
|
||||||
res.write("$.getScript('/static/js/" + jsFiles[i]+ "');\n");
|
res.write("loadjsfile('"+ jsFiles[i] + "');\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
res.end();
|
res.end();
|
||||||
|
|
|
@ -81,6 +81,20 @@ async.waterfall([
|
||||||
res.sendfile(filePath, { maxAge: exports.maxAge });
|
res.sendfile(filePath, { maxAge: exports.maxAge });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//if minified is disabled, we need to server the static files under /p/static too
|
||||||
|
//it looks like dynamic script loading works only for subfolders, thats the reason we're doing this
|
||||||
|
if(settings.minify == false)
|
||||||
|
{
|
||||||
|
//serve static files
|
||||||
|
app.get('/p/static/*', function(req, res)
|
||||||
|
{
|
||||||
|
res.header("Server", serverName);
|
||||||
|
var filePath = path.normalize(__dirname + "/.." + req.url.split("?")[0].replace("p/",""));
|
||||||
|
console.error(filePath);
|
||||||
|
res.sendfile(filePath, { maxAge: exports.maxAge });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//serve minified files
|
//serve minified files
|
||||||
app.get('/minified/:id', function(req, res)
|
app.get('/minified/:id', function(req, res)
|
||||||
{
|
{
|
||||||
|
@ -149,7 +163,7 @@ async.waterfall([
|
||||||
|
|
||||||
//serve pad.html under /p
|
//serve pad.html under /p
|
||||||
app.get('/p/:pad', function(req, res, next)
|
app.get('/p/:pad', function(req, res, next)
|
||||||
{
|
{
|
||||||
//ensure the padname is valid and the url doesn't end with a /
|
//ensure the padname is valid and the url doesn't end with a /
|
||||||
if(!isValidPadname(req.params.pad) || /\/$/.test(req.url))
|
if(!isValidPadname(req.params.pad) || /\/$/.test(req.url))
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,7 +125,7 @@ We removed this feature cause its not worth the space it needs in the editbar
|
||||||
<li>
|
<li>
|
||||||
<a id="timesliderlink" title="Show the history of this pad">
|
<a id="timesliderlink" title="Show the history of this pad">
|
||||||
<script>
|
<script>
|
||||||
$("#timesliderlink").attr("href", document.location+ '/timeslider');
|
document.getElementById('timesliderlink').href = document.location+ '/timeslider';
|
||||||
</script>
|
</script>
|
||||||
<img src="../static/img/editbar_timeslider.gif" width="16" height="16" />
|
<img src="../static/img/editbar_timeslider.gif" width="16" height="16" />
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue