On Tue, Nov 22, 2011 at 1:43 PM, Riaz Shafi <riaz_shafi(a)hotmail.com> wrote:
Hi,
I have followed the javascriptExtension example.
I can execute the javascript when I have "Always on this page" selected
(simple alert("HELLO"); command)
The problem I have is executing the javascript on demand.
Using the following code I cannot execute the javascript on demand.
{{velocity}}$xwiki.jsx.use("<space>.<javascript Name>"){{/velocity}}
It should be:
{{velocity}}$xwiki.jsx.use("<space>.<NameOfThePageThatHoldsTheJSXObject>"){{/velocity}}
So don't use the value of the "Name" property of the
JavaScriptExtension object. Use the name of the page holding the
object.
While debugging you can use:
{{velocity}}$xwiki.jsx.use("Space.Page", {'minify':
false}){{/velocity}}
so that you can easily put breakpoints and debug your code with tools
like Firebug.
Is there anything else that I need to do? I have followed the javascript
example verbatim and tried executing the following code but no success:
{{velocity}}$xwiki.jsx.use("XWiki.MyFirstJavascriptExtension"){{/velocity}}
Any ideas?
It should work if XWiki.MyFirstJavascriptExtension is the wiki page
that has the JavaScriptExtension object with your JavaScript code.
Hope this helps,
Marius
Thanks
Riaz
-----Original Message-----
From: devs-bounces(a)xwiki.org [mailto:devs-bounces@xwiki.org] On Behalf Of
Marius Dumitru Florea
Sent: 16 November 2011 14:44
To: XWiki Developers
Subject: Re: [xwiki-devs] {{html}} tag using JavaScript
Hi Riaz,
The clean approach is to put the JavaScript code in a
JavaScriptExtension (see
http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial#HMi
nimalJavaScripteXtension
) and leave only the HTML in the page content.
Hope this helps,
Marius
On Mon, Nov 14, 2011 at 1:30 PM, Riaz Shafi <riaz_shafi(a)hotmail.com> wrote:
Hi,
I'm struggling with adding a google map to an xwiki page using javascript.
Below is the code I'm using which does not work. It's not easy to see
where
the problem is.
{{html clean="false" wiki="false"}}
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false"></scr…
<script type="text/javascript" id="script">
var tableid = 297050;
var map;
function initialize() {
map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(37.4, -122.1),
zoom: 10,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'Address',
from: tableid
},
map: map
});
}
</script>
<script>
window.onload=initialize();
</script>
HELLO
<table><tr><td width="400" height="400">
<div id="map_canvas" style="width:100%;
height:100%"></div>
</td></tr></table>
{{/html}}
The page can be viewed Today (14/11/2011) on
http://playground.xwiki.org/xwiki/bin/view/Test/MapJavaScript
Username: guest password guest123
The html page I am trying to display is shown here:
http://gmaps-samples.googlecode.com/svn/trunk/fusiontables/fusiontableslayer
_example.html
Any help is much appreciated.
Thanks
Riaz
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs