Power User Guide for the iPhone, Droid or Other Smart Phone ... and Computer → Washingtons Blog
Power User Guide for the iPhone, Droid or Other Smart Phone ... and Computer - Washingtons Blog

Sunday, June 5, 2011

Power User Guide for the iPhone, Droid or Other Smart Phone ... and Computer

Become a power user on your smart phone, computer or any web-surfing device ...

To get a sense of these tools, right-click on one of the following links, save as a bookmark, surf to the flashiest website you know with alot of pictures, go to your browser's bookmarks, and then choose the bookmark you saved:

I store these types of power-user bookmarks in a separate bookmarks folder like this for easy access:

Okay, here's the background.

As I noted in 2009:

Since I just bought an iPhone, I am learning - and will be posting - some tricks and shortcuts for making it more useful.

The iPhone G3 is a great smart phone and mobile computing device. However, it has some real blind spots. For example, you cannot do a basic search within a web page for words or phrases.

Here is the hack/workaround:

1) Open up your Safari web browser

2) Bookmark a page (by tapping the button)

3) Go into bookmarks (by tapping the button)

4) Click "Edit"

5) Select your new bookmark [technically known as a "bookmarklet" when it runs javascript]

6) Change the name to "Search" or "Find"

7) Delete the address

8) Copy and paste the following into the address box [just double-click anywhere within the javascript code, copy and then paste]:

javascript:void%28s%3Dprompt%28%27Find%20text%3A%27%2C%27%27%29%29%3Bs%3D%27%28%27+s+%27%29%27%3Bx%3Dnew%20RegExp%28s%2C%27gi%27%29%3Brn%3DMath.floor%28Math.random%28%29*100%29%3Brid%3D%27z%27%20+%20rn%3Bb%20%3D%20document.body.innerHTML%3Bb%3Db.replace%28x%2C%27%3Cspan%20name%3D%27%20+%20rid%20+%20%27%20id%3D%27%20+%20rid%20+%20%27%20style%3D%5C%27color%3A%23000%3Bbackground-color%3Ayellow%3B%20font-weight%3Abold%3B%5C%27%3E%241%3C/span%3E%27%29%3Bvoid%28document.body.innerHTML%3Db%29%3Balert%28%27Found%20%27%20+%20document.getElementsByName%28rid%29.length%20+%20%27%20matches.%27%29%3Bwindow.scrollTo%280%2Cdocument.getElementsByName%28rid%29%5B0%5D.offsetTop%29%3B
9) Save (by tapping Done)

Now surf as normal, and when you want to find something within a web page, choose bookmarks and select "Search" or "Find".

The following javascript dialog will pop up:

It works well.

I've set up a number of other power-user bookmarks on my iPhone since then. To install them, follow the 9 steps above, but substitute the following javascript code for the code in step 8 above.

Google Search

Highlight text, then use this bookmark to automatically run a Google search for that text:

javascript:q%20=%20""%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(!q)%20q%20=%20prompt("You%20didn't%20select%20any%20text.%20%20Enter%20a%20search%20phrase:",%20"");%20if%20(q!=null)%20location="http://www.google.com/search?q="%20+%20escape(q).replace(/%20/g,%20"+");%20void%200
Compare Google

After you've run a search in any search engine other than Google, use this bookmark to compare Google's search results (Note: remove all of the "amp;" notations first in the following code and all other scripts):
javascript:Q=[];%20c=location.search.slice(1).split('&');%20for%20(i%20in%20c)%20{%20f=c[i].split('=');%20if%20(f[0]=='q'%20||%20f[0]=='as_q'%20||%20f[0]=='p'%20||%20f[0]=='query')%20if%20(f[1])%20Q.push(f[1])%20}%20R=unescape(Q.join(';%20').replace(/\+/g,'%20'));%20location%20=%20'http://www.google.com/search?q='%20+%20escape(R);
Compare Bing

After you've run a search in any search engine other than Bing, use this bookmark to compare Bings's search results:
javascript:Q=[];%20c=location.search.slice(1).split('&');%20for%20(i%20in%20c)%20{%20f=c[i].split('=');%20if%20(f[0]=='q'%20||%20f[0]=='as_q'%20||%20f[0]=='p'%20||%20f[0]=='query')%20if%20(f[1])%20Q.push(f[1])%20}%20R=unescape(Q.join(';%20').replace(/\+/g,'%20'));%20location%20=%20'http://search.msn.com/results.aspx?q='%20+%20escape(R);
Wiki Search

