var dropfiles function var moveMode var xOffset var yOffset var window

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
var dropfiles = function() {
var moveMode = 0;
var xOffset = 0;
var yOffset = 0;
var windowXOffset = 0, windowYOffset = 0;
var moving = 0;
var clicked = {
x: 0,
y: 0
};
$(".file-overlay").unbind().on("mousedown", function(e) {
moveMode = 1;
var parent = $(this).parent();
original = parent;
moving = parent.clone().css({
opacity: "0.3",
zIndex: "10000000"
}).addClass("dragable");
moving.insertAfter(parent);
clicked.x = e.pageX;
clicked.y = e.pageY;
xOffset = e.pageX - parseInt(parent.parent().css("marginLeft"));
yOffset = e.pageY - parseInt(parent.parent().css("marginTop"));
windowXOffset = parseInt(parent.parent().parent().css("left"));
windowYOffset = parseInt(parent.parent().parent().css("top"))
}).on("dblclick", function() {
if ($(this).parent().attr("file") == "folder") {
var rWindow = $(".window").eq(1).find(".content");
rWindow.find(".file").detach();
var all = "";
$.each(oFile2, function(index, value) {
if (index != "length")
all += '<div class="file" file="' + value.file + '" name="' + value.name + '"></div>' + "\r\n";
});
rWindow.prepend(all);
files();
resizes();
dropfiles();
overlays();
} else {
var file = $(this).parent().attr("file");
var table = '<table width="100%" height="100%"><tr width="100%" height="100%"><td width="100%" height="100%" valign="middle" align="center">';
var tableEnd = "</td></tr></table>";
image = table + "<img class='preview' src='files/" + $(this).parent().attr("name") + "' />" + tableEnd;
audio = table + "<audio controls autoplay src='files/" + $(this).parent().attr("name") + "' />" + tableEnd;
switch (file) {
case "png":
case "gif":
addNewWindow("black", 1, 1, 1, "Просмотр изображения", image, 1);
break;
case "mp3":
case "wav":
case "aac":
addNewWindow("black", 1, 1, 1, "Прослушивание аудиозаписи", audio, 1);
break;
}
}
});
$(".content").unbind("mousemove").unbind("mouseup").on("mousemove", function(e) {
if (moveMode) {
var row = Math.floor((e.pageY - windowYOffset + 20 + moving.parent().scrollTop()) / 75) - 1;
var col = Math.floor((e.pageX - windowXOffset + 20.) / 82);
var maxCols = original.parent().attr("cols");
num = (row * maxCols) + col;
$(".file:not('.dragable')").css({
borderLeft: "none"
});
$(".file:not('.dragable')").eq(num).css({
borderLeft: "3px solid black"
});
moving.css({top: e.pageY - yOffset, left: e.pageX - xOffset});
}
}).on("mouseup", function() {
if (moving) {
moving.detach();
if (num >= 0) {
insertFile(original, Math.max(num, 0));
selected = $("none");
} else {
if (target.className == "file-overlay" && target != selected.find(".file-overlay")[0]) {
var overlay = original.find(".file-overlay");
unselectFile($(".file-overlay"));
unselectFile($(".file-overlay"));
selectFile(overlay, "black");
if (selected) selected.css({
background: "#eee",
color: "#137"
});
selected = original;
}
}
}
moveMode = 0;
moving = 0;
original = 0;
num = -1;
});
}