What would you like done?
I know this is ridiculous but my users are photographers and many of them are older folks and don’t understand how easy this is to bypass, so just go with me here.
I do not want to turn off pointer events because I still want the users to be able to zoom in to the full size image, and I don’t want to disable right click globally and reduce functionality.
I have tried this script for the thumbnail which only works when you refresh the page
<script type="text/javascript">
$(document).ready(function(){
$("img").bind("contextmenu",function(e){
return false;
});
});
</script>
Any creative ideas on how to get this working without losing functionality?
When do you need it done?
ASAP
What is your budget, in $ USD that you can offer for this task?
$100
3 إعجابات
fefrei
(Felix Freiberger)
5 سبتمبر 2018، 7:03م
2
The onPageChange event should help you:
Discourse Themes and Theme Components can be used to customize the look, feel and functionality of Discourse’s frontend. This section of the developer guides aims to provide all the reference materials you need to develop simple themes for a single site, right up to complex open-source theme components.
This introduction aims to provide a map of all the tools and APIs for theme development. If you prefer a step-by-step tutorial for theme development, jump straight to:
Themes vs. Theme Compon…
It’s executed whenever the user navigates in Discourse. $(document).ready isn’t enough because Discourse normally avoids full page reloads.
Something like this could work for you:
<script type="text/discourse-plugin" version="0.8">
api.onPageChange((url, title) => {
$("img").bind("contextmenu",function(e) {
return false;
});
});
</script>
This doesn’t handle posts that are inserted into the page by infinite scrolling, but maybe it’s enough to appease your users
(I understand this is a Marketplace post and you are looking for a fully baked solution. This isn’t that, but I thought it might still help.)
3 إعجابات
I think this was already answered elsewhere?
Yes, I’m not sure where the replies went, but I do not need this anymore.
Thank you @fefrei for chiming in.
This what I ultimately went with
<script type="text/discourse-plugin" version="0.8">
const TopicRoute = require("discourse/routes/topic").default;
TopicRoute.reopen({
activate: function() {
this._super();
Em.run.next(function() {
$('body').on('contextmenu', '.cooked img, .mfp-img', function(e){ return false; });
});
}
});
</script>
8 إعجابات
system
(system)
تم إغلاقه في
6 أكتوبر 2018، 12:54ص
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.