2012-04-17 03:53:38 +02:00
|
|
|
/**
|
|
|
|
* @provides javelin-behavior-differential-user-select
|
|
|
|
* @requires javelin-behavior
|
|
|
|
* javelin-dom
|
|
|
|
* javelin-stratcom
|
|
|
|
*/
|
|
|
|
|
|
|
|
JX.behavior('differential-user-select', function() {
|
|
|
|
|
|
|
|
var unselectable;
|
|
|
|
|
|
|
|
function isOnRight(node) {
|
2012-09-19 20:38:00 +02:00
|
|
|
return node.previousSibling &&
|
|
|
|
node.parentNode.firstChild != node.previousSibling;
|
2012-04-17 03:53:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
JX.Stratcom.listen(
|
|
|
|
'mousedown',
|
|
|
|
null,
|
|
|
|
function(e) {
|
|
|
|
var key = 'differential-unselectable';
|
|
|
|
if (unselectable) {
|
|
|
|
JX.DOM.alterClass(unselectable, key, false);
|
|
|
|
}
|
|
|
|
var diff = e.getNode('differential-diff');
|
|
|
|
var td = e.getNode('tag:td');
|
|
|
|
if (diff && td && isOnRight(td)) {
|
|
|
|
unselectable = diff;
|
|
|
|
JX.DOM.alterClass(diff, key, true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|