Ślęczę nad tym i ślęczę i nie mogę znaleźć tej literówki. W okolicy 31...32 jest błąd...To musi być jakaś moja literów, bo nawet nie wiem gdzie miałbym zapomnieć o ":". Pomożecie? W znalezieniu? Nie wiem. Gdzieś nawiasu nie dopisałem?
(function($){
$.fn.changeColor = function(options)
{
function onClick(event){
//cialo metody prywatnej
$this = $(this);
data = $this.data('changeColor');
data.first = !data.first;
$this.css("backgroundColor", data.first ? data.colorSecond : data.colorFirst);
return true;
}
//metody publiczne
var methods = {
swapColors: function(){
$this=$(this);
data = $this.data('changeColor');
tmp = data.colorSecond;
data.colorSecond = data.colorFirst;
data.colorFirst = tmp;
},
destroy: function(){
//destruktor
$this = $(this);
$this.unbind("click");
$this.css("backgroundColor","");
$this.removeData("changeColor");
}
};
return this.each(function()({
if(methods[options])
{
return methods[options].apply(this,arguments);
}
else if (typeof options === ' object ' || ! options){
//parametry pluginu
var settings = $.extend({
colorFirst:'Red',
colorSecond:'Green'
},options);
$this = $(this);
data = $this.data('changeColor');
if (!data)
{
data = $this.data('changeColor',settings);
$this.bind('click',onClick);
}
$this.css("background-color",settings.colorFirst);
data.first=true;
return;
}
else
{
//bład
$.error('changeColor: no method: '+ options);
}
});
}
})(jQuery);