Sign up | Lost password? | Help

[ advanced search ]

Ultimate Search Highlighter

Forums » Opera Community » General Opera topics » User JavaScript


Go to last post

Thursday, 13. July 2006, 14:45:29

Stoen

avatar

Posts: 1109

Ultimate Search Highlighter

An update of UHB (with permission from Luchio, thanks)

You can get the latest version here
http://my.opera.com/Stoen/homes/uhb/highlighter.js (the main script file)
http://my.opera.com/Stoen/homes/uhb/ush.css (a css skin file, copy paste content to user.css or add as an on demand stylesheet)

Requires Opera 9+

Features:

  • Supports multiple search engines with the ability to add your own
  • New toolbar format
  • Jump to next instance of highlighted term or previous (shift click on term in toolbar)
  • Toggle highlighting
  • Supports RegExp highlighting


Usage:

As a bookmark or from the address bar
Add "##SEARCH TERMS" after the url to have "SEARCH TERMS" highlighted

From right click
Add the following to the [Hotclick Popup Menu] section of menu.ini
Item, "Highlight"="Go to page, "javascript:(function(){UserJS_USH.check = window.getSelection().toString(); UserJS_USH(null,'new',UserJS_USH.check);})()""

As a search engine
Add the following as a search engine in the Search configuration *
javascript:UserJS_USH.check = '%s'; UserJS_USH(null,'new',UserJS_USH.check);

As a button for an existing search field
Drag and drop the following button to your toolbar *
button



About highlighting:

By default RegExp highlighting is turned off.

At all time you can use "+" (plus) or "-" (minus) to include or disable highlighting of a specific term.

A space character " " seperates search terms.

To include the highlighting of "+", "-" or " " enclose the search terms in double quotes.

Remember to escape single quotes using "\" (backslash) eg "don't" becomes "don\'t". This is because of how Opera parses the search string

* Opera converts spaces to "+" when using the search field. To always treat "+" as a seperator when using a Search field, set stripPluses in the script to true or use the following button which gets around this limitation by instead copying the content of a Search field to the clipboard, it also highlights as a RegExp when help down. Requires Integrated Search to be ticked.
button

Saturday, 5. July 2008, 04:37:28

Stoen

avatar

Posts: 1109

Originally posted by skye11:

one thing - when using the key shortcuts (or mouse) sometimes the searchbar hides the searched/found words
you need to make sure the searched/focused words appear below the searchbar and can be seen on the page


This shouldnt happen. Got a link to a page where it does?

Saturday, 5. July 2008, 15:45:01 (edited)

skye11

avatar

Posts: 416

Stoen,
I couldn’t remember which websites that problem occured on
and after testing many different sites, I could not replicate the problem, but I finally managed to find one

ok, do a google search for "world history"
go 10 links down and click on "World History Timeline" (www.camelotintl.com/world/)
on that site, click on a continent
then use the searchbar (or keyboard "~ + #")
notice the found search words are hidden underneath the searchbar and only the blue rectangle visible

Sunday, 13. July 2008, 13:56:51

Stoen

avatar

Posts: 1109

Originally posted by skye11:

notice the found search words are hidden underneath the searchbar and only the blue rectangle visible


Fixed.

USH v1.39
http://files.myopera.com/Stoen/uhb/highlighter.js
http://files.myopera.com/Stoen/uhb/ush.css

Monday, 14. July 2008, 01:16:49

skye11

avatar

Posts: 416

Originally posted by Stoen:

Fixed.


:up: :cheers:

Monday, 14. July 2008, 14:32:07

skye11

avatar

Posts: 416

oops,
found another site where the problem still exists - can you test & confirm?
http://www.pallab.net/2006/04/12/extending-opera-the-ultimate-guide-to-customizing-opera/

Tuesday, 15. July 2008, 11:02:49

Stoen

avatar

Posts: 1109

Originally posted by skye11:

found another site where the problem still exists - can you test & confirm?


Cant confirm. What were you searching for? What version of Opera are you using?

Tuesday, 15. July 2008, 14:46:41

skye11

avatar

Posts: 416

sorry, you are right
after reboot, working fantastic (using 9.2, v10089) :up:

Friday, 18. July 2008, 00:27:26

