Skip to content

Commit

Permalink
Lightbox, Login design
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k1o committed Sep 23, 2017
1 parent 8dc8b75 commit 14f15d8
Show file tree
Hide file tree
Showing 10 changed files with 810 additions and 10 deletions.
8 changes: 7 additions & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ pic_big = static/images/profile_big.jpg
[language]
lang = en

[components]
highlight = true

[custom]
;styles[] = static/styles/custom1.css
;styles[] = static/styles/custom2.css
;scripts = static/styles/scripts.css

[login]
force_login = true
nick = demo
pass = demo

[system]
system_name = blog
version = 1.04
version = 1.041
debug = true
logs = false
42 changes: 37 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,30 @@
$header = '';
}

// Translate styles into html
$styles = Config::get_safe("styles", []);
$styles_html = '';
if(!empty($styles)){
if(!is_array($styles)){
$styles = [$styles];
}

$styles = array_unique($styles);
$styles_html = '<link href="'.implode('" rel="stylesheet" type="text/css"/>'.PHP_EOL.'<link href="', $styles).'" rel="stylesheet" type="text/css"/>'.PHP_EOL;
}

// Translate script urls into html
$scripts = Config::get_safe("scripts", []);
$scripts_html = '';
if(!empty($scripts)){
if(!is_array($styles)){
$styles = [$styles];
}

$scripts = array_unique($scripts);
$scripts_html = '<script src="'.implode('" type="text/javascript"></script>'.PHP_EOL.'<script src="', $scripts).'" type="text/javascript"></script>'.PHP_EOL;
}

?><!DOCTYPE html>
<html>
<head>
Expand All @@ -63,7 +87,10 @@

<link href="https://fonts.googleapis.com/css?family=Open+Sans&amp;subset=all" rel="stylesheet">

<link href="static/styles/lightbox.css" rel="stylesheet" type="text/css" />
<?php echo Config::get("highlight") ? '<link href="static/styles/highlight.css" rel="stylesheet" type="text/css" />' : ''; ?>

<?php echo $styles_html; ?>
</head>
<body>
<div id="dd_mask" class="mask"></div>
Expand All @@ -79,20 +106,21 @@

<!-- Login Modal -->
<div class="modal login_modal">
<div class="modal-dialog">
<div class="modal-dialog" style="max-width: 350px;">
<div class="modal-content">
<div class="modal-header">
<a class="close"></a>
<h4 class="modal-title"><?php echo __("Logout"); ?></h4>
<h4 class="modal-title"><?php echo __("Login"); ?></h4>
</div>
<div class="modal-body">
<input type="text" class="nick" placeholder="<?php echo __("Nick"); ?>">&nbsp;
<div class="modal-body login-form">
<input type="text" class="nick" placeholder="<?php echo __("Nick"); ?>">
<input type="password" class="pass" placeholder="<?php echo __("Password"); ?>">
</div>
<div class="modal-footer">
<div class="buttons">
<!--<div class="left"><a>Register</a> - <a>Forgot Password</a></div>-->
<a class="button gray close"><?php echo __("Cancel"); ?></a>
<button type="button" class="button blue do_login"><?php echo __("Logout"); ?></button>
<button type="button" class="button blue do_login"><?php echo __("Login"); ?></button>
</div>
</div>
</div>
Expand Down Expand Up @@ -299,8 +327,12 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<!--<script src="static/scripts/jquery.min.js"></script>-->
<script>$["\x61\x6A\x61\x78\x53\x65\x74\x75\x70"]({"\x68\x65\x61\x64\x65\x72\x73":{"\x43\x73\x72\x66-\x54\x6F\x6B\x65\x6E":"<?php echo $_SESSION['token'];?>"}});</script>

<script src="static/scripts/lightbox.js"></script>
<script src="static/scripts/autosize.js"></script>
<?php echo Config::get("highlight") ? '<script src="static/scripts/highlight.js"></script><script>hljs.initHighlightingOnLoad();</script>' : ''; ?>
<script src="static/scripts/app.js?v=<?php echo Config::get("version"); ?>"></script>

<?php echo $scripts_html; ?>
</body>
</html>
Binary file added static/images/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/next.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/prev.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 13 additions & 4 deletions static/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ var posts = {
};

// Content functions
var lightboxes = 0;
var cnt_funcs = {
link: function(data){
var obj = $("#prepared .b_link").clone();
Expand Down Expand Up @@ -145,6 +146,7 @@ var cnt_funcs = {
image: function(data){
var obj = $("#prepared .b_img").clone();
obj.attr("href", data.path);
obj.attr("data-lightbox", 'image-'+lightboxes++);
obj.find("img").attr("src", data.thumb);

return obj;
Expand Down Expand Up @@ -199,10 +201,14 @@ var login = {
// Clone modal
var modal = $('#prepared .login_modal').clone();
$("body").css("overflow", "hidden");

// Focus Nick
modal.find(".nick").focus();


// On enter save
modal.find(".nick,.pass").keypress(function(e) {
if(e.which == 13) {
modal.find(".do_login").click();
}
});

// On close
modal.find(".close").click(function(){
modal.close();
Expand Down Expand Up @@ -242,6 +248,9 @@ var login = {

// Append modal
$("body").append(modal);

// Focus Nick
modal.find("input.nick").focus();
});

$("#headline").append(btn);
Expand Down
Loading

0 comments on commit 14f15d8

Please sign in to comment.