Tweak right-click modal

This commit is contained in:
Noah Petherbridge 2023-11-27 21:53:02 -08:00
parent 8130ce4845
commit f23a787d32
4 changed files with 65 additions and 35 deletions

View File

@ -133,6 +133,7 @@ var baseTemplates = []string{
config.TemplatePath + "/base.html", config.TemplatePath + "/base.html",
config.TemplatePath + "/partials/user_avatar.html", config.TemplatePath + "/partials/user_avatar.html",
config.TemplatePath + "/partials/like_modal.html", config.TemplatePath + "/partials/like_modal.html",
config.TemplatePath + "/partials/right_click.html",
} }
// templates returns a template chain with the base templates preceding yours. // templates returns a template chain with the base templates preceding yours.

View File

@ -1,5 +1,29 @@
// Right-click button handler, to dissuade downloading. // Right-click button handler, to dissuade downloading.
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
// Whitelist of paths to NOT engage the script on (because it's annoying)
let path = window.location.pathname;
if (path === "/") return;
let pathWhitelist = [
"/messages",
"/forum/post",
"/f/",
"/settings",
"/photo/certification",
"/notes/me",
"/notes/u/",
"/admin",
"/about",
"/faq",
"/tos",
"/privacy",
"/contact",
];
for (let prefix of pathWhitelist) {
if (path.indexOf(prefix) === 0) {
return;
}
}
const $modal = document.querySelector("#rightclick-modal"), const $modal = document.querySelector("#rightclick-modal"),
$button = $modal.querySelector("button"), $button = $modal.querySelector("button"),
cls = 'is-active'; cls = 'is-active';

View File

@ -369,41 +369,7 @@
{{template "like-modal"}} {{template "like-modal"}}
<!-- Right-click modal --> <!-- Right-click modal -->
<div class="modal nonshy-important-modal" id="rightclick-modal"> {{template "right-click-modal"}}
<div class="modal-background"></div>
<div class="modal-content">
<div class="card">
<div class="card-header has-background-warning">
<p class="card-header-title has-text-dark-dark">
<i class="fa fa-info-circle mr-2"></i> Please respect peoples' privacy
</p>
</div>
<div class="card-content content">
<p>
Please respect our members' privacy and refrain from downloading any pictures from {{PrettyTitle}}.
</p>
<p>
It is <a href="/tos#downloading">against the rules</a> to download a copy of other peoples' photos
from this site. I know that I can't stop you from doing so anyway if you're so determined, but
please consider that many of us don't wish for our pictures to end up reposted somewhere
else on the Internet or seen by people outside of the {{PrettyTitle}} community.
</p>
<p>
Thank you for your understanding!
</p>
</div>
<div class="card-footer has-text-centered">
<div class="card-footer-item">
<button type="button" class="button is-success">
Acknowledge
</button>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="/static/js/right-click.js?build={{.BuildHash}}"></script>
</body> </body>
</html> </html>
{{end}} {{end}}

View File

@ -0,0 +1,39 @@
<!-- Right-click deterrent modal -->
{{define "right-click-modal"}}
<div class="modal nonshy-important-modal" id="rightclick-modal">
<div class="modal-background"></div>
<div class="modal-content">
<div class="card">
<div class="card-header has-background-warning">
<p class="card-header-title has-text-dark-dark">
<i class="fa fa-info-circle mr-2"></i> Please respect peoples' privacy
</p>
</div>
<div class="card-content content">
<p>
Please respect our members' privacy and refrain from downloading any pictures from {{PrettyTitle}}.
</p>
<p>
It is <a href="/tos#downloading">against the rules</a> to download a copy of other peoples' photos
from this site. I know that I can't stop you from doing so anyway if you're so determined, but
please consider that many of us don't wish for our pictures to end up reposted somewhere
else on the Internet or seen by people outside of the {{PrettyTitle}} community.
</p>
<p>
Thank you for your understanding!
</p>
</div>
<div class="card-footer has-text-centered">
<div class="card-footer-item">
<button type="button" class="button is-success">
Acknowledge
</button>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="/static/js/right-click.js?build={{.BuildHash}}"></script>
{{end}}