|
@ -1,15 +1,15 @@ |
|
|
var Question = new Class( { |
|
|
var Question = new Class( { |
|
|
|
|
|
|
|
|
initialize : function(question, hint, answers) { |
|
|
initialize : function(question, hint, answers) { |
|
|
var self = this |
|
|
var self = this; |
|
|
|
|
|
|
|
|
self.question = question |
|
|
self.question = question; |
|
|
self.hint = hint |
|
|
self.hint = hint; |
|
|
self.answers = answers |
|
|
self.answers = answers; |
|
|
|
|
|
|
|
|
self.createQuestion(); |
|
|
self.createQuestion(); |
|
|
self.answers.each(function(answer) { |
|
|
self.answers.each(function(answer) { |
|
|
self.createAnswer(answer) |
|
|
self.createAnswer(answer); |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
@ -29,14 +29,14 @@ var Question = new Class( { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
createAnswer : function(options) { |
|
|
createAnswer : function(options) { |
|
|
var self = this |
|
|
var self = this; |
|
|
|
|
|
|
|
|
var answer = new Element('a', Object.merge(options, { |
|
|
var answer = new Element('a', Object.merge(options, { |
|
|
'class' : 'answer button '+(options['class'] || '')+(options['cancel'] ? ' cancel' : '') |
|
|
'class' : 'answer button '+(options['class'] || '')+(options['cancel'] ? ' cancel' : '') |
|
|
})).inject(this.container) |
|
|
})).inject(this.container); |
|
|
|
|
|
|
|
|
if (options.cancel) { |
|
|
if (options.cancel) { |
|
|
answer.addEvent('click', self.close.bind(self)) |
|
|
answer.addEvent('click', self.close.bind(self)); |
|
|
} |
|
|
} |
|
|
else if (options.request) { |
|
|
else if (options.request) { |
|
|
answer.addEvent('click', function(e){ |
|
|
answer.addEvent('click', function(e){ |
|
@ -44,7 +44,7 @@ var Question = new Class( { |
|
|
new Request(Object.merge(options, { |
|
|
new Request(Object.merge(options, { |
|
|
'url': options.href, |
|
|
'url': options.href, |
|
|
'onComplete': function() { |
|
|
'onComplete': function() { |
|
|
(options.onComplete || function(){})() |
|
|
(options.onComplete || function(){})(); |
|
|
self.close(); |
|
|
self.close(); |
|
|
} |
|
|
} |
|
|
})).send(); |
|
|
})).send(); |
|
@ -59,7 +59,7 @@ var Question = new Class( { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
toElement : function() { |
|
|
toElement : function() { |
|
|
return this.container |
|
|
return this.container; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
}); |
|
|