Marthee commited on
Commit
e777287
·
1 Parent(s): 8b139d2

Upload wordSearch.html

Browse files
Files changed (1) hide show
  1. templates/wordSearch.html +1021 -0
templates/wordSearch.html ADDED
@@ -0,0 +1,1021 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" dir="ltr">
3
+ <head>
4
+
5
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
6
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet"/>
7
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
8
+ <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
9
+
10
+ <link rel="stylesheet" href="https://use.typekit.net/zos0ars.css">
11
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
12
+ <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
13
+ <link rel="stylesheet" href="static/MenuStyle.css">
14
+ <link rel="stylesheet" href="static/LegendPageStyle.css">
15
+ <link rel="stylesheet" href="static/wordSearchCss.css">
16
+ <link rel="stylesheet" href="static/popups.css">
17
+ <link rel="stylesheet" href="static/IMG-Larger.css">
18
+ <meta charset="utf-8">
19
+ <title>ADR Console</title>
20
+ <link rel = "icon" type = "image/png" sizes = "180x154" href = "static/images/TSAlogoCropped180x154.png">
21
+ <link rel = "icon" type = "image/png" sizes = "32x27" href = "static/images/TSAlogoCropped32x27.png">
22
+ <link rel = "icon" type = "image/png" sizes = "16x14" href = "static/images/TSAlogoCropped16x14.png">
23
+ <link rel = "mask-icon" href = "static/images/TSAlogoCropped180x154.png">
24
+ <link rel = "shortcut icon" href = "static/images/TSAlogoCropped180x154.png">
25
+
26
+ <script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-core.min.js"></script>
27
+ <script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-sunburst.min.js"></script>
28
+ <script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-data-adapter.min.js"></script>
29
+
30
+
31
+
32
+ </head>
33
+ <body >
34
+ <div id="all">
35
+ {% include 'loading.html' %}
36
+ </div>
37
+ <!--Main tab links-->
38
+ <div class="tab" >
39
+ <div class="container" id="toggle">
40
+ <div class="bar1"></div>
41
+ <div class="bar2"></div>
42
+ <div class="bar3"></div>
43
+ </div>
44
+
45
+ <button class="tablinks" id="pagetitle" onclick="openTab(event, 'home')">ADR Console <i class="fa fa-home" > </i></button>
46
+ <button class="tablinks" id="LegendHist" onclick="openTab(event, 'legends')">Legends History <i class="fa fa-caret-down"></i></button>
47
+ <button class="dropbtn" onclick="userguideclick()"><img id="infoImg" src="data:image/png;base64,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"></button>
48
+ </div>
49
+
50
+
51
+ <div id="mySidebar" class="slide-out">
52
+ <div id="menuOptions">
53
+ <li><a href="{{ url_for('measurementConsoleFn') }}">Measure Plans </a></li>
54
+ <li onclick=redirectAlaaSearch()>Search in Documents</li>
55
+ <!-- <li><a href="{{ url_for('searchDocument') }}">Search in Documents</a></li> -->
56
+ </div>
57
+ </div>
58
+
59
+ <div id="home" class="tabcontent" >
60
+ <div id="loading" hidden> </div>
61
+
62
+ <div id="canvaswindow" hidden="until-found">
63
+ <canvas id="myCanvas"></canvas>
64
+ <br>
65
+ <input type="button" value="Draw New Shape" id="NewShapeButtonId" />
66
+ <input type="button" value="Undo" id="undoButtonId" />
67
+ <div id="colorpickers">
68
+ <input type="color" id="color" value="#2FFFFF" >
69
+ </div>
70
+ <input type="button" value="Save" id="savecanvas" />
71
+ </div>
72
+
73
+ <form method="post" id="myForm" >
74
+ <div class="w3-container">
75
+ <div class="w3-row">
76
+ <a href="javascript:void(0)" id="FileTabID" onclick="openFileFolderTab(event, 'file');">
77
+ <div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding" style="width: 185px; font-family: 'acumin-pro', sans-serif; font-style: normal; font-size: 17;">File</div>
78
+ </a>
79
+ <a href="javascript:void(0)" id="FolderTabID" onclick="openFileFolderTab(event, 'folder');">
80
+ <div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding" style="width: 185px; font-family: 'acumin-pro', sans-serif; font-style: normal; font-size: 17;">Folder</div>
81
+ </a>
82
+ </div>
83
+ <div id="file" class="w3-container FileFolder" style="display:none"> </div>
84
+ <div id="folder" class="w3-container FileFolder" style="display:none"> </div>
85
+ </div>
86
+ <div id="sunburst"></div>
87
+
88
+ <div id ="">
89
+ <select name="selectproj" class="selectionsProj" id="selectionsProjid" onchange=getproj() required > </select>
90
+ </div>
91
+
92
+ <div class="KeyWord">
93
+ <label id="keywordLabelID">Keyword</label>
94
+ <br>
95
+ <input type="text" placeholder="keyword" id="keywordinputID" required />
96
+ </div>
97
+
98
+ <div id ="tomeasurediv" hidden="until-found">
99
+ <label id="measureLabel">Documents To Search in</label> <br>
100
+ <div id="measureCheckbox">
101
+ <select style="margin-left: -1%;" hidden id="measureselectid" multiple size="5" required> </select>
102
+ </div>
103
+ </div>
104
+
105
+ <div id ="relvDocdiv" hidden="until-found">
106
+ <label id="relvDocLabel">Other Relevant Documents</label> <br>
107
+ <div id ="relvdiv">
108
+ <select style="margin-left: -1%;" hidden name="relvselectname" id="relvselectid" multiple size="5"> </select>
109
+ </div>
110
+ </div>
111
+
112
+ <button type="button" id="WordSearch" onclick="displayOutput()" >Search</button>
113
+ <br>
114
+ <!-- Outputs -->
115
+ <div id="OutputsId" class="w3-container w3-center w3-animate-opacity" hidden="until-found">
116
+ <div id="Table_df_ID"> </div>
117
+ <div class="scroll-container"> </div>
118
+ </div>
119
+
120
+ <div id="myModal" class="modal">
121
+ <span class="close">&times;</span>
122
+ <img class="modal-content" id="img01">
123
+ <div id="caption"></div>
124
+ </div>
125
+
126
+ </form>
127
+ </div>
128
+
129
+
130
+ <div id="legends" class="tabcontent">
131
+ <ul class="graynavbarLegend" >
132
+ <label class="label1">Project Name / Project Part / NRM Section /</label> <label class="label2">Legend</label>
133
+ <div class="legendtime">
134
+ <div style="display: inline-flex;">
135
+ <label class="CreatedTime"> Created Time </label>
136
+ <button id="sortBtnCreateDesc" class="sortbutton" onclick="sortlegends(this.id)"><i id="CreatesortDesc" class="fa fa-sort-amount-desc" aria-hidden="true" ></i> </button>
137
+ <button id="sortBtnCreateAsc" class="sortbutton" onclick="sortlegends(this.id)"><i id="CreatesortAsc" class="fa fa-sort-amount-asc" aria-hidden="true" ></i></button>
138
+ </div>
139
+ <div style="display: inline-flex;">
140
+ <label class="EditTime"> Last Edited Time </label>
141
+ <button id="sortBtnEditDesc" class="sortbutton" onclick="sortlegends(this.id)"><i id="EditsortDesc" class="fa fa-sort-amount-desc" aria-hidden="true" ></i></button>
142
+ <button id="sortBtnEditAsc"class="sortbutton" onclick="sortlegends(this.id)"><i id="EditsortAsc" class="fa fa-sort-amount-asc" aria-hidden="true" ></i> </button>
143
+ </div>
144
+
145
+ </div>
146
+ </ul>
147
+
148
+ </div>
149
+ <div class="dropdown-content">
150
+ <div id="userguidetext">
151
+ <div id="textfirstpage">
152
+ <label style="font-style: oblique;"> <br> Before using this tool, kindly read the following. </label>
153
+ <br><br>
154
+ <label style="font-style: oblique;" > Note : This algorithm is based on searching in pdfs only. </label>
155
+ <br><br>
156
+ The tool has two main tabs. File search - Folder Search.
157
+ <br><br>
158
+ <li id="userguideheadings"> File Search </li>
159
+ <br>The first dropdown available allows you to select the name of the project you wish to search in.
160
+ <br >
161
+ Write down the word you want to search for in the field labeled 'Keyword'.
162
+ You could choose one or more projects to search in from the "Documents to Measure" section. Additionally, you have the ability to view any relevant documents you might need in Dropbox.(optional)
163
+ <br> <br>
164
+ <li id="userguideheadings" > Folder Search </li>
165
+ <br>
166
+ Allows you to search in all pdfs found in a specific folder.
167
+ <br><br>
168
+ <label id="underlinedLables"> - Outputs: </label> <br>
169
+ Table: Contains a summary of the keyword used to search with, the name(s) of the document(s) search in, the number of occurences.
170
+ <br>
171
+ Image View of the pages in which the keyword was found.
172
+ <br> <br> <br>
173
+ </div>
174
+ </div>
175
+ </div>
176
+ <!-- POP-UP code -- to handle errors -->
177
+ <!-- Link to trigger modal -->
178
+
179
+ <!-- Modal popup box -->
180
+ <div id="mpopupBox" class="mpopup">
181
+ <!-- Modal content -->
182
+ <div class="modal-content">
183
+ <div class="modal-header">
184
+ <span class="close">×</span>
185
+ <h2>Error</h2>
186
+ </div>
187
+ <div class="modal-body">
188
+ <p id="modal-bodyText">
189
+ </p>
190
+ </div>
191
+
192
+ </div>
193
+ </div>
194
+
195
+ </body>
196
+ </html>
197
+
198
+ <script >
199
+ ///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
200
+
201
+ fileFolderTabVal=0
202
+ function openFileFolderTab(evt, cityName) {
203
+ var i, x, tablinks;
204
+ x = document.getElementsByClassName("FileFolder");
205
+ fileFolderTabVal=cityName
206
+ console.log(fileFolderTabVal)
207
+ for (i = 0; i < x.length; i++) {
208
+ x[i].style.display = "none";
209
+
210
+ }
211
+ tablinks = document.getElementsByClassName("tablink");
212
+ for (i = 0; i < x.length; i++) {
213
+ tablinks[i].className = tablinks[i].className.replace(" w3-border-blue", "");
214
+
215
+ }
216
+ document.getElementById(cityName).style.display = "block";
217
+ evt.currentTarget.firstElementChild.className += " w3-border-blue";
218
+ fileFolderSearch(fileFolderTabVal);
219
+ }
220
+ PopupElement=document.getElementById('modal-bodyText');
221
+
222
+ // add project names to first dropdown from google sheet
223
+ firstdropdown=document.getElementsByClassName('selectionsProj')[0];
224
+
225
+ $(firstdropdown).select2({
226
+ placeholder:'Projects',
227
+ closeOnSelect: true,
228
+ width:'51ch'
229
+
230
+ });
231
+
232
+ var measSelect = document.getElementById("measureselectid");
233
+ var relvSelect = document.getElementById("relvselectid");
234
+ document.getElementById("all").style.display = "block";
235
+
236
+ PrjNamesArray=[];
237
+ PrjPartsArray=[];
238
+ PrjSectionsArray=[];
239
+ var partsArrwithID=[];
240
+ var firstDpwnValue;
241
+
242
+ $.get('/getprojectnames/')
243
+ .success(function(data) {
244
+ document.getElementById("all").style.display = "none";
245
+ for (let i=0;i<data.length;i++)
246
+ {
247
+ var op0 = document.createElement("OPTION") ;
248
+ op0.text= 'Projects'
249
+ op0.value= "";
250
+ op0.hidden=true;
251
+ firstdropdown.add(op0);
252
+ opt=document.createElement("option");
253
+ opt.textContent=data[i];
254
+ opt.text=data[i];
255
+ firstdropdown.append(opt);
256
+ PrjNamesArray.push(data[i]);
257
+ }
258
+
259
+ })
260
+ .error(function(jqXHR, textStatus, errorThrown) {
261
+ PopupElement.textContent='Error occured while retrieving the Project Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
262
+ ShowPopUp();
263
+
264
+ });
265
+
266
+
267
+
268
+ /*Menu bar icon mySidebar and Toggle*/
269
+ var $mySidebar = document.getElementById('mySidebar');
270
+ var $toggle = document.getElementById('toggle');
271
+ $toggle.addEventListener('click', function() {
272
+
273
+ var isOpen = $mySidebar.classList.contains('slide-in');
274
+ w3_open();
275
+ $mySidebar.setAttribute('class', isOpen ? 'slide-out' : 'slide-in');
276
+ $toggle.classList.toggle("change");
277
+
278
+
279
+ if ($mySidebar.classList.contains('slide-out')){
280
+ w3_close()
281
+ }
282
+
283
+ });
284
+
285
+
286
+ //___________________________________________________________________________________________________________
287
+ //___________________________________________________________________________________________________________
288
+
289
+ //___________________________________________________________________________________________________________
290
+ //___________________________________________________________________________________________________________
291
+ /*Tab View of User Guide*/
292
+
293
+ function w3_open() {
294
+ document.getElementById("home").style.marginLeft = "25%";
295
+ document.getElementById("legends").style.marginLeft = "25%";
296
+
297
+ document.getElementById("home").style.transition= '0.8s';
298
+ document.getElementById("legends").style.transition= '0.8s';
299
+
300
+ document.getElementById("mySidebar").style.width = "25%";
301
+ document.getElementById("mySidebar").style.display = "block";
302
+ }
303
+
304
+ function w3_close() {
305
+ document.getElementById("home").style.marginLeft = "0%";
306
+ document.getElementById("legends").style.marginLeft = "0%";
307
+ document.getElementById("home").style.transition= '1.5s'
308
+ document.getElementById("legends").style.transition= '1.5s'
309
+ document.getElementById("mySidebar").style.display = "none";
310
+ }
311
+ //___________________________________________________________________________________________________________
312
+ //___________________________________________________________________________________________________________
313
+ /*Red Alert to fill in the first 3 dropdowns: prj name, part, section*/
314
+ document.getElementById('WordSearch').addEventListener('click',function(){
315
+ if (!document.getElementsByClassName('selectionsProj')[0].value)
316
+ document.getElementsByClassName('selectionsProj')[0].style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
317
+
318
+ // //___________________________________________________________________________________________________________
319
+ // //___________________________________________________________________________________________________________
320
+
321
+ });
322
+ //___________________________________________________________________________________________________________
323
+ //___________________________________________________________________________________________________________
324
+ /*Toggle Tab View of Home and Legend along with the Menu bar icon*/
325
+ function openTab(evt, tabname) {
326
+ // Declare all variables
327
+ var i, tabcontent, tablinks;
328
+
329
+ // Get all elements with class="tabcontent" and hide them
330
+ tabcontent = document.getElementsByClassName("tabcontent");
331
+ for (i = 0; i < tabcontent.length; i++) {
332
+ tabcontent[i].style.display = "none";
333
+ }
334
+
335
+ // Get all elements with class="tablinks" and remove the class "active"
336
+ tablinks = document.getElementsByClassName("tablinks");
337
+ for (i = 0; i < tablinks.length; i++) {
338
+ tablinks[i].className = tablinks[i].className.replace(" active", "");
339
+ }
340
+
341
+ // Show the current tab, and add an "active" class to the button that opened the tab
342
+ document.getElementById(tabname).style.display = "block";
343
+ evt.currentTarget.className += " active";
344
+ var isOpen = $mySidebar.classList.contains('slide-in');
345
+ if ($mySidebar.classList.contains('slide-in'))
346
+ {
347
+ $mySidebar.setAttribute('class', isOpen ? 'slide-out' : 'slide-in');
348
+
349
+ document.getElementById("pagetitle").style.backgroundColor='rgb(0, 60, 255)';
350
+
351
+ $toggle.classList.toggle("change");
352
+
353
+ }
354
+
355
+ }
356
+ // Start with the first page (Home)
357
+ document.getElementById("pagetitle").click();
358
+ document.getElementById("FileTabID").click();
359
+
360
+ function redirectAlaaSearch(){
361
+ $toggle.classList.toggle("change");
362
+ var isOpen = $mySidebar.classList.contains('slide-out');
363
+ $mySidebar.setAttribute('class', isOpen ? 'slide-in' : 'slide-out');
364
+ w3_close()
365
+
366
+ }
367
+
368
+ //___________________________________________________________________________________________________________
369
+ //___________________________________________________________________________________________________________
370
+ // _________________________________________________________________________________
371
+ //___________________________________________________________________________________________________________
372
+ /*User Guide button toggle*/
373
+ function userguideclick(){
374
+ console.log('cghj')
375
+ var acc = document.getElementsByClassName("dropdown-content")[0];
376
+ var i;
377
+ acc.classList.toggle("active");
378
+
379
+ /* Toggle between hiding and showing the active panel */
380
+ if (acc.style.display === "block") {
381
+ acc.style.display = "none";
382
+
383
+ } else {
384
+ acc.style.display = "block";
385
+ acc.style.backgroundColor=(0, 153, 255);
386
+ }
387
+ }
388
+ //to be retrieved from python code
389
+
390
+
391
+ //___________________________________________________________________________________________________________
392
+ //___________________________________________________________________________________________________________
393
+ /*Populate dropdowns*/
394
+
395
+ //get the dropdown value - projname
396
+ var proj = document.getElementsByClassName("selectionsProj")[0];
397
+ var pdfname;
398
+
399
+ function fileFolderSearch(fileFolderTabVal){
400
+ console.log(fileFolderTabVal)
401
+
402
+ if (fileFolderTabVal.startsWith('file'))
403
+ {
404
+ document.getElementById('tomeasurediv').removeAttribute('hidden');
405
+ document.getElementById('relvDocdiv').removeAttribute('hidden');
406
+ folderSunburst();
407
+
408
+ }
409
+ if (fileFolderTabVal.startsWith('folder'))
410
+ {
411
+ document.getElementById('tomeasurediv').setAttribute('hidden','until-found');
412
+ document.getElementById('relvDocdiv').setAttribute('hidden','until-found');
413
+ // folderSunburst();
414
+
415
+ }
416
+
417
+ }
418
+ // _________________________________________________________________________________
419
+ //___________________________________________________________________________________________________________
420
+ //Retrieves list of projects
421
+ function getproj(){
422
+
423
+ document.getElementById("all").style.display = "block";
424
+
425
+ var proj = document.getElementsByClassName("selectionsProj")[0];
426
+ var projectVal=proj.value.toString() //selected project
427
+
428
+
429
+ $.get( '/getmethod/'+JSON.stringify(projectVal))
430
+ .success (function(data){
431
+ document.getElementById("all").style.display = "none";
432
+ var docsToMeasure=data[0]; //
433
+ var relvDocs=data[1]
434
+ var projname = document.getElementsByClassName("selectionsProj")[0];
435
+
436
+ var meas = document.getElementById("measureCheckbox") ;
437
+ var relv = document.getElementById("relvdiv") ;
438
+
439
+ const measids=[];
440
+ const relvids=[];
441
+ const measoptns=[];
442
+
443
+ var measSelect = document.getElementById("measureselectid");
444
+ var relvSelect = document.getElementById("relvselectid");
445
+ var levelcheckbox= document.getElementById("levelcheckbox");
446
+
447
+ measSelect.removeAttribute("hidden");
448
+ relvSelect.removeAttribute("hidden");
449
+ measSelect.innerHTML='';
450
+ var optn2 = document.createElement("OPTION");
451
+ optn2.text= 'Select project to measure';
452
+ optn2.value=''
453
+ optn2.hidden=true;
454
+ optn2.id='hidden';
455
+
456
+ measSelect.add(optn2);
457
+ document.getElementById("hidden").required = true;
458
+ // console.log(measSelect)
459
+
460
+ relvSelect.innerHTML='';
461
+
462
+ for (i = 0; i < docsToMeasure.length; i++) {
463
+ //relevant documents
464
+ var optn1 = document.createElement("OPTION");
465
+ if (data=='No projects found'){
466
+ optn1.style.color='#bdbcbc';
467
+ optn1.style.cursor='not-allowed';
468
+ optn1.setAttribute('disabled',true);
469
+ }
470
+ else{
471
+ optn1.text= relvDocs[i][0];
472
+ optn1.value= relvDocs[i][0] ;
473
+ optn1.id=relvDocs[i][1] ;
474
+ relvSelect.add(optn1);
475
+ }
476
+ //to measure documents
477
+ var optn2 = document.createElement("OPTION");
478
+ if (data=='No projects found'){
479
+ optn2.style.color='#bdbcbc';
480
+ optn2.style.cursor='not-allowed';
481
+ optn2.setAttribute('disabled',true);
482
+ }
483
+ else{
484
+ optn2.text= docsToMeasure[i][0];
485
+ optn2.value= docsToMeasure[i][0] ;
486
+ optn2.id=docsToMeasure[i][1] ;
487
+ measSelect.add(optn2);
488
+ measoptns.push(optn2);
489
+ }
490
+ }
491
+
492
+ relvids.push(relvSelect) ;
493
+ measids.push(measSelect);
494
+ //to open pdf in a new tab (relevant documents)
495
+
496
+ $(measSelect).select2({
497
+ placeholder:'Select Projects',
498
+ closeOnSelect: true,
499
+ width:'51ch'
500
+ });
501
+
502
+ relvids.forEach(function(elem){
503
+ elem.addEventListener("change", function() {
504
+ document.getElementById("all").style.display = "block";
505
+ // var pdfpatharr=[]
506
+ // pdfpatharr.push(projname.value, projpart.value,projsec.value, elem.value)
507
+ $.get( '/getdropboxurl/'+JSON.stringify(elem.value))
508
+ .success (function(data){
509
+ document.getElementById("all").style.display = "none";
510
+ window.open( data)
511
+ })
512
+ .error(function(jqXHR, textStatus, errorThrown) {
513
+ PopupElement.textContent='Error occured while retrieving the dropbox URL. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
514
+ ShowPopUp();
515
+ });
516
+ });
517
+ });
518
+
519
+ measids.forEach(function(elem) {
520
+ elem.addEventListener("change", function() {
521
+ canvasimg='';
522
+ ry=[[]];
523
+ levelcheckbox.checked=false;
524
+ pdfname=elem.value;
525
+ measSelect.style.boxShadow='none';
526
+
527
+ document.getElementById("all").style.display = "block";
528
+ pixelArr=[projname.value, projpart.value,projsec.value, pdfname]
529
+
530
+ });
531
+
532
+ });
533
+ // document.getElementById('WordSearch').onclick= function()
534
+ // {
535
+ // if (!measSelect.value)
536
+ // measSelect.style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
537
+ // }
538
+ })
539
+ .error(function(jqXHR, textStatus, errorThrown) {
540
+ PopupElement.textContent='Error occured while retrieving the Project Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
541
+ ShowPopUp();
542
+ });
543
+ }
544
+ //___________________________________________________________________________________________________________
545
+ //___________________________________________________________________________________________________________
546
+ function displayOutput()
547
+ {
548
+ document.getElementById("loading").hidden = false;
549
+ document.getElementById('OutputsId').setAttribute('hidden','until-found');
550
+
551
+ document.getElementById('WordSearch').setAttribute('disabled',true);
552
+ document.getElementById('WordSearch').style.cursor='not-allowed';
553
+ document.getElementById('WordSearch').style.boxShadow = 'none';
554
+ document.getElementById('WordSearch').style.color = 'white';
555
+ document.getElementById('WordSearch').style.backgroundColor="rgb(154,152,152)";
556
+
557
+ if (fileFolderTabVal=='file')
558
+ ComputeOutput('/searchInDocs');
559
+ if (fileFolderTabVal=='folder')
560
+ ComputeOutput('/searchInFolder');
561
+ }
562
+
563
+ function ComputeOutput(pathtoFunc){
564
+
565
+ var outputs=document.getElementById('OutputsId');
566
+ var table=document.getElementById('Table_df_ID');
567
+ var imgsDiv= document.getElementsByClassName('scroll-container')[0]
568
+ if (pathtoFunc.startsWith('/searchInDocs'))
569
+ {
570
+
571
+ data= JSON.stringify({
572
+ keyword : document.getElementById('keywordinputID').value,
573
+ listofprojs : $('#measureselectid').val()
574
+ })
575
+ }
576
+ else
577
+ {
578
+ data= JSON.stringify({
579
+ keyword : document.getElementById('keywordinputID').value,
580
+ ProjectName : projectname
581
+ })
582
+ }
583
+
584
+ $.ajax({
585
+ url: pathtoFunc,
586
+ type: "POST",
587
+ contentType: "application/json",
588
+ data: data,
589
+ dataType: "json",
590
+ success: function(data)
591
+ {
592
+ document.getElementById("loading").hidden = true;
593
+ document.getElementById('WordSearch').removeAttribute('disabled');
594
+ document.getElementById('WordSearch').style.cursor='pointer';
595
+ document.getElementById('WordSearch').style.color = 'white';
596
+ document.getElementById('WordSearch').style.backgroundColor="#16c72e";
597
+ document.getElementById('WordSearch').style.padding='10px 102px';
598
+ document.getElementById('WordSearch').addEventListener('mouseover',function(){
599
+ document.getElementById('WordSearch').style.color='black';
600
+ document.getElementById('WordSearch').style.boxShadow=' 0 0 8px 2px #16c72e';
601
+ })
602
+ document.getElementById('WordSearch').addEventListener('mouseout',function(){
603
+ document.getElementById('WordSearch').style.color='white';
604
+ document.getElementById('WordSearch').style.boxShadow='none';
605
+ });
606
+
607
+ table.innerHTML='';
608
+ imgsDiv.innerHTML='';
609
+ document.getElementById('OutputsId').removeAttribute('hidden')
610
+ df=data[0]
611
+ listofImgs=data[1]
612
+ table.innerHTML=df
613
+
614
+ for (i=0;i<listofImgs.length;i++)(function(i){
615
+ console.log('lennn',listofImgs.length)
616
+ var imgcanvas= document.createElement("img");
617
+ imgcanvas.src= 'data:image/gif;base64,' +listofImgs[i];
618
+ // imgcanvas.width=700;
619
+ imgcanvas.height=500;
620
+ imgcanvas.id=listofImgs[i];
621
+ imgcanvas.alt="Larry";
622
+ imgcanvas.style.zIndex=999;
623
+ imgcanvas.onclick = function() {ImgLarger(imgcanvas.id,imgcanvas.src); }
624
+ imgsDiv.append(imgcanvas)
625
+
626
+ })(i);
627
+ },
628
+ error: function(err) {
629
+ PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
630
+ ShowPopUp();
631
+ }
632
+ });
633
+ }
634
+
635
+ function ImgLarger(id, src){
636
+ // Get the modal
637
+ var modal = document.getElementById('myModal');
638
+
639
+ // Get the image and insert it inside the modal - use its "alt" text as a caption
640
+ var img = document.getElementById(id);
641
+ var modalImg = document.getElementById('img01');
642
+ var captionText = document.getElementById("caption");
643
+ modal.style.display = "block";
644
+ modalImg.src = src;
645
+ captionText.innerHTML = 'Preview';
646
+
647
+
648
+ // Get the <span> element that closes the modal
649
+ var span = document.getElementsByClassName("close")[0];
650
+
651
+ // When the user clicks on <span> (x), close the modal
652
+ span.onclick = function() {
653
+ modal.style.display = "none";
654
+ }
655
+ }
656
+ //___________________________________________________________________________________________________________
657
+ //___________________________________________________________________________________________________________
658
+ //___________________________________________________________________________________________________________
659
+ //___________________________________________________________________________________________________________
660
+ /////////////////////////////////////*Sunburst*//////////////////////////////////
661
+
662
+ /////////////////////////////////////////////////////////////////////////////////////////
663
+ /////////////////////////////////////////////////////////////////////////////////////////
664
+
665
+ function folderSunburst(){
666
+
667
+ $.get('/getsunburst')
668
+ .success(function(data){
669
+ console.log(data)
670
+ drawSunburst(data)
671
+
672
+ })
673
+ .error(function(jqXHR, textStatus, errorThrown) {
674
+ PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
675
+ ShowPopUp();
676
+ });
677
+ }
678
+
679
+ function drawSunburst(old) {
680
+ // create a data tree from the dataset
681
+ console.log(old)
682
+ var data = [{
683
+ type: "sunburst",
684
+ labels: ['parent','child'],
685
+ parents: ['parent','child'],
686
+ values: old,
687
+ outsidetextfont: {size: 20, color: "#377eb8"},
688
+ leaf: {opacity: 0.4},
689
+ marker: {line: {width: 2}},
690
+ }];
691
+
692
+ var layout = {
693
+ margin: {l: 0, r: 0, b: 0, t: 0},
694
+ width: 500,
695
+ height: 500
696
+ };
697
+
698
+
699
+ Plotly.newPlot('sunburst', data, layout);
700
+ }
701
+ //___________________________________________________________________________________________________________
702
+ //___________________________________________________________________________________________________________
703
+ //___________________________________________________________________________________________________________
704
+ //___________________________________________________________________________________________________________
705
+ /////////////////////////////////////*LEGEND DIRECTORY*//////////////////////////////////
706
+
707
+ /////////////////////////////////////////////////////////////////////////////////////////
708
+ /////////////////////////////////////////////////////////////////////////////////////////
709
+ /*Get tables of Prj Names, parts , sections from API code */
710
+ table1={}
711
+ table2={}
712
+ table3={}
713
+ $.get('/getAPITables/')
714
+ .success(function(data){
715
+
716
+ table1=data[0]; //prj names table
717
+ table2=data[1]; //prj parts table
718
+ table3=data[2]; //prj sections table
719
+ })
720
+ .error(function(jqXHR, textStatus, errorThrown) {
721
+ PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
722
+ ShowPopUp();
723
+ });
724
+ var pathsarr={};
725
+ var legendscontent= document.getElementById('legends');
726
+ var createdTimeDiv= document.getElementById('createdTimeDiv');
727
+ //___________________________________________________________________________________________________________
728
+ //___________________________________________________________________________________________________________
729
+ /*Create divs for each prj and div for each part*/
730
+ getlegendstoDirectory()
731
+ function getlegendstoDirectory(){
732
+ $.get( '/getdrivelinks/'+'0').then (function(data){
733
+
734
+ pathsarr=data
735
+ if (!legendscontent.children[1]){
736
+ var allprjdiv= document.createElement("div");
737
+ allprjdiv.id='allprjdiv';
738
+ }
739
+ else{
740
+ legendscontent.children[1].innerHTML='';
741
+ var allprjdiv=legendscontent.children[1];
742
+ allprjdiv.id='allprjdiv';
743
+ }
744
+
745
+ for (let proj=0; proj<PrjNamesArray.length ; proj++)
746
+ {
747
+ var labelprojdiv= document.createElement("div");
748
+ var newlabelproj = document.createElement("label")
749
+ var i = document.createElement("i");
750
+ var brk= document.createElement("br");
751
+ i.className="fa fa-folder"
752
+ newlabelproj.textContent=PrjNamesArray[proj];
753
+ newlabelproj.id='prjname';
754
+ newlabelproj.className='prjnameclass';
755
+
756
+ labelprojdiv.append(i)
757
+ labelprojdiv.append(newlabelproj)
758
+ labelprojdiv.append(brk)
759
+ allprjdiv.append(labelprojdiv)
760
+
761
+ }
762
+ legendscontent.append(allprjdiv)
763
+
764
+ legendscontent.querySelectorAll('label').forEach(function(elem){
765
+ elem.addEventListener('click',function(){
766
+
767
+ if (!elem.parentElement.children[3]){
768
+
769
+ var prjnameId;
770
+ var prjpartsforLgnd=[];
771
+ var prjpartId;
772
+ var prjSectionsforLgnd=[];
773
+ /*get prj clicked on */
774
+ for (item in table1.ProjectName)
775
+ {
776
+ if (table1.ProjectName[item] == elem.textContent.toString())
777
+ {
778
+ prjnameId = table1.ProjectId[item];
779
+ break;
780
+ }
781
+ }
782
+ /*get prj parts of this prj and its id*/
783
+ for (item in table2.ProjectId)
784
+ {
785
+ if (table2.ProjectId[item] == prjnameId.toString())
786
+ {
787
+ prjpartsforLgnd.push(table2.ProjectPart[item]);
788
+ prjpartId=table2.ProjectPartId[item] ;
789
+ }
790
+ }
791
+ var allpartsdiv= document.createElement("div");
792
+ for (let prjpart=0;prjpart<prjpartsforLgnd.length;prjpart++)
793
+ {
794
+ var labelpartdiv= document.createElement("div");
795
+ labelpartdiv.style.marginLeft='20px';
796
+
797
+ var newlabelpart = document.createElement("label")
798
+ var i = document.createElement("i");
799
+ var brk= document.createElement("br");
800
+ i.className="fa fa-folder"
801
+
802
+ newlabelpart.textContent=prjpartsforLgnd[prjpart];
803
+ newlabelpart.id='prjpart';
804
+ newlabelpart.className='prjpartclass';
805
+
806
+ labelpartdiv.append(i)
807
+ labelpartdiv.append(newlabelpart)
808
+ labelpartdiv.append(brk)
809
+
810
+ allpartsdiv.append(labelpartdiv)
811
+ }
812
+ elem.parentElement.append(allpartsdiv)
813
+ elem.parentElement.querySelector('i').className='fa fa-folder-open';
814
+ /*Sections divs*/
815
+ for (let c=0;c<elem.parentElement.children[3].children.length;c++) //Div of Part
816
+ {
817
+ elem.parentElement.children[3].children[c].children[1].addEventListener('click',function(){
818
+ var partlabelText= elem.parentElement.children[3].children[c].children[1].textContent;
819
+
820
+ for (item in table3.ProjectId)
821
+ {
822
+ if (table3.ProjectId[item] ==prjnameId && table3.ProjectPartId[item]==prjpartId )
823
+ {
824
+ prjSectionsforLgnd.push(table3.ProjectSection[item]);
825
+ }
826
+ }
827
+
828
+ if (! elem.parentElement.children[3].children[c].children[3]) {
829
+
830
+ var labelsecdiv= document.createElement("div");
831
+ labelsecdiv.style.marginLeft='25px';
832
+ for (let cc=0;cc<prjSectionsforLgnd.length;cc++){
833
+ var seperateSecdiv = document.createElement("div")
834
+ var newlabelsec = document.createElement("label")
835
+ var i = document.createElement("i");
836
+ var brk= document.createElement("br");
837
+ i.className="fa fa-folder"
838
+
839
+ newlabelsec.textContent=prjSectionsforLgnd[cc];
840
+ newlabelsec.id='prjsec';
841
+ newlabelsec.className='prjsecclass';
842
+ if (!(newlabelsec.textContent.toString().startsWith('1.0') || newlabelsec.textContent.startsWith('3.2') || newlabelsec.textContent.startsWith('2.2') || newlabelsec.textContent.startsWith('2.1')))
843
+ {
844
+ newlabelsec.style.color='lightgray';
845
+ i.style.color='lightgray'
846
+ newlabelsec.style.cursor='default';
847
+ }
848
+ seperateSecdiv.append(i)
849
+ seperateSecdiv.append(newlabelsec)
850
+ seperateSecdiv.append(brk)
851
+ labelsecdiv.append(seperateSecdiv)
852
+
853
+ elem.parentElement.children[3].children[c].append(labelsecdiv)
854
+ // console.log(labelsecdiv)
855
+ }
856
+ elem.parentElement.children[3].children[c].children[0].className='fa fa-folder-open';
857
+
858
+
859
+ /*Get path to legends - project name , part , section*/
860
+
861
+ for (let k=0;k<elem.parentElement.children[3].children[c].children[3].children.length;k++)
862
+ {
863
+ elem.parentElement.children[3].children[c].children[3].children[k].children[1].addEventListener('click',function(){
864
+ legendpathh='/'+elem.textContent +'/' + partlabelText + '/' + elem.parentElement.children[3].children[c].children[3].children[k].children[1].textContent+'/'
865
+
866
+ if (!elem.parentElement.children[3].children[c].children[3].children[k].children[3])
867
+ {
868
+
869
+ for (let o=0; o<pathsarr.length;o++){
870
+ console.log(pathsarr[o])
871
+ if (JSON.stringify(pathsarr[o][1]) === JSON.stringify(legendpathh) ){
872
+ var legendsdiv= document.createElement("div");
873
+ legendsdiv.style.marginLeft='20px';
874
+
875
+ var seperateSecdiv = document.createElement("div")
876
+ var legendlabel = document.createElement("label")
877
+ var brk= document.createElement("br");
878
+ legendlabel.textContent=pathsarr[o][0]
879
+ legendlabel.id='legend';
880
+
881
+ legendlabel.className='legendclass';
882
+ var legendlabeldiv= document.createElement("div");
883
+ legendlabeldiv.id='legendtimediv'
884
+
885
+ var createdTimelbl = document.createElement("label")
886
+ var brk= document.createElement("br");
887
+ createdTimelbl.textContent=new Date(pathsarr[o][2].createdTime ).toUTCString()
888
+ createdTimelbl.id='legendtime';
889
+ createdTimelbl.className='legendclass';
890
+
891
+ var modifiedTimelbl = document.createElement("label")
892
+ var brk= document.createElement("br");
893
+ modifiedTimelbl.textContent=new Date(pathsarr[o][2].modifiedTime ).toUTCString()
894
+ modifiedTimelbl.id='legendmodtime';
895
+ modifiedTimelbl.className='legendclass';
896
+
897
+ console.log(pathsarr[o][2].createdTime,pathsarr[o][2].modifiedTime )
898
+ seperateSecdiv.append(legendlabel)
899
+ legendlabeldiv.append(createdTimelbl)
900
+ legendlabeldiv.append(modifiedTimelbl)
901
+
902
+ seperateSecdiv.style.display='flex';
903
+ seperateSecdiv.id='legendlbldivwhole'
904
+ seperateSecdiv.append(legendlabeldiv);
905
+ seperateSecdiv.append(brk);
906
+ legendsdiv.append(seperateSecdiv);
907
+ console.log(legendsdiv);
908
+
909
+ elem.parentElement.children[3].children[c].children[3].children[k].append(legendsdiv)
910
+
911
+
912
+ /*open legend link*/
913
+ seperateSecdiv.addEventListener('click',function(){
914
+ window.open('https://docs.google.com/spreadsheets/d/'+pathsarr[o][3])
915
+ })
916
+ if (elem.parentElement.children[3].children[c].children[3].children[k].children[0].className=='fa fa-folder')
917
+ elem.parentElement.children[3].children[c].children[3].children[k].children[0].className='fa fa-folder-open';
918
+ }
919
+ }
920
+ }
921
+ else{
922
+ for (let y =elem.parentElement.children[3].children[c].children[3].children[k].children.length; y>=0;y--)
923
+ {
924
+ if (elem.parentElement.children[3].children[c].children[3].children[k].children[y] instanceof HTMLDivElement)
925
+ elem.parentElement.children[3].children[c].children[3].children[k].removeChild(elem.parentElement.children[3].children[c].children[3].children[k].children[y]);
926
+ }
927
+ elem.parentElement.children[3].children[c].children[3].children[k].children[0].className='fa fa-folder';
928
+ }
929
+ })
930
+ }
931
+ }
932
+ else{
933
+ elem.parentElement.children[3].children[c].removeChild(elem.parentElement.children[3].children[c].children[3]);
934
+ elem.parentElement.children[3].children[c].children[0].className='fa fa-folder';
935
+
936
+ }
937
+
938
+ })
939
+ }
940
+ }
941
+ /*remove all parts along with sectionns of element (prj name)s*/
942
+ else{
943
+ elem.parentElement.removeChild(elem.parentElement.children[3]);
944
+ elem.parentElement.children[0].className='fa fa-folder';
945
+ }
946
+ })
947
+ })
948
+ })
949
+ }
950
+ function sortlegends(clicked_id){
951
+ var allarr=[]
952
+ for ( let u=0 ; u<document.getElementById('allprjdiv').children.length ; u++)
953
+ {
954
+ //Project names folder
955
+ if (document.getElementById('allprjdiv').children[u].children[3])
956
+ {
957
+ for (let uu=0 ; uu<document.getElementById('allprjdiv').children[u].children[3].children.length;uu++)
958
+ {//Project part folder
959
+ if(document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3])
960
+ {
961
+ var arr=[]
962
+ for (let uuu=0;uuu<document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children.length;uuu++)
963
+ {//NRM section folder - direct parent
964
+ for (let h=0;h<document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children.length;h++)
965
+ {
966
+ if (document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h] instanceof HTMLDivElement)
967
+ {
968
+ if (clicked_id == 'sortBtnCreateDesc' || clicked_id == 'sortBtnCreateAsc' )
969
+ arr.push([document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h], new Date(document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h].children[0].children[1].children[0].textContent)])
970
+ if (clicked_id == 'sortBtnEditDesc' || clicked_id == 'sortBtnEditAsc' )
971
+ arr.push([document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h], new Date(document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h].children[0].children[1].children[1].textContent)])
972
+ // legends in this parent only
973
+
974
+ if (h==document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children.length-1)
975
+ {
976
+ if (clicked_id == 'sortBtnCreateDesc' || clicked_id == 'sortBtnEditDesc' )
977
+ x=arr.sort((a, b) => b[1]- a[1])
978
+ if (clicked_id=='sortBtnCreateAsc' || clicked_id == 'sortBtnEditAsc' )
979
+ x=arr.sort((a, b) => a[1]- b[1])
980
+
981
+ if (document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h] instanceof HTMLDivElement)
982
+ {
983
+ console.log(document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu] )
984
+ for (let k =0; k <x.length; k++)
985
+ document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].appendChild(x[k][0])
986
+ }
987
+ }
988
+ }
989
+ }
990
+ }
991
+ allarr.push(arr);
992
+ }
993
+ }
994
+ }
995
+ }
996
+ }
997
+ //___________________________________________________________________________________________________________
998
+ //___________________________________________________________________________________________________________
999
+ /* POP-UP code JS*/
1000
+ // Select modal
1001
+ var mpopup = document.getElementById('mpopupBox');
1002
+ // Select trigger link
1003
+ var mpLink = document.getElementById("mpopupLink");
1004
+ // Select close action element
1005
+ var close = document.getElementsByClassName("close")[0];
1006
+ function ShowPopUp(){
1007
+ // Open modal
1008
+ mpopup.style.display = "block";
1009
+ }
1010
+ // Close modal once close element is clicked
1011
+ close.onclick = function() {
1012
+ mpopup.style.display = "none";
1013
+ };
1014
+ // Close modal when user clicks outside of the modal box
1015
+ window.onclick = function(event) {
1016
+ if (event.target == mpopup) {
1017
+ mpopup.style.display = "none";
1018
+ }
1019
+ };
1020
+ </script>
1021
+