NashAsh

avatar

Posts: 6

I'm a little bit confused as to what the _ shortcut does.

In very early versions (I finally upgraded from 2 years ago, I can't believe it's been that long!) a box popped up where I could enter new search terms. In the new case, the _ shortcut just "refreshes" the search? Is there a shortcut to focus/highlight the search box in the toolbar?

Saturday, 19. July 2008, 03:59:19

Stoen

avatar

Posts: 1109

Originally posted by NashAsh:

I'm a little bit confused as to what the _ shortcut does.

In very early versions (I finally upgraded from 2 years ago, I can't believe it's been that long!) a box popped up where I could enter new search terms. In the new case, the _ shortcut just "refreshes" the search? Is there a shortcut to focus/highlight the search box in the toolbar?


The shortcuts are directly linked to the buttons on the toolbar

To focus the search field add the following as a shortcut in Opera. See here for how. I find "ctrl ." to be a useful shortcut.
Go to page,"javascript:opera.USH.run(null,'newBlank');",1

Sunday, 27. July 2008, 10:55:57

Stoen

avatar

Posts: 1109

Originally posted by d.i.z.:

And btw. That bug with postMessage preventing TinyMCE from loading is a bummer. Lately I must keep highlighter disabled because of that. Or maybe I'll change it to init on load instead...


This is really starting to annoy me as well. It does more than prevent TinyMCE from loading, it completely locks up the entire tab.

Testcase:
document.addEventListener('DOMContentLoaded',function() { 
  // Step 1 of bug: call postMessage method of top
  top.postMessage('1');
  
  if( self == top ) {
    var iframe = document.createElement('iframe');
    // Step 2 of bug: set source of iframe to a javascript uri
    iframe.src = 'javascript:';
    document.documentElement.appendChild(iframe);
  
    // Step 3 of bug: call the open method of iframe.contentDocument
    iframe.contentDocument.open();
    //iframe.contentDocument.write('');
    //iframe.contentDocument.close();
  }
},false);


And for those of you using Opera 9.5+ who use this script (or any other that uses cross document messaging) and are having problems where a page containing TinyMCE locks up, then the following script should fix it.
// Fix for TinyMCE
opera.addEventListener('BeforeEventListener.DOMContentLoaded',function(e) {
  this.removeEventListener(e.type,arguments.callee,false);
  if( !window.tinymce ) { return; }
  HTMLIFrameElement.prototype.setAttribute = function() {
    if( (/^src$/i).test(arguments[0]) && (/^javascript:/i).test(arguments[1]) ) { return; }
    return HTMLElement.prototype.setAttribute.apply(this,arguments);
  }
},false);

Sunday, 27. July 2008, 14:36:55

d.i.z.

bug hunter

avatar

Posts: 2931

Poland

Originally posted by Stoen:

And for those of you using Opera 9.5+ who use this script (or any other that uses cross document messaging) and are having problems where a page containing TinyMCE locks up, then the following script should fix it.


You say that bug doesn't happen when iframe doesn't have src="javascript:"?
Because I have tc that does not set src attribute.

Sunday, 27. July 2008, 15:36:06

Stoen

avatar

Posts: 1109

Originally posted by d.i.z.:

You say that bug doesn't happen when iframe doesn't have src="javascript:"?


Yup, using b10093, it only happens with a javascript uri. If any of steps 1 through 3 dont happen then there are no problems.

Originally posted by d.i.z.:

Because I have tc that does not set src attribute.


Can you post it?

Monday, 28. July 2008, 10:39:19

Stoen

avatar

Posts: 1109

Interesting, seems the big difference in your testcase is
iframe.contentDocument.write('<scr'+'ipt>top.postMessage("PASS", "*");</scr'+'ipt>loaded');

Try it with
iframe.contentDocument.write('<body onload="top.postMessage(\'PASS\',\'*\');"></body>');

It wont freeze without setting the source of the iframe to a javascript uri.

Monday, 28. July 2008, 11:50:49

d.i.z.

bug hunter

avatar

Posts: 2931

Poland

Originally posted by Stoen:

It wont freeze without setting the source of the iframe to a javascript uri.


