17 August, 2013

12 August, 2013

UserJS for Flickr: center the full size picture and kill the topbar


  This script centers the full size picture vertically (if the photo is bigger than the screen) and kills the topbar that obscures the view. It's triggered with a click on the page (except links).


05 August, 2013

Flickr old design. Greasemonkey Script for Firefox

  Flickr is not usable with the new design, which is, btw, an example of the epidemy of moronic blunders made by big internet/computer companies: from Microsoft's Windows 8 Metro interface (created for cats and monkeys playing with tablets) to Opera 15 (a browser without... bookmarks - lol).

  To get some of the old, normal usability of the Flickr website, you can add "?details=1" suffix to the profile address and "detail/" to the "set" view address. This script (which works also in old Opera) can be used to do it automatically. Install the script and and press the key "q" or "5" to get to the old design on "photostream" and "set" (sometimes you have to press the key twice or more times to get it quickly).
/Note: I changed the shortcuts from "f" and "3", because flickr uses "f" as "favorite" and 3 may be already taken in Opera , too)/
The script also allows to get to the bigger-size version of the pictures after pressing the same keys.
  Another script below does this automatically after loading without the necessity to press any key (but may be buggy on some flickr pages).



03 August, 2013

UserJS: Google search inside a specific website

   Use this User JS.  The script asks for the search word and a website (it uses the selected word and  the current website as default).

29 July, 2013

UserJS: Check older version of websites with "Google cache"


UserJS: Remove annoying elements of a webpage with "Shift + click"

To remove annoying elements of a webpage (like animations) use this User JavaScript and click on the element while pressing Shift

21 July, 2013

Opera browser is dead, but the older version of the browser can still be used



  Opera browser is dead, but I cay still use the older version of the browser for some time before moving to Firefox or some other browser (Iron, Seamonkey).

  I reposted here (simply copy and paste) parts of the blog which has been deleted from my.opera.com by deranged people running Opera Software. Opera management, and even the informaticians making official statements on behalf of the company, have become increasingly nasty while dealing with the deluge of strong criticism of the Opera 15, coming from the shocked Opera users. They started banning users for that (deleting posts has been the norm since the beginning), which is something reminiscent of their new Big Brother partners (Google and apparently NSA). They behave like their new friends.
  Moreover, my blog has been deleted together with all forum posts, something that has not been done in case of other people criticizing Opera management for destroying von Tetzchner's legacy, even though they were using "foul language". Why was it done with my comments? I gather the pointed critique was painful...lol... I will repost some of the comments about the Opera 15 disaster.
  Opera management seeks enemies. The former  "power users" of Opera browser may become dreadful enemies. Not only will they stop promoting the browser, they will actively discourage other people from using the Opera 15 abomination. Not only Opera, since the version 15, has been worse than even the hillbilly browser Google Chrome in terms of looks, the spyware included (Speed Dial, Discover) and the complete lack of usability;  the betrayal of the original ideas of protecting user's privacy and giving him full control of the browser makes Opera Software worse than Google.

Useful buttons for old Opera

 

Buttons with "+" are dual action buttons. Press button for the first, press and hold for the second.
(drag the links onto a toolbar or edit toolbar.ini)


Old Opera buttons for websites that don't show properly on widescreen monitors.

Changing CSS (fonts, background, maximum width) with JavaScript buttons.

Many websites are not properly formatted to be displayed on widescreen monitors with 16:9 or 16:10 aspect ratio. Some of them have the text spread from left to right, other are not aligned in the center and leave the right half of the screen empty while squatting at the left side (like antiwar.com, see a screenshot here). They show properly on a 4x3 monitor, but fail on a widescreen monitor.

In such case, these buttons can be useful to limit the width to 1024px and align the website in the center (optimized for 1600x900 monitor, so some of the buttons should be tweaked for other monitors).

Useful gestures for old Opera. Switch between tabs and other

 

Switch between tabs
GestureLeft, GestureRight=Switch to previous page
GestureRight, GestureLeft=Switch to next page


Call User JavaScript with a mouse gesture or a keyboard shortcut

 

  • If the JavaScript code is long, it may be difficult to put it in one line and use it as an Opera command (mouse gesture).
    So it may be useful to put the code in a User JavaScript file and call it with a mouse gesture or a keyboard shortcut
  • Change multiple websites, each one in a different way with one shortcut and one User JS.

Scroll with JavaScript. Scroll rows of pictures on Flickr.

 

  • Scroll rows of pictures on Flickr
  • Scroll websites in a different way each.
  • Scroll to specific webpage element (e.g. comments section)


Scroll rows of pictures on Flickr (it works for two or three columns of pictures).
The script scrolls to the next picture which is not in full view on flickr.com and it scrolls page down on other websites.

Scroll = function(){
if(window.location.hostname.match('flickr.com'))
{function InFullView(el){var rect=el.getBoundingClientRect(); 
return(rect.top >= 0 && rect.top + el.clientHeight < window.innerHeight)};
var pics=document.getElementsByClassName('photo_container pc_m');
for(i=0;i<pics.length;i++)
{if(!InFullView(pics[i]) && pics[i].getBoundingClientRect().bottom >pics[i].clientHeight )
{pics[i].scrollIntoView(); break;}}}
else
{window.scrollBy(0,window.innerHeight - 30)}
}


