Trying to disable remove on a per file-pond item basis - filepond

I'm investigating adding custom functionality via my own plugins, and here's what I've done so far
Premise
Create a plugin which will disable the remove button for relevant items
Attempted so far
Registered a plugin and during DID_LOAD_ITEM tried the below
const removeItemButtons = el.querySelectorAll('.filepond--action-remove-item');
removeItemButtons.forEach(removeItemButton => {
removeItemButton.setAttribute("disabled", "disabled");
});
But the button is not disabled. The attribute does not appear on the remove button. Am I missing something in the lifecycle on how plugins interact with the DOM? The button does get returned by the querySelector all, is it modified after the plugin is called?

did the removeItemButtons have been rendered before your function? it seems like your selector did not get the items

Related

How to disable the click event in electron app

I am able to built the desktop app in electronJS. I am trying to implement the functionality to disable the click event on window when there is no internet connectivity similar to the slack.I found the API to detect the internet in electron but not able to find the way to disable the click events.
You can disable all pointer events by adding the following rule to your page's CSS:
body {
pointer-events:none;
}
or via JavaScript:
document.body.style.pointerEvents = "none";
to re-enable:
body {
pointer-events:auto;
}
or
document.body.style.pointerEvents = "auto";
You can do this on more specific elements to gain more granular control.
You could add an invisible panel in front of everything and catch the clicks there.

How to destroy dropdzonejs?

How to destroy dropdzonejs?
When I have SPA and leave the page, I want to clean up so it does not listen to body events anymore.
myDropzone.destroy();
I swear I had the same problem and I'll find that with a
lucky attempt... it works!
I removed removedfile() function from Dropzone options and myDropzone.destroy(); worked for me.
According to the documentation:
If you do not need a dropzone anymore, just call .disable() on the
object. This will remove all event listeners on the element, and clear
all file arrays. To reenable a Dropzone use .enable()
If you initialize dropzone like:
var myDropzone = new Dropzone("#mydropzoneid", { url: "/some/url"});
You should be able to disable it with:
myDropzone.disable();
Use one of the following methods : The destroy() and disable() methods both exist, and they seem to act the exact same way.
In fact, DropZone does not have a real destruction method. These methods will "put the instance in pause" (what is, by design, the closest implementation of a DropZone instance destruction).
This applies to DropZone 5.x and DropZone 6.x (try myDropzone.disable() or myDropzone.destroy() in the console on this v6.x example page https://www.dropzone.dev/bootstrap.html) : The DropZone instance will be disabled, thus leading to the "Add Files..." button being inoperative.
The instance can then be re-enabled by calling myDropzone.enable().
PS : DropZone switch from v5 to v6 in 2021-2022. The website was completely revamped and screwed-up: the documentation is partial, incomplete, too short.
If you still need to access the excellent and exhaustive v5 documentation, you can head up to the obvious Web Archive Wayback machine ! Here is the very latest v5 documentation page https://web.archive.org/web/20210829160314/https://www.dropzonejs.com/
If you want destroy all dropzone instances just add if (Dropzone.instances.length > 0) Dropzone.instances.forEach(dz => dz.destroy()) to document ready.

Clean up DOM after a Firefox add-on SDK extension Disable/Remove action is fired

I am working on a add-on SDK extension which uses a pageMod object with a content script that adds a DIV tag to the DOM (this tag behaves like a button) when the action button is being clicked.
I am trying to find a solution where I can delete that newly added DOM element when the extension is being disabled or removed and I've had no luck so far.
The first thing that I've tried was to use the AddonManager.addAddonListener(listener) approach where I would listen for a onUninstalling or a onDisabling event and then communicate with the content script but I got nowhere.
What I've tried next was to make use of the exports.onUnload solution where I tried to send a message from the pageMod's worker to the content script and deal with the removal of the DIV from there but it seems that the content script is no longer responsive by the time the onUnload function is being triggered.
Is there really no way to clean up the modified DOM when the extension is being disabled/removed?
At your content script listen for the detach event.
self.on("detach", function(reason){
//remove that div
});
In #paa's answer the "port" part is missing:
e.g., from the docs
var oldInnerHTML = window.document.body.innerHTML;
window.document.body.innerHTML = "eaten!";
self.port.on("detach", function() {
window.document.body.innerHTML = oldInnerHTML;
});
I am not using PageMod nd this works for me.

Handling click of proxy view in app.js in android module

I have created one carousel view using module in android. Here everything is going fine. But how to handle click of individual image in this view. I can handle this easily in my native android code but I need to get listener in my app.js so when one image from carousel will be clicked I will get is name but I have no idea how to achieve this. Here is my code:-
var carouselandroid = require('com.carouselandroid');
var proxy = carouselandroid.createExample({ message : "Creating an example Proxy", width : Ti.UI.FILL, height : Ti.UI.SIZE, });
win.add(proxy);
proxy.addEventListener('click', function(e) { Ti.API.info('--------getting e: ' + JSON.stringify(e)); });
but listener is not called.
As I was unable to get click of proxy so I used fireEvent in my module but again I was unable to pass data using fireEvent may be I need to understand modules more. Nevertheless to achieve this I made one property of proxy in my module and then firing one method. This way it is working.

“Object doesn't support property or method 'ready'”

Object doesn't support property or method 'ready'
I am getting this error while using custom dropdown list with js mootools slider. I have downloaded js slider and custom dropdown and while trying to merge it, I am facing this error.
I have downloaded the js slider plugin from here:
http://landofcoder.com/index.php?option=com_jdownloads&Itemid=372&task=view.download&cid=6
Can anyone tell me what's wrong with it ?
Make sure what you have mootool and jquery required. You can open Inspector in Google Chrome and type in console tab MooTools and jQuery.
This libraries has conflict on global variable $.
document.id('element_id') // Mootools' "$"
jQuery('selector or something') // jQuery's "$"
I hope in you situation this should help
jQuery(document).ready(function() {
// initialize you code
});

Resources