bookmarklets working without reuse existing page

Forums » Opera for Windows/Mac/Linux » Desktop wish-list

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

20. March 2004, 15:22:00

porneL

79% geek, 47% nerd

Posts: 2633

bookmarklets working without reuse existing page

I prefer to have 'reuse existing page' disabled, but unfortunately it makes bookmarklets and some buttons useless.
There should be some support for bookmarklets. Maybe option like "enable bookmarklets" that would make all links with 'javascript:' url open in same window.
Or there could be prefs command for enabling/disabling 'reuse' option. Buttons like "enable reuse; bookmarklet; disalbe reuse" could be made.
Or there could be command like "Reuse page" working as "Go to page" with 'reuse' enabled.

9. April 2004, 15:22:30

Guille

Spanish Forum's Moderator

Posts: 1290

+1 I agree with you, having to go to the preferences every time I try to run a bookmarklet is making me crazy!
Moderando un poco

9. April 2004, 15:47:51

Anon

Anonymous Member

Posts: 1285

i'd also like to see something like this done. there is a workaround i've found: if you drag a bookmarklet button into a page from a toolbar they work on the current page.
You are not your ****ing system specs. You are not your uptime stats, your script file, or your oversized desktop screencap. You are not your broadband connection. You are not your ****ing postcount.

| Download Opera Today | Beta Testing | Community | WIKI | Documentation | Support | Press Releases | Buy | Promote | OperaStuff |

9. April 2004, 16:20:56

burnout426

Posts: 12415

Another vote!

@anon.

Thanks for the dragging to a page workaround. That helps.

6. May 2005, 15:49:41

porneL

79% geek, 47% nerd

Posts: 2633

I still dislike reusing pages, but I'd like to use favelets attached to menus and buttons...

6. May 2005, 17:13:40

tetsuro

Posts: 144

With userJS there is a way to use bookmarklets with buttons. In the userJS file, write this :

function your_function_name(){
//here insert the bookmarklet_code without javascript:
}

And create a button with this code :

Button = Search, "javascript:your_function_name('%s')"

Make sure the button is placed on a toolbar with an address field or a search field.

6. May 2005, 17:17:40

porneL

79% geek, 47% nerd

Posts: 2633

tetsuro: How is that supported to work, when button will execute "javascript:your_function_name('%s')" in new window?

6. May 2005, 17:36:00

tetsuro

Posts: 144

There is no new window open, it executes on the same page. Don't ask me why but it works.

7. May 2005, 07:09:52

burnout426

Posts: 12415

party

This is great.

Now we simulate bookmarklet support without dragging.

Note:, if you try to create one of these with the button maker and choose to add a title or icon to the button, it won't work because of a missing %22.

Also won't be able to post the button here because of the javascript part.

7. May 2005, 09:34:13

non-troppo

Spinning Top

Posts: 4662

Basically it seems Search works without creating a new page and so instead of running a search URL you run your javascript code? Why do you need userJS in this case, can't you inject JS directly into the Search button?

This is still not a very flexible solution, though a very creative workaround tetsuro! wink I'll have to play with it soon.

+1 for the original thread

7. May 2005, 11:15:40

burnout426

Posts: 12415

^^ yes, you don't actually need user.js to execute a script with search.

You can do something like this:

Search, "javascript:alert(document.compatMode); x = '%s';"

Just as long as the %s is in there somewhere.

However, as you will notice, after you click ok to close the alert, it will redirect the page, which is why you use user.js.

7. May 2005, 12:11:03

Stoen

Posts: 1140

http://nontroppo.org/wiki/UltimateHighlightBookmarklet?show_comments=1

whistle smile

Another limitation is that it only seems to work when the field is on the left of the button and it can be ANY field on the same toolbar (pertinent in regards to button placement if you have more than one field on a toolbar) as long as it not empty and it is on the left of the button.

But still +1 for the original request

7. May 2005, 17:05:02

tetsuro

Posts: 144

It is indeed the UHB which gave me this workaround. I also support the request of course.

The '%s' parameter will catch the content of the first non empty field placed on the left of the button, and otherwise the content of the first non empty field placed on the right of the button. So as long as you don't actually use the %s parameter, you can place it anywhere on the toolbar. (the %s parameter also introduces encoding problem because it won't accept unicode characters).

Indeed there must a non empty field.

Burnout, you can prevent the redirection by placing your code in a function like this :

Search, "javascript: (function(){alert(document.compatMode); x = '%s';})()"

I proposed the userJS solution because it's easier to maintain, if you want to modify your code. And you can see the results without having to restart Opera.
But for dragging purpose, you must indeed insert your code as a parameter for the search action

17. June 2005, 22:37:12

blee

Posts: 27

+1. With social bookmarking becoming more popular, the need for this is probably growing.
Opera 8 Win32

17. July 2005, 10:41:30

tetsuro

Posts: 144

does this action (in buttons, mouse gestures and keyboard shortcuts) make the bookmarklets work with reuse existing pages unticked :

Go to page, "javascript:code", 1

because it works for me and I didn't see comments on it, so maybe people are not aware of this (as an example the actual version of the web dev toolbar for opera 8.0 and above doesn't use the 1 parameter).

17. July 2005, 14:16:25

gun

Posts: 1742

Yes, this works, but I think this was never used in older version of Opera, but I discovered it now in 8.02tp1 because it's now the default setting for link-buttons on toolbars.

Go to page, "address", 0

This brings back old behaviour (depending on "Reuse existing page" setting).

@non-troppo: Moch work to do for you to fix all those bookmarklets in your wiki. lol
Need help on this task?

18. July 2005, 09:25:17

non-troppo

Spinning Top

Posts: 4662

tetsuro: great news, indeed I wasn't aware of this. Did you find it by trial-n-error, or simply superior intellect? wink

gun: crybigeyeseek any help much appreciated!

Forums » Opera for Windows/Mac/Linux » Desktop wish-list