mirror of
https://github.com/MatMoul/quickdial-webext.git
synced 2024-12-23 07:26:11 +00:00
Bug: Prevent dragdrop on back node
This commit is contained in:
parent
dbe7751b77
commit
550757a186
@ -258,13 +258,25 @@ dial.initGrid = function(){
|
|||||||
link.onmousedown = function(){ dial._selectedItem = this; };
|
link.onmousedown = function(){ dial._selectedItem = this; };
|
||||||
|
|
||||||
function dragstart_handler(ev) {
|
function dragstart_handler(ev) {
|
||||||
|
if(!ev.target.Node){
|
||||||
|
ev.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
var index = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.getAttribute('gridindex'));
|
var index = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.getAttribute('gridindex'));
|
||||||
if(app.settings.grid.backNode && dial.path != '/') index -= dial.page;
|
if(app.settings.grid.backNode && dial.path != '/') index -= dial.page;
|
||||||
ev.dataTransfer.setData("text/plain", index);
|
ev.dataTransfer.setData("text/plain", index);
|
||||||
}
|
}
|
||||||
function dragover_handler(ev) {
|
function dragover_handler(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.dataTransfer.dropEffect = "move"
|
if(app.settings.grid.backNode && dial.path != '/'){
|
||||||
|
var gridIndex = 0;
|
||||||
|
if(ev.target.tagName == 'DIV') gridIndex = +(ev.target.parentElement.parentElement.getAttribute('gridindex'));
|
||||||
|
else gridIndex = +(ev.target.getAttribute('gridindex'));
|
||||||
|
if(gridIndex==0) ev.dataTransfer.dropEffect = "none";
|
||||||
|
else ev.dataTransfer.dropEffect = "move";
|
||||||
|
} else {
|
||||||
|
ev.dataTransfer.dropEffect = "move";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function drop_handler(ev) {
|
function drop_handler(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
Loading…
Reference in New Issue
Block a user