Initial commit

Couldnt keep the history unfortunately.
This commit is contained in:
Riyyi
2021-03-03 17:55:48 +01:00
commit a8056b66cc
67 changed files with 7759 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
Options -MultiViews -Indexes +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [NC,L]
+117
View File
@@ -0,0 +1,117 @@
/* General */
/*----------------------------------------*/
html {
font-family: "Segoe UI", "DejaVu Sans", sans-serif;
}
body {
background-color: #f4f4f4;
}
table td.middle {
vertical-align: middle;
}
/* Navigation */
/*----------------------------------------*/
nav.shadow {
box-shadow: 0 .25rem .5rem rgba(0,0,0,.28) !important;
}
/* Main content */
/*----------------------------------------*/
.container {
margin: 56px auto 0 auto;
}
.content {
position: relative;
/* height: calc(100% - 56px); */
min-height: calc(100vh - 80px);
padding: 20px 20px 50px 20px;
background-color: #fff;
}
#home {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.padding-border {
padding: 10px 15px 10px 15px;
}
.padding-border-col {
padding: 10px 15px 0px 0px;
}
.pointer {
cursor: pointer;
}
/* Admin content */
/*----------------------------------------*/
.admin-toggle {
left: auto;
margin: 10px 15px;
padding: 5px 10px;
border-radius: 5px;
color: #ffffff;
}
.admin-menu {
position: fixed;
top: 0;
right: 0;
padding-right: 0px;
z-index: 1030;
}
.admin-content {
min-height: 100vh;
}
.admin-hidden {
position: absolute;
top: 0;
left: -9999px;
}
.admin-upload-dragover {
background-color: rgba(0,0,0,0.1);
}
/* Cursor color in normal mode */
.CodeMirror.cm-fat-cursor .CodeMirror-cursor {
background: white;
}
/* Cursor color in visual mode */
.CodeMirror .cm-animate-fat-cursor {
background-color: white;
animation: none !important;
}
/* Footer */
/*----------------------------------------*/
footer {
position: absolute;
bottom: 0;
width: calc(100% - 30px);
height: 50px;
padding-top: 10px;
text-align: center;
color: #909090;
}
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+10
View File
@@ -0,0 +1,10 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once __DIR__ . '/../vendor/autoload.php';
\App\Classes\Session::start();
\App\Classes\Config::load();
\App\Classes\Router::fire();
+226
View File
@@ -0,0 +1,226 @@
$(document).ready(function() {
// Confirm to submit
$('.js-confirm').on('click', function() {
return confirm("Are you sure you want to continue?");
});
// Confirm to delete
$('.js-delete').on('click', function(event) {
event.preventDefault();
var csrfToken = $(this).attr('data-token');
if (confirm('Are you sure you want to continue?')) {
$.ajax({
url: $(this).attr('href'),
type: 'DELETE',
data: { _token: csrfToken },
success: function(data) {
window.location.reload();
}
});
}
});
// Edit
$('.js-edit').on('click', function(event) {
var href = $(this).attr('href');
$.ajax({
url: href,
type: "PUT",
data: $('#form-edit').serialize(),
success: function(data, textStatus, jqXHR) {
window.location.href = data;
}
});
});
//------------------------------------------
$('.js-upload')
.on("drag dragstart dragend dragover dragenter dragleave drop", function(e) {
e.preventDefault();
e.stopPropagation();
})
.on("dragover dragenter", function(e) {
$(this).addClass('admin-upload-dragover');
})
.on("dragend dragleave drop", function(e) {
$(this).removeClass('admin-upload-dragover');
})
.on("drop", function(e) {
// Set file input to the dropped files
$(this).find('input[type=file]')[0].files = e.originalEvent.dataTransfer.files;
updateUploadLabel($(this));
})
.change(function(e) {
updateUploadLabel($(this));
});
function updateUploadLabel(element) {
var files = element.find('input[type=file]')[0].files;
var text = element.find('span');
// Update label text
if (files.length == 1) {
text.html(files[0].name);
}
else {
text.html(files.length + ' files selected');
// Set tooltip
var fileNames = '';
Array.from(files).forEach(file => { fileNames += file.name + '\n'; });
element.prop('title', fileNames);
}
}
//------------------------------------------
// CodeMirror editor
var editor;
var editorOptions = {
lineSeparator: '\n',
theme: 'tomorrow-night-eighties',
mode: 'text/html',
indentUnit: 4,
lineNumbers: true,
lineWrapping: true,
cursorBlinkRate: 0,
keyMap: 'vim',
};
// Copy editor selection to clipboard on <C-c>
function registerEditorCopy() {
editor.on('vim-keypress', function(e) {
if (e === '<C-c>' && editor.state.vim.visualMode === true) {
document.execCommand("copy");
}
});
}
// Enable CodeMirror Editor
$.fn.codeMirror = function() {
editor = CodeMirror.fromTextArea($(this)[0], editorOptions);
editor.setSize('100%', '500');
registerEditorCopy();
return editor;
}
$('textarea#syntax-code').codeMirror().setOption('mode', 'text/x-csrc');
// Enable WYSIWYG Editor
$('textarea#summernote').summernote({
tabDisable: true,
tabsize: 4,
minHeight: 450,
maxHeight: null,
focus: true,
fontNames: [
'Helvetica', 'Arial', 'Verdana', 'Trebuchet MS', 'sans-serif',
'Georgia', 'Times New Roman', 'Courier New', 'monospace'
],
fontNamesIgnoreCheck: [],
toolbar: [
['style', ['style']],
['font', ['bold', 'underline', 'italic', 'strikethrough', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
['view', ['fullscreen', 'codeview', 'help']],
],
callbacks: {
onInit: function() {
$("#summernote").summernote('codeview.activate');
editor = $('.CodeMirror')[0].CodeMirror;
registerEditorCopy();
}
},
prettifyHtml: false,
codemirror: editorOptions,
});
var syntaxLanguages = {
'c': 'text/x-csrc',
'cpp': 'text/x-c++src',
'css': 'text/css',
'html': 'text/html',
'javascript': 'text/javascript',
'php': 'application/x-httpd-php',
'python': 'text/x-python',
'shell': 'text/x-sh',
};
// Syntax Language selection
$('#syntax-language').on('change', function() {
// Set the editor language mode
editor.setOption('mode', syntaxLanguages[this.value]);
// Set the language class
var parse = $('code');
parse.removeClass().addClass('language-' + this.value);
})
.trigger('change');
// Syntax Highlight
$('#syntax-highlight').on('click', function() {
// Set the code
var parse = $('code');
parse.text(editor.getValue());
// Highlight the <code> DOM element
Prism.highlightAll();
});
// Copy highlighted syntax to the clipboard
$('#syntax-copy').on('click', function() {
// Copy text into hidden textarea
var parse = $('div#syntax-parse').html();
var copy = $('textarea#syntax-parse-copy');
copy.val(parse);
// Select the text field
copy = copy[0];
copy.select();
copy.setSelectionRange(0, copy.value.length);
// Copy the text inside the field to the clipboard
document.execCommand("copy");
alert("Copied to the clipboard");
});
//------------------------------------------
// Hotkeys
$(window).keydown(function(e) {
// Save form
if (e.ctrlKey && e.keyCode == 83) { // Ctrl + S
e.preventDefault();
// Codeview needs to be deactived before saving
$('#summernote').summernote('codeview.deactivate');
$('.js-edit').click();
}
// Toggle codeview
if (e.ctrlKey && e.keyCode == 71) { // Ctrl + G
e.preventDefault();
$('#summernote').summernote('codeview.toggle');
}
});
});
// @Todo
// - Look at converting .ajax() into the JS fetch API (native)
+83
View File
@@ -0,0 +1,83 @@
$(document).ready(function() {
//------------------------------------------//
$.fn.inViewport = function() {
var elementTop = $(this).offset().top;
var elementBottom = elementTop + $(this).outerHeight();
var viewportTop = $(window).scrollTop();
var viewportBottom = viewportTop + $(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;
}
//------------------------------------------//
// Image hover mouseenter
$(".js-img-hover").mouseenter(function(event) {
var width = $(window).width() - event.clientX - 1 + "px";
if (!$("#isMobile").is(":hidden")) {
width = "100%";
}
var url = $(this).data("img-hover");
var divImg = $("<div id='img-hover' style='z-index: 9999; position: fixed; top: 0px; right: 0px;'>" +
"<img style='max-width: " + width + "; height auto;' src=" + url + "></div>");
divImg.appendTo("body");
});
// Image hover mouseleave
$(".js-img-hover").mouseleave(function() {
$("#img-hover").remove();
});
// Lazy load video's
$(window).on('resize scroll', function() {
$('.js-video').each(function(index) {
if (!$(this).inViewport()) {
return true;
}
$(this).find('source').each(function() {
var source = $(this).attr('data-src');
if (source === undefined) {
return true;
}
$(this).attr("src", source);
var video = this.parentElement;
video.load();
video.play();
$(this).removeAttr('data-src');
});
});
});
$(window).trigger('scroll');
// Only 1 field is required
var $inputs = $('input[name=reset-password-username],input[name=reset-password-email]');
$inputs.on('input', function() {
// Set the required property of the other input to false if this input is not empty.
$inputs.not(this).prop('required', !$(this).val().length);
});
// List toggle
$('.js-toggle').click(function() {
$(this).next("ul").toggle(400);
});
// Admin panel toggle
$('.js-admin-toggle').click(function() {
$.get('/admin/toggle').done(function(data) {
if (data == '1') {
$('.js-admin-menu').removeClass('d-none').addClass('d-block');
$('.js-main-content').removeClass('col-12').addClass('col-9');
}
else if (data == '0') {
$('.js-admin-menu').removeClass('d-block').addClass('d-none');
$('.js-main-content').removeClass('col-9').addClass('col-12');
}
});
});
});
View File