Problem with meebo bar

Hi all, this is the instructions to use Meebo Bar


<script type="text/javascript">

if (typeof Meebo == 'undefined') {

    Meebo=function(){(Meebo._=Meebo._||[]).push(arguments)};

    (function(_){ var d=document,b=d.body; if(!<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' />{var c=arguments.callee;

    return setTimeout(function(){c(_)},100)} var a='appendChild',c='createElement',

    m=b.insertBefore(d[c]('div'), b.firstChild),n=m[a](d[c]('m')),i=d[c]('iframe');

    m.style.display='none';m.id='meebo';i.frameBorder="0";

    n[a](i).id="meebo-iframe"; var d=i.contentWindow.document;d.open();

    d.write(['<body onload=\'var d=document;d.getElementsByTagName("head")[0].',

    a,'(d.',c,'("script")).src="http',_.https?'s':'','://',

    _.stage?'stage-':'','cim.meebo.com','/cim?iv=2&network=', _.network,

    _.lang?'&lang='+_.lang:'','"\'></body>'].join('')); d.close(); })

    ({ network: 'MY_NETWORK_HERE', stage: false });    

    Meebo("makeEverythingSharable"); 

}

</script>

In your template, immediately prior to the closing </body>, insert the following code:


<script type="text/javascript">

  Meebo("domReady");

</script>

The problem is the output…


<script type="text/javascript">

if (typeof Meebo == 'undefined') {

    Meebo=function(){(Meebo._=Meebo._||[]).push(arguments)};

    (function(_){ var d=document,b=d.body; if(!<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' />{var c=arguments.callee;

    return setTimeout(function(){c(_)},100)} var a='appendChild',c='createElement',

    m=b.insertBefore(d[c]('div'), b.firstChild),n=m[a](d[c]('m')),i=d[c]('iframe');

    m.style.display='none';m.id='meebo';i.frameBorder="0";

    n[a](i).id="meebo-iframe"; var d=i.contentWindow.document;d.open();

    d.write(['<body onload=\'var d=document;d.getElementsByTagName("head")[0].',

    a,'(d.',c,'("script")).src="http',_.https?'s':'','://',

    _.stage?'stage-':'','cim.meebo.com','/cim?iv=2&network=', _.network,

    _.lang?'&lang='+_.lang:'','"\'><script type="text/javascript">

/*<![CDATA[*/

jQuery(document).ready(function() {

jQuery('#yw0').yiiListView({'ajaxUpdate':['yw0'],'ajaxVar':'ajax','pagerClass':'pager','loadingClass':'list-view-loading','sorterClass':'sorter'});

});

/*]]>*/

</script>

</body>'].join('')); d.close(); })

    ({ network: 'glhfit_se74qi', stage: false });    

    Meebo("makeEverythingSharable"); 

}

</script>



Like you can see Yii in some way overwrite meebo’s js…

how can I solve it?

Like you can see Yii initialization put before the ‘</body>’ of the javascript this:


<script type="text/javascript">

/*<![CDATA[*/

jQuery(document).ready(function() {

jQuery('#yw0').yiiListView({'ajaxUpdate':['yw0'],'ajaxVar':'ajax','pagerClass':'pager','loadingClass':'list-view-loading','sorterClass':'sorter'});

});

/*]]>*/

</script>



How can I resolve this ‘bug’?

Seems that Yii is looking for </body> to insert something before that… try to change it to </body > (one space before >)

it doesn’t solve the problem…

Yii need to insert that code on the latest </body>, but i don’t know which .php of the framework do that…

CClientScript.php (in system.web) -> renderBodyEnd() - http://www.yiiframework.com/doc/api/CClientScript#renderBodyEnd-detail

uhm the problem is that i don’t know how to let the function replace only the latest match…

It’s not a nice way to modify the core files by yourself, for example will you remember these changes when new version of Yii comes out…

You should open a ticket at http://code.google.com/p/yii/issues/list so the developet take this in consideration

Anyway I would suggest to put that code in a separate .js file like "meeboinit.js" and include that file where you need it…

Hi. This is Chris from Meebo. We saw this issue in a number of sites and we’ve actually made a change to our embed code. The problem is indeed the </body> tag. If you change it to read </bo’,'dy>, I believe that will resolve the issue (or at least it has with other tools that were behaving similarly).

Hope that helps. You can email me at chrisf@meebo-inc.com if you have more questions about the bar.

Chris