no compatibility google add and my class (prototype)

15 views
Skip to first unread message

houpdelta

unread,
Jan 24, 2012, 6:22:24 PM1/24/12
to Prototype & script.aculo.us
Hi,

I have a problem.
I have a google add plugin.and I have a JS file written by me.

<script type="text/javascript">
window.___gcfg = {lang: 'fr'};
(function() {
var po = document.createElement('script'); po.type = 'text/
javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
</script>
<script src="../js/prototype/class.prototype-1-7.js" charset="utf-8"
type="text/javascript"></script>
<script src="../js/class.function_1.0.js" charset="utf-8" type="text/
javascript"></script>

In class.function_1.0.js , I have this code :

var User;
User = Class.create({
.....
});

var Errror;
Error = {
};

If I don't write the google add plugin, this code is good.
If I write the google add plugin, the google button doesn't work, it
is hidden.

If I modify my code

var User;
User = Class.create({
.....
});
}; -> add this element

var Errror;
Error = {
};

The google button is visible and works but the class "user" is not
defined.

I don't understand, I think that I make a mistake with };.

Can you help me ?

Thank.




Victor

unread,
Jan 25, 2012, 9:12:59 AM1/25/12
to prototype-s...@googlegroups.com
What is

var Errror;
Error = {
};

(note the difference between Errror and Error)

laurent barre

unread,
Jan 25, 2012, 10:37:40 AM1/25/12
to prototype-s...@googlegroups.com
It's a mistake.

var Error;
Error = {

};

2012/1/25, Victor <vkhom...@gmail.com>:


> What is
>
> var Errror;
> Error = {
> };
>

> (note the difference between *Errror* and *Error*)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/prototype-scriptaculous/-/EVbMZKNLXmcJ.
> To post to this group, send email to
> prototype-s...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scripta...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>

laurent barre

unread,
Jan 25, 2012, 10:38:44 AM1/25/12
to prototype-s...@googlegroups.com
var Errror;
Error = {

function_1 () {
...
},

function_2 () {
...
}

};

2012/1/25, laurent barre <houp...@gmail.com>:

Victor

unread,
Feb 10, 2012, 4:15:36 AM2/10/12
to prototype-s...@googlegroups.com
1. You cannot use the name `Error` - there is already global object named Error. Try with another name.
2. You can shorten your code a bit:
var User = Class.create({
  // methods
});

Reply all
Reply to author
Forward
0 new messages