How to get the selected text from current tab?


arian99

Recommended Posts

Hi all!

Would anyone please be kind to help?:

On maxthon classic, I have a sidebar plugin which pop ups the URL of the current tab.

The code that does this is:

alert(external.get_tab(max_security_id, external.cur_sel).document.URL)

However, i want to get the selected text and have it popped up.

I tried:

alert(external.get_tab(max_security_id, external.cur_sel).document.getSelection())

it doesn't work.

Is there a way to get the text selection from the current tab? WHy doesn't the above return it?

Any answers?

Thanks in advance.

Link to comment
Share on other sites

Thank you, I tested your code. But i can't make it work.

My html file begins with: ""

After this, I pasted your code.

I have the textarea in the sidebar, but when i click the button, nothing happens.

Am I doing something wrong? Have you tested it with Maxthon classic, does it work?

Link to comment
Share on other sites

Ya, the reason your way wouldn't work is because MX Classic has a completely different plugin creation method than the systems since.

It's really too bad. :(

BTW, one thing I noticed is how come this plugin doesn't have an Icon folder?

How is it even working without one, something to click on to make it work?

Link to comment
Share on other sites

leeuniverse replied at 2013-7-28 09:19 back.gif

Ya, the reason your way wouldn't work is because MX Classic has a completely different plugin creati ...

Yes, indeed. It doesn't have any icon folders, at least in the way I have installed them. After I installed the addon zhg4398586 kindly offered, this is what happened:

The vertical sidebar expanded by the space of one icon but without showing any. To get the addon working, I simply click on this blank expansion area, as if there were an icon there..

As I do mouseover on this little blank space, the name of the addon (here being "test") is displayed. In short, no icons of any sort, just a blank space on the sidebar is clicked and the sidebar expands, showing the form that the addon includes.

Link to comment
Share on other sites

Ya, I do see that. Turns out the reason I wasn't seeing is because the extension wasn't checked in the extension manager, my bad.

Although, the extension also doesn't appear to work either, in 4.0 anyway.

The panel pop's up, but then it doesn't do anything clicking the box etc.

Anyway, not an extension I need, was just curious.

Link to comment
Share on other sites

This addon triggers the function via button from the sidebar.

Is there a way to pass the selected text to the sidebar, automatically?

I mean, as soon as we do a mouseup in the main tab, right after selecting the text..

Zhhaogen? Anyone?

P.S I tried to add the onmouseup event to various functions, but had no results.

Link to comment
Share on other sites

SkyNote is good for note managing but i need more than it is aimed for.

The steps to achieving my aim are:

1. Have maxthon installed.

2. Have an addon that passes the selected text in the main tab to a form in the sidebar.

3. The html of the selection should be preserved. Image files, bold characters, italics etc.

4. The selection should be passed automatically on mouseup from the main tab.

5. The text passed from the main tab should not replace the text in the textarea of the form. It must be added to the textarea for each selection.

5. The form shoud include the URL, title, author of the webpage.

6. The form will post to the database that is running on my local server.

7. I will publish this database as a website on my local server, totally for my own needs.

I'm having trouble with 3 and 4 above. Any help will be much appreciated.

And thank you very much for bringing SkyNote to my attention.

Link to comment
Share on other sites

Maxthon Classic used to have a couple like that plugin wise. I think something close was the "Net Snippets" plugin (but you also had to install the Program (dead software now)). I can't remember the name of the other plugin or two that did similar (minus the database to server stuff, nothing like that).

I am planning of looking to see if I can get the Net Snippets plugin to work with MX4, but that's going to take some time, and I don't know if I can. Further, I don't know if Net Snippets will actually work in anything above XP.

Link to comment
Share on other sites

Thanks for your consideration.

Net Snippets sounds familiar to me, too. All these programs are good for note keeping, but it seems to me taht, rather than a program, I need a javascript code.

There's an addon called "auto copy" that achieves part of what I'd wish to have. After selecting the text in the main tab, it copies the text automatically, on mouse up to your clipboard.

I'd love to see how this addon responds to the mouseup.. However, it is in dll format and when I open it up in a text editor all that I get is squares and strange symbols that mean nothing to me.

I'd love to see a javascript code, triggering onmouseup from the main tab..

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.