Thursday, 13. July 2006, 14:45:29
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
Thursday, 13. July 2006, 16:32:54 (edited)
Friday, 14. July 2006, 07:08:59
Fixed removing Stop Words at the wrong time
Enabled RegExp by default
Added option to only highlight whole words. Enabled by default
Added check to make sure search string is valid. If the Search field is empty or if the search string contains text from non Search fields (the URL of the current page or "100%" from the Zoom field) then the script wont use the clipboard content.
highlighter.js
Menu entry:
Item, "Highlight"="Go to page, "javascript:(function(){UserJS_USH.check = window.getSelection().toString(); UserJS_USH(null,'new',UserJS_USH.check);})()""
Search engine:
javascript:UserJS_USH.check = '%s'; UserJS_USH(null,'new',UserJS_USH.check);
Search button:
button
Better search button that uses clipboard and uses RegExp on hold
button
Also updated file, buttons, search and menu entries in the first post.
Saturday, 15. July 2006, 10:36:58
Check this out, add this strings to the end of gotoHighlight function!
var selectNode=function (n) {
var p=n.parentNode;
var i=0;
var e=n;
while(e=e.previousSibling) i++;
var s=window.getSelection();
s.removeAllRanges();
var r=document.createRange();
r.setStart(p,i);
r.setEnd(p,i+1);
s.addRange(r);
};
selectNode(document.getElementById('UserJS-USH-'+here+'_'+term[2]));
Saturday, 15. July 2006, 13:09:43
First: Very awesome script - nice work!
I'm using advanced search functions at google. I saw, that the handling of "+" is already implemented - and works fine.
Can you implement, that for example "+Hello|Goodbye" gives you the two words "Hello" and "Goodbye" (the pipe should be handled as separator...)
Thanks.
Mike
Saturday, 15. July 2006, 16:11:24 (edited)
Originally posted by profiT:
I was working on similar script, but Stoen was first to publish
Originally posted by profiT:
Feel free to request or contributeexcept one or two features
Originally posted by profiT:
If I understand the code cant you just dofound items' selection
var n = document.getElementById('UserJS-USH-'+here+'_'+term[2]),
s = window.getSelection(), r = document.createRange();
s.removeAllRanges(); r.setStart(n,0); r.setEnd(n,1); s.addRange(r);
I added the above to the script, but will probably make it optional because of annoyances that can occur due to Opera's double and triple click behaviourOriginally posted by Tyanah:
Can you elaborate on what you want to happen in terms of resetting the current search?Is it possible to add a function to reset the current search without typing another search to clean the previous one ?
Originally posted by d.i.z.:
Well in that case I went overboard.I would prefer just remove. Maybe other shortcuts for toggling but I'm not that much of a keyboard user so don't ask me.
Shortcuts are as follows:
` (the key commonly found next to the 1/! key) toggles all shortcuts, ie. none of the following will work unless you press ` once and any Opera shortcuts normally assigned to the following wont work until you press ` again 1-9 acts like clicking on one of the first nine search terms - (minus) acts like clicking on the "New" button = (equals) acts like clicking on the "Toggle" button \ (backslash) acts like clicking on the "Close" buttonJust like shift clicking, shift pressing also works (in case you didnt know shift clicking on the caption buttons applies that action to all frames)
All these keys, except 1-9 are customisable
keyShortcuts = ['`', // The toggle key. Enables or disables the other shortcuts. Search terms are 1-9
'-_', // The key for the 'New' button
'=+', // The key for the 'Toggle' button
'\\|']; // The key for the 'Close' button
The toggle key only accepts one key, the others may require two keys if the key has an alternate shift character. To change to a non printable character use hex encoding, so ESC would be '\x1B'. I may not have explained this well...Originally posted by Big_Mike:
I added it to the seperators, but it may require additional handling... I havent tested it, so let me know how it worksthe pipe should be handled as separator...
v1.02
Added keyboard shortcuts
Added ability to automatically create a selection from a search term
Added "|" to the list of non RegExp special characters
http://my.opera.com/Stoen/homes/uhb/highlighter.js
Edit: If you downloaded the above file before this edit please re-download, the file had a small but vital omission
Saturday, 15. July 2006, 16:44:05
Originally posted by Stoen:
I added it to the seperators, but it may require additional handling... I havent tested it, so let me know how it works
Hm, at the moment, I can only say: like expected - thank you!
But I'll report any further problems...
A second thing:
Would you be so kind and replace strings in messages and hints by variables and put them on top.
So it'll be much easier to translate the script after an update, because you mustn't look through the whole code.
Saturday, 15. July 2006, 17:42:03
Originally posted by Stoen:
Shortcuts are as follows:
I can't use it that way. Mostly because my special keyboard driver triggers this '`' character only every second press (to allow for inserting some special characters the same way that you have showed here. So it collides with your script).
I could use some other key, but to tell the truth I don't like the 'two keys' approach.
I've applied some dirty workaround to allow for simple ESC press, to remove the highlighting.
BTW. I must say that figuring out how to implement this hack, took me quite a lot of time. Thanks to your advanced key handling technique
Saturday, 15. July 2006, 22:46:49 (edited)
Really great srcipt !
Thank you !!
Just one little question, how to make ESC (remove search highlights) work on a non English keyboard layout ?
edit 1:
I tried ESC set to '\x1B', but to no avail here, unfortunately.
edit 2:
@Luchio
Alternatively, I'm using UHB 2.0 on #8533 without any worries here.
(firstly it is small size & secondly no system slow downs while using it on a site in question and thirdly this script seems to be recourse friendly to Opera and less "intrusive" than UHB 2.5 and highlight 1.02 at my end).
------
edit 3:
personal remark:
I'm using Opera both in business and private (actually, biz: 7730, private: 8533).
Searching the internet or any sites on my screen is quite important for me and our business.
I am aware comparing those UHBs resp highlight scripts might be a question of taste and personal feelings.
Highlight search either in a web site or in a search result of any search engine as such is a feature Opera is missing IMHO.
Many thanks to Luchio and Stoen to give as such king of alternative and opportunities!
Sunday, 16. July 2006, 07:51:46 (edited)
Fixed bug with highlighting whole words only
(Hopefully) Fixed inconsistencies with how "|" and "-" are handled by Google. Let me know if there are further inconsistencies
Fixed misc errors
Changed usage of strings for easy translation
Changed keyboard shortcuts toggle to occur before check for keyboard commands
http://my.opera.com/Stoen/homes/uhb/highlighter.js
Originally posted by Big_Mike:
Would you be so kind and replace strings in messages and hints by variables and put them on top.So it'll be much easier to translate the script after an update, because you mustn't look through the whole code.
Done
Originally posted by d.i.z.:
I don't like the 'two keys' approach.I've applied some dirty workaround to allow for simple ESC press, to remove the highlighting.
Because of this change
Changed keyboard shortcuts toggle to occur before check for keyboard commands
you can set the toggle key to be the same as the close key and it should work as you want.
Originally posted by d.i.z.:
BTW. I must say that figuring out how to implement this hack, took me quite a lot of time. Thanks to your advanced key handling technique
I only did it that way because I am lazy and didnt want to change the rest of the code
Originally posted by idleskitter:
Just one little question, how to make ESC (remove search highlights) work on a non English keyboard layout ?Would ESC be like '\x1B', and would be the appropriate place to insert it just underneath line 27 (section: keyShortcuts =) of version 1.02 ?
I am not sure if it is any different for non English keyboard layouts, but I dont think it is. "\x1B" is equivalent to ESC and if you want to use ESC for one of the keys you would replace the current keyboard shortcut. Say for example you wanted to make ESC act as "Close" you would replace
'\\|']; // The key for the 'Close' button
with
'\x1B']; // The key for the 'Close' button
If, like diz, you only want the ESC shortcut you would also change the toggle key, replacing
keyShortcuts = ['`', // The toggle key. Enables or disables the other shortcuts. Search terms are 1-9
with
keyShortcuts = ['\x1B', // The toggle key. Enables or disables the other shortcuts. Search terms are 1-9
Edit: If you downloaded the above file before this edit please re-download, the file had a small but vital omission
Sunday, 16. July 2006, 08:07:53 (edited)
It seems that I am either sort of brain dead, dull or just to stupid ... I am stuck. Can not find the mistake I'm sitting on obviously. I am pretty sure that I'm missing something obvious at the moment ... my fault ... I'm blind
I know hex-code ... I tried both ways you mentioned, i.e. one try replacing the key just for "close" the other try with replacing just the toggle key, no go here (as a side note: '\x1B' replacing with '\u001B' has no effect either).
Maybe this is a question of how Opera is interpreting RegExp as such resp. how Opera has userJS's like highlight.js in her mind while focusing a page in question.
My intention is to make highlight stop with ESC like pushing the close button on far right hand side.
edit:
However and nevertheless no worries, Stoen, your script (version 1.03 & corresponding CSS resp userCSS etc) works fine with my mouse here
Sunday, 16. July 2006, 08:38:44
Originally posted by idleskitter:
one try replacing the key just for "close"
This will mean you have to press the key toggle then ESC to close
Originally posted by idleskitter:
the other try with replacing just the toggle key
This will mean the ley toggle is now ESC and you will have to press "\" or "|" to close
From what you said it sounds like what you want is to make both the key toggle and the close key "\x1B" as follows
keyShortcuts = ['\x1B', // The toggle key. Enables or disables the other shortcuts. Search terms are 1-9
'-_', // The key for the 'New' button
'=+', // The key for the 'Toggle' button
'\x1B'];// The key for the 'Close' button
Apologies if you have already tried this. If that all doesnt work add the following as a UserJS. It will output the string you need to use, just press ESC (or any other key)
window.addEventListener('keypress',function(e) {
var key = "0123456789ABCDEF", dec = e.keyCode, hex = '';
while( dec >= 0 ) {
hex = key.substr(dec&15,1) + hex;
if( !(dec = dec >> 4) ) { alert('\\x'+hex); break; }
}
},false);
Sunday, 16. July 2006, 09:34:15
Originally posted by Stoen:
From what you said it sounds like what you want is to make both the key toggle and the close key "\x1B" as follows
My fault, please take my apologies as my language skilles aren't sufficient, sorry.
My intention was just to make highlight.js stop/ quit with ESC like pushing the close button coming up at top right hand side while highlight script is on.
Example: See your own screenshot of your first post, I mean the "X" button like "close" underneath "zoom = 100 %" drop-down menu placed at top right of your screenshot.
Nevermind, it's ok the script works fine with my non English mouse, thank you.
Sorry for causing trouble and making noise, thanks.
Monday, 17. July 2006, 14:30:46
Serching text "Сообщается, что оба пилота остались живы."
Find results:
In v1.01 script - http://img391.imageshack.us/img391/4677/uhbbug101nw8.png (first & latest word)
In v1.04 script - http://img391.imageshack.us/img391/1991/uhbbug104uj4.png (all words!)
Monday, 17. July 2006, 15:37:40
I googled for "Сообщается, что оба пилота остались живы."
and got this search page http://www.google.com.au/search?client=opera&rls=en&q=%D0%A1%D0%BE%D0%BE%D0%B1%D1%89%D0%B0%D0%B5%D1%82%D1%81%D1%8F,+%D1%87%D1%82%D0%BE+%D0%BE%D0%B1%D0%B0+%D0%BF%D0%B8%D0%BB%D0%BE%D1%82%D0%B0+%D0%BE%D1%81%D1%82%D0%B0%D0%BB%D0%B8%D1%81%D1%8C+%D0%B6%D0%B8%D0%B2%D1%8B&sourceid=opera&ie=utf-8&oe=utf-8&safe=off
Clicking the first result leads me to http://www.lenta.ru/news/2006/07/13/copter/ which seems to be the same page as the one you took a screenshot of, is it?
The google highlight in this case works fine here. Right click > highlight also works fine here. The first search button in the first post results in rubbish (but thats another problem, I thought Opera was supposed to be able to handle international characters in the search box...) The second search button in the first post also works fine. Also, highlighting the aforementioned text in this thread works fine. So basically I have no idea. Does anyone else have the same problem?
Can you try it with other UserJS disabled?
Monday, 17. July 2006, 16:53:46
Originally posted by Stoen:
Can you try it with other UserJS disabled?
Try - result the same
Monday, 17. July 2006, 17:19:33
@DimiON - The problem occurs because the Russian characters are not being matched as word characters (\w) in the RegExp. Because of this the word boundary (\b) matching is not working either. I really dont know how to fix this, does anyone know if it is an Opera bug? I will try to figure out a workaround. In the meantime please change
wholeWordsOnly = true,// Only highlight whole words
in the script to
wholeWordsOnly = false,// Only highlight whole words
Monday, 17. July 2006, 17:44:54
Originally posted by Stoen:
@DimiON - The problem occurs because the Russian characters are not being matched as word characters (\w) in the RegExp. Because of this the word boundary (\b) matching is not working either. I really dont know how to fix this, does anyone know if it is an Opera bug? I will try to figure out a workaround. In the meantime please change
wholeWordsOnly = true,// Only highlight whole words
in the script towholeWordsOnly = false,// Only highlight whole words
...
Eternal problems with this cyrillics!
Changed!
Wednesday, 19. July 2006, 01:28:31
Originally posted by d.i.z.:
I succeeded by setting BOTH the toggle key, and the close key to '\x1B'. Weird that it does not work for you.
Hmm, no clue what could be wrong at my end either
Tried settings [using highlighter v1.05), but to no avail:
keyShortcuts = ['\x1B', // The toggle key. Enables or disables the other shortcuts. Search terms are 1-9
'-_', // The key for the 'New' button
'=+', // The key for the 'Toggle' button
'\x1B'];// The key for the 'Close' button
Well, stupid question, could it have something to do with general cookies settings, I set opera:config#UserPrefs|EnableCookies to 1?
Wednesday, 19. July 2006, 04:46:24 (edited)
Version 1.04 & 1.05
Fixed bugs with key handling. There is one remaining problem, the INSERT, DEL, HOME, END, PGUP and PGDWN keys will trigger some of the keyboard shortcuts. Unfortunately I cant do too much about it so just bear this in mind.
Added ability to toggle individual search term highlight by CTRL clicking a search term button
Added ability to toggle toolbar visibility with the 0 (zero) key
Added ability to SHIFT CTRL click on caption buttons to apply that action to all frames except the current
Cleaned up code
Version 1.06
Changed individual search term highlight toggle to be click and holding on a search term button
Changed moving to the previously highlighted term to CTRL clicking
Changed selecting of search term to be enabled by SHIFT clicking to try to minimise problem caused by rapid clicking triggering the HotClick menu
Introduced alternate method of highlighting whole words only for use with non ASCII characters. Available as a seperate file because I dont know if what I did is actually correct, but it seems to work. Let me know if it doesnt. Alternatively just set wholeWordsOnly to false
Fixed misc bugs and cleaned up code
Fixed security error
http://my.opera.com/Stoen/homes/uhb/highlighter.js
http://my.opera.com/Stoen/homes/uhb/highlighter_u.js (Unicode hack version)
Wednesday, 19. July 2006, 06:16:20
There is a small problem with your Js: if a dark skin is in use you cannot see the amount of hits in the toolbar because of the black font. I understand absolutely nothing about Js, but perhaps it is possible to take the font color from the toolbar or perhaps the numbers have to appear inside the highlighted areas...
tomu
ttt-skins -drag&drop buttons- wallpapers
Wednesday, 19. July 2006, 07:34:02
It is possible to get the colour from the used skin however the problem is that some skins dont specify the "Text Color" property. When this happens the resulting colour is also somewhat unreadable, possibly because the colour that is returned comes from the "Color" property. The other option is to use the colours as specified by your window manager, which most skins that dont specify "Text Color" rely on. But if you are using a dark Opera skin but your UI text colour is also dark then you get the same problem. Basically whichever option you use it is likely that it wont work in one case or the other.
You can of course change the colour to whatever you want, either in the script or in the seperate CSS depending on what you use.
Look for
#UserJS-USH-toolbar { height: auto !important; ...
and replace it with
#UserJS-USH-toolbar { color: SOMEVALUE !important; height: auto !important; ...
where SOMEVALUE can take a form as given by http://www.w3.org/TR/css3-color/#colorunits
Or you can get the colour from a skin element by using a value for SOMEVALUE as given by
-o-skin('SOME ELEMENT')
where 'SOME ELEMENT' could, for example, be 'Browser Window Skin'
Wednesday, 19. July 2006, 14:37:27
#UserJS-USH-toolbar { color: -o-skin('Browser Window Skin') !important; height: ...
works well in my case.
tomu
ttt-skins -drag&drop buttons- wallpapers
Wednesday, 19. July 2006, 22:08:29
I would also like to be able to append search terms to the words I have already highlighted, instead of reentering all my previous search terms. Possibly have an input field that I can edit the regular expression that was already in use? Thanks for your work in all of this!
Thursday, 20. July 2006, 00:04:23
Highlight.js quirk
Only appears in the skin TTT-Blue 5.8, but it's my fav
Thursday, 20. July 2006, 03:33:19
To make the toolbar permanent look for the following line in either the internal embedded CSS or external CSS file depending on which you use
#UserJS-USH-toolbar { height: auto...
and replace with
#UserJS-USH-toolbar { visibility: visible !important; height: auto...
The first caption button from the left opens a prompt allowing you to search for new terms. It is supposed to be pre filled with the current query but it is bugged atm. Will fix it
@Niddhogg
I'm not sure why but the
Tile Top= window/tile_top.png
in the [Browser Window Skin] section seems to cause this redraw error
As a workaround search for the following text in either the internal embedded CSS or external CSS file depending on which you use
'Browser window skin'
and replace with
'Navigationbar skin'
But it wont look as good...
@All
For anyone who modifies the CSS I would recommend you copy the contents of the external CSS to your user.css file so that your changes wont be lost if/when I update the script
Thursday, 20. July 2006, 03:59:54
Fixed problem with not saving current search terms
http://my.opera.com/Stoen/homes/uhb/highlighter.js
http://my.opera.com/Stoen/homes/uhb/highlighter_u.js
Thursday, 20. July 2006, 04:20:34
- Present a small input field in the toolbar, where one could type new words to search, instead of presenting a prompt window.
- Choose the position of the toolbar (up or down)
- Add a keyboard to toggle toolbar visibility (like Ctrl+F), or export a simple js function which could be added to the keyboard setup like "Go to page, "javascript:UserJSHighlightToolbarToggle();"
then the user press the shortcut, the toolbar pops up, he/she types something, presses enter, the words highlight, and also the selected words in go to the toolbar (like the current behaviour) which one can click.. bla bla bla, same behaviour as now.
Thursday, 20. July 2006, 05:12:28
Originally posted by xErath:
- Choose the position of the toolbar (up or down)
That can be done by editing the CSS. Change
#UserJS-USH-mouseover, #UserJS-USH-toolbar {position: fixed !important; top: 0 !important;...
to
#UserJS-USH-mouseover, #UserJS-USH-toolbar {position: fixed !important; bottom: 0 !important;...
and search for
border-width: 0 0 1px 0 !important;
and change it to
border-width: 1px 0 0 0 !important;
I take it from your other suggestions that you want to be able to call the script at anytime without having to use one of Opera's search fields so that it will create its own hideable search field, am I right?
The basic ability to do all of this is already present and changing from a prompt to a field could be done... I will see what I can do but the script was designed to work with Opera's search fields so adding this functionality may be a bit redundant
Btw the "0" (zero) key toggles toolbar visibility, but currently only when the toolbar has already been created.
Thursday, 20. July 2006, 12:55:12
Just now I updated the TTT-blue 5.8 skin (without changing the version number). The unsightly big bar with the Highglighter-Js was my fault
tomu
ttt-skins -drag&drop buttons- wallpapers
Friday, 21. July 2006, 03:22:35
Changed to include a search field in the toolbar so you can search in a similar manner to Opera's inline find. As a result I removed the prompt. A side effect of this is that the askForTerms options no longer exists (it was disabled by default anyway...) I also havent updated the external CSS so make sure embedStyle remains true
I still think it is a little redundant given that you can already search from any field in the Opera UI but it does have the advantage of not having to use the clipboard
Add this command to a keyboard shortcut or button
Go to page, "javascript:UserJS_USH.check=' ';UserJS_USH(null,'newBlank');",1
Let me know what you think (there will probably be bugs)
http://my.opera.com/Stoen/homes/uhb/highlighter_test.js
Friday, 21. July 2006, 12:35:13
Originally posted by Stoen:
Let me know what you think (there will probably be bugs)
http://my.opera.com/Stoen/homes/uhb/highlighter_test.js
Neat! very nicely done.
just one thing. I don't know whether or not it's possible but it would be even better if instead of the searchbox you got the little popup at the bottom of the page (same as when you press . to search) and have it search realtime.
EDIT: ran into a little buglet. When you refresh a tab, or go to a different adress in the same tab the shortcut just stops working.
And (not sure whether this is a bug or WAD) you can't perform two different searches on the same tab. If you've closed the first search with the cross button and then press the shortcut again to begin a different search the first search result pops up again.
Saturday, 22. July 2006, 06:20:48
Originally posted by Zotlan:
just one thing. I don't know whether or not it's possible but it would be even better if instead of the searchbox you got the little popup at the bottom of the page (same as when you press . to search) and have it search realtime.
I doubt I will do that, firstly I couldnt be bothered creating another input method (the search box is just a small change to the previous method) and secondly there is no way this script can run as fast as the internal search even if the INPUT event was delayed so that it didnt fire every time a letter is entered.
Edit: It was never meant to be a replacement for internal search but rather an addition to it. IMHO the best way to use this script is to put a search field on a toolbar, and enable Integrated Search then change the current find inline shortcut (or add a new one) to become "Find".
Originally posted by Zotlan:
ran into a little buglet. When you refresh a tab, or go to a different adress in the same tab the shortcut just stops working.And (not sure whether this is a bug or WAD) you can't perform two different searches on the same tab. If you've closed the first search with the cross button and then press the shortcut again to begin a different search the first search result pops up again.
I cant confirm any of these problems, the second issue you mentioned is not by design unless it picks up a search engine referrer but that is not applicable in this case since you are using a shortcut that bypasses the check for the referrer. Anyone else experiencing this?
Do you get any script errors in the error console when the shortcut stops working?
If you close the search then it wipes the cookies, so I dont know how it could redo the previous search. I may have made a mistake somewhere but I cant see it anywhere
Saturday, 22. July 2006, 11:24:05
Sunday, 23. July 2006, 05:21:06
There are a couple of ways to use the seperate css, the easiest being to edit the file shown in this config setting LocalCSSFile. Copy and paste the contents of ush.css into that file. If the file doesnt exist, create it. Note you can make a new file and just change the path in the previous link.
For another method see here
Monday, 24. July 2006, 13:05:33
Saved previous search terms in a dropdown for easy access. Searches, except for the most current, are not saved in cookies so they only last until the page is close or reloaded.
An empty search now shows a minimal toolbar
http://my.opera.com/Stoen/homes/uhb/highlighter.js ( Main script )
http://my.opera.com/Stoen/homes/uhb/highlighter_u.js ( Unicode hack version )
http://my.opera.com/Stoen/homes/uhb/ush.css ( External CSS )
Thursday, 27. July 2006, 12:27:09
Numerous bug fixes mostly related to operation in frames (security errors, saving search terms, keyboard shortcuts, etc.)
Fixed styles to avoid styling issues in QuirksMode
http://my.opera.com/Stoen/homes/uhb/highlighter.js ( Main script )
http://my.opera.com/Stoen/homes/uhb/highlighter_u.js ( Unicode hack version )
http://my.opera.com/Stoen/homes/uhb/ush.css ( External CSS )
Thursday, 27. July 2006, 17:22:06
document.addEventListener('DOMContentLoaded', function (e) {
if (location.href.match(/^http:\/\/www\.(?:pocketpccity|windowsmobiletoday)\.com\/software\/newest\d+\.html/)) {
UserJS_USH(null,'new',UserJS_USH.check = '"freeware"');
}
} ,false);I'd been using this code (in a separate UserJS file) to automatically highlight certain words on certain pages. At some point along the line it stopped working, and I've finally had the time to figure out why.e = (!e?window.event:e);
if( e && ( type = e.type ) ) {It appeared the fact that my call of UserJS_USH() was the result of an event (hence window.event apparently inheriting the DOMContentLoaded event) directed the code down a path where highlighting is never even attempted. It puzzled me why you were bothering with window.event on code that will never run in IE. So I commented out that line, and all worked fine; until I noticed that the keys worked less than fine.if ((window.event) && !(window.event.type == 'DOMContentLoaded')) {e = (!e?window.event:e); }I now have this in place. Perhaps you can come up with a more elegant solution (so that I don't have to remember to keep that change on every upgrade Showing topic replies 1 - 50 of 360.
Forums » Opera Community » General Opera topics » User JavaScript
