Styling fixes

This commit is contained in:
2019-08-10 19:50:20 +02:00
parent cba6372c19
commit 7accbdef4e
4 changed files with 11 additions and 13 deletions

View File

@@ -118,7 +118,7 @@ var Sharebar = {
if (navigator.share) {
navigator.share({
title: Viewer.title,
text: "Get this file from Pixeldrain!",
text: "Download " + Viewer.title + " here",
url: window.location.href
});
return;

View File

@@ -152,11 +152,14 @@ body{
width: 100%;
padding: 5px 5px 5px 20px;
box-sizing: border-box;
overflow-y: scroll;
overflow-x: hidden;
}
.pre-container{
.text-container > pre {
white-space: pre-wrap;
word-wrap: break-word;
overflow: hidden;
}
.pannable{

View File

@@ -72,7 +72,7 @@
<div id="sharebar" class="file_viewer_sharebar">
Share on:<br/>
<button class="sharebar-button button_full_width" onClick="window.open('mailto:please@set.address?subject=File%20on%20PixelDrain&body=You%20can%20view%20it%20here%20' + window.location.href);">
<button class="sharebar-button button_full_width" onClick="window.open('mailto:please@set.address?subject=File%20on%20PixelDrain&body=' + window.location.href);">
<img src="/res/img/social_email.png" alt="Share on E-Mail" style="width:40px; height: 40px;"/>
<br/>E-Mail
</button>
@@ -80,7 +80,7 @@
<img src="/res/img/social_reddit.png" alt="Share on Reddit" style="width:40px; height: 40px;"/>
<br/>Reddit
</button>
<button class="sharebar-button button_full_width" onClick="window.open('https://twitter.com/share?text=Check%20out%20this%20file%20on%20%23Pixeldrain&url=' + window.location.href);">
<button class="sharebar-button button_full_width" onClick="window.open('https://twitter.com/share?url=' + window.location.href);">
<img src="/res/img/social_twitter.png" alt="Share on Twitter" style="width:40px; height: 40px;"/>
<br/>Twitter
</button>

View File

@@ -144,7 +144,7 @@ func (f filePreview) text() string {
<pre class="pre-container %s" style="width: 100%%;">%s</pre>
</div>`
if f.FileInfo.Size > 1e6 { // Prevent out of memory errors
if f.FileInfo.Size > 1<<22 { // 4 MiB limit to prevent out of memory errors
return fmt.Sprintf(htmlOut, "",
"File is too large to view online.\nPlease download and view it locally.",
)
@@ -176,14 +176,9 @@ func (f filePreview) text() string {
)
}
result = html.EscapeString(result)
htmlOut += `<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=desert"></script>`
var prettyPrint string
if f.FileInfo.MimeType != "text/plain" {
prettyPrint = "prettyprint linenums"
htmlOut += `<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=desert"></script>`
}
return fmt.Sprintf(htmlOut, prettyPrint, result)
return fmt.Sprintf(htmlOut, "prettyprint linenums", html.EscapeString(result))
}
func (f filePreview) markdown() string {