-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject.php
More file actions
365 lines (271 loc) · 12.5 KB
/
project.php
File metadata and controls
365 lines (271 loc) · 12.5 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Build Up Your App</title>
<link rel="stylesheet" href="project/project.css"/>
<link rel="stylesheet" href="project/workspace.css"/>
<link rel="stylesheet" href="project/global.css"/>
</head>
<body>
<!--This is the screen dialog and it's outside the container-->
<div id="screensPAGE" class="screenPAGEhide">
<button onclick="AddNewScreen();">Add Screen</button>
<br/><hr/>
<button style="color:red" onclick="DeleteScreen();">X</button>
<select id="selectSCREEN" onchange="SwitchTheScreen(this.value);">
<option value="1" id="optionScreen1">screen1</option>
</select>
<button onclick="RenameScreen();" style="color:red;background:none;border:none;padding:0">
🖋️
</button>
</div>
<div style="position:absolute;z-index:1;display:flex;align-items: center;flex-direction: row;">
<img id="RunButton" onclick="runTHEproject();" class="btn-active-start hover-effect" src="media/svg/play.svg" width="30px" alt="ActButton"
onmouseover ="ShowingToolTip(ActButtonTooltip,true);"
onmouseleave="ShowingToolTip(ActButtonTooltip);"/>
<span id="ActButtonTooltip" style="z-index:1;opacity:0;">
Alt+R
</span>
</div>
<div style="position:absolute;z-index:1;display:flex;align-items: center;flex-direction: row;">
<img id="Screenshot" class="hover-effect" onclick="ScreenshotNow();" src="media/svg/screenshot.svg" width="30px" alt="Screenshot"
onmouseover ="ShowingToolTip(ScreenShotTooltip,true);"
onmouseleave="ShowingToolTip(ScreenShotTooltip);"/>
<span id="ScreenShotTooltip" style="z-index:1;opacity:0;">
Alt+S
</span>
</div>
<div style="position:absolute;z-index:1;display:flex;align-items: center;flex-direction: row;">
<img id="BuildAPP" class="hover-effect" onclick="StartBuildAPP();" src="media/svg/build.svg" width="30px" alt="BuildAPP"
onmouseover ="ShowingToolTip(BuildAPPTooltip,true);"
onmouseleave="ShowingToolTip(BuildAPPTooltip);"/>
<span id="BuildAPPTooltip" style="z-index:1;opacity:0;">
Alt+B
</span>
</div>
<div id="imgDIALOG">
<p>
Choose Picture Or Upload New One.
</p>
<label class="upload-btn">
Upload Picture
<input type="file" accept="image/*" onchange="handleFileUpload(event)">
</label>
<div id="imgArea">
</div>
</div>
<div id='project_container' class="additionalProjectContainer">
<!--<div class='project_div' id="project_properties" style="display:none">-->
<div class='project_div' id="project_properties" style="display:none">
<!--<p>project_properties</p>-->
<input type="text" id='properties_name' onchange="if(this.value!='')updateKITname(this.value);"/>
<br/><hr/>
<?php
include('project/blocks/properties.html');
?>
<div id="btns">
<!--REMOVE BUTTON-->
<button id="Remove_button" class="hover-effect" onclick="REMOVINGtime({});" title="Delete The Entire Kit" disabled>Remove</button>
<!--REMOVE BUTTON-->
<!--SAVE BUTTON-->
<button id="Save_button" class="hover-effect" onclick="SAVINGtime();" title="Save Your New Changes" disabled>Save</button>
<!--SAVE BUTTON-->
</div>
</div>
<div class='project_div' id='project_timeline'><p id="timelineTITLE">project_timeline</p>
<p id="screenSETTINGS" class="hover-effect" onclick="showScreenProperties();" data-only="screen" data-id="1" data-name="Screen1" data-background="#f0f0f0">Current Screen Settings Properties</p>
<div id="screen1" class="timelineSCREEN">
<div id="drop-indicator" style="display: none;">
<div></div>
<!-- Having Small Issue With indicator for the first time. -->
</div>
</div>
</div>
<div class='project_div' id="project_live">
<div class="status-bar" id="con">
<div class="left" id="clock">00:00</div>
<div class="" id="activeDOT"></div>
<div class="right noselect" onclick="ScreensManager();" id="screenBUTTON" role="button" tabindex="0">screen1</div>
</div>
<img src="media/mockup/iphone.png" alt="Smartphone Frame" class="smartphone-frame" id="smartphone"/>
<div style="width:17.5em;">
<!--will use it to add informations later, maybe screen controls?-->
<!--i think maybe i will use it to add EXPORT button to save and download the project-->
<p style="font-size:10px;margin: 0;">Version v.0.1.5</p>
</div>
<div class="iframe-container">
<iframe frameborder="0" id="live_iframe" style="flex: 1;height:100%;width:100%;border:0;z-index: 1;"></iframe>
<div id="overlay" >
<img alt="" id="ScreenshotResult" width="251px" height="520px" style="visibility: hidden;"/>
</div> <!-- Overlay for drag-and-drop -->
</div>
</div>
<!--In Toolkit section, all the required tools will be here-->
<div class='project_div noselect' id="project_toolkit" onmouseout="infoParagraph.style.display='none';"><p>project_toolkit</p>
<!--
List of registered [elements] i'll add:
-Label [for short text].
-text [for longer text].
-picture [for inserting images].
-button [for adding clickable buttons].
-input [for allowing user to type text].
-switch [for creating a switcher on and off].
List of registered [functions] i'll add:
-Switch Page[Done]
-Storage
-->
<?php
include('project/blocks/toolkit.html');
?>
</div>
</div>
<button class="functionBTN hover-effect" onclick="switchScreen();">
Code Workspace⬇️
<div class="tooltip">ALT + 1</div>
</button>
<?php include "project/blocks/workspace.html"?>
<?php include "project/blocks/variablebox.html"?>
<script>
const screen1 = document.getElementById('project_container');
const screen2 = document.getElementById('CodeWorkspace');
const screen3 = document.getElementById('VariableBox');
function switchScreen()
{
// Toggle classes to switch screens
if (screen1.style.transform === 'translateY(-100%)') {//SHOWS PROJECT screen
screen1.style.transform = 'translateY(0)'; // Show Screen1.
screen2.style.transform = 'translateY(100%)'; //Hide Screen2.
} else {//SHOWS WORKSPACE screen
screen1.style.transform = 'translateY(-100%)';//Hide Screen1.
screen2.style.transform = 'translateY(0)'; // Show Screen2.
ScreensManager(false,true);
}
//Hiding, Or Showing The Act Button, maybe will need better enhance in the future to remove the animation.
RunButton.parentElement.classList.toggle("ToggleLikeSwitchScreen");
ScreenshotButton.parentElement.classList.toggle("ToggleLikeSwitchScreen");
BuildAPP.parentElement.classList.toggle("ToggleLikeSwitchScreen");
}
function switchVariableBox()
{
// showing the WORKSPACE screen
if (screen3.style.transform.includes('translateX(0')) {//checks if VariableBox is visible or not, i used includes instead of === because error of "0px"
screen3.style.transform = 'translateX(100%)'; //Hide Screen2.
screen3.style.opacity = "0";
console.log("Showing Workspace");
}
else {//showing the Variable Box screen
//screen2.style.transform = 'translateY(-100%)';//Hide Screen1.
screen3.style.transform = 'translateX(0)'; // Show Screen2.
screen3.style.opacity = "1";
console.log("Showing VARIABLE BOX");
}
}
</script>
<script src="project/variables.js"></script>
<script src="project/shortcut.js"></script>
<script src="project/actions.js"></script>
<script src="project/iframe.js"></script>
<script src="project/kit.js"></script>
<script src="project/project.js"></script>
<script src="project/workspace.js"></script>
<script src="project/build.js"></script>
<script src="project/interpreter.js"></script>
<script src="database/AJAXcalls.js"></script>
<script src="libraries/html2canvas.js"></script>
<div class="custom-cursor" style="z-index: 100;"></div>
<script>
const cursor = document.querySelector('.custom-cursor');
// Show cursor on first movement and remove listener
window. onFirstMouseMove = (e) => {
cursor.style.opacity = 1;
updateCursorPosition(e);
document.removeEventListener('mousemove', onFirstMouseMove);
};
// Update cursor position
window. updateCursorPosition = (e) => {
if(!isMouseInIframe)
{
cursor.style.left = `${e.clientX - cursor.offsetWidth / 2}px`;
cursor.style.top = `${e.clientY - cursor.offsetHeight / 2}px`;
}
else
{
const rect = live_iframe.getBoundingClientRect(); // Get iframe position
const mouseX = rect.left + e.clientX; // Adjust for iframe position
const mouseY = rect.top + e.clientY; // Adjust for iframe position
// Update cursor position, centered around the mouse pointer
cursor.style.left = `${mouseX - cursor.offsetWidth / 2}px`;
cursor.style.top = `${mouseY - cursor.offsetHeight / 2}px`;
//hover on certian elements like button, within IFRAME....
const element = e.target;
if (element.tagName === 'BUTTON')
ManageCursorHover(true);
else
ManageCursorHover(false);
}
};
// Initialize with one-time listener to show the cursor on first movement
document.addEventListener('mousemove', onFirstMouseMove);
// Listen for mouse movement to update position
document.addEventListener('mousemove', updateCursorPosition);
function ManageCursorHover(Status)
{
if(Status) cursor.classList.add('hovered');
else cursor.classList.remove('hovered');
}
// Add or remove 'hovered' class based on hovering over .hover-effect elements
document.addEventListener('mouseover', (e) => {
// Check if the hovered element or any of its parents has the 'hover-effect' class
const targetElement = e.target;
const parentWithHoverEffect = targetElement.closest('.hover-effect');
if (parentWithHoverEffect) {
// Apply the 'hovered' class to the cursor when hovering over the element or its children
ManageCursorHover(true);
}
/* if (e.target.classList.contains('hover-effect')) {
} */
});
document.addEventListener('mouseout', (e) => {
// Check if the hovered element or any of its parents has the 'hover-effect' class
const targetElement = e.target;
const parentWithHoverEffect = targetElement.closest('.hover-effect');
if (parentWithHoverEffect) {
// Apply the 'hovered' class to the cursor when hovering over the element or its children
ManageCursorHover(false);
}
/* if (e.target.classList.contains('hover-effect')) {
}*/
});
//live_iframe
let isMouseInIframe = false;
// Detect when the mouse leaves the iframe
live_iframe.addEventListener('mouseleave', () => {
isMouseInIframe = false;
ManageCursorHover(false);
});
// Detect when the mouse go inside the iframe
live_iframe.addEventListener('mouseenter', () => {
isMouseInIframe = true;
});
// Hide cursor when the user leaves the tab or window
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
cursor.style.display = 'none';
}
else cursor.style.display = 'block';
document.body.style.cursor = 'none'; // Hide default cursor
});
// Hide cursor when the user leaves browser
window.addEventListener('blur', () => {
if(!isMouseInIframe)
cursor.style.display = 'none';
document.body.style.cursor = 'none'; // Hide default cursor
});
// Show cursor when the user returns to the tab or window
window.addEventListener('focus', () => {
cursor.style.display = 'block';
});
</script>
</body>
</html>