Closed GoogleCodeExporter closed 9 years ago
This post is a bit off topic, as it doesn't involve the gwt_gadgets API.
You are right, there is something about that technique that doesn't work. I
found
this alternative implementation of the gadget worked, though:
In SimpleFriendConnect.html, add:
<!-- Include the Google Friend Connect javascript library. -->
<script type="text/javascript"
src="http://www.google.com/friendconnect/script/friendconnect.js"></script>
Then, I took the HTML code and translated it to JSNI:
package com.example.simpleFriendConnect.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class SimpleFriendConnect implements EntryPoint {
static native void addFriendConnect(String divId) /*-{
var skin = {};
skin['BORDER_COLOR'] = '#cccccc';
skin['ENDCAP_BG_COLOR'] = '#e0ecff';
skin['ENDCAP_TEXT_COLOR'] = '#333333';
skin['ENDCAP_LINK_COLOR'] = '#0000cc';
skin['ALTERNATE_BG_COLOR'] = '#ffffff';
skin['CONTENT_BG_COLOR'] = '#ffffff';
skin['CONTENT_LINK_COLOR'] = '#0000cc';
skin['CONTENT_TEXT_COLOR'] = '#333333';
skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';
skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';
skin['CONTENT_HEADLINE_COLOR'] = '#333333';
skin['DEFAULT_COMMENT_TEXT'] = '- add your comment here -';
skin['HEADER_TEXT'] = 'Comments';
skin['POSTS_PER_PAGE'] = '5';
// NOTE: Prepend $wnd to the calls to the friendconnect API.
$wnd.google.friendconnect.container.setParentUrl('/users/eric/');
$wnd.google.friendconnect.container.renderWallGadget(
// NOTE: substitute 'divId' for the string generated by Google Friendconnect
{ id: divId,
site: '01989614359727495564',
'view-params':{"disableMinMax":"true",
"scope":"PAGE","features":"video,comment",
"startMaximized":"true"}
}, skin);
}-*/;
/**
* This is the entry point method.
*/
public void onModuleLoad() {
RootPanel.get().add(new Label("Member Gadget shown below:"));
DivElement gadgetDiv = Document.get().createDivElement();
String id = "div-friendconnect1";
gadgetDiv.setId(id);
gadgetDiv.getStyle().setPropertyPx("width", 282);
gadgetDiv.getStyle().setProperty("border", "1px, solid #cccccc");
RootPanel.get().getElement().appendChild(gadgetDiv);
addFriendConnect(id);
}
}
Original comment by galgwt.reviews@gmail.com
on 6 Mar 2009 at 3:52
Thanks for you help.
Yes, this post is a bit off topic.
Because I did not understood the difference between "Mozilla Firefox" and other
browsers. And the test result is that only can show correct on Firefox. So, I
post this.
And thanks for you update. That is very helpful. I will continue research this.
Original comment by lexiong...@gmail.com
on 6 Mar 2009 at 5:34
After talking to some other folks, The reason the loading in the body of the
HTML
widget doesn't work is that on some browsers, the <script> body of an element
injected in the DOM is not executed after the document loads.
Original comment by galgwt.reviews@gmail.com
on 6 Mar 2009 at 6:04
Updating account names
Original comment by zundel@google.com
on 21 Dec 2009 at 2:00
Original issue reported on code.google.com by
lexiong...@gmail.com
on 5 Mar 2009 at 5:22