Highlight text, then use this bookmark to automatically search for that phrase in Wikipedia:
javascript:function se(d) {return d.selection ? d.selection.createRange().text : d.getSelection()} s = se(document); for (i=0; i<frames.length && !s; i++) s = se(frames[i].document); if (!s || s=='') s = prompt('Enter%20search%20terms%20for%20Wikipedia',''); open('http://en.wikipedia.org' + (s ? '/w/index.php?title=Special:Search&search=' + encodeURIComponent(s) : '')).focus();
Search for Term Within Favorite Site

Highlight text, then use this bookmark to automatically search for that phrase at your favorite site (in the following example, I used my own site; substitute whatever site you want for the 2 bolded uses of WashingtonsBlog.com below): javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("Search%20WashingtonsBlog.com%20[leave%20selection%20and%20box%20blank%20to%20list%20all%20pages]%20...").replace(/\s\+/g,"%252B");if(q!=null)window.open('http://www.google.com/search?q=%27+%27site:WashingtonsBlog.com+%27+q.replace(/\s+/g,%27+%27));void(0);

When Modified

It is often difficult to tell whether a web page has new or very old and stale information on it.

Use this bookmark to tell you when the web page was last modified:

javascript:alert('Modification%20Date:%20'+document.lastModified);
Previous Versions

Anyone who has used the Internet Archive's Wayback Machine knows that it is a very powerful way to look at old versions of the website.

Here's the bookmark for looking at old versions of any web page:
javascript:location.href='http://web.archive.org/web/*/'+document.location.href;
Whose Website

It is often difficult to tell who is behind a website.

Use this bookmark to see who bought the website's domain name:
javascript:void(w=window.open('http://mxtoolbox.com/SuperTool.aspx?action=whois%3A'+location.hostname,%20'MXToolbox',%20'scrollbars,resizable,width=500,height=600'));

Scroll to Bottom of Page

You can easily scroll to the top of a webpage - at least on the iPhone - by tapping the built-in status bar at the top of the screen.

But to scroll to the bottom of the page, create a bookmark using the following code:

javascript:scroll(0,document.getElementsByTagName('body')%5B0%5D.scrollHeight);
Mark Position in Web Page

If you find something you want to re-read, use this bookmark to set the position within the web page:
javascript:void(InPageBookmark=pageYOffset)
Then use this bookmark to go back to that same place in the web page (make this a separate bookmark):
javascript:if%20(typeof%20InPageBookmark=='undefined')%7Balert('No%20in-page%20bookmark.%20Use%20Set%20In-Page%20Bookmark%20tool.%20(bookmarklets.com)')%7Delse%7BscrollBy(0,InPageBookmark-pageYOffset)%7D
Up a Level

If you're in a web page, but you want to go to one of the websites' main pages, use this bookmark until you get where you want to go:
javascript:void(location.href=location.href.substring(0,location.href.substring(0,location.href.length-1).lastIndexOf('/')+1))
How Many Windowfulls?

When you go to a web page, it is impossible at first to know whether it is a short or endlessly long web page. If you start reading something which ends up being hundreds of pages long, it is helpful to know that before you start reading (for example, you might want to save a long essay and read it another time, or print it out and read it at your leisure).

This bookmark tells you how many "full windows" the web page has:
javascript:alert('The%20document%20fills%20about%20'+Math.round((document.height*document.width)/(innerHeight*innerWidth))+'%20windows%20(at%20current%20window%20size)')
Show Emails

Emails can be hidden in huge web pages, which makes it hard to find out who to contact. This bookmark finds them for you:
javascript:Ai7Mg6P='';for%20(i7M1bQz=0;i7M1bQz%3Cdocument.images.length;i7M1bQz++){Ai7Mg6P+='%3Cimg%20src='+document.images[i7M1bQz].src+'%3E%3Cbr%3E'};if(Ai7Mg6P!=''){document.write('%3Ccenter%3E'+Ai7Mg6P+'%3C/center%3E');void(document.close())}else{alert('No%20images!')}
List All Links

This bookmark lists all links on a webpage:
javascript:WN7z=open('','Z6','width=400,height=200,scrollbars,resizable,menubar');DL5e=document.links;with(WN7z.document){write('<base%20target=_blank>');for(lKi=0;lKi<DL5e.length;lKi++){write(DL5e[lKi].toString().link(DL5e[lKi])+'<br><br>')};void(close())}
Change Links to Show True URL

This bookmark changes all links on a webpage to show where you'll actually end up if you click:
javascript:(function(){var%20i,c,x,h;%20for(i=0;x=document.links[i];++i)%20{%20h=x.href;%20x.title+="%20"%20+%20x.innerHTML;%20while(c=x.firstChild)x.removeChild(c);%20x.appendChild(document.createTextNode(h));%20}%20})()
Display All Images

If you want show all of the images on a web page, use this bookmark:
javascript:Ai7Mg6P='';for%20(i7M1bQz=0;i7M1bQz%3Cdocument.images.length;i7M1bQz++){Ai7Mg6P+='%3Cimg%20src='+document.images[i7M1bQz].src+'%3E%3Cbr%3E'};if(Ai7Mg6P!=''){document.write('%3Ccenter%3E'+Ai7Mg6P+'%3C/center%3E');void(document.close())}else{alert('No%20images!')}
Double Image Size

Doubles the size of all images on the web page:
javascript:(function(){%20function%20zoomImage(image,%20amt)%20{%20if(image.initialHeight%20==%20null)%20{%20/*%20avoid%20accumulating%20integer-rounding%20error%20*/%20image.initialHeight=image.height;%20image.initialWidth=image.width;%20image.scalingFactor=1;%20}%20image.scalingFactor*=amt;%20image.width=image.scalingFactor*image.initialWidth;%20image.height=image.scalingFactor*image.initialHeight;%20}%20var%20i,L=document.images.length;%20for%20(i=0;i<L;++i)%20zoomImage(document.images[i],%202);%20if%20(!L)%20alert("This%20page%20contains%20no%20images.");%20})();
Halve Image Size

Halves the size of all images on the web page:
javascript:(function(){%20function%20zoomImage(image,%20amt)%20{%20if(image.initialHeight%20==%20null)%20{%20/*%20avoid%20accumulating%20integer-rounding%20error%20*/%20image.initialHeight=image.height;%20image.initialWidth=image.width;%20image.scalingFactor=1;%20}%20image.scalingFactor*=amt;%20image.width=image.scalingFactor*image.initialWidth;%20image.height=image.scalingFactor*image.initialHeight;%20}%20var%20i,L=document.images.length;%20for%20(i=0;i<L;++i)%20zoomImage(document.images[i],.5);%20if%20(!L)%20alert("This%20page%20contains%20no%20images.");%20})();
Double Size of Fixed Elements

If you're going crazy trying to make something bigger because you can't see it, try this:
javascript:factor=Math.sqrt(2);%20if(!window.scale)%20{%20scale=1;%20zW=[];%20zH=[];%20unitless=/^[0-9.]+$/;%20function%20r(N)%20{%20w=N.width;%20h=N.height;%20if%20(unitless.test(w))%20zW.push([N,w]);%20if%20(unitless.test(h))%20zH.push([N,h]);%20var%20C=N.childNodes,i;%20for%20(i=0;i<C.length;++i)%20r(C[i]);%20}%20r(document.body);%20}%20scale*=factor;%20for(i%20in%20zW)%20zW[i][0].width=zW[i][1]*scale;%20for(i%20in%20zH)%20zH[i][0].height%20=%20zH[i][1]*scale;%20[].v<c.length;++i)%20r(c[i]);%20}%20r(document.body);%20}%20scale*=factor;%20for(i%20in%20zw)%20zw[i][0].width=zw[i][1]*scale;%20for(i%20in%20zh)%20zh[i][0].height%20=%20zh[i][1]*scale;%20[].v></c.length;++i)%20r(c[i]);%20}%20r(document.body);%20}%20scale*=factor;%20for(i%20in%20zw)%20zw[i][0].width=zw[i][1]*scale;%20for(i%20in%20zh)%20zh[i][0].height%20=%20zh[i][1]*scale;%20[].v>
Cookie-Killer