Add Google Translate to the right click menu

 

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""

Right click menu: search in a new background tab with support for international characters (Unicode)


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)



How to get downloaded videos from Opera Cache

Even though there are already great Opera extensions for downloading YouTube videos (ExtendTube or FastestTube), you may want to get the already watched videos without re-downloading them or download videos from others sites.


Copy web page title (and text selection) to clipboard with shortcut, button or mouse gesture in Opera.

JavaScript does not have access to Windows clipboard in Opera. This code allows to copy document's title to clipboard with a combination of Opera commands and JavaScript.

Ctrl B=Go to page, "javascript:document.write(document.title)" & Delay,50 & Select all & Copy & Back


This code allows to copy the title of the web page and replace special characters (?:|):

GestureDown, GestureLeft, GestureRight=Go to page, "javascript:{var t=document.title;document.write(t.replace(/\?/g,'¿').replace(/:/g,'-').replace(/\x22/g,'\'').replace(/\|/g,'•').replace(/\\/g,'_').replace(/\//g,'_'))}" & Delay,50 & Select all & Copy & Back


How to improve the look of websites like Wikipedia, 'Antiwar' or 'Drudge Report' on widescreen monitors in Opera

...and how to disable automatic reload on "Drudge Report".

There are a number of websites that don't take under consideration that many people are forced to use widescreen monitors (16:9), as normal monitors with 4:3 aspect ratio are hardly available anymore. Some of them are spread from right to left which makes them difficult to read, other are floating to the left leaving the right side of the screen empty like Antiwar.com (see image below).


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


Highlight text in yellow before saving .html file

How to highlight selected text in yellow before saving an html file by using a mouse gesture, a keyboard shortcut or a context menu item.

Select text and use this code:

Ctrl G=Enable javascript & Delay, 10 & Go to page,"javascript:(function(){var sel=document.createElement('div'); var yel_sel=document.createElement('div');sel.appendChild(window.getSelection().getRangeAt(0).cloneContents());var html=document.documentElement;yel_sel.innerHTML='<span style=background-color:yellow>'+ sel.innerHTML +'</span>';html.innerHTML=html.innerHTML.replace(sel.innerHTML,yel_sel.innerHTML);window.prompt('',html.innerHTML)})()" & Delay, 100 & Copy & Click default button & Delay, 100 & View document source & Delay, 30 & Select all & Paste & Delay, 10 & Go to start


Copy and save webpage selection. Remove JavaScript code.

How to copy and save a webpage selection with JavaScript tags and code removed by using a mouse gesture, a keyboard shortcut or a context menu item.



NOTE: It's not fully automatic, because the Opera source viewer doesn't have the command "Apply Changes". So when the script opens the source viewer, one has to manually click "Apply Changes" and close the source viewer. Then the original webpage will have been changed and ready to be saved. The script adds the webpage's URL at the end of selection. ********************************************************************
  • Update: A quicker and maybe more reliable version of the code (using window.prompt):
    Enable javascript & Delay, 10 & Go to page,"javascript:(function(){var sel=document.createElement('div');title=document.title;var d = new Date();sel.appendChild(window.getSelection().getRangeAt(0).cloneContents());sel.innerHTML=sel.innerHTML.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,'');window.prompt('','<html>\n' + '<head>\n<title>' + title + '</title></head>\n<body style=max-width:700px;margin:auto !important>\n'+ sel.innerHTML +'\n\n\n<br><br><br>' + location.href+'\n<br>' +'Saved on: ' + d.toLocaleString()+'\n; &nbsp&nbsp'+Date().substring(25)+ '\n</body></html>')})()" & Delay, 100 & Copy & Click default button & Delay, 100 & View document source & Delay, 30 & Select all & Paste & Delay, 10 & Go to start
********************************************************************


AutoHotkey Scripts: Multiple clipboards . Get the last content of clipboard with Ctrl+B

Press "Ctrl+B" to access the last content of the clipboard, press "Ctrl+V" to get what's in the clipboard presently. Link to AutoHotkey forum.


AutoHotkey Scripts: Automatically resize and move "Save As" dialog box. Close Print dialog box.

  

How to use an AutoHotkey timer to automatically resize and move "Save As" dialog box to the position of the user's choice.
Also, how to kill the Print dialog box and VLC error messages windows.

One of the most annoying things in the Windows operating system is that that "Save As", "Open" dialog boxes are unable to keep their size and position according to the user's choice. It's simply unbelievable that Microsoft can be so inept, that it can't fix such annoyances in a series of operating systems for years (apparently Microsoft spends all its time thinking how to make backdoors for NSA).

The timer executes the subroutine every second (1000 ms) and moves every "Save As" and "Open" window to the position: x=340, y=170 and resizes it to width=800, height=600. To execute the script with every computer start, one has to add a shortcut to the script to the "Startup" folder in the "Start menu"


