No it goes in library.js since it's a server side hook. And you need to add the corresponding entry in plugin.json.
// library.js myPlugin.filterMiddlewareRender = async (hookData) => { hookData.templateData.user = await user.getUserData(hookData.req.uid); return hookData; }; //plugin.json "hooks": { "filter:middleware.render": "filterMiddlewareRender" ... }Disable widget only in mobile - possible
-
Is it possible to disable a widget in mobile , but leave it on in desktop
-
It is planned https://github.com/NodeBB/NodeBB/issues/2302
-
@baris thanks
-
For now just wrap it in a div and use a media query to set that div to display:none below a certain viewport.
-
@a_5mith what would the the query look like that can differentiate between mobile and desktop
can you use navigator.userAgent.match(/iPhone/i) etc..
don't currently have phone to check , but will try work some code up when I have access.
maybe you can use it in your ACP - disable for mobile devices checkbox on widget
-
@media only screen and (max-width : 480px) { .div-name { display:none; } } Think that's right, might be min-width. On an iPad so can't check.
-
In fact bootstrap has a no-mobile class you can use already. I just don't remember it.
-
hidden-xs