external-application-button icon indicating copy to clipboard operation
external-application-button copied to clipboard

Add [TITLE] to placeholders..

Open tbone2k-git opened this issue 2 years ago • 2 comments

Hello! o)

I finally found this.. hell yes! o) I always wanted to have a simple browser function: "Copy Title and Url to Clipboard" so I could fill simple text files with very simple bookmarks for later reference (or maybe even write title and url directly to a file). This is not possible with modern browsers for some reason, but EAB is to the rescue - thank you for that! o)

I used [PRE_SCRIPT] and document.currentScript.output = document.title; to get the webpage' title passed on the my jscript. Finding out how this works took some hours of trying around. Powershell and Batch did not do well with parameters passed, cscript.exe did best for me.

So everything is fine? Almost! o)

There are websites like this, GitHub, where inline execution of script code is not allowed, the [PRE_SCRIPT] thing won't do the trick, it will always be empty. To still get the webpage title, it would be cool if EAB would have a [TITLE] placeholder. It would need to replace dquotes with squotes though, to not mess up resulting command lines.

Thank you! o)

tbone2k-git avatar Jul 06 '23 13:07 tbone2k-git

+1

stax76 avatar Dec 29 '23 12:12 stax76

Thank you @stax67 for joining in! o)

Whenever I want to get a Github url and title (e-g-), I am irritated shortly, because it fails.. then I remember the issue! o)

If anybody could enhance on this, it would be much appreciated, thank you! o)

tbone2k-git avatar Dec 29 '23 18:12 tbone2k-git

Mr. Portmen, thank you! I tried this immediately, but I only get "undefined" for the new [TITLE] placeholder. I reinstalled the extension, not sure though your new enhancement is automatically picked up? Is there anything else to update? Thank you in advance! o)

tbone2k-git avatar Apr 07 '24 13:04 tbone2k-git

@tbone2k-git right, it works on the toolbar action, but not from context menu. I've push a quick fix. Hopefully will be fixed on "0.5.4.1" release.

andy-portmen avatar Apr 07 '24 14:04 andy-portmen

Awesome.. really appreciate your work! o)

Can you tell me, how am I supposed to update the browser extension, does it auto update somehow?

tbone2k-git avatar Apr 07 '24 15:04 tbone2k-git

It is still under review. Usually, it takes about 2 days.

andy-portmen avatar Apr 08 '24 04:04 andy-portmen

Ok, thank you, I'll be waiting some days then. The extension will auto update or how is the process to get the most current version? Deinstall / reinstall or what actions are required exactly?

tbone2k-git avatar Apr 08 '24 07:04 tbone2k-git

One more question unfortunately, sorry to bother you! o)

I had a closer look at your change: https://github.com/andy-portmen/external-application-button/commit/b7dee6cb375b801c63af3d20f686680c2d0c3917

As mentioned in my initial issue posting, I think EAB needs to replace all double quotes in the tab title, when passing the value on to the command line, otherwise it will probably mess up the command line for the external script. Double quotes are quite common in tab titles for some reason and I had to handle these in the [PRE_SCRIPT] solution as well. .replace(/\[TITLE\]/g, tab.title) I am thinking of something like this (replace with double single quote). .replace(/\[TITLE\]/g, tab.title).replace(/\"/g, "''") I am not sure if and how other special characters in the tab.title could lead to problems building the command line, I think it's especially difficult to tell, because Linux and things are supported, but handling the double quotes at least is probably the minimum required and should do the trick for most cases?!

Maybe you even have a better idea how to solve this, in any case, thank you! o)

tbone2k-git avatar Apr 08 '24 07:04 tbone2k-git