Browse code
Added color changing button and js
fiddlerwoaroof authored on 02/09/2015 17:12:03
Showing 5 changed files
Showing 5 changed files
... | ... |
@@ -230,9 +230,18 @@ |
230 | 230 |
;rebase $base03,$base02,$base01,$base00 ,$base0 ,$base1 ,$base2 ,$base3 |
231 | 231 |
|
232 | 232 |
|
233 |
-(cl-oid-connect:def-route ("/theme.css" (params) :app *app*) |
|
233 |
+ |
|
234 |
+(cl-oid-connect:def-route ("/theme/dark.css" (params) :app *app*) |
|
235 |
+ (let ((*palette* (make-instance 'palette))) |
|
236 |
+ (eval '(get-theme-css)))) |
|
237 |
+ |
|
238 |
+(cl-oid-connect:def-route ("/theme/light.css" (params) :app *app*) |
|
239 |
+ (let ((*palette* (invert-palette (make-instance 'palette)))) |
|
240 |
+ (eval '(get-theme-css)))) |
|
241 |
+ |
|
242 |
+(defun get-theme-css () |
|
234 | 243 |
(flet ((combine-unit-q (quant unit) (format nil "~d~a" quant unit))) |
235 |
- (let* ((header-height 13) |
|
244 |
+ (let* ((header-height 19) |
|
236 | 245 |
(height-units "vh") |
237 | 246 |
(ss (lass:compile-and-write |
238 | 247 |
`(* :color ,(colorscheme-fg *colorscheme*)) |
... | ... |
@@ -250,9 +259,12 @@ |
250 | 259 |
:border-bottom "thin" "solid" ,(colorscheme-accent *colorscheme*) |
251 | 260 |
:height ,(combine-unit-q header-height height-units) |
252 | 261 |
:font-size ,(combine-unit-q (* 0.75 header-height) height-units) |
253 |
- :line-height ,(combine-unit-q header-height height-units)) |
|
262 |
+ :line-height ,(combine-unit-q header-height height-units) |
|
263 |
+ (.flip-button |
|
264 |
+ :float right)) |
|
254 | 265 |
|
255 | 266 |
`(main |
267 |
+ :border-left thin solid ,(colorscheme-accent *colorscheme*) |
|
256 | 268 |
:height ,(combine-unit-q (- 100 header-height) height-units)) |
257 | 269 |
|
258 | 270 |
`((:or a (:and a :visited) (:and a :active) code.url) |
... | ... |
@@ -266,7 +278,9 @@ |
266 | 278 |
:background-color ,(colorscheme-bg-highlight *colorscheme*) |
267 | 279 |
:color ,(colorscheme-fg-highlight *colorscheme*)))) |
268 | 280 |
|
269 |
- `(.feed :border thin solid ,(colorscheme-fg *colorscheme*)) |
|
281 |
+ `(.feed |
|
282 |
+ :border-bottom thin solid ,(colorscheme-fg *colorscheme*) |
|
283 |
+ :border-left none) |
|
270 | 284 |
|
271 | 285 |
`(.link |
272 | 286 |
:border-top thin solid ,(colorscheme-fg *colorscheme*) |
... | ... |
@@ -342,10 +356,12 @@ |
342 | 356 |
(:script :src "/static/js/fold.js" :type "text/javascript" "") |
343 | 357 |
(:link :rel "stylesheet" :href "/static/css/main.css") |
344 | 358 |
(:link :rel "stylesheet" :href "/static/css/content.css") |
345 |
- (:link :rel "stylesheet" :href "/theme.css")) |
|
359 |
+ (:link :rel "stylesheet" :href "/theme/light.css")) |
|
346 | 360 |
(:body |
347 | 361 |
(:header |
348 |
- (:h1 "Worricow")) |
|
362 |
+ (:button :class "flip-button" "c") |
|
363 |
+ (:h1 "Feeds") |
|
364 |
+ ) |
|
349 | 365 |
(:section :id "content" |
350 | 366 |
(:section :id "sidebar" |
351 | 367 |
(cl-markup:raw (feedlist-markup *feeds*))) |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
(:import "url(https://fonts.googleapis.com/css?family=Lato:400,100,300,400italic,300italic,700,700italic,900&subset=latin,latin-ext)") |
2 | 2 |
(:import "url(https://fonts.googleapis.com/css?family=Caudex)") |
3 | 3 |
|
4 |
-(.feed |
|
4 |
+((:or .feed main) |
|
5 | 5 |
:-webkit-backface-visibility hidden; |
6 | 6 |
:-webkit-transform "translateZ(0)") |
7 | 7 |
|
... | ... |
@@ -37,7 +37,7 @@ |
37 | 37 |
:font-family "Caudex" |
38 | 38 |
:font-size inherit |
39 | 39 |
:margin-top "0em" |
40 |
- :padding-left "1em" |
|
40 |
+ :padding-left "10vw" |
|
41 | 41 |
:font-weight 200)) |
42 | 42 |
|
43 | 43 |
((:or "#sidebar" main) |
... | ... |
@@ -28,4 +28,15 @@ |
28 | 28 |
(chain ($ this) (css "max-height" (@ this scroll-height))) |
29 | 29 |
(chain ($ this) (css "max-height" "0px")))))) |
30 | 30 |
(chain ($ this) (parent) (toggle-class "closed"))))) |
31 |
+ (setf invert-palette |
|
32 |
+ (lambda () |
|
33 |
+ (let* ((style-sheet (chain ($ "link[href^=\"/theme\"]"))) |
|
34 |
+ (style-sheet-name (chain style-sheet (attr "href")))) |
|
35 |
+ (chain style-sheet (attr "href" |
|
36 |
+ (if (chain style-sheet-name (match (regex |dark|))) |
|
37 |
+ (chain style-sheet-name |
|
38 |
+ (replace (regex |dark|) "light")) |
|
39 |
+ (chain style-sheet-name |
|
40 |
+ (replace (regex |light|) "dark")))))))) |
|
41 |
+ (chain ($ ".flip-button") (click invert-palette)) |
|
31 | 42 |
null))) |
... | ... |
@@ -1 +1 @@ |
1 |
-@import url(https://fonts.googleapis.com/css?family=Lato:400,100,300,400italic,300italic,700,700italic,900&subset=latin,latin-ext);@import url(https://fonts.googleapis.com/css?family=Caudex);.feed{-webkit-backface-visibility:hidden;-webkit-transform:translateZ(0);}*{box-sizing:border-box;margin:0px;padding:0px;}body{font-family:Lato;}main > ul,main > ol,#sidebar > ul,#sidebar > ol,.feed > ul,.feed > ol{list-style:none;margin:0px;}ul{margin:1em;}h1,h2{font-size:153.9%;}:h3{font-size:146.5%;}h4,h5,h6{font-size:138.5%;}ul + h1,ul + h2,ul + h3,ul + h4,ul + h5,ul + h6{width:initial;}header{color:white;}header h1{font-family:Caudex;font-size:inherit;margin-top:0em;padding-left:1em;font-weight:200;}#sidebar,main{border-top:none;}section#sidebar{width:38vw;height:90vh;position:fixed;overflow:auto;}section#sidebar ul.menu{text-align:right;font-variant:small-caps;}section#sidebar ul.menu li a{width:100%;display:block;padding:0.5em;color:inherit;text-decoration:none;font-weight:700;font-size:125%;}main{width:62vw;float:right;clear:right;overflow-x:hidden;overflow-y:scroll;}.feed-header{padding-bottom:0em;}.feed-header h2,.feed-header h3{padding:0.62em;}.feed-header h2{padding-bottom:0.38em;}.feed-header h3{padding-top:0.38em;}.link.closed .link-content{max-height:0px;padding:0em;}.link.closed{padding-bottom:0em;}.link{text-decoration:none;display:block;overflow:hidden;font-size:0.8em;}.link .link-header{padding:1em;padding-bottom:0em;cursor:pointer;}.link .link-header h4{margin-bottom:0.5em;display:inline-block;}.link .link-info{margin-left:-1em;margin-right:-1em;padding-left:1em;padding-right:1em;padding-bottom:0.32em;}.link .link-info .link-url{float:left;}.link .link-info .link-date{float:right;display:block;}.link .link-info:after{content:" ";display:block;clear:both;}.link .link-content{-moz-transition:max-height 0.5s ease;-o-transition:max-height 0.5s ease;-webkit-transition:max-height 0.5s ease;-ms-transition:max-height 0.5s ease;transition:max-height 0.5s ease;}.link .link-content > div{padding:1em;}.feed.closed .post-list{max-height:0px;padding:0em;}.feed:first-child{border-top:none;}.feed{overflow:hidden;}.feed .post-list{-moz-transition:max-height 0.5s ease;-o-transition:max-height 0.5s ease;-webkit-transition:max-height 0.5s ease;-ms-transition:max-height 0.5s ease;transition:max-height 0.5s ease;} |
|
2 | 1 |
\ No newline at end of file |
2 |
+@import url(https://fonts.googleapis.com/css?family=Lato:400,100,300,400italic,300italic,700,700italic,900&subset=latin,latin-ext);@import url(https://fonts.googleapis.com/css?family=Caudex);.feed,main{-webkit-backface-visibility:hidden;-webkit-transform:translateZ(0);}*{box-sizing:border-box;margin:0px;padding:0px;}body{font-family:Lato;}main > ul,main > ol,#sidebar > ul,#sidebar > ol,.feed > ul,.feed > ol{list-style:none;margin:0px;}ul{margin:1em;}h1,h2{font-size:153.9%;}:h3{font-size:146.5%;}h4,h5,h6{font-size:138.5%;}ul + h1,ul + h2,ul + h3,ul + h4,ul + h5,ul + h6{width:initial;}header{color:white;}header h1{font-family:Caudex;font-size:inherit;margin-top:0em;padding-left:10vw;font-weight:200;}#sidebar,main{border-top:none;}section#sidebar{width:38vw;height:90vh;position:fixed;overflow:auto;}section#sidebar ul.menu{text-align:right;font-variant:small-caps;}section#sidebar ul.menu li a{width:100%;display:block;padding:0.5em;color:inherit;text-decoration:none;font-weight:700;font-size:125%;}main{width:62vw;float:right;clear:right;overflow-x:hidden;overflow-y:scroll;}.feed-header{padding-bottom:0em;}.feed-header h2,.feed-header h3{padding:0.62em;}.feed-header h2{padding-bottom:0.38em;}.feed-header h3{padding-top:0.38em;}.link.closed .link-content{max-height:0px;padding:0em;}.link.closed{padding-bottom:0em;}.link{text-decoration:none;display:block;overflow:hidden;font-size:0.8em;}.link .link-header{padding:1em;padding-bottom:0em;cursor:pointer;}.link .link-header h4{margin-bottom:0.5em;display:inline-block;}.link .link-info{margin-left:-1em;margin-right:-1em;padding-left:1em;padding-right:1em;padding-bottom:0.32em;}.link .link-info .link-url{float:left;}.link .link-info .link-date{float:right;display:block;}.link .link-info:after{content:" ";display:block;clear:both;}.link .link-content{-moz-transition:max-height 0.5s ease;-o-transition:max-height 0.5s ease;-webkit-transition:max-height 0.5s ease;-ms-transition:max-height 0.5s ease;transition:max-height 0.5s ease;}.link .link-content > div{padding:1em;}.feed.closed .post-list{max-height:0px;padding:0em;}.feed:first-child{border-top:none;}.feed{overflow:hidden;}.feed .post-list{-moz-transition:max-height 0.5s ease;-o-transition:max-height 0.5s ease;-webkit-transition:max-height 0.5s ease;-ms-transition:max-height 0.5s ease;transition:max-height 0.5s ease;} |
|
3 | 3 |
\ No newline at end of file |
... | ... |
@@ -18,6 +18,12 @@ $(document).ready(function () { |
18 | 18 |
}); |
19 | 19 |
return $(this).parent().toggleClass('closed'); |
20 | 20 |
}); |
21 |
+ invertPalette = function () { |
|
22 |
+ var styleSheet = $('link[href^="/theme"]'); |
|
23 |
+ var styleSheetName = styleSheet.attr('href'); |
|
24 |
+ return styleSheet.attr('href', styleSheetName.match(/dark/) ? styleSheetName.replace(/dark/, 'light') : styleSheetName.replace(/light/, 'dark')); |
|
25 |
+ }; |
|
26 |
+ $('.flip-button').click(invertPalette); |
|
21 | 27 |
return null; |
22 | 28 |
}); |
23 | 29 |
|