Removes cookies set by the site, including cookies with paths and domains.
javascript:(function(){C=document.cookie.split(";%20");for(d="."+location.host;d;d=(""+d).substr(1).match(/\..*$/))for(sl=0;sl<2;++sl)for(p="/"+location.pathname;p;p=p.substring(0,p.lastIndexOf('/')))for(i%20in%20C)if(c=C[i]){document.cookie=c+";%20domain="+d.slice(sl)+";%20path="+p.slice(1)+"/"+";%20expires="+new%20Date((new%20Date).getTime()-1e11).toGMTString()}})()
Remove Redirect

This removes link redrirects, so you go directly to the ultimate target webpage, instead of through some other site:
javascript:(function(){var%20k,x,t,i,j,p;%20for(k=0;x=document.links[k];k++){t=x.href.replace(/[%]3A/ig,':').replace(/[%]2f/ig,'/');i=t.lastIndexOf('http');if(i>0){%20t=t.substring(i);%20j=t.indexOf('&');%20if(j>0)t=t.substring(0,j);%20p=/https?\:\/\/[^\s]*[^.,;'">\s\)\]]/.exec(unescape(t));%20if(p)%20x.href=p[0];%20}%20else%20if%20(x.onmouseover&&x.onmouseout){x.onmouseover();%20if%20(window.status%20&&%20window.status.indexOf('://')!=-1)x.href=window.status;%20x.onmouseout();%20}%20x.onmouseover=null;%20x.onmouseout=null;%20}})();Stop Annoyances

This powerful bookmark zaps java, flash, background music, third-party iframes, colors, cheap effects, blind links, exit pop up ads, event handlers, and timers all at the same time:
javascript:(function(){function%20R(w){try{var%20d=w.document,j,i,t,T,N,b,r=1,C;for(j=0;t=["object","embed","applet","iframe"][j];++j){T=d.getElementsByTagName(t);for(i=T.length-1;(i+1)&&(N=T[i]);--i)if(j!=3||!R((C=N.contentWindow)?C:N.contentDocument.defaultView)){b=d.createElement("div");b.style.width=N.width;%20b.style.height=N.height;b.innerHTML="<del>"+(j==3?"third-party%20"+t:t)+"</del>";N.parentNode.replaceChild(b,N);}}}catch(E){r=0}return%20r}R(self);var%20i,x;for(i=0;x=frames[i];++i)R(x)})();%20javascript:(function(){var%20newSS,%20styles='*%20{%20background:%20white%20!%20important;%20color:%20black%20!important%20}%20:link,%20:link%20*%20{%20color:%20#0000EE%20!important%20}%20:visited,%20:visited%20*%20{%20color:%20#551A8B%20!important%20}';%20if(document.createStyleSheet)%20{%20document.createStyleSheet("javascript:'"+styles+"'");%20}%20else%20{%20newSS=document.createElement('link');%20newSS.rel='stylesheet';%20newSS.href='data:text/css,'+escape(styles);%20document.getElementsByTagName("head")[0].appendChild(newSS);%20}%20})();%20javascript:(function(){var%20d=document;%20function%20K(N,w)%20{%20var%20nn%20=%20d.createElement(w),%20C%20=%20N.childNodes,%20i;%20for(i=C.length-1;i>=0;--i)%20nn.insertBefore(C[i],nn.childNodes[0]);%20N.parentNode.replaceChild(nn,N);%20}%20function%20Z(t,w)%20{%20var%20T%20=%20document.getElementsByTagName(t),%20j;%20for%20(j=T.length-1;j>=0;--j)%20K(T[j],w);%20}%20Z("blink",%20"span");%20Z("marquee",%20"div");%20})();%20javascript:(function(){var%20H=["mouseover","mouseout","unload","resize"],o=window.opera;%20if(document.addEventListener/*MOZ*/&&!o)%20for(j%20in%20H)document.addEventListener(H[j],function(e){e.stopPropagation();},true);%20else%20if(window.captureEvents/*NS4*/&&!o)%20{%20document.captureEvents(-1/*ALL*/);for(j%20in%20H)window["on"+H[j]]=null;}%20else/*IE*/%20{function%20R(N){var%20i,x;for(j%20in%20H)if(N["on"+H[j]]/*NOT%20TEXTNODE*/)N["on"+H[j]]=null;for(i=0;x=N.childNodes[i];++i)R(x);}R(document);}})();%20javascript:(function()%20{%20var%20c,%20tID,%20iID;%20tID%20=%20setTimeout(function(){},%200);%20for%20(c=1;%20c<1000%20&&%20c<=tID;%20++c)%20clearTimeout(tID%20-%20c);%20iID%20=%20setInterval(function(){},1000);%20for%20(c=0;%20c<1000%20&&%20c<=iID;%20++c)%20clearInterval(iID%20-%20c);%20})();
Remove Images

If you want a web page to be less cluttered or appropriate for work or other public places, you can remove all images using this bookmark:
javascript:(function()%7Bfunction%20toArray%20(c)%7Bvar%20a,%20k;a=new%20Array;for%20(k=0;%20k%20%3C%20c.length;%20++k)a%5Bk%5D=c%5Bk%5D;return%20a;%7Dvar%20images,%20img,%20altText;images=toArray(document.images);for%20(var%20i=0;%20i%20%3C%20images.length;%20++i)%7Bimg=images%5Bi%5D;altText=document.createTextNode(img.alt);img.parentNode.replaceChild(altText,%20img)%7D%7D)();
No Color

If a webpage's obnoxious colors makes it hard to read, strip out the colors using this bookmark:
javascript:(function()%7Bvar%20newSS,%20styles='*%20%7B%20background:%20white%20!%20important;%20color:%20black%20!important%20%7D%20:link,%20:link%20*%20%7B%20color:%20%230000EE%20!important%20%7D%20:visited,%20:visited%20*%20%7B%20color:%20%23551A8B%20!important%20%7D';%20if(document.createStyleSheet)%20%7B%20document.createStyleSheet(%22javascript:'%22+styles+%22'%22);%20%7D%20else%20%7B%20newSS=document.createElement('link');%20newSS.rel='stylesheet';%20newSS.href='data:text/css,'+escape(styles);%20document.getElementsByTagName(%22head%22)%5B0%5D.appendChild(newSS);%20%7D%20%7D)();
Translate Into English

This bookmark detects what language the web page is in, then uses Google translate to translate it into English:
javascript:void(0);void(0);void(0);void(0);void('Add%20this%20text%20into%20the%20code%20to%20suppress%20the%20tooltip%20with%20long%20script');void(0);void(0);void(0);void(0);void(0);void(0);void(0);q=location.href;void(location.href='http://translate.google.com/translate?u='+q);
Count Characters in Text Boxes

Many web pages only allow you a certain number of characters in a text box. With this, you can keep count:
javascript:(function(){var%20D=document,i,f,j,e;for(i=0;f=D.forms[i];++i)for(j=0;e=f[j];++j)if(e.type=="text"||e.type=="password"||e.tagName.toLowerCase()=="textarea")S(e);function%20S(e){if(!e.N){var%20x=D.createElement("span"),s=x.style;s.color="green";s.background="white";s.font="bold%2010pt%20sans-serif";s.verticalAlign="top";e.parentNode.insertBefore(x,e.nextSibling);function%20u(){x.innerHTML=e.value.length;}u();e.onchange=u;e.onkeyup=u;e.oninput=u;e.N=x;}else{e.parentNode.removeChild(e.N);e.N=0;}}})()
Remove Maximum Number of Characters in Text Boxes

If you want to remove the maximum number of characters you can type in a text box, use this:
javascript:(function(){var%20x,k,f,j;x=document.forms;for(k=0;k<x.length;++k){f=x[k];for(j=0;j<f.length;++j)f[j].removeAttribute("maxLength");}})()
Show Passwords

If you want to reveal passwords masked by asteriks or dots (for example, you've typed in a long password, but your phone rings and you forget if you finished it or typed it correctly), use this:
javascript:(function(){var%20s,F,j,f,i;%20s%20=%20"";%20F%20=%20document.forms;%20for(j=0;%20j%3CF.length;%20++j)%20{%20f%20=%20F[j];%20for%20(i=0;%20i%3Cf.length;%20++i)%20{%20if%20(f[i].type.toLowerCase()%20==%20"password")%20s%20+=%20f[i].value%20+%20"/n";%20}%20}%20if%20(s)%20alert("Passwords%20in%20forms%20on%20this%20page:/n/n"%20+%20s);%20else%20alert("There%20are%20no%20passwords%20in%20forms%20on%20this%20page.");})();

Tiny Url

Make a smaller version of the url for the web page:

javascript:void(location.href='http://tinyurl.com/create.php?url='+location.href)
These types of javascript bookmarks work on your Droid or other smart phones as well. They also work on your computer or laptop. Just create bookmarks in whatever device you're using, and then run 'em. Or you can copy and paste any of the javascript bookmarks into your browser's address bar.

Bookmark this webpage so you can come back to it and mine for bookmarks as the need/desire arises.

For more bookmarklets (or to find code if one of the bookmarks above isn't working), see this and this.

No comments:

Post a Comment

→ Thank you for contributing to the conversation by commenting. We try to read all of the comments (but don't always have the time).

→ If you write a long comment, please use paragraph breaks. Otherwise, no one will read it. Many people still won't read it, so shorter is usually better (but it's your choice).

→ The following types of comments will be deleted if we happen to see them:

-- Comments that criticize any class of people as a whole, especially when based on an attribute they don't have control over

-- Comments that explicitly call for violence

→ Because we do not read all of the comments, I am not responsible for any unlawful or distasteful comments.