-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
568 lines (493 loc) · 28.9 KB
/
Copy pathindex.php
File metadata and controls
568 lines (493 loc) · 28.9 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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
<?php
session_start();
include_once("php_functions/functions.php");
include_once("configs/conn.inc");
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="<?php echo $assets; ?>assets/plugins/highlightjs/styles/monokai-sublime.min.css">
<title> Zidi : Home</title>
<style>
li.active {
color: red;
}
</style>
<!-- <script type="text/javascript" src="assets/ckeditor/ckeditor.js"></script> -->
<!-- Bootstrap Core and vendor -->
<?php
include_once 'styles.php';
?>
</head>
<body class="font-opensans">
<!-- Page Loader -->
<div class="page-loader-wrapper">
<div class="loader">
</div>
</div>
<!-- Start main html -->
<div id="main_content">
<?php
include_once 'index-header.php';
?>
<!-- start main body part-->
<div id="body-wrapper" class="row">
<!-- start body header -->
<div class="col-lg-1"></div>
<div class="col-lg-2" style="border-right: 3px solid #dfdfdf;">
<button class="btn btn-default btn-block hidden visible-xs mobile_button" type="button" data-toggle="collapse" data-target="#funct_box" aria-expanded="false" aria-controls="collapseExample">
<i class="fe fe-chevrons-down"></i> Show Functionality List
</button>
<div class="collapse dont-collapse-sm" id="funct_box">
<div class="input-icon pl-2">
<span class="input-icon-addon">
<i class="fe fe-search"></i>
</span>
<input type="text" id="search_functionality" class="form-control" placeholder="Filter Functionalities...">
</div>
<div class="tab-content">
<div class="tab-pane fade active show" id="all-tab">
<nav class="sidebar-nav">
<div id="mobi_scrollto">
<a onclick="scrolltoview('search_results_all')">
<img src="assets/images/scroll.png" width="70px">
</a>
</div>
<div class="card-body scrolli" style="padding: 10px 10px;">
<ul class="metismenu func_" id="functions_">
<!-- <i class="fe fe-list"></i> Language List -->
<div class="spinner-border text-muted" role="status">
<span class="sr-only">Loading...</span>
</div>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
<div class="col-lg-9">
<div id="title-bar" style="border-bottom: 2px solid #d0d0d0;">
<div class="row">
<div class="col-sm-12" id="codeimp-title">
<h4> Select a functionality to get started...</h4>
</div>
</div>
<div class="row" id="about_list">
<div class="col-sm-4" id="imptype-and-contributor"><i class="fe fe-users"></i> Contributor Details</div>
<div class="col-sm-2" id="framework-dropdown"><i class="fa fa-cubes"></i> Framework List</div>
<div class="col-sm-2" id="codestyle-dropdown"> <i class="fe fe-code"></i>
Codestyle List
</div>
<div class="col-sm-1"><span id=edit-code></span></div>
<div class="col-sm-3" id="contribute-code"></div>
</div>
</div>
<div class="row" style="min-height: 400px;">
<div class="col-lg-2 col-md-2 pr-0">
<button class="btn btn-default btn-block hidden visible-xs mobile_button" type="button" data-toggle="collapse" data-target="#lang_box" aria-expanded="false" aria-controls="collapseExample">
<i class="fe fe-chevrons-down"></i> Show Languages List
</button>
<div class="collapse dont-collapse-sm" id="lang_box">
<div class="scrollk mt-10sides">
<div class="transcard">
<div class="card-header pl-0 pt-3 pb-1 pr-0">
<h4 class="card-title text-orange"><i class="fe fe-droplet"></i> Language</h4>
</div>
<div class="card-body p-0">
<ul class="metismenu ci-effect-1 prominent lang_" id="language_">
<li class="font-weight-normal font-14 font-italic">
<div class="spinner-border text-muted" role="status">
<span class="sr-only">Loading...</span>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-7 col-md-7 pl-0 pr-0 codearea" style="display: none;" id="codeareaid">
<div class="card transcard ">
<div class="card-header pb-2 pt-2">
<table style="width: 60%">
<tr>
<td>
<button onclick="copyCodesnippet()" class="btn text-white btn-sm text-sm bg-indigo mr-3" title="copy code"> <i class="fe fe-copy"></i>
<!--Copy-->
</button>
<button class="btn text-white btn-sm text-sm mr-3" title="download code" style="background: forestgreen;"> <i class="fe fe-download"></i>
<!--Download-->
</button>
<button onclick="shareCodesnippet()" class="tooltip-test btn btn-dark btn-sm text-sm" title="share code"> <i class="fe fe-share-2"></i>
<!--Share-->
</button>
</td>
</tr>
</table>
<div id="code-composition">
</div>
<div class="card-options">
<label class="custom-switch m-0">
<input type="checkbox" value="1" class="custom-switch-input" id="custom-switch-input" checked>
<span onclick="toggleEditorTheme()" class="custom-switch-indicator"></span>
</label>
</div>
</div>
<div id="editor" class="card-body dark-screen">
<div id="nocode" class="text-muted-dark text-center">
<div class="font-24 text-bold align-middle"><i class="fa fa-info-circle"></i> Get Started</div>
<div class="font-14 mt-3"> <i class="fa fa-hand-o-left"></i> Use the left panel to filter through functionalities.<br /> <i class="fa fa-hand-o-up"></i> The top bar to search for snippets. <br /> The right section to find implementations <i class="fa fa-hand-o-right"></i> <br />
<i class="fa fa-heart"></i> Contribute new code and help other developers worldwide
</div>
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="usercontent col-md-12" id="code-instructions">
</div>
</div>
</div>
<!-- Button trigger modal -->
<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Launch demo modal
</button> -->
<!-- Modal -->
<!-- <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Comment</h5>
<button type="button" onclick="dismissModal2()" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<input type="hidden" id="comment-edit-id0" value="add comment">
<input type="hidden" id="cke-init-0" value="#fcbody0">
<div class="col-sm-12"> <span class='hide'>Replying to...</span> <textarea name="content" placeholder="Leave a comment..." id="fcbody0"></textarea></div>
<div class="offset-sm-1 col-sm-11 error" id="comment0Err"></div>
</div>
</div>
<div class="modal-footer">
<button onclick="dismissModal2()" type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Post</button>
</div>
</div>
</div>
</div> -->
</div>
<div class="foot_ mt-10sides usercontent">
<div class="container container-fluid">
<div class="row">
<div class="col-md-7">
<h5 id="total-comments"></h5>
</div>
<div class="col-md-5" id="add-comment"></div>
</div>
</div>
<div id="loginOrRegisterModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 id="modal-title" class="modal-title">Please <a class="cpointer" style="color:blue; text-decoration: underline;" href="login">register</a> or <a class="cpointer" style="color:blue; text-decoration: underline;" href="register">sign up</a> to add a comment</h5>
<button type="button" onclick="dismissModal('#loginOrRegisterModal')" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
</div>
</div>
<div class="comments_wrapper">
<!-- <textarea name="content" id="editor1">This is some sample content.</textarea> -->
<div class="comment_area hide" id="cform0">
<div class="row">
<input type="hidden" id="comment-edit-id0" value="add comment">
<input type="hidden" id="cke-init-0" value="#fcbody0">
<div class="col-sm-1">
<div class="hicon" id="replyHicon0">S</div>
</div>
<div class="col-sm-11"> <span class='hide'>Replying to...</span> <textarea class="form-control" name="content" placeholder="Leave a comment..." id="fcbody0"></textarea></div>
<div class="offset-sm-1 col-sm-10 error" id="comment0Err"></div>
</div>
<div class="row mt-2">
<div class="col-sm-1"></div>
<div class="col-sm-9"><button onclick="closeForm('#cform0');" class="btn btn-outline-secondary btn-round"><i class=""></i> Cancel</button></div>
<div class="col-sm-2"><button onclick="saveComment('fcbody0', 0)" class="btn btn-success btn-round"><i class=""></i> Post</button></div>
</div>
</div>
<!-- <div class="modal fade" id="commentModal" tabindex="-1" role="dialog" aria-labelledby="commentModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="commentModalLabel">Add Comment</h5>
<button type="button" onclick="dismissModal2('#commentModal')" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<input type="hidden" id="comment-edit-id0" value="add comment">
<input type="hidden" id="cke-init-0" value="#fcbody0">
<div class="col-sm-12"> <span class='hide'>Replying to...</span> <textarea onkeyup="validateComment('#comment0Err');" name="content" placeholder="Leave a comment..." id="fcbody0"></textarea></div>
<div class="col-sm-12 error" id="comment0Err"></div>
</div>
</div>
<div class="modal-footer">
<button onclick="dismissModal2('#commentModal');" type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button onclick="getckeditorData('#fcbody_input_', 'fcbody0'); saveComment();" type="button" class="btn btn-primary"><span id="btn-action">Add</span></button>
</div>
</div>
</div>
</div> -->
<div id="outer-c">
</div>
<div id="pagingDiv"></div>
</div>
</div>
</div>
<div class="col-lg-7 pl-0 pr-o" id="search_results_all" style="border-right: 3px solid #dfdfdf;">
<div class="card" style="min-height: 500px;">
<div class="card-body" id="all_solutions">
<span class="font-weight-bold text-indigo font-16">Loading solutions ...</span>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3" style="margin-left: 0; padding-left: 0; min-height: 500px;">
<div id="solns-box" class="card scrollh transcard mb-0 pb-0 all-solns">
<div style="display: none;">
<div class="card-header pt-3">
<h3 class="card-title text-center"><i class="fe fe-eye"></i> <span id="links-title">All Solutions</span></h3>
</div>
<div class="card-body pt-0" style="padding: 10px 0px;">
<div class="list-group" id="available-solns">
</div>
</div>
<div class="card-footer">
<div class="d-flex justify-content-between">
</div>
</div>
</div>
<div>
<div class="card-header pt-3">
<a href="https://marketplace.visualstudio.com/items?itemName=Samuel-Munyi.zidi-code-search&ssr=false#review-details"><img src="assets/images/zidi-vscode-ext.jpeg" width="100%"></a>
</div>
</div>
</div>
<div id="solns-box2" class="card transcard scrollh related-soln-container hidden">
<div class="card-header">
<h4 class="card-title"><i class="fe fe-eye"></i> <span id="related-soln-title"> Related Solutions</span></h4>
<div class="pl-4 pr-0 mr-0 pull-right" id="all-solns-nav">
</div>
</div>
<div class="card-body" style="padding: 10px 0px;">
<div class="list-group" id="related-solns">
</div>
</div>
<div class="card-footer">
<div class="d-flex justify-content-between">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Start page footer -->
<div class="section-body">
<?php
include_once 'footer.php';
?>
</div>
<div class="overlaymask" id="layleft" >
<div class="overlayin blue" id="overin">
<div class="overlaycont">
<div class="over-header">
<h4 class="modal-title color-orange" id="exampleModalLabel"><img src="assets/images/hi.png" height="30px"> Welcome to our Platform</h4> <hr/>
</div>
<div class="over-body">
<p class="font-16 font-weight-light">We will help you find code snippets for all your backend tasks in over 30 programming languages </p>
<p class="font-16 text-capitalize">What's your favourite language?</p>
<div id="language_select_modal">
Loading...
</div>
</div>
<div class="over-footer">
<p class="pull-left font-15 font-weight-bolder text-azure"> Join our communities <a href="https://fb.me/zidiapp" target="_BLANK" class="btn btn-outline-light"><i class="fa fa-facebook"></i></a>
<a href="https://twitter.com/zidiplatform" target="_BLANK" class="btn btn btn-outline-light btn-sm"><i class="fa fa-twitter"></i></a>
<a href="https://t.me/zidiapp" target="_BLANK" class="btn btn btn-outline-light btn-sm"><i class="fa fa-telegram"></i></a>
</p>
<a onclick="hidewelcome()" class="font-28 pointer" id="closeover"><i class="fe fe-x"></i> Close</a>
</div>
</div>
</div>
</div>
</div>
<!-- jQuery and bootstrtap js -->
<?php
include_once('scripts.php');
?>
<script>
////////------Overlay message
window.addEventListener('mousedown', function(event) {
var inner = document.getElementById('overin');
var outer = document.getElementById('layleft');
if (event.target === inner) {
inner.style.display = "block";
} else if (event.target === outer) {
$('#overin').fadeOut('fast');
$('#layleft').fadeOut('fast');
}
});
$(document).mouseup(function (e) {
var search_box = document.getElementById('search_box');
var code_results = document.getElementById('code_results');
if ($(e.target).closest("#code_results").length === 0 && $(e.target).closest("#search_box").length === 0) {
$("#code_results").hide();
}
});
$(document).ready(function() {
let language = persistence_read('language');
if(!language){
setTimeout(function (){
showelcome();
},2000);
}
updateHeader("index"); //check for logged in user so as to update the header accordingly
$('#search_box').css('display', 'block');
})
</script>
<script>
$(document).ready(function() {
persistUrl() //print url string
let current_loc = currentLoc();
contributeCodeNav() //dynamic contribute new code nav
footer_date(); //load footer
persistence_remove("gotourl");
if (current_loc && current_loc.cur_page) {
} else {
persistence("cur_page", 1); //set default comment first page to 1
}
if (current_loc && current_loc.last_page) {
} else {
persistence("last_page", 1); //set default comment last page to 1
}
//if theme editor is not set, set it else return empty string
let editorTheme = "";
if (current_loc && current_loc.editorTheme) {
editorTheme = current_loc.editorTheme;
} else {
editorTheme = "monokai";
persistence("editorTheme", "monokai");
}
//toggle the theme switch indicator based on the theme set
if (editorTheme == "monokai") {
//$('#custom-switch-input').prop('checked', true);
$("#editor").removeClass("light-screen");
$("#editor").addClass("dark-screen");
} else {
$('#custom-switch-input').prop('checked', false);
$("#editor").removeClass("dark-screen");
$("#editor").addClass("light-screen");
}
let codeId = 0;
const search_ = "<?php echo $_GET['search_']; ?>"?.trim();
const url = getCurrentUrl(); //grab the current to determine whether the site is live or local
const host = url.host;
if (host == "localhost") {
if ("<?php echo $_GET['cid']; ?>") {
codeId = parseInt("<?php echo $_GET['cid']; ?>");
}
} else {
if ("<?php echo $_GET['dir']; ?>") {
let codeUrl = "<?php echo $_GET['dir']; ?>";
let codeUrlArr = codeUrl.split("/");
codeId = parseInt(codeUrlArr.pop());
}
}
if (codeId > 0) {
load_codesnippetById(codeId); //load code links with previously loaded code params
} else {
persistence_remove("func");
persistence_remove("subfunc");
// persistence_remove("language");
persistence_remove("framework");
persistence_remove("codestyle");
persistence_remove("allFrams");
//loadCodesnippetsLink(); //load code links with any available params needed to to load the solutions
// handle url with a search term and without in loading solutions
if (search_) {
getAllSolns('','','','','', search_);
}else{
getAllSolns('','','','','');
}
getAllFrams();
functions_load() //load all functions and subfunctions
load_languages(); //Load all the languages
codeStyles();
}
//pagination click even listener
$("#pagingDiv").on("click", "a", function() {
setTargetPage($(this).attr("data-pn"))
});
});
</script>
<script>
//////--------Custom scroll
(function($) {
$(window).on("load", function() {
$('#logo_home').css('display', 'none');
$(".scrolli").mCustomScrollbar({
theme: "inset-2-dark",
// autoHideScrollbar: true
});
$(".scrollk").mCustomScrollbar({
theme: "inset-2-dark",
// autoHideScrollbar: true
});
$(".scrollh").mCustomScrollbar({
theme: "inset-2-dark",
// autoHideScrollbar: true
});
});
})(jQuery);
//////-------Search functions/subfunctions
$(function() {
//following code makes jquery contains case insensitive
jQuery.expr[":"].Contains = jQuery.expr.createPseudo(function(arg) {
return function(elem) {
return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
$('#search_functionality').keyup(function() {
let k_ = $('#search_functionality').val().trim();
if (k_) {
$('ul#functions_ li.outer_list').hide();
$('ul#functions_ .inner_list').fadeIn('fast');
$('ul#functions_ li:Contains(' + $(this).val() + ')').show();
// $('ul#functions_ li.outer_list ul.inner_list').show();
// $('ul#functions_ .inner_list.subfunc-)').hide();
} else {
//-----Restore
$('.inner_list').fadeOut('fast');
$('.outer_list').slideDown();
//$('ul#functions_ li').show();
}
})
//toggle active code link
$('#available-solns').on('click', 'a', function() {
$('#available-solns a').removeClass('active-two');
$(this).addClass('active-two');
});
});
</script>
<script>
//initialize ckeditor on the comment form
createEditor2('fcbody0');
//initCkeditor('index');
</script>
</body>
</html>