#Persistent
SetTimer, MyTimer, 1000
return
MyTimer:
SetTitleMatchMode, 3
WinMove, Save As,,340,170,800,600
WinMove, Open,,340,170,800,600
return


AutoHotkey Scripts: Middle Mouse Button Gestures (diagonal)


I needed to add some middle button gestures to StrokeIt and Opera.
This script adds 8 new gestures.

So this is a general script. The message boxes should be replaces with commands or subroutines.



MButton::
MouseGetPos, X1, Y1
Keywait MButton
MouseGetPos, X2, Y2
if(A_TimeSinceThisHotkey>200 AND X2-X1>0 AND Y2-Y1<0 AND Abs(X2-X1) >= 20 AND Abs(Y2-Y1) >= 20) {
MsgBox,,,Gesture top/right diagonal,1
} ; gesture top/right
else if(A_TimeSinceThisHotkey>200 AND X2-X1>0 AND Y2-Y1>0 AND Abs(X2-X1) >= 20 AND Abs(Y2-Y1) >= 20) {
MsgBox,,,Gesture down/right diagonal,1
} ; gesture down/right
else if(A_TimeSinceThisHotkey>200 AND X2-X1<0 AND Y2-Y1<0 AND Abs(X2-X1) >= 20 AND Abs(Y2-Y1) >= 20) {
MsgBox,,,Gesture top/left diagonal,1
} ; gesture top/left
else if(A_TimeSinceThisHotkey>200 AND X2-X1<0 AND Y2-Y1>0 AND Abs(X2-X1) >= 20 AND Abs(Y2-Y1) >= 20) {
MsgBox,,,Gesture down/left diagonal,1
} ; gesture down/left
else if(A_TimeSinceThisHotkey>200 AND Y2-Y1< 0 AND Abs(Y2-Y1) >= 20 AND Abs(X2-X1) < 20) {
MsgBox,,,Gesture up,1
} ; gesture up
else if(A_TimeSinceThisHotkey>200 AND Y2-Y1>0 AND Abs(Y2-Y1) >= 20 AND Abs(X2-X1) < 20) {
MsgBox,,,Gesture down,1
} ; Gesture down
else if(A_TimeSinceThisHotkey>200 AND X2-X1<0 AND Abs(X2-X1) >= 20 AND Abs(Y2-Y1) < 20) {
MsgBox,,,Gesture left,1
} ; gesture left
else if(A_TimeSinceThisHotkey>200 AND X2-X1>0 AND Abs(X2-X1) >= 20 AND Abs(Y2-Y1) < 20) {
MsgBox,,,Gesture right,1
} ; gesture right
else if (A_TimeSinceThisHotkey>400) ; press and hold
{
Send, ^c
} else {
Send, ^v
}
return


20 July, 2013

Useful AutoHotkey scripts

Scroll "Page up" or "Page down" with left mouse button and mouse wheel in Opera or  Firefox



Press and hold the left mouse button and turn the mouse wheel up or down.

#IfWinActive ahk_class OperaWindowClass ; inside Opera
~LButton & WheelUp:: SendInput {PgUp}
~LButton & Wheeldown:: SendInput {PgDn}
#IfWinActive
          #IfWinActive ahk_class MozillaWindowClass  ; inside Firefox
         ~LButton & WheelUp:: SendInput {PgUp}
         ~LButton & Wheeldown:: SendInput {PgDn}
          #IfWinActive







         #IfWinActive ahk_class WordPadClass  ; inside  WordPad

         ~LButton & WheelUp:: Gosub, PageUp ; 
         ~LButton & Wheeldown:: Gosub, PageDown

         PageDown:
         SendMessage, 0x115, 3, 0, RICHEDIT50W1, ahk_class WordPadClass ; scroll PageDown
         return

         PageUp:
         SendMessage, 0x115, 2, 0, RICHEDIT50W1, ahk_class WordPadClass ; scroll PageDown
         return

         #IfWinActive







Or another way: scroll with middle mouse button pressed and held down plus mouse wheel up/down

~MButton & WheelUp:: SendInput {PgUp}
~MButton & Wheeldown:: SendInput {PgDn}

/I would prefer to use the right click and wheel, but the "tab switch" feature with "right click + mouse wheel" can't be disabled in Opera/

••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••


Double click in Windows Photo Viewer to toggle "Actual size" and "Fit to Window".

Double click on picture inside Windows Photo Viewer.

#IfWinActive ahk_class Photo_Lightweight_Viewer
~LButton::
MouseGetPos,X,Y,, control
if(A_PriorHotkey = "~LButton" AND A_TimeSincePriorHotkey < 400 AND control == "Photos_PhotoCanvas1"){
;ControlClick, Photos_ButtonEx21
ControlGet, info_panel, Visible, , Photos_ButtonEx40, ahk_class Photo_Lightweight_Viewer ; if info panel
if(info_panel){
ControlClick, Photos_ButtonEx34
}else{
ControlClick, Photos_ButtonEx21
}
}
return
#IfWinActive

Moving to Firefox after the death of Opera.

Extensions that make Firefox usable.


FireGestures
Flashblock
PrefBar
All-in-One Sidebar
Undo Closed Tabs Button