Giter Club home page Giter Club logo

Comments (9)

buggyj avatar buggyj commented on July 19, 2024 1

yes may be better. As we seem to be in agreement I will make a new build with this code using "data-message-box-creator".

from file-backups.

buggyj avatar buggyj commented on July 19, 2024

One solution would be to alway add a 'current saver attribute' and set to the name of the saver. Before any saving this attribute can be read, if it is not the same as set then don't do anything, except warn the user.

from file-backups.

buggyj avatar buggyj commented on July 19, 2024

May be it is enough to check if the messagebox exists when installing (if it already exists then another extension has created it).

from file-backups.

buggyj avatar buggyj commented on July 19, 2024

@pmario I have removed savetiddlers until this issue is resolved

from file-backups.

pmario avatar pmario commented on July 19, 2024

I just had a closer look to the following functions

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/onInstalled
and
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/connect

But imo there is no "safe" way to communicate, that can't be abused by others. ... So imo the message box ID seems to be the easiest way.

from file-backups.

pmario avatar pmario commented on July 19, 2024

So the ContentScript can do the following:

	// Inject the message box
	var messageBox = doc.getElementById("tiddlyfox-message-box");
	if (!messageBox) {
		messageBox = doc.createElement("div");
		messageBox.id = "tiddlyfox-message-box";
		messageBox.setAttribute("data-tiddlyfox-creator", "<your-addon-name>")
		messageBox.style.display = "none";
		doc.body.appendChild(messageBox);

And if a new ContentScript is initialized, it can activate an info box.
If the user doesn't resolve the problem, a "tm-save-wiki" will cause a new message box. ... And so on.

from file-backups.

buggyj avatar buggyj commented on July 19, 2024

I was think of this:


		// Inject the message box
		var messageBox = doc.getElementById("tiddlyfox-message-box");
		if(messageBox) {
			var othersw = messageBox.getAttribute("data-message-box-creator")|| null;
			if (othersw) {
				alert ("as another tiddlysaver called "+othersw+" is install - savetiddlers is shutting down");
				return;
			} else {
				messageBox.setAttribute("data-message-box-creator","savetiddlers");
		} else {
			messageBox = doc.createElement("div");
			messageBox.id = "tiddlyfox-message-box";
			messageBox.style.display = "none";
			messageBox.setAttribute("data-message-box-creator","savetiddlers");
			doc.body.appendChild(messageBox);
		}
		// Attach the event handler to the message box
		messageBox.addEventListener("tiddlyfox-save-file",function(event) {

As we have return from the function no listener was installed so the extension does not react to requests

from file-backups.

pmario avatar pmario commented on July 19, 2024
alert ("as another tiddlysaver called "+othersw+" is install - savetiddlers is shutting down");

I think the newly imported plugin should be more "self-confident" :)

"savetiddlers" has detected another plugin named: "xxxx".\n
At the moment only 1 "convenience save mecahnism" can be active at once.\n
We will temporarily deactivate the functionality, until the problem is resolved!

This message pops up till the user solves the problem. ...

from file-backups.

pmario avatar pmario commented on July 19, 2024

But imo the main goal should be to make the convenience functions stackable.

from file-backups.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.