Monday, 29. May 2006, 13:54:36
View selection source
Hello,I have another User JS
http://www.webkitchen.cz/lab/opera/get-selection-source1.png (76 KB)
http://www.webkitchen.cz/lab/opera/get-selection-source2.png (66 KB)
Script is here:
http://www.webkitchen.cz/lab/opera/get-selection-source.js
I recommend add this entry to "Hotclick Popup Menu" in your menu settings.
Item, "View selection source"="Go to page, "javascript:opera.getSelectionSource()""
You can choose from 3 color schemes and easily write your own one. It works only with 9TP1+ because it uses window.getSelection().
Thursday, 6. July 2006, 20:31:50
Saturday, 15. July 2006, 01:43:04
Nice, is it possible you could make it a pure bookmarklet?
Of course, but after I finish it, there is still one minor bug (see TODO in source).
And highlight the selected text parts in yellow if possible?
Now it's updated, what's new?
- in opened window is selected the same text
- works in XML pages
- works correctly in nested frames
- highlights CDATA
Actual screenshot (I like the desert scheme
http://www.webkitchen.cz/lab/opera/get-selection-source-0.5.png (66 KB)
Download version 0.5:
http://www.webkitchen.cz/lab/opera/get-selection-source.js
Friday, 1. September 2006, 15:19:02
you can created an userJS with 'word density' function of mozilla FF?
Thanks !
Excuse for my bad Englesh...
Saturday, 16. September 2006, 14:03:29
I have tranlate the use of your good script for user on Italian Community
http://www.operazone.it/forum/viewtopic.php?p=3366#3366
Friday, 29. September 2006, 07:17:34
do you have paypal account for donations?
Thursday, 5. October 2006, 23:09:27
Nexus009:
I have tranlate the use of your good script for user on Italian Community
Thank you
intravenous:
Great! Thanks a lot, jkb! it's one of the several features i was missing in opera - view selection source.
do you have paypal account for donations?![]()
Damn I haven't!
alexas:
Wish it also could work with images.
I don't know what you mean, can you explain it, please?
I added there support for word wrap (white-space: pre-wrap). Default is it off, you can toggle it via 'v' key. The shortcut is configurable (toggleWrapKeyCode option).
Version 0.6
Saturday, 14. October 2006, 00:55:59
shoust:
Nice, is it possible you could make it a pure bookmarklet?
Bookmarklet version is ready:
http://www.webkitchen.cz/lab/opera/get-selection-source-bookmarklet.js.txt
Saturday, 14. October 2006, 11:11:10
Which version of Opera do you have? Requirement is to have at least version 9TP1.
Here is version for direct use in Opera's menu:
http://www.webkitchen.cz/lab/opera/get-selection-source-menu-item.js.txt
Saturday, 14. October 2006, 12:03:16
Originally posted by jkb:
See my sig...Which version of Opera do you have? Requirement is to have at least version 9TP1.
I tried also your user.js versions 0.5 and 0.6, with the 'Hotlick popup menu' entry, and I managed to see it once, the next time it crashed again, both with v0.5.
I made a screenshot from the crash, unfortunately I didn't make one from the successful try.
But what I've seen there was an illegal character in the title, illegal because it had been replaced by some 'BlackSpace' placeholder, it replaced the character 'e' in the last word 'source'...
Funny to see also, the title of the display (console) pop-up window is changed to the title of the page with the selected text one is evaluating. M/B this is a hint.
See here:
View Selection Source Crash
Saturday, 14. October 2006, 13:25:25 (edited)
I finally succeeded to make it work, there must be a problem with other user.js files I am using.
I removed all of them and now 'get-selection-source.js' being the only one left is working fine. Also the menu item version from your last post is behaving well...
Proof:
View Selection Source with Bookmarklet Version
View Selection Source with Menu Item Version
When I get some more time I will dig further into it, M/B.
The list of my user.js I have on, normally:
add-alt-text.js
autosizer.js
highlighter.js
link-alert.js
noclicktoactivate.js
operapedia.js
robosticky.js
vfpO8.js
xml-tree.user.js
just in case you would like trying to reproduce it.
To make it somewhat easier for you I zipped them altogether into:
My 'user.js' files
Plus your version 0.6 for sure.
Thanks a lot for your good work!
Saturday, 14. October 2006, 14:23:30 (edited)
Saturday, 14. October 2006, 15:25:12
Originally posted by philry4n:
the menu item needs no clicking of a popup item whatsoever...when i click the popup item it doesn't do anything
Just choose the menu entry after you have selected some parts of contents from the actual page, for sure.
See my screenshots!
BTW, did you observe my remarks about the user.js problematics?
Monday, 16. October 2006, 09:29:02
Originally posted by saito:
What do you mean with renamed?Renamed .js
AFAIK the name of a user.js is irrelevant, it's included into OPERA's workspace if it only exists in OPERA's user.js directory to which OPERA is set.
Please correct me if I'm wrong.
Thursday, 19. October 2006, 01:22:52
Originally posted by HaJotKE:
Originally posted by saito:
What do you mean with renamed?Renamed .js
AFAIK the name of a user.js is irrelevant, it's included into OPERA's workspace if it only exists in OPERA's user.js directory to which OPERA is set.
I had a trouble at GMail, so temporarily rename this.js to this.jsBAK, to disable it.
As for GMail issue, after disabling view_selection_source, still I have random abortion of Opera, so I think this script might not be guilty. Google sometimes changes their codes without notices, though I don't know if this is the case or not. Some of my friends Opera users don't have any troubles at GMail, but I can't separate the real cause of trouble, for it's a mass of scripts.
Friday, 20. October 2006, 16:26:28
You mustn't download this as a user.js, it has to be copied into the address field of the address bar of your bookmark, that's why it's called a 'bookmarklet', and then calling this bookmark activates said Javascript bookmarklet for your active page!
And don't put it into your user.js folder, this can lead to some unexpected behavior of OPERA!
Bookmarklets are only appearing in the address fields of bookmarks.
Friday, 20. October 2006, 16:36:59
Originally posted by philry4n:
i mean how to implement this userjs, i've already download it to my userjs folder, bookmarked it, now what?
There are three ways how to use it:
- UserJS called from menu
Download the UserJS file into your UserJS directory. Open your ini file with menus definition and find section '[Hotclick Popup Menu]'. Append there this item:Item, "View selection source"="Go to page, "javascript:opera.getSelectionSource()""
Finally this section will looks similar to this:[Hotclick Popup Menu] Item, 50872=Copy Item, 67652=Copy to note Feature Voice, Item, 70494=Speak selection Platform Mac, Item, 70494=Speak selection --------------------1 Item, 65184=Hotclick search, 200 ;Submenu, 291920, Search with menu Submenu, 291920, Internal Search With Item, 65187=Hotclick search, 50 Item, 65188=Hotclick search, 51 --------------------2 Submenu, 291960, Translate menu ;Item, 65186=Hotclick search, 52 --------------------3 Item, 67394=Go to page, "%t" Item, 65218=Send text in mail. --------------------4 Item, "View selection source"="Go to page, "javascript:opera.getSelectionSource()""
The result is that you can choose a color scheme of the source display (you must edit the JS file) and some other things. Usage will be the same like in Firefox.
- Bookmarklet in menu definition
This is very similar to the previous variant, but you don't need the JS file, just add whole code to the menu ini file. Here is prepared item for usage in the menu:
http://www.webkitchen.cz/lab/opera/get-selection-source-menu-item.js.txt
- Classical bookmarklet
The simplest way. You just create new bookmark and in the 'Address field' insert the whole JS code [screenshot]. When you want to use it, click on the bookmark item in Opera's 'Bookmarks' panel. The code for this usage is here:
http://www.webkitchen.cz/lab/opera/get-selection-source-bookmarklet.js.txt
// sorry for my bad English
Thursday, 9. November 2006, 10:23:30
Originally posted by pih poh:
What I do in such a case is: printing it!But how about copy selection source? Can it be done?
I have an 'Adobe Writer' printer driver installed - still version 4 only, alas! Would love to have V5/6/7? - and printing to it gives just clean and neat web - snippets!
W/O images however, which are not included in 'get-selection-source'...
Tuesday, 21. November 2006, 20:48:32
Although, with your instructions above, you might like to suggest what to do if the user doesn't have a "menu definition" specified. I know I don't have a path specified on both my home and work PC.
Wednesday, 22. November 2006, 04:50:53
Originally posted by jkb:
Script is here: http://www.webkitchen.cz/lab/opera/get-selection-source.jsI recommend add this entry to "Hotclick Popup Menu" in your menu settings.Item, "View selection source"="Go to page, "javascript:opera.getSelectionSource()""
Thanx for this script, installed on latest weekly build and all seems to works fine.
Friday, 8. December 2006, 17:58:02
Originally posted by drworm:
Although, with your instructions above, you might like to suggest what to do if the user doesn't have a "menu definition" specified. I know I don't have a path specified on both my home and work PC.
I created web page with instructions, hope it helps:
http://www.webkitchen.cz/lab/opera/view-selection-source/
Sunday, 4. November 2007, 23:06:20
I'm curious, is it possible that a variation of this script could be created to copy the source to the clipboard (rather than just viewing it). Some software, such as Evernote, take advantage the HTML information when copying content from a webpage, but Opera is the only browser (I know of) that doesn't allow copying of HTML code. This script might be a useful alternative.
Monday, 5. November 2007, 19:21:50 (edited)
Forums » Opera Community » General Opera topics » User JavaScript