Sunday, May 23, 2010

Embed Google’s Pac Man game on your own webpage

To celebrate the 30th anniversary of the most popular video game of all time, Pac Man, Google put a playable version of the game on Google’s home page on May 21. It’s no longer on the page now but I hope you did catch it at least once during the 48 hours when it was up.

Update: By popular demand, Pac Man is now available permanently on http://www.google.com/pacman/

pacman

Now a blogger over at Rustybrick put together a quick code allowing people to embed the game on their own web pages. Simply copy the code below and paste it on to your page to immortalize Google Pac Man forever.

<script>google.pml=function(){function d(a){if(!google.pml_installed){google.pml_installed=true;if(!a){document.getElementById("logo").style.background="black";window.setTimeout(function(){var b=document.getElementById("logo-l")
;if(b)b.style.display="block"},400)}a=document.createElement("script");a.type="text/javascript";

a.src="https://rustybrick.s3.amazonaws.com/pacman10-hp.2.js";

google.dom.append(a)}}function e(){if(document.f&&document.f.btnI)document.f.btnI.onclick=function(){typeof google.pacman!="undefined"?google.pacman.insertCoin():d(false);return false}}if(!google.pml_loaded){google.pml_loaded=true;window.setTimeout(function(){document.f&&document.f.q&&document.f.q.value==""&&d(true)},1E4);e();google.rein&&google.rein.push(e);google.dstr&&google.dstr.push(function(){google.pacman&&google.pacman.destroy();if(google.pml_installed){for(var a=(document.getElementById("xjsc")||document.body).getElementsByTagName("script"),b=0,c;c=a[b++];)c.src.indexOf("/logos/js")!=-1&&google.dom.remove(c);google.pml_installed=false}});google.pacManQuery=function(){google.nav(document.getElementById("dlink").href)}}};</script>

<form action="/search" name=f onsubmit="google.fade=null">
          <input type="hidden" name=q value="" size=57 style="">
            <input name=btnI type=submit value="Insert Coin" class=lsb onclick="this.checked=1">
</form>

            <div id=xjsd>
            </div>
            <div id=xjsi>
<script>if(google.y)google.y.first=[];if(google.y)google.y.first=[];if(!google.xjs){google.dstr=[];google.rein=[];window.setTimeout(function(){var a=document.createElement("script");
a.src="https://rustybrick.s3.amazonaws.com/jscript.js";

(document.getElementById("xjsd")||document.body).appendChild(a);
if(google.timers&&google.timers.load.t)google.timers.load.t.xjsls=(new Date).getTime();},0);
google.xjs=1};google.neegg=1;google.y.first.push(function(){google.ac.i(document.f,document.f.q,'','','ZAO1UHON4Cy3HD_vAXF7cQ',{o:1,sw:1});(function(){
var h,i,j=1,k=google.time(),l=[];google.rein.push(function(){j=1;k=google.time()});google.dstr.push(function(){google.fade=null});function m(a,f){var b=[];for(var c=0,e;e=a[c++];){var d=document.getElementById(e);d&&b.push(d)}for(var c=0,g;g=f[c++];)b=b.concat(n(g[0],g[1]));for(var c=0;b[c];c++)b[c]=[b[c],"opacity",0,1,0,""];return b}function n(a,f){var b=[],c=new RegExp("(^|\\s)"+f+"($|\\s)");for(var e=0,d,g=document.getElementsByTagName(a);d=
g[e++];)c.test(d.className)&&b.push(d);return b}google.fade=function(a){if(google.fx&&j){a=a||window.event;var f=1,b=google.time()-k;if(a&&a.type=="mousemove"){var c=a.clientX,e=a.clientY;f=(h||i)&&(h!=c||i!=e)&&b>600;h=c;i=e}if(f){j=0;google.fx.animate(600,m(["fctr","ghead","pmocntr","sbl","tba","tbe"],[["span","fade"],["div","fade"],["div","gbh"]]));for(var d=0;d<
l.length;++d)if(typeof l[d]=="function")l[d]()}}};google.addFadeNotifier=function(a){l.push(a);if(!j)a()};
})();
;google.History&&google.History.initialize('/')});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);google.fade=null;}google.pml && google.pml();</script>
            </div>
<script>(function(){
var b,d,e,f;function g(a,c){if(a.removeEventListener){a.removeEventListener("load",c,false);
a.removeEventListener("error",c,false)}else{a.detachEvent("onload",c);
a.detachEvent("onerror",c)}}function h(a){f=(new Date).getTime();++d;a=a||window.event;var c=a.target||a.srcElement;g(c,h)}var i=document.getElementsByTagName("img");b=i.length;d=0;for(var j=0,k;j<b;++j){k=i[j];if(k.complete||typeof k.src!="string"||!k.src)++d;else if(k.addEventListener){k.addEventListener("load",h,false);k.addEventListener("error",
h,false)}else{k.attachEvent("onload",h);k.attachEvent("onerror",h)}}e=b-d;function l(){google.timers.load.t.ol=(new Date).getTime();google.timers.load.t.iml=f;google.kCSI.imc=d;
google.kCSI.imn=b;google.kCSI.imp=e;
google.report&&google.report(google.timers.load,google.kCSI)}if(window.addEventListener)window.addEventListener("load",l,false);
else if(window.attachEvent)window.attachEvent("onload",l);google.timers.load.t.prt=(f=(new Date).getTime());
})();

</script>

[via Search Engine Roundtable]

6 comments:

  1. Where do you paste the code?

    ReplyDelete
  2. Here is an interesting report on this Google's PAC-MAN

    Google PAC-MAN Cost Users 4.82 million hours and $120 Million



    Over the past few weeks, you might have been greeted with the Google PAC-MAN game whenever you visited Google.com. The game was cute, enticing and annoying at its best, however, according to some reports from the RescueTime blog, over the span of 48 hours users spent a total of 4.82 million hours playing the game, which cost us $120 million+ in total.

    Google PAC-MAN Doodle

    According to the study done by RescueTime, an average user usually spends 4 and a half minutes on Google with 22 page views on an average with each page view timed to 11 seconds. However, according to the data they have the average user spent 36 seconds more on last Friday, the day the Google PAC-MAN game went live.

    Some of the intriguing stats from their study includes the following:

    * Google Pac-Man consumed 4,819,352 hours of time (beyond the 33.6m daily man hours of attention that Google Search gets in a given day)
    * $120,483,800 is the dollar tally, If the average Google user has a COST of $25/hr (note that cost is 1.3 – 2.0 X pay rate).
    * For that same cost, you could hire all 19,835 google employees, from Larry and Sergey down to their janitors, and get 6 weeks of their time. Imagine what you could build with that army of man power.
    * $298,803,988 is the dollar tally if all of the Pac-Man players had an approximate cost of the average Google employee.

    So how long did you spend playing PAC-MAN on Google? Oh and by the way you can continue playing the Google PAC-MAN game at its new home.

    ReplyDelete
  3. do you just paste this into an html document, because this only got me the insert coin button and nothing else

    ReplyDelete

Popular Posts