It always passes for me with:
      window.onload = function(){
        var iframe = document.createElement('iframe');
        iframe.setAttribute('src', 'javascript:""');
        iframe = document.body.appendChild( iframe );

        // set initial message
        setMsg('FAIL');

        iframe.contentDocument.open();
        iframe.contentDocument.write('<body onload="top.postMessage(\'PASS\',\'*\');">loaded</body>');
        iframe.contentDocument.close();
      }


But maybe other things can affect it as it seems to be a bit timing dependant.

Monday, 28. July 2008, 13:28:54

Stoen

avatar

Posts: 1109

Originally posted by d.i.z.:

But maybe other things can affect it as it seems to be a bit timing dependant.


LCD seems to be document.open() in one frame and window.postMessage() in a different frame. Plus something else...

Btw does the TinyMCE fix work for you at all?

Monday, 28. July 2008, 13:55:40 (edited)

d.i.z.

bug hunter

avatar

Posts: 2931

Poland

Originally posted by Stoen:

Btw does the TinyMCE fix work for you at all?


yes
btw. src matters when doing all that stuff in DOMContentLoaded. With onload, it never works (in my original tc).
Mangled it all. Anyway, your version behaves different in LOAD and DCL listeners. That's why fix works for tinymce. Cause it uses DCL listener.

Wednesday, 3. September 2008, 14:55:55

dapxin

avatar

Posts: 99

Nigeria

Sorry if this has been asked. How do I enable this on sites OTHER than google search ? Thx dude !

Friday, 5. September 2008, 01:22:39

nullpage

こんにちは

avatar

Posts: 42

Japan

USH 1.39 + FTW (fit to windw width) on Kestrel
The 'close' button in the USH tool bar, can not fit with 1 line.

What should I do?
(Opera 9.6 win32 10408)

Sunday, 19. October 2008, 13:09:52

Stoen

avatar

Posts: 1109

Originally posted by dapxin:

Sorry if this has been asked. How do I enable this on sites OTHER than google search ? Thx dude !


Could you please clarify? Enable highlighting for the results of another search engine or just find and highlight text on any site based on user input?

Originally posted by nullpage:

USH 1.39 + FTW (fit to windw width) on Kestrel
The 'close' button in the USH tool bar, can not fit with 1 line.
What should I do?


Try the new version

Main script v1.40
http://files.myopera.com/Stoen/uhb/highlighter.js

Optional preferences file (a new preference was added, so if you use this file, it needs to be updated):
http://files.myopera.com/Stoen/uhb/highlighter-preferences.js
Optional UserCSS file (CSS has changed, so if you use this file, it needs to be updated):
http://files.myopera.com/Stoen/uhb/ush.css

Please note the following item from the O9.6 changelog:
- Script focused elements are no longer highlighted

This breaks one of the main features of this script. I have tried to work around it but there will be problems.

Monday, 8. December 2008, 19:27:51

d.i.z.

bug hunter

avatar

Posts: 2931

Poland

There seems to be some problems with toolbar layout in O 10 alpha. Or is it me only?
ush_toolbar.png
No close and other buttons.

Monday, 8. December 2008, 22:20:05

skye11

avatar

Posts: 416

confirmed
I suspected that Stoen was aware of the problems by now and was probably reworking the script
then due to the silence here, I thought maybe he's waiting to get beyond he Alpha stage before working on it
there's a chance those issues might not be present in subsquent releases of Opera
but auto-hide (document-click to auto-hide) hasn't worked for a long time now

Monday, 8. December 2008, 22:30:50

Luchio

Burninating!

avatar

Posts: 941

Canada

The buttons are taken from the skin, and since there currently are some skin issues in this alpha...

Tuesday, 9. December 2008, 13:53:32

Stoen

avatar

Posts: 1109

Originally posted by skye11:

I suspected that Stoen was aware of the problems by now


I wasnt actually. I had updated the script a while ago but forgot to upload it. The old version had some CSS properties that I had forgotten to remove after testing and apparently Peregrine has some changes in how it calculates the specificity of selectors. Combined, these two factors caused the buttons to dissapear.

Anyway updated.

v1.41
Should work better in O9.2x
Removed workaround for element highlighting based on spatial navigation (didnt work well enough)
Misc minor fixes

