forked from 0x2620/pandora
add pandora.logEvent
This commit is contained in:
parent
9ceeb34171
commit
e62467cba1
1 changed files with 30 additions and 0 deletions
|
@ -951,6 +951,36 @@ pandora.isClipView = function(view, item) {
|
||||||
).indexOf(view) > -1;
|
).indexOf(view) > -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pandora.logEvent = function(data, event, element) {
|
||||||
|
var element = this,
|
||||||
|
handlers = self.eventHandlers ? self.eventHandlers[event] : [];
|
||||||
|
if (!Ox.contains([
|
||||||
|
'mousedown', 'mouserepeat', 'anyclick', 'singleclick', 'doubleclick',
|
||||||
|
'dragstart', 'drag', 'dragenter', 'dragleave', 'dragpause', 'dragend',
|
||||||
|
'draganddropstart', 'draganddrop', 'draganddropenter', 'draganddropleave', 'draganddropend',
|
||||||
|
'playing', 'position', 'progress', 'request'
|
||||||
|
], event)) {
|
||||||
|
try {
|
||||||
|
data = JSON.stringify(data)
|
||||||
|
} catch(e) {}
|
||||||
|
Ox.print(
|
||||||
|
'EVENT',
|
||||||
|
element.oxid,
|
||||||
|
'"' + element[0].className.split(' ').filter(function(className) {
|
||||||
|
return /^Ox/.test(className);
|
||||||
|
}).map(function(className) {
|
||||||
|
return className.replace(/^Ox/, '');
|
||||||
|
}).join(' ') + '"',
|
||||||
|
event,
|
||||||
|
data,
|
||||||
|
handlers.length,
|
||||||
|
handlers.map(function(handler) {
|
||||||
|
return handler.toString().split('\n').shift();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
pandora.signin = function(data) {
|
pandora.signin = function(data) {
|
||||||
pandora.user = data.user;
|
pandora.user = data.user;
|
||||||
Ox.extend(pandora.user, {
|
Ox.extend(pandora.user, {
|
||||||
|
|
Loading…
Reference in a new issue