script(translate.js): dragging does not toggle original text.
This commit is contained in:
parent
6fcde3f63f
commit
800f2e6439
|
@ -45,11 +45,34 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
||||||
$prevNode.addClass('hidden');
|
$prevNode.addClass('hidden');
|
||||||
}
|
}
|
||||||
if (!isLink(node) && !isButton(node)) {
|
if (!isLink(node) && !isButton(node)) {
|
||||||
$node.on('click', function () {
|
var isDragging = false;
|
||||||
$prevNode.toggleClass('hidden');
|
$node.on('mousedown', function(){
|
||||||
|
$(window).on('mousemove', function(){
|
||||||
|
isDragging = true;
|
||||||
|
$(window).unbind('mousemove');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
$prevNode.on('click', function () {
|
$prevNode.on('mousedown', function(){
|
||||||
$prevNode.addClass('hidden');
|
$(window).on('mousemove', function(){
|
||||||
|
isDragging = true;
|
||||||
|
$(window).unbind('mousemove');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$node.on('mouseup', function () {
|
||||||
|
var wasDragging = isDragging;
|
||||||
|
isDragging = false;
|
||||||
|
$(window).unbind('mousemove');
|
||||||
|
if(!wasDragging){
|
||||||
|
$prevNode.toggleClass('hidden');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$prevNode.on('mouseup', function () {
|
||||||
|
var wasDragging = isDragging;
|
||||||
|
isDragging = false;
|
||||||
|
$(window).unbind('mousemove');
|
||||||
|
if(!wasDragging){
|
||||||
|
$prevNode.addClass('hidden');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$node.after($prevNode);
|
$node.after($prevNode);
|
||||||
|
@ -57,7 +80,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSpacingBetweenCnAndEn($node) {
|
function addSpacingBetweenCnAndEn($node) {
|
||||||
var nodes = document.querySelectorAll('.translated-cn');
|
var nodes = document.querySelectorAll('.translated-cn');
|
||||||
_.each(nodes, function (node) {
|
_.each(nodes, function (node) {
|
||||||
|
|
Loading…
Reference in New Issue