http://files.myopera.com/Stoen/uhb/highlighter.js
http://files.myopera.com/Stoen/uhb/ush.css (optional)

Originally posted by skye11:

but auto-hide (document-click to auto-hide) hasn't worked for a long time now


I thought I fixed that. Does it work in v1.41?

Tuesday, 9. December 2008, 15:14:50

skye11

avatar

Posts: 416

missing toolbar items now appear
but toolbar still does not auto-hide - click page to auto-hide does not work either (mouse-over works)
also, highlighting does not work on any Google pages

Thursday, 11. December 2008, 08:46:16

TerDale

avatar

Posts: 39

France

Hi there,

Originally posted by Stoen:

Optional preferences file (a new preference was added, so if you use this file, it needs to be updated):
http://files.myopera.com/Stoen/uhb/highlighter-preferences.js


JIC it was missed by some of us, there's a typo in this one: "vvar preferences" instead of "var preferences" ;-)

Thursday, 11. December 2008, 10:33:33

Stoen

avatar

Posts: 1109

Originally posted by skye11:

but toolbar still does not auto-hide - click page to auto-hide does not work either (mouse-over works)


Hmm, I didnt think the script ever used to hide like that, atleast not intentionally. Added it now anyway.

Originally posted by skye11:

also, highlighting does not work on any Google page


Can you clarify? Script is designed not to autohighlight if a search result is a Google page, since it is difficult to differentiate between such a page and the next lot of search results (also a Google page). Manual highlighting should still work. If that is not what you are talking about, check your referrer settings, site preferences, etc.

Originally posted by TerDale:

JIC it was missed by some of us, there's a typo in this one: "vvar preferences" instead of "var preferences" ;-)


Bugger. Fixed. Also fixed broken search engines regular expressions in the preferences and the main script.

v1.42
http://files.myopera.com/Stoen/uhb/highlighter.js

http://files.myopera.com/Stoen/uhb/highlighter-preferences.js (updated)
http://files.myopera.com/Stoen/uhb/ush.css (no change)

Saturday, 3. January 2009, 14:15:56

userz

avatar

Posts: 2

Using USH 1.42 with Opera 9.26. Not sure I understand how stopwords work in USH.

Preferences are ...
useStopwords: false
highlightOnLoad: false

If I search for 'a car' only 'car' is highlighted in the google cache (as expected).

Clicking on the USH 'New Highlight' button highlights both 'a' and 'car'.

I'm wondering why the stopword 'a' is highlighted by USH.

What to do next? Thanks for any help.

Saturday, 10. January 2009, 06:20:00

Stoen

avatar

Posts: 1109

Originally posted by userz:

Not sure I understand how stopwords work in USH.


Stopwords are only ignored when automatically highlighting from search results to try and match what Google does. Because you have set highlightOnLoad: false this does not apply to your case.

Originally posted by userz:

Clicking on the USH 'New Highlight' button highlights both 'a' and 'car'.

I'm wondering why the stopword 'a' is highlighted by USH.


In this instance you are manually searching for something. I dont want to mess with manual operation, otherwise you would never be able to highlight something that was deemed a stopword (a, this, where, about, etc.)

Originally posted by userz:

What to do next? Thanks for any help.


I will look into changing the script so that the first manual highlight is treated as an automatic hightlight if highlightOnLoad is set to false.

As an aside I uploaded the wrong version of 1.42, the autohiding that skye11 was after and some bugs with scrolling the viewport to make sure the highlighted words are visible, werent corrected. Please redownload the script
http://files.myopera.com/Stoen/uhb/highlighter.js

Friday, 16. January 2009, 11:00:43 (edited)

userz

avatar

Posts: 2

Thanks for the explanation.

Originally posted by Stoen:

I will look into changing the script so that the first manual highlight is treated as an automatic hightlight if highlightOnLoad is set to false.



That would be good.

One reason for setting 'highlightOnLoad: false' is that occasionally a search result turns out to be a huge & irrelevant page that would take some time to highlight.

Just the best example of this that I could find right now .....

http://www.google.com/search?num=20&hl=en&q=copernic+invalid.page.fault+site%3Awww2b.abc.net.au&btnG=Search&lr=lang_en

Saturday, 17. January 2009, 05:08:21

