Initial commit
This commit is contained in:
178
public/css/main.css
Normal file
178
public/css/main.css
Normal file
@ -0,0 +1,178 @@
|
||||
a {
|
||||
color: #2a7ae2;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #1756a9;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #111;
|
||||
}
|
||||
|
||||
.header {
|
||||
margin-bottom: 2em;
|
||||
border-top: 5px solid #424242;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
.header h4 {
|
||||
display: inline-block;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.header form,
|
||||
.header .login,
|
||||
.header .post-create,
|
||||
.header .register,
|
||||
.header .search {
|
||||
display: inline-block;
|
||||
margin: 1.3em 0.25em 0;
|
||||
}
|
||||
|
||||
.header .search {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.header a.login:visited {
|
||||
color: #212529;
|
||||
}
|
||||
|
||||
.header a.post-create:visited,
|
||||
.header a.register:visited {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.pager li > a {
|
||||
display: inline-block;
|
||||
padding: 5px 14px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 15px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.pager li > span {
|
||||
display: inline-block;
|
||||
padding: 5px 14px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 15px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.pager .next > a,
|
||||
.pager .next > span {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.pager .previous > a,
|
||||
.pager .previous > span {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.header a:hover,
|
||||
.sidebar a.user-info:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.pager li > a:hover,
|
||||
.pager li > a:focus {
|
||||
text-decoration: none;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
ul.errors,
|
||||
ul.messages {
|
||||
padding-left: 3em;
|
||||
}
|
||||
|
||||
.posts .title {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.posts .title .match {
|
||||
background-color: #ff0;
|
||||
}
|
||||
|
||||
button.preview-post-btn {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.pager {
|
||||
margin: 20px 0;
|
||||
padding-left: 0;
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pager li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.clearfix::before,
|
||||
.clearfix::after,
|
||||
.pager::before,
|
||||
.pager::after {
|
||||
display: table;
|
||||
content: " ";
|
||||
}
|
||||
|
||||
.clearfix::after,
|
||||
.pager::after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
article {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.comments {
|
||||
padding-top: 25px;
|
||||
border-top: 2px solid #f2f2f2;
|
||||
}
|
||||
|
||||
.comments h3 {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.comments p {
|
||||
margin: 25px;
|
||||
}
|
||||
|
||||
.comments .comment-form {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.comments .avatar {
|
||||
float: left;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.sidebar h4 {
|
||||
position: relative;
|
||||
top: 2px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.sidebar img {
|
||||
border-radius: 25px;
|
||||
}
|
||||
|
||||
.sidebar .tags {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.user-setting {
|
||||
display: inline-block;
|
||||
margin: 11px 5px;
|
||||
}
|
||||
|
||||
.gear {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 120px;
|
||||
padding: 30px 0;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
}
|
23
public/index.php
Normal file
23
public/index.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
if (preg_match(
|
||||
'/\.css|\.js|\.jpg|\.png$/',
|
||||
$_SERVER['REQUEST_URI'],
|
||||
$match
|
||||
)) {
|
||||
$mimeTypes = [
|
||||
'.css' => 'text/css',
|
||||
'.js' => 'application/javascript',
|
||||
'.jpg' => 'image/jpg',
|
||||
'.png' => 'image/png'
|
||||
];
|
||||
$path = __DIR__ . $_SERVER['REQUEST_URI'];
|
||||
if (is_file($path)) {
|
||||
header("Content-Type: {$mimeTypes[$match[0]]}");
|
||||
require $path;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
require 'core/Bootstrap.php';
|
64
public/js/main.js
Normal file
64
public/js/main.js
Normal file
@ -0,0 +1,64 @@
|
||||
/* global marked */
|
||||
(function () {
|
||||
var forms = document.querySelectorAll('form')
|
||||
forms.forEach(function (node) {
|
||||
node.addEventListener(
|
||||
'submit',
|
||||
function () {
|
||||
node.querySelector('button[type="submit"]').disabled = true
|
||||
},
|
||||
false
|
||||
)
|
||||
})
|
||||
var deleter = document.querySelectorAll(
|
||||
'a[data-toggle][data-target="#confirm-modal"], ' +
|
||||
'a[data-toggle][data-target="#comment-confirm-modal"]'
|
||||
)
|
||||
deleter.forEach(function (node) {
|
||||
node.addEventListener(
|
||||
'click',
|
||||
function () {
|
||||
document
|
||||
.getElementById('delete-form')
|
||||
.setAttribute('action', node.dataset.action)
|
||||
},
|
||||
false
|
||||
)
|
||||
})
|
||||
var search = document.querySelector('#search')
|
||||
search.addEventListener('keydown', function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
window.location = '/search/' + encodeURIComponent(search.value)
|
||||
return false
|
||||
}
|
||||
})
|
||||
var editor = document.querySelectorAll(
|
||||
'a[data-toggle][data-target="#comment-edit-modal"]'
|
||||
)
|
||||
editor.forEach(function (node) {
|
||||
node.addEventListener(
|
||||
'click',
|
||||
function (e) {
|
||||
e.preventDefault()
|
||||
var form = document.getElementById('comment-edit-form')
|
||||
form.setAttribute('action', node.dataset.action)
|
||||
var textarea = form.querySelector('textarea')
|
||||
textarea.textContent = textarea.value =
|
||||
node.parentNode.nextElementSibling.textContent
|
||||
},
|
||||
false
|
||||
)
|
||||
})
|
||||
var previewBtn = document.querySelector('#preview-post-btn')
|
||||
if (previewBtn != null) {
|
||||
previewBtn.addEventListener(
|
||||
'click',
|
||||
function () {
|
||||
document.getElementById('preview-content').innerHTML = marked(
|
||||
document.getElementById('source-content').value
|
||||
)
|
||||
},
|
||||
false
|
||||
)
|
||||
}
|
||||
})()
|
Reference in New Issue
Block a user