forked from ButzYung/SystemAnimatorOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drop_area.html
106 lines (83 loc) · 2.11 KB
/
drop_area.html
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
99
100
101
102
103
104
105
106
<html>
<head>
<style>
body {
font-family:Segoe UI;
overflow:hidden;
}
div {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
#Ldrop_area {
position:absolute;
top:0px;
left:0px;
width:240px;
height:240px;
background-color:white;
display:flex;
justify-content:center;
flex-direction:column;
text-align:center;
font-size:48px;
font-weight:bold;
color:black;
border:8px dashed black;
border-radius: 24px;
opacity:0.5;
}
</style>
<script>
window.onload = function () {
document.ondblclick = function () { window.close() }
var _dragCancelDefault = function (e) {
e.stopPropagation();
e.preventDefault();
}
var _dragEnter = function (e) {
_dragCancelDefault(e)
}
var _dragExit = function (e) {
_dragCancelDefault(e)
}
var _dragOver = function (e) {
_dragCancelDefault(e)
}
var _drop = function (e) {
_dragCancelDefault(e);
var path = e.dataTransfer.files[0].path;
/*
var item = new System.Shell._FolderItem(new WebKit_object["Shell.Application"]._FolderItem({path:path}))
if (DragDrop.validate_func(item))
DragDrop.onDrop_finish(item)
*/
// NOTE: getGlobal is NOT reliable here with the current version of @electron/remote
//if ((require('electron').remote || require('@electron/remote')).getGlobal("is_transparent")) document.getElementById('Ldrop_area').style.visibility="hidden";
//(require('electron').remote || require('@electron/remote')).getGlobal("DropArea_drop")(path);
var remote = require('electron').remote;
if (remote) {
remote.getGlobal("DropArea_drop")(path);
}
else {
let ipcRenderer = require('electron').ipcRenderer;
ipcRenderer.send('getGlobal', 'DropArea_drop', path);
}
}
document.addEventListener("dragenter", _dragEnter, false);
document.addEventListener("dragexit", _dragExit, false);
document.addEventListener("dragover", _dragOver, false);
document.addEventListener("drop", _drop, false);
}
</script>
</head>
<body>
<!--
<div style="position:absolute; top:5px; left:5px; width:240px; height:240px; background-color:blue;" ></div>
-->
<div id="Ldrop_area">
<p style="cursor:default;">DROP<br/>AREA</p>
</div>
</body>
</html>