skye11

avatar

Posts: 416

works perfect now - I love this script!
Thanks!!! :cheers:

Saturday, 17. January 2009, 09:18:29

Stoen

avatar

Posts: 1109

Originally posted by userz:

That would be good.


Done.

v1.43
  • When highlighting based on search engine results and highlightOnLoad is disabled, the first manual highlight follows automatic highlighting settings
  • Changed CSS to avoid bug where mouseover element is not resized


http://files.myopera.com/Stoen/uhb/highlighter.js

http://files.myopera.com/Stoen/uhb/ush.css (updated)
http://files.myopera.com/Stoen/uhb/highlighter-preferences.js (no change)

Monday, 19. January 2009, 17:19:13

d.i.z.

bug hunter

avatar

Posts: 2931

Poland

Is it a new "feature" that I'm being constantly refocused to different iframes while page is loading? :wink:

Saturday, 24. January 2009, 14:17:11

Alexandros1976

avatar

Posts: 4

I am using Opera 9.62 in Ubuntu Linux. Unfortunately I cannot get full functionality out of USH.

It works fine with google but what I need it for is other pages that I visit.

In some of these pages I need to have the words "word01", "word02", "word03" etc. constantly highlighted.

Can you please tell me EXACTLY how can I do that?

In other words I need the USH toolbar to be active all the time and not only when I visit a page through google.

Please tell me all the necessary steps as I don't seem to find any other way to do it.

Thank you :smile:

Sunday, 25. January 2009, 16:38:02

d.i.z.

bug hunter

avatar

Posts: 2931

Poland

Originally posted by d.i.z.:

Is it a new "feature" that I'm being constantly refocused to different iframes while page is loading? :wink:


In run method, either add
if ( self==top ) toolbar.tBar.focus();
or remove focus.

Thursday, 29. January 2009, 12:00:13

Stoen

avatar

Posts: 1109

Originally posted by Alexandros1976:

Please tell me all the necessary steps as I don't seem to find any other way to do it.


The easiest way is to change the url to something like
http://www.someurl.com/##word1 word2 word3


Originally posted by d.i.z.:

Is it a new "feature" that I'm being constantly refocused to different iframes while page is loading?


I think it has been that way for a while. Its there as a poor workaround to allow Opera keyboard shortcuts/buttons to focus the input field (due to the craptacular way this script works on pages with frames). I'll try to think of a better way to do it.

Friday, 30. January 2009, 12:06:32

Alexandros1976

avatar

Posts: 4

Originally posted by Stoen:

Originally posted by Alexandros1976:

Please tell me all the necessary steps as I don't seem to find any other way to do it.


The easiest way is to change the url to something like
http://www.someurl.com/##word1 word2 word3



Thank you for your answer. This helps me a lot.

The problem is that I need to do it every time I go to a new page. Is there a method to have these words constantly highlighted in every page that I visit?

Saturday, 31. January 2009, 05:30:24

Stoen

avatar

Posts: 1109

Originally posted by Stoen:


Originally posted by d.i.z.:


Is it a new "feature" that I'm being constantly refocused to different iframes while page is loading?


I think it has been that way for a while. Its there as a poor workaround to allow Opera keyboard shortcuts/buttons to focus the input field (due to the craptacular way this script works on pages with frames). I'll try to think of a better way to do it.


Correction, that is actually new code related to the feature skye11 wanted whereby the toolbar would be hidden when you click on the page. As per your suggestion I have changed the script so that it only does this on top

Originally posted by Alexandros1976:

The problem is that I need to do it every time I go to a new page. Is there a method to have these words constantly highlighted in every page that I visit?


Are you familiar with Regular Expressions? I have modified the script so you can add entries into the searchEngines array to achieve what you want but it might be a bit complicated if you dont know about Regular Expressions. The format is
[8,'siteLocationRegExp',,'searchTerm1 searchTerm2']

Where siteLocationRegExp is a regular expression that will match the URL for the sites you want highlighted

A simpler, but less flexible method is to use the following code
document.addEventListener('DOMContentLoaded',function() {
  if( !opera.USH ) { return; }
  // Uncomment following line to highlight on all pages
  //opera.USH.query = 'term1 term2';
  if( false ) {}
  // modify following line to highlight on a specific site only
  else if( location == 'http://www.somesite.com/' ) {
    opera.USH.query = 'term1 term2';
  }
},false);


