Widget API and Prototype.js conflict

170 views
Skip to first unread message

olafos

unread,
May 16, 2012, 7:58:06 AM5/16/12
to panora...@googlegroups.com
Hello,

I'm facing the following problem: I'm using prototype.js library on my site (http://www.prototypejs.org/) which is a pretty well-known JavaScript framework. Unfortunately it seems to be conflicting with the Widget API. Here's an example code:

<html>
<head>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
<script type="text/javascript" src="http://www.panoramio.com/wapi/wapi.js?v=1&amp;hl=en"></script>

</head>
<body>

<div id="my_widget" ></div>
<script type="text/javascript">
var search_rect = {rect: {sw: {lat: 54.158319 , lng: 19.394938}, ne: {lat: 54.158823, lng: 19.395689}}};
var photo_ex_options = {width: 350, height: 200};
var panoramioPhotoWidget = new panoramio.PhotoWidget('my_widget', search_rect, photo_ex_options);
panoramioPhotoWidget.setPosition(0);
</script>

</body>
</html>
 
The widget fails to render because of the following error: (this is what Chrome's console displays):

Uncaught SyntaxError: Invalid regular expression: /function each(iterator, context) { var index = 0; try { this._each(function(value) { iterator.call(context, value, index++); }); } catch (e) { if (e != $break) throw e; } return this; }/: Nothing to repeat


Does anyone know a solution?

Thanks,
Olaf

QuentinUK

unread,
Jan 21, 2013, 11:15:13 AM1/21/13
to panora...@googlegroups.com
Move the Prototype include after the Panoramio, thus:-
Reply all
Reply to author
Forward
0 new messages