21 July, 2013

How to use JavaScript gestures with JavaScript turned off. Open link with no URL referrer from the right click menu

How to use JavaScript gestures, shortcuts or buttons with JavaScript turned off

If you use the browser with JavaScript turned off (for security and privacy reasons), you can still use JavaScript gestures, shortcuts or buttons. You have to simply add this code before and after the original code:

Enable javascript & Delay, 10 & /before/
& Delay, 100 & Disable javascript /after/


Open link with no URL referrer from the right click menu

In order to open a link with no URL referrer from the right click menu, you have to add this code to menu.ini under [Link Popup Menu]

[Link Popup Menu]
Item, Open link with no referrer ="Go to page, "%l""



Other useful changes to menu.ini




1. Under [Hotclick Popup Menu], [Link Selection Popup Menu], [Edit Widget Popup Menu], you can add this code to have a 'search Google in new page' option in the right click menu (if you don't want to use modifier keys for that: Ctrl +Shift)
NOTE: For international characters encoding should be used: encodeURI()

Item, Search in New Tab=Copy & New Page & Go to page, "http://www.google.com/search?q=%c&num=%i&sourceid=opera" & Minimize page


or

Item, Search in New Tab="Enable javascript, , , ,"Search Web" & Delay, 10 & Go to page,"javascript:(function(){var sel=window.getSelection().getRangeAt(0);var url='http://www.google.com/search?q=' + encodeURI(sel) + '&num=%i';  window.open(url, '_blank')})()""


or search in a new background tab with support for international characters (Unicode)

Item, Search in New Tab="Enable javascript, , , ,"Search Web" & Delay, 10 & Go to page,"javascript:(function(){var sel=window.getSelection().getRangeAt(0);var url='http://www.google.com/search?q='+ encodeURI(sel) +'&num=%i';var a = document.createElement('a');a.href = url;var evt = document.createEvent('MouseEvents'); evt.initMouseEvent('click', true, true, window,0, 0, 0, 0, 0,true, false, true, false, 0, null);a.dispatchEvent(evt);})()"


or search Google.pl in a new tab

Item, Search Google.pl="Enable javascript, , , ,"Search Web" & Delay, 10 & Go to page,"javascript:(function(){var sel=window.getSelection().getRangeAt(0); var url= 'http://www.google.pl/search?num=50&hl=pl&lr=lang_pl&as_qdr=all&tbs=lr%3Alang_1pl&q=' + encodeURI(sel) + '&btnG=Szukaj'; window.open(url, '_blank')})()""


or search Google.pl a new background tab with support for international characters

Item, Search Google.pl="Enable javascript, , , ,"Search Web" & Delay, 10 & Go to page,"javascript:(function(){var sel=window.getSelection().getRangeAt(0);var url= 'http://www.google.pl/search?num=50&hl=pl&lr=lang_pl&as_qdr=all&tbs=lr%3Alang_1pl&q='+ encodeURI(sel) +'&btnG=Szukaj'; var a = document.createElement('a');a.href = url;var evt = document.createEvent('MouseEvents'); evt.initMouseEvent('click', true, true, window,0, 0, 0, 0, 0,true, false, true, false, 0, null);a.dispatchEvent(evt);})()"



2. To have a 'go to the selected web address (URL)' option in the right click menu, add this under [Hotclick Popup Menu],.

Item, Go to Address in New Tab=Copy & New Page & Go to page, "%c" & Minimize page[/COLOR]



3. In order to add Google Translate to the right click menu, add this code under [Hotclick Popup Menu]

Item, Google Translate="Go to page, "http://translate.google.com/#auto|en|%t", , , "Mail Compose Strikethrough""


For other languages change "en" for your language code (for instance "fr", "pl")

4. Search Google News under [Link Popup Menu]:

Item, Search News=Copy & New Page & Go to page, "http://www.google.com/search?client=opera&rls=en&q=%c&um=1&ie=UTF-8&tbo=u&tbm=nws&source=og&sa=N&hl=en&tab=wn&biw=1280&bih=652&cad=cbv" & Minimize page


or

Item, Search News="Enable javascript, , , ,"Mail Compose Center" & Delay, 10 & Go to page,"javascript:(function(){var sel=window.getSelection().getRangeAt(0); var url='http://www.google.com/search?hl=en&gl=us&tbm=nws&q=' + encodeURI(sel) ; window.open(url, '_blank')})()""




To make those changes, you need to go to Preferences/Advanced/Toolbars/Menu setup and click duplicate "Opera standard" menu (if you don't have it already duplicated), then select the copy and press OK. Then go to %appdata%\Opera\Opera\menu\ and open standard_menu (1).ini with Notepad. Search for those entries (like [Hotclick Popup Menu]) and add the code in the intended order (you can go to Tamil blog for some helpful screens).

Semicolon (;) added before the line makes Opera ignore the whole line, so there is no need to delete the line you don't need. You can always bring it back later by deleting ";".

No comments:

Post a Comment