I have modified the preferences file to include this code, you just need to modify it to your needs

v1.44
http://files.myopera.com/Stoen/uhb/highlighter.js

http://files.myopera.com/Stoen/uhb/highlighter-preferences.js (updated)

Saturday, 31. January 2009, 09:23:50 (edited)

Alexandros1976

avatar

Posts: 4

Originally posted by Stoen:

Originally posted by Alexandros1976:

The problem is that I need to do it every time I go to a new page. Is there a method to have these words constantly highlighted in every page that I visit?


Are you familiar with Regular Expressions? I have modified the script so you can add entries into the searchEngines array to achieve what you want but it might be a bit complicated if you dont know about Regular Expressions. The format is
[8,'siteLocationRegExp',,'searchTerm1 searchTerm2']

Where siteLocationRegExp is a regular expression that will match the URL for the sites you want highlighted



Thank you once again. Unfortunately, I don't have the slightest idea what regular expressions are.

Originally posted by Stoen:

A simpler, but less flexible method is to use the following code

document.addEventListener('DOMContentLoaded',function() {
  if( !opera.USH ) { return; }
  // Uncomment following line to highlight on all pages
  //opera.USH.query = 'term1 term2';
  if( false ) {}
  // modify following line to highlight on a specific site only
  else if( location == 'http://www.somesite.com/' ) {
    opera.USH.query = 'term1 term2';
  }
},false);


I have modified the preferences file to include this code, you just need to modify it to your needs

v1.44
http://files.myopera.com/Stoen/uhb/highlighter.js

http://files.myopera.com/Stoen/uhb/highlighter-preferences.js (updated)



I downloaded highlighter-preferences.js and changed the code to:

document.addEventListener('DOMContentLoaded',function() {
  if( !opera.USH ) { return; }
  // Uncomment following line to highlight on all pages
  opera.USH.query = 'opera javascript great script';
  if( false ) {}
  // modify following line to highlight on a specific site only
  //else if( location == 'http://www.somesite.com/' ) {
   // opera.USH.query = 'term1 term2';
  }
},false);


In order to have the words opera javascript great script highlighted in every site that I visit. Unfortunately, nothing happens. The script is not working :cry:

What am I doing wrong?

Saturday, 31. January 2009, 11:35:36 (edited)

Stoen

avatar

Posts: 1109

Ok lets start again.

v1.44
http://files.myopera.com/Stoen/uhb/highlighter.js

http://files.myopera.com/Stoen/uhb/highlighter-preferences.js (Optional) (Updated to remove site specific highlighting code)
http://files.myopera.com/Stoen/uhb/highlighter-siteSpecificHighlights.js (Optional) (Needs to be modified)

The main script file, highlighter.js, is mandatory. Nothing will work without this file.

The preferences file, highlighter-preferences.js, is optional, if you are not going to change any of the script's settings then you dont need it.

I have removed the code to highlight a specific site only from the preferences file and moved it to a new file highlighter-siteSpecificHighlights.js. You need to download this file in addition to highlighter.js and modify it to meet your own needs.

When enabling User JS in Opera's preferences you need to select the folder where you have saved all your User JS files, and not the individual files themselves. This way you can use multiple files.

Using your previous example you would modify highlighter-siteSpecificHighlights.js as follows:
// Code to have the script programmatically highlight a page
document.addEventListener('DOMContentLoaded',function() {
  if( !opera.USH ) { return; }

  // Uncomment the following line (remove "//") to highlight on all pages
  //opera.USH.query = 'term1 term2';
  
  var loc = location.toString();
  if(false){}
  
  // Uncomment the following 3 lines (remove "//") and modify to highlight on a site whose URL starts with the specified text
  else if( loc.indexOf('http://www.abcd.net') == 0 ) {
    opera.USH.query = 'opera highlighter ultimate';
  }

  // Uncomment the following 3 lines (remove "//") and modify to highlight on a site whose URL contains the specified text
  //else if( loc.indexOf('index.html') > -1 ) {
  // opera.USH.query = 'term1 term2';
  //}

  // Uncomment the following 3 lines (remove "//") and modify to highlight on a site whose URL exactly equals the specified text
  //else if( loc == 'http://www.site2.com' ) {
  //  opera.USH.query = 'term1 term2';
  //}
},false);

