You need to be logged in to post in the forums. If you do not have an account, please sign up first.
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.
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 |
| Download Opera Today | Beta Testing | Community | WIKI | Documentation | Support | Press Releases | Buy | Promote | OperaStuff |
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.
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.
tetsuro: How is that supported to work, when button will execute "javascript:your_function_name('%s')" in new window?
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.
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!
I'll have to play with it soon.
+1 for the original thread
This is still not a very flexible solution, though a very creative workaround tetsuro!
I'll have to play with it soon.+1 for the original thread
The Opera WIKI, including tips, custom buttons & performance tweaks for Opera. Custom Setups for Web Developers & power users with ƃiƤølař ƌisøřƌeř! RSS feed to keep up-to-date with the wiki.
Tools: Button/Command creator ¤ GZip Discrimination Tester ¤ INI Difference Tool
Wishes: Advanced Page Management ¤ Sticky Searches (mock-up) ¤ Better Find Interface ¤Oh, and a logo that doesn't look like it's been chewed by a dog...
Tools: Button/Command creator ¤ GZip Discrimination Tester ¤ INI Difference Tool
Wishes: Advanced Page Management ¤ Sticky Searches (mock-up) ¤ Better Find Interface ¤
^^ 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.
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.
http://nontroppo.org/wiki/UltimateHighlightBookmarklet?show_comments=1
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
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
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
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
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).
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).
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.
Need help on this task?
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.
Need help on this task?
tetsuro: great news, indeed I wasn't aware of this. Did you find it by trial-n-error, or simply superior intellect? 
gun:

any help much appreciated!

gun:


any help much appreciated!
The Opera WIKI, including tips, custom buttons & performance tweaks for Opera. Custom Setups for Web Developers & power users with ƃiƤølař ƌisøřƌeř! RSS feed to keep up-to-date with the wiki.
Tools: Button/Command creator ¤ GZip Discrimination Tester ¤ INI Difference Tool
Wishes: Advanced Page Management ¤ Sticky Searches (mock-up) ¤ Better Find Interface ¤Oh, and a logo that doesn't look like it's been chewed by a dog...
Tools: Button/Command creator ¤ GZip Discrimination Tester ¤ INI Difference Tool
Wishes: Advanced Page Management ¤ Sticky Searches (mock-up) ¤ Better Find Interface ¤