Skip to content

Commit 14f15d8

Browse files
committed
Lightbox, Login design
1 parent 8dc8b75 commit 14f15d8

File tree

10 files changed

+810
-10
lines changed

10 files changed

+810
-10
lines changed

config.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ pic_big = static/images/profile_big.jpg
1515
[language]
1616
lang = en
1717

18+
[components]
1819
highlight = true
1920

21+
[custom]
22+
;styles[] = static/styles/custom1.css
23+
;styles[] = static/styles/custom2.css
24+
;scripts = static/styles/scripts.css
25+
2026
[login]
2127
force_login = true
2228
nick = demo
2329
pass = demo
2430

2531
[system]
2632
system_name = blog
27-
version = 1.04
33+
version = 1.041
2834
debug = true
2935
logs = false

index.php

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,30 @@
4747
$header = '';
4848
}
4949

50+
// Translate styles into html
51+
$styles = Config::get_safe("styles", []);
52+
$styles_html = '';
53+
if(!empty($styles)){
54+
if(!is_array($styles)){
55+
$styles = [$styles];
56+
}
57+
58+
$styles = array_unique($styles);
59+
$styles_html = '<link href="'.implode('" rel="stylesheet" type="text/css"/>'.PHP_EOL.'<link href="', $styles).'" rel="stylesheet" type="text/css"/>'.PHP_EOL;
60+
}
61+
62+
// Translate script urls into html
63+
$scripts = Config::get_safe("scripts", []);
64+
$scripts_html = '';
65+
if(!empty($scripts)){
66+
if(!is_array($styles)){
67+
$styles = [$styles];
68+
}
69+
70+
$scripts = array_unique($scripts);
71+
$scripts_html = '<script src="'.implode('" type="text/javascript"></script>'.PHP_EOL.'<script src="', $scripts).'" type="text/javascript"></script>'.PHP_EOL;
72+
}
73+
5074
?><!DOCTYPE html>
5175
<html>
5276
<head>
@@ -63,7 +87,10 @@
6387

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

90+
<link href="static/styles/lightbox.css" rel="stylesheet" type="text/css" />
6691
<?php echo Config::get("highlight") ? '<link href="static/styles/highlight.css" rel="stylesheet" type="text/css" />' : ''; ?>
92+
93+
<?php echo $styles_html; ?>
6794
</head>
6895
<body>
6996
<div id="dd_mask" class="mask"></div>
@@ -79,20 +106,21 @@
79106

80107
<!-- Login Modal -->
81108
<div class="modal login_modal">
82-
<div class="modal-dialog">
109+
<div class="modal-dialog" style="max-width: 350px;">
83110
<div class="modal-content">
84111
<div class="modal-header">
85112
<a class="close"></a>
86-
<h4 class="modal-title"><?php echo __("Logout"); ?></h4>
113+
<h4 class="modal-title"><?php echo __("Login"); ?></h4>
87114
</div>
88-
<div class="modal-body">
89-
<input type="text" class="nick" placeholder="<?php echo __("Nick"); ?>">&nbsp;
115+
<div class="modal-body login-form">
116+
<input type="text" class="nick" placeholder="<?php echo __("Nick"); ?>">
90117
<input type="password" class="pass" placeholder="<?php echo __("Password"); ?>">
91118
</div>
92119
<div class="modal-footer">
93120
<div class="buttons">
121+
<!--<div class="left"><a>Register</a> - <a>Forgot Password</a></div>-->
94122
<a class="button gray close"><?php echo __("Cancel"); ?></a>
95-
<button type="button" class="button blue do_login"><?php echo __("Logout"); ?></button>
123+
<button type="button" class="button blue do_login"><?php echo __("Login"); ?></button>
96124
</div>
97125
</div>
98126
</div>
@@ -299,8 +327,12 @@
299327
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
300328
<!--<script src="static/scripts/jquery.min.js"></script>-->
301329
<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>
330+
331+
<script src="static/scripts/lightbox.js"></script>
302332
<script src="static/scripts/autosize.js"></script>
303333
<?php echo Config::get("highlight") ? '<script src="static/scripts/highlight.js"></script><script>hljs.initHighlightingOnLoad();</script>' : ''; ?>
304334
<script src="static/scripts/app.js?v=<?php echo Config::get("version"); ?>"></script>
335+
336+
<?php echo $scripts_html; ?>
305337
</body>
306338
</html>

static/images/close.png

280 Bytes
Loading

static/images/loading.gif

8.28 KB
Loading

static/images/next.png

1.32 KB
Loading

static/images/prev.png

1.33 KB
Loading

static/scripts/app.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ var posts = {
113113
};
114114

115115
// Content functions
116+
var lightboxes = 0;
116117
var cnt_funcs = {
117118
link: function(data){
118119
var obj = $("#prepared .b_link").clone();
@@ -145,6 +146,7 @@ var cnt_funcs = {
145146
image: function(data){
146147
var obj = $("#prepared .b_img").clone();
147148
obj.attr("href", data.path);
149+
obj.attr("data-lightbox", 'image-'+lightboxes++);
148150
obj.find("img").attr("src", data.thumb);
149151

150152
return obj;
@@ -199,10 +201,14 @@ var login = {
199201
// Clone modal
200202
var modal = $('#prepared .login_modal').clone();
201203
$("body").css("overflow", "hidden");
202-
203-
// Focus Nick
204-
modal.find(".nick").focus();
205-
204+
205+
// On enter save
206+
modal.find(".nick,.pass").keypress(function(e) {
207+
if(e.which == 13) {
208+
modal.find(".do_login").click();
209+
}
210+
});
211+
206212
// On close
207213
modal.find(".close").click(function(){
208214
modal.close();
@@ -242,6 +248,9 @@ var login = {
242248

243249
// Append modal
244250
$("body").append(modal);
251+
252+
// Focus Nick
253+
modal.find("input.nick").focus();
245254
});
246255

247256
$("#headline").append(btn);

0 commit comments

Comments
 (0)