Saturday, 31. January 2009, 11:58:41

Alexandros1976

avatar

Posts: 4

PERFECT:D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D

This script is awesome. Thank you so much for your help!!!!

You can't even imagine how much time this saves!!!!

I really appreciate it!

Thank you, thank you, thank you!!!!

Sunday, 8. February 2009, 18:52:42

vinczej

Az Internet zenéje

avatar

Posts: 2256

Hungary

A stupid question: How can I put onto my toolbar the Highlighter button?

I saved the highlighter 1.44 into my User.JS directory. And now if I search on Google, on the opened page from results gives me Highlighter toolbar next below to address bar. It works awfully. :up: But I can't activate it individually. :frown: I followed the instructions in the .js file, but in the address bar I have only an error message.

How can I make a button to call the function by button?:cry:

Monday, 9. February 2009, 23:10:13

NlCe

avatar

Posts: 2

Germany

I have similar problems as the above poster. The button for 'existing search field' opens a new tab using my first search engine instead of highlighting. I also tried adding it to the popup menu and to the 'on demand' user stylesheets, but none of them work. Clicking them doesn't do anything. I get following error message in the Error Console though:

JavaScript - http://my.opera.com/community/forums/topic.dml?id=149014&abc=&page=7&skip=300&show=&perscreen=50
Javascript URL thread: "javascript:(function(){UserJS_USH.check = window.getSelection().toString(); UserJS_USH(null,'new',U..."
Error:
name: ReferenceError
message: Statement on line 1: Undefined variable: UserJS_USH
Backtrace:
  Line 1 of unknown script 
    function(){UserJS_USH.check = window.getSelection().toString(); UserJS_USH(null,'new',UserJS_USH.check);}
  Line 1 of unknown script 
    (function(){UserJS_USH.check = window.getSelection().toString(); UserJS_USH(null,'new',UserJS_USH.check);})()
stacktrace: n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'


I second the suggestion of a button to activate/deactivate it, that would be nice. It currently only works for me with adding "##'search items' " to the url, this needs refreshing of a loaded page (when added afterwards) though, which isn't always possible.

I hope this doesn't sound too much like negative crticism, because the script is really great, good job on it. It's just that a button to show/hide the highlight toolbar would make it perfect. :smile:

Saturday, 14. February 2009, 12:58:53

Hi I have install the latest js for the highlighter and the http://files.myopera.com/Stoen/uhb/highlighter-siteSpecificHighlights.js . I have set opera to see the javascript files under Advanced-Content-Java script options, restarted opera installed the button but I am unable to highlight any text.

What have I not done that I should have please ???

Saturday, 14. February 2009, 14:57:16

Stoen

avatar

Posts: 1109

@vinczej & NlCe:

Button that uses an existing search field (currently kinda broken due to Opera bug that messes up custom search fields):
USH

USH specific search field:
USH

Button to activate the script:
USH

Originally posted by John164:

but I am unable to highlight any text.


How are you trying to highlight text? The script should work automatically based on Google search results. If you are trying to manually highlight stuff, try one of the buttons above.

Saturday, 14. February 2009, 15:08:55

vinczej

Az Internet zenéje

avatar

Posts: 2256

Hungary

Thanks, Stoen!

The third USH button works fine! :up:

Sunday, 15. February 2009, 10:24:36

NlCe

avatar

Posts: 2

Germany

Awesome! :up: Thanks a lot Stoen, highly appreciated! :smile:

Tuesday, 10. March 2009, 23:57:13

Arnt

avatar

Posts: 656

Norway

This script was awesome..! Thank you! :yes:

Sunday, 22. March 2009, 23:11:09

skvalen

avatar

Posts: 11

Norway

Please update first post/top post, it has several errors: the Right click code i wrong, the search engine code is wrong and possibly more. Not every (ie me) reads the info in the js-file, and the problems piles up. But it is a awesome script :smile:, best not to ruined by bad information.

Forums » Opera Community » General Opera topics » User JavaScript