-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathedit.htm
299 lines (258 loc) · 12.5 KB
/
edit.htm
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link REL="SHORTCUT ICON" HREF="img/shanti.ico">
<title>VisualEyes Project Editor</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script src="jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" src='//www.google.com/jsapi?autoload={"modules":[{"name":"visualization","version":"1"}]}'></script>
<script src="data.js" type="text/javascript"></script>
<style type="text/css">
body { font-family:Verdana,Geneva,sans-serif; font-size:12px;
padding: 0px; box-sizing: border-box;
}
.ef-main {
}
.ef-menu { width: 100%; height: 32px; color:#666; background-color:#ddd; opacity: inherit;
border-top-left-radius: 6px; border-top-right-radius:6px;
}
.ef-menuItem { margin-left: 50px; cursor: pointer; color:#000; font-weight: normal;
}
.ef-navMenubar { position:absolute;padding:16px;
}
.ef-navMenuItem { margin-right:20px;cursor:pointer;
}
.ef-showItem { font-weight: bold; text-align: left; float: right; margin-right: 12px; margin-top: 8px;
}
.ef-body { width: calc(100% - 4px);min-height: 300px; color :#666; border: 2px solid #ddd;
background-color:#fff; opacity: inherit;
}
.ef-editor { position: absolute; background-color :#ddd; width: 576px; height: 276px;
border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; padding: 12px;
border: 1px solid #999;
}
.ef-pullDown { position: absolute; background-color :#ddd; width: 100px;
}
.ef-pullDownItem:hover{ background-color: #bbb; color: #eee
}
.ef-pullDownItem { padding-bottom: 6px; cursor: pointer; width: 92px; padding:6px;
padding-left: 8px; padding-right: 0px; color:#999;
}
.unselectable { -moz-user-select: none; -khtml-user-select: none;
-webkit-user-select: none; -ms-user-select: none; user-select: none;
}
.selectable { -moz-user-select: text; -khtml-user-select: text;
-webkit-user-select: text; -ms-user-select: text; user-select: text;
}
.ef-is { border-radius:1 0px; padding-left: 8px; padding-right: 8px; padding-top: 1px;
border: 1px solid #999; font-size: 12px; height: 20px; width: 200px;
}
.ef-bs { border-radius:10px; padding-left:8px; padding-right:8px; padding-top:1px; background-color: #aaa;
border:1px solid #999; font-size:12px; height:20px; color:#fff; cursor: pointer;
}
</style>
</head>
<body>
<div id="mainDiv" class="ef-main unselectable" style="opacity:0">
<div id="menuDiv" class="ef-menu" >
<img src="img/menuheader.png">
<span style="vertical-align:10px">
S H A N T l
<span style="margin-left:100px"></span>
<span id="eventMenu" class="ef-menuItem" onclick='EditEvent(this)'>Event</span>
<span id="graphicMenu" class="ef-menuItem" onclick='EditGraphic(this)'>Graphic</span>
<span id="storyMenu" class="ef-menuItem" onclick='EditStory(this)'>Story</span>
<span id="helpMenu" class="ef-menuItem">Help</span>
<span id="refreshMenu" style="margin-left:50px"class="ef-bs">Preview & Save</span>
<div id="showMenu" class="ef-showItem"><b>No project loaded yet...</b></div>
</span>
</div>
<div id="bodyDiv" class="ef-body"></div>
</div>
<script>
var isMobile=false; // Flag for mobile devices
var host="//viseyes.org/visualeyes/"; // Set host for database save/load
var userName="",password="",curShow=0; // Login info
var lastClickTime=0; // Store last click time
var changed=false; // Changed flag
var curShow=""; // Current show
var dtl={}; // Holds data library
var curJson=[]; // Holds
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// INIT
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$(document).ready(function() { // WHEN PAGE LOADED
if (window.addEventListener) // If supported this way
window.addEventListener("message",shivaEventHandler,false); // Add event handler
else // Use other method
window.attachEvent("message",shivaEventHandler); // Add handler
var url=window.location.search.substring(1); // Get query string
dtl=new DataLoad(); // Alloc data module
isMobile=navigator.userAgent.match(/(ipad|iphone|ipod|android)/i) ? true : false; // Set mobile flag
drupalMan=(""+url).match(/pr=d/); // If called from Drupal manager
var h=$(window).height()-55; // Calc height
var str="<iframe class='player' frameborder='0' scrolling='no' id='playerIF' src='index.html?-456";// Iframe
str+="' style='border:0;padding:0;margin:0;width:100%;height:"+h+"px'></iframe>"; // Sizing
$("#bodyDiv").append(str); // Add player iframe
$("#mainDiv").animate({ opacity:1 },3000); // Fade in
$(window).resize(function() { // Dynamic resizing
var h=$(window).height()-55; // Calc height
$("#playerIF").height(h) // Resize iframe
});
});
function SendShivaMessage(cmd, msg) // SEND SHIVA MESSAGE
{
var str=cmd; // Add src
if (msg) // If more to it
str+="|"+msg; // Add it
var win=document.getElementById("playerIF").contentWindow; // Point at iframe
win.postMessage(str,"*"); // Send message to show
}
function shivaEventHandler(e) // ON SHIVA EVENT
{
if (e.data && e.data.match(/Editor=load/)) { // A show loaded
curShow=e.data.substring(12); // Get show number
$("#showMenu").text("Current show: "+curShow); // Set id
var url="//www.stagetools.com/qmedia/loadshow.php?id="+curShow; // Get from db
$.ajax({ url: url, dataType:'jsonp' }); // Get jsonp and call LoadShow() from it
}
}
function LoadShow(data) // LOAD A SHOW
{
if (data.sheet) { // If a spreadsheet spec'd
dtl.GetSpreadsheet(data.sheet,true,null,function(mobs) { // Get spreadsheet data
var i,key;
for (i=0;i<mobs.length;++i) // For each mob
for (key in mobs[i]) { // For each field in mob
if (mobs[i][key]) // If not null
mobs[i][key]=(""+mobs[i][key]).replace(/(\s)$/,""); // Strip trailing space
}
curJson=mobs; // Set mobs
},true);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// MENUS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$("#fileMenu").on("click",function(e) {
var l=$(this).position().left+92;
var t=$(this).position().top+23;
$("#fileMenu").css("color","#009900");
$("#fileDiv").remove();
var str="<div class='ef-pullDown' style='left:"+l+"px;top:"+t+"px' id='fileDiv'>";
str+="<div class='ef-pullDownItem' onclick='dataObj.Save()'> Copy </div>";
str+="<div class='ef-pullDownItem' onclick=''dataObj.Load()'> Paste </div>";
str+="<div id='undoMenu' class='ef-pullDownItem' onclick='UnDo()'> Undo</div>";
str+="</div>";
$("body").append(str);
$("#undoMenu").css("color", changed ? "#000" : "#999"); // Show active undos available
$("#fileDiv").on("mouseleave",function() {
$("#fileDiv").remove();
$("#fileMenu").css("color","#000");
});
$("#fileDiv").on("click",function(e) {
var i=Math.floor(Math.max(0,Math.min((e.clientY-42)/24,4)));
$("#fileDiv").remove();
$("#eventMenu").css("color","#000");
});
});
$("#refreshMenu").on("click",function() {
SendShivaMessage("Editor=refresh");
});
$("#helpMenu").on("click",function(e) {
window.open("https://docs.google.com/document/d/161td5ZuqKqT5R5r9z1P8AxBA6l9LaP-eYl_RvCyvw2g","_blank");
});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// EDITING
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function EditEvent(o)
{
var l=$(o).position().left+20;
var t=$(o).position().top+24;
$(".ef-menuItem").css({ "color":"#000","font-weight":"normal" }); // Restore menu bar
$("#eventMenu").css({ "color":"#009900","font-weight":"bold" }); // Highlight this menu
$("#editDiv").remove(); // Remove old editor
var str="<div class='ef-editor' style='left:"+l+"px;top:"+t+"px' id='editDiv'>"
str+="<img src='img/closedot.gif' style='float:right' id='editCloseDot'>";
str+="Show list of graphics to edit"
str+="</div>";
$("body").append(str); // Add editor
$("#editDiv").draggable(); // Make it draggable
$("#editCloseDot").on("click",function(e) {
$("#editDiv").remove(); // Remove editor
$(".ef-menuItem").css({ "color":"#000","font-weight":"normal" }); // Restore menu bar
});
}
function EditStory(o)
{
var t=$(o).position().top+24;
var w=$(window).width()-34;
var h=$(window).height()-t-36;
var l=w*.66667;
$(".ef-menuItem").css({ "color":"#000","font-weight":"normal" }); // Restore menu bar
$("#storyMenu").css({ "color":"#009900","font-weight":"bold" }); // Highlight this menu
$("#editDiv").remove(); // Remove old editor
var str="<div id='editDiv' class='ef-editor' style='left:"+l+"px;top:"+t+"px;"
str+="width:"+w*.33333+"px;height:"+h+"px;border-radius:0'>";
str+="<img src='img/closedot.gif' style='float:right' id='editCloseDot'>";
str+="Rich text editor";
str+="</div>";
$("body").append(str); // Add editor
$("#editDiv").draggable(); // Make it draggable
$("#editCloseDot").on("click",function(e) {
$("#editDiv").remove(); // Remove editor
$(".ef-menuItem").css({ "color":"#000","font-weight":"normal" }); // Restore menu bar
});
}
function EditGraphic(o)
{
var l=$(o).position().left+20;
var t=$(o).position().top+24;
$(".ef-menuItem").css({ "color":"#000","font-weight":"normal" }); // Restore menu bar
$("#graphicMenu").css({ "color":"#009900","font-weight":"bold" }); // Highlight this menu
$("#editDiv").remove(); // Remove old editor
var str="<div class='ef-editor' style='left:"+l+"px;top:"+t+"px' id='editDiv'>"
str+="<img src='img/closedot.gif' style='float:right' id='editCloseDot'>";
str+="Show list of graphics to edit<br>"
str+="</div>";
$("body").append(str); // Add editor
$("#editDiv").draggable(); // Make it draggable
$("#editCloseDot").on("click",function(e) {
$("#editDiv").remove(); // Remove editor
$(".ef-menuItem").css({ "color":"#000","font-weight":"normal" }); // Restore menu bar
});
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// UNDO
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function UnDo()
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HELPERS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function trace(msg, p1, p2, p3, p4) // CONSOLE
{
if (p4 != undefined)
console.log(msg,p1,p2,p3,p4);
else if (p3 != undefined)
console.log(msg,p1,p2,p3);
else if (p2 != undefined)
console.log(msg,p1,p2);
else if (p1 != undefined)
console.log(msg,p1);
else
console.log(msg);
}
// GOOGLE ANALYTICS ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-10474630-1', 'auto');
ga('send', 'pageview');
</script>
</body></html>