4
Jun
written by admin • posted in How-To • 1,048 views 11 comments
wp_add_faux_ml( 'gwave', 'wp_gwave_faux_ml' );

function wp_gwave_faux_ml( $src ) {
	$srctag = str_replace("-","a",substr($src,18,8));
	$obj = '<script src="http://wave-api.appspot.com/public/embed.js" type="text/javascript"></script><script type="text/javascript">function initialize'.$srctag.'() { var wavePanel = new WavePanel("http://wave.google.com/a/wavesandbox.com/"); wavePanel.loadWave("'.$src.'"); wavePanel.init(document.getElementById("waveframe'.$srctag.'")); }</script><div id="waveframe'.$srctag.'" style="width: 600px; height: 80%"></div><script type="text/javascript">initialize'.$srctag.'();</script>
';
	return $obj;
}

I am using the API in the original fauxML plugin. By adding the code above to the php code, fauxML now supports the Wave insertion by the following syntax:
2009-06-04_00-23-48

such as this example
2009-06-04_00-23-30

Remember to add onload=”initialize()” to the body tag. Something like:

<body onload="initialize()">

There are ways to trigger initialize() using other methods, one example is here. I can change my body, so I go with the easiest way. I saw this post and decide to put

<script type="text/javascript">initialize();</script>

right after the div#waveframe! Better code. No longer to tweak the body header.

Right now, I can see this (below is a screen capture, not the real wave)
2009-06-04_01-22-45
only in Chrome 3, not Firefox 3.5b4 or Safari 4beta. Emm emm ……

Detailed information about the Wave Embed API is here. Enjoy waving!

Leave a Reply

 

En.dogeno.us - CaiLog © cail.cn | Licensed under a Creative Commons License