Embed resources into templates

This commit is contained in:
2019-12-23 23:56:57 +01:00
parent 269bf7eed1
commit 7b5723705c
87 changed files with 12669 additions and 7216 deletions

View File

@@ -4,7 +4,6 @@
<head>
{{template "meta_tags" "Administrator panel"}}
{{template "user_style" .}}
<script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
</head>
<body>
{{$isAdmin := .PixelAPI.UserIsAdmin}}
@@ -24,9 +23,11 @@
<canvas id="bandwidth_chart"></canvas>
</div>
<script src="/res/script/Chart.min.js"></script>
<script src="/res/script/jquery.js"></script>
<script src="/res/misc/chartjs/Chart.min.js"></script>
<script>
var apiEndpoint = '{{.APIEndpoint}}';
Chart.defaults.global.defaultFontColor = "#b3b3b3";
Chart.defaults.global.defaultFontSize = 15;
Chart.defaults.global.defaultFontFamily = "Ubuntu";

View File

@@ -6,19 +6,17 @@
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
{{template "user_style" .}}
<link rel="stylesheet" href="/res/style/viewer.css?v5"/>
<link rel="stylesheet" href="/res/style/layout.css?v5"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
<meta name="theme-color" content="#75AD38"/>
{{.OGData}}
<style>
{{template `viewer.css`}}
{{template `layout.css`}}
</style>
<script type="text/javascript">
var apiEndpoint = '{{.APIEndpoint}}';
var captchaKey = '{{.Other.CaptchaKey}}';
</script>
{{.OGData}}
</head>
<body>
@@ -26,7 +24,7 @@
<div id="file_viewer_headerbar" class="highlight_1 file_viewer_headerbar">
<button id="button_toggle_toolbar" class="button_toggle_toolbar" onClick="Toolbar.toggle();"></button>
<a href="/" id="button_home" class="button button_home">
<img src="/res/img/pixeldrain_transparent.png"
<img src="{{template `pixeldrain_icon.png`}}"
alt="Back to the Home page"
style="height: 1.5em; margin: -0.2em; margin-right: 0.2em;"/>
</a>
@@ -49,19 +47,19 @@
<div id="stat_downloads" style="text-align: center;">N/A</div>
<button id="btnDownload" class="toolbar_button button_full_width" onClick="Toolbar.download();">
<img src="/res/img/floppy_small.png" alt="Download this file"/>
<img src="{{template `floppy_small.png`}}" alt="Download this file"/>
<span>Download</span>
</button>
<button id="btnCopy" class="toolbar_button button_full_width" onClick="Toolbar.copyUrl();">
<img src="/res/img/clipboard_small.png" alt="Copy file URL to clipboard"/>
<img src="{{template `clipboard_small.png`}}" alt="Copy file URL to clipboard"/>
<span><u>C</u>opy Link</span>
</button>
<button id="btnShare" class="toolbar_button button_full_width" onClick="Sharebar.toggle();">
<img src="/res/img/share_small.png" alt="Share this file on social media"/>
<img src="{{template `share_small.png`}}" alt="Share this file on social media"/>
<span>Share</span>
</button>
<button id="btnDetails" class="toolbar_button button_full_width" onClick="DetailsWindow.toggle();">
<img src="/res/img/info_small.png" alt="Help"/>
<img src="{{template `info_small.png`}}" alt="Help"/>
<span>Deta<u>i</u>ls</span>
</button>
{{template "advertisement" .}}
@@ -75,33 +73,34 @@
<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=' + window.location.href);">
<img src="/res/img/social_email.png" alt="Share on E-Mail" style="width:40px; height: 40px;"/>
<img src="{{template `social_email.png`}}" alt="Share on E-Mail" style="width:40px; height: 40px;"/>
<br/>E-Mail
</button>
<button class="sharebar-button button_full_width" onclick="window.open('https://www.reddit.com/submit?url=' + window.location.href);">
<img src="/res/img/social_reddit.png" alt="Share on Reddit" style="width:40px; height: 40px;"/>
<img src="{{template `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?url=' + window.location.href);">
<img src="/res/img/social_twitter.png" alt="Share on Twitter" style="width:40px; height: 40px;"/>
<img src="{{template `social_twitter.png`}}" alt="Share on Twitter" style="width:40px; height: 40px;"/>
<br/>Twitter
</button>
<button class="sharebar-button button_full_width" onClick="window.open('http://www.facebook.com/sharer.php?u=' + window.location.href);">
<img src="/res/img/social_facebook.png" alt="Share on Facebook" style="width:40px; height: 40px;"/>
<img src="{{template `social_facebook.png`}}" alt="Share on Facebook" style="width:40px; height: 40px;"/>
<br/>Facebook
</button>
<button class="sharebar-button button_full_width" onClick="window.open('http://www.tumblr.com/share/link?url=' + window.location.href);">
<img src="/res/img/social_tumblr.png" alt="Share on Tumblr" style="width:40px; height: 40px;"/>
<img src="{{template `social_tumblr.png`}}" alt="Share on Tumblr" style="width:40px; height: 40px;"/>
<br/>Tumblr
</button>
<button class="sharebar-button button_full_width" onClick="window.open('https://voat.co/submit?linkpost=true&url=' + window.location.href);">
<img src="/res/img/social_voat.png" alt="Share on Voat" style="width:40px; height: 40px;"/>
<img src="{{template `social_voat.png`}}" alt="Share on Voat" style="width:40px; height: 40px;"/>
<br/>Voat
</button>
</div>
<div id="filepreview" class="file_viewer_file_preview">
<img src="/res/img/misc/loadthink.gif" style="margin-top: 20%; width: 200px; height: 200px;" />
<!-- <img src="{{template `loadthink.gif`}}" style="margin-top: 20%; width: 200px; height: 200px;" /> -->
<div class="image" style="margin-top: 20%; width: 100px; height: 100px;">{{template "spinner.svg"}}</div>
</div>
</div>
</div>
@@ -162,12 +161,16 @@
<div id="captcha_popup_captcha" style="text-align: center;"></div>
</div>
<script src="/res/misc/chartjs/Chart.min.js"></script>
<script src="/res/script/Chart.min.js"></script>
<script src="/res/script/jquery.js"></script>
<script src="/res/script/Toolbar.js?v7"></script>
<script src="/res/script/Viewer.js?v7"></script>
<script src="/res/script/ListNavigator.js?v7"></script>
<script>
<script type="text/javascript">
var apiEndpoint = '{{.APIEndpoint}}';
var captchaKey = '{{.Other.CaptchaKey}}';
{{template `Toolbar.js`}}
{{template `Viewer.js`}}
{{template `ListNavigator.js`}}
// This info gets filled in on the server side to prevent having to make an API call right after the page loads.
// Just to slice another few milliseconds from the load time :)
window.addEventListener("load", function(){

View File

@@ -4,14 +4,14 @@
{{if ne (isBrave .UserAgent) true}}
Use the Brave web browser for a faster and safer web!<br/>
<a href="https://brave.com/pix009" id="btnBrave" class="button toolbar_button button_full_width button_highlight">
<img src="/res/img/brave_lion.png" alt="Brave lion"/>
<img src="{{template `brave_lion.png`}}" alt="Brave lion"/>
<span>Get Brave</span>
</a>
<br/>
or <a href="https://medium.com/pixeldrain/advertising-on-pixeldrain-a-more-honest-approach-d5e00e3f0c29">learn why pixeldrain supports Brave</a>
{{else}}
Thank you for using Brave! Please consider supporting pixeldrain with a tip
<img src="/res/img/bat_logo_color.png" style="height: 1em; width: 1em;" />
<img src="{{template `bat_logo_color.png`}}" style="height: 1em; width: 1em;" />
{{end}}
</div>
<br/>

View File

@@ -29,7 +29,7 @@
{{if eq $field.Type "textarea"}}
<td colspan="2">
{{$field.Label}}<br/>
<textarea id="input_{{$field.Name}}" name="{{$field.Name}}" class="form_input" style="width: 100%; height: 5em; resize: vertical;">{{$field.DefaultValue}}</textarea>
<textarea id="input_{{$field.Name}}" name="{{$field.Name}}" class="form_input" style="width: 100%; height: 10em; resize: vertical;">{{$field.DefaultValue}}</textarea>
</td>
{{else}}
<td>{{$field.Label}}</td>

View File

@@ -2,7 +2,6 @@
<title>{{.}} ~ PixelDrain</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<link rel="stylesheet" href="/res/style/layout.css?v4" />
<link rel="shortcut icon" href="/res/img/tray32.png" />
<meta name="theme-color" content="#75AD38" />
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png" />

View File

@@ -1,10 +1,6 @@
{{define "user_style"}}
<style>
{{.UserStyle}}
body,
.checkers {
background-image: url("/res/img/{{bgPattern}}");
}
{{template "layout.css"}}
</style>
{{end}}

View File

@@ -5,8 +5,6 @@
{{template "user_style" .}}
<script src="res/script/jquery.js"></script>
<script src="res/script/jquery-cookie.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
</head>
<body>
@@ -23,7 +21,7 @@
<div id="uploadedFiles" class="highlight_dark"></div>
</div></div>
{{template "page_bottom" .}}
<script src="/res/script/history.js"></script>
<script>{{template `history.js`}}</script>
{{template "analytics"}}
</body>
</html>{{end}}

View File

@@ -4,7 +4,6 @@
<head>
{{template "meta_tags" "Free file sharing service"}}
{{template "user_style" .}}
<script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
</head>
<body>
{{template "page_top" .}}
@@ -65,9 +64,12 @@
{{template "page_bottom"}}
<script src="/res/script/jquery-2.1.4.min.js"></script>
<script type="text/javascript">var API_URL = "/api";</script>
<script src="/res/script/compiled/home.js"></script>
<script type="text/javascript">
var apiEndpoint = '{{.APIEndpoint}}';
var API_URL = "/api";
{{template "home.js"}}
</script>
{{template "analytics"}}
</body>
</html>

View File

@@ -4,7 +4,6 @@
<head>
{{template "meta_tags" "Text Upload"}}
{{template "user_style" .}}
<script src="/res/script/jquery-2.1.4.min.js"></script>
<style>
#toolbar {
@@ -46,11 +45,11 @@
<body>
<div id="toolbar">
<button class="toolbar_button button_full_width" onClick="uploadText();">
<img src="/res/img/upload_small.png" alt="Start Upload"/>
<img src="{{template `upload_small.png`}}" alt="Start Upload"/>
<span>Upload</span>
</button>
<a href="/" class="button toolbar_button button_full_width">
<img src="/res/img/pixeldrain_transparent.png" alt="Back to the Home page"/>
<img src="{{template `pixeldrain_icon.png`}}" alt="Back to the Home page"/>
<span>Home</span>
</a>
<br/><br/>
@@ -60,7 +59,10 @@
<div class="textarea_container">
<textarea id="textarea" class="textarea" placeholder="Your text here..." autofocus="autofocus"></textarea>
</div>
<script src="/res/script/compiled/textupload.js"></script>
<script src="/res/script/jquery.js"></script>
<script>{{template "textupload.js"}}</script>
{{template "analytics"}}
</body>
</html>

View File

@@ -2,16 +2,14 @@
<!DOCTYPE html>
<html>
<head>
{{template "meta_tags" "Widget showcase"}}
{{template "meta_tags" "Free file sharing service"}}
{{template "user_style" .}}
<script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
</head>
<body>
{{template "page_top" .}}
<img id="header_image" class="header_image" src="/res/img/header_neuropol.png" alt="Header image"/>
<br/>
<div id="body" class="body">
{{template "menu" .}}
<div class="page_content"><div class="limit_width">
<h1>Widget showcase</h1>
<h2>Size 2 header</h2>
<h3>Size 3 header</h3>
@@ -23,10 +21,6 @@
<div class="highlight_middle">Middle highlight</div>
<div class="highlight_dark">Dark highlight</div>
<br/>
<div class="highlight_light">Light highlight with borders</div>
<div class="highlight_middle">Middle highlight with borders</div>
<div class="highlight_dark ">Dark highlight with borders</div>
<br/>
Link <a href="#">A link to someplace</a>.
<hr/>
Buttons <button>Regular ol' button!</button>
@@ -67,8 +61,8 @@
Color <input type="color" name="favcolor" value="#ff0000">
<br/>
{{template "footer"}}
</div>
</div></div>
{{template "page_bottom"}}
</body>
</html>
{{end}}