diff --git a/public/script.js b/public/script.js new file mode 100644 index 0000000..9b852a5 --- /dev/null +++ b/public/script.js @@ -0,0 +1,9 @@ +function search(q) +{ + var quotes = document.getElementsByClassName('quotes'); + for( var i in quotes ) + { + if( quotes[i].innerHTML == undefined ) continue; + quotes[i].className = quotes[i].innerHTML.indexOf(q) == -1 ? 'quotes hidden' : 'quotes'; + } +} diff --git a/public/styles.css b/public/styles.css index 77f8506..600520d 100644 --- a/public/styles.css +++ b/public/styles.css @@ -2,6 +2,7 @@ * Authors * Dafydd "Afal" Francis [ http://www.somethingafal.com/ ] * "npc" / Samuel Clements [ http://borntyping.co.uk ] + * danharibo / Daniel Evans [ http://bytecove.co.uk] */ html { @@ -16,13 +17,24 @@ body { padding: 25px; margin: 0; font-family: "Lucida Grande"; - color: black; + color: #444; text-shadow: 1px 1px 2px #2B2B2B; } +div#page { + width: 90%; + margin: 0 auto 0 auto; +} + div#title { font-size: 42px; font-weight: bold; + margin: 0 0 10px 0; + color: #444; +} + +div#title a { + color: #000; } div#main { @@ -30,35 +42,47 @@ div#main { margin: 0px; font-size: 21px; text-align:center; + background: #FFF; + border-radius: 20px; + box-shadow: 0px 0px 4px #000; } -a { +div#controls { + width: 100%; +} + +input { + width: 80%; +} + +a,a:active,a:visited { text-decoration: none; } -div.quotes, div.quote { - color: #12699B; - box-shadow: 0 0 20px black; - opacity: 0.5; +ul#quotelist { + padding: 0; + margin: 0; +} + +li.quotes, li.quote { + color: #3333FF; } /* Quotes list page */ -div.quotes { - background: white; - float: left; - display: inline; - margin: 10px; - padding: 20px; - border-radius: 15px; +li.quotes { + margin: 8px; + padding: 6px; + display: inline-block; + border-radius: 10px; } -div.quotes:hover { - opacity: 0.8; +li.quotes:hover { + background: rgba(0,0,255,0.3); } -div.quotes a { - +.hidden { + display: none !important; } /* Quote list pages */ @@ -67,18 +91,17 @@ div#quotelist { width:100%; } -div#quotelist div.quote { +li.quote { background: white; border-radius: 5px; - margin: 10px auto; - padding: 10px; + display: inline-block; + margin: 6px auto; + padding: 6px; font-size: 18px; - width:90%; - opacity: 0.7; - color:darkblue; + width: 40%; text-shadow: 1px 1px 1px black; } -div#quotelist div.quote:hover { - opacity: 1; -} \ No newline at end of file +img { + max-width: 100%; +} diff --git a/views/layout.jade b/views/layout.jade index 4709720..fe4fd48 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -1,10 +1,13 @@ !!! 5 -html(lang: 'en') +html(lang='en') head - meta(charset: 'utf-8') - link(rel: 'stylesheet', type: 'text/css', href: '/styles.css') + meta(charset='utf-8') + link(rel='stylesheet', type='text/css', href='/styles.css') title Depressionbot web interface body - div#title Depressionbot web interface - div#main - !{body} + div#page + div#title + a(href='/') Depressionbot web interface + div#main + !{body} + script(type="text/javascript", src="/script.js") diff --git a/views/quotelist.jade b/views/quotelist.jade index c33110c..154fb1a 100644 --- a/views/quotelist.jade +++ b/views/quotelist.jade @@ -1,3 +1,7 @@ --each quote in quotelist - div.quotes - a(href='/quotes/'+quote) #{quote} +div#controls + input(type="text", name="search", id="search-text", oninput="search(this.value)") +ul#quotelist + -each quote in quotelist + a(href='/quotes/'+quote) + li.quotes #{quote} + diff --git a/views/quotes.jade b/views/quotes.jade index b52557a..0010440 100644 --- a/views/quotes.jade +++ b/views/quotes.jade @@ -1,11 +1,11 @@ -div#quotelist +ul#quotelist -each quote in quotes -if(quote.match(locals.url_regex)) - div.quote + li.quote a(href=quote) -if(quote.match(/(jpg|png|gif|jpeg|tiff)$/)) img(src=quote) -else =quote -else - div.quote #{quote} + li.quote #{quote}