Permalink
Browse files

user can change css

  • Loading branch information...
1 parent 6a7cfe3 commit 6b9c9e1d195b712a7f775ff4b4613f753c4ec8af @halida committed Nov 14, 2011
Showing with 103 additions and 61 deletions.
  1. +6 −0 main.rb
  2. +9 −3 views/_nav.haml
  3. +1 −1 views/article.haml
  4. +37 −0 views/color.sass
  5. +8 −0 views/color1.sass
  6. +8 −0 views/color2.sass
  7. +8 −0 views/color3.sass
  8. +8 −0 views/color4.sass
  9. +8 −0 views/color5.sass
  10. +1 −1 views/index.haml
  11. +2 −1 views/layout.haml
  12. +3 −4 views/main.coffee
  13. +4 −51 views/main.sass
View
@@ -96,6 +96,12 @@ def link_to name, link, pjax=""
sass :main
end
+get '/color1.css' do ; sass :color1; end
+get '/color2.css' do ; sass :color2; end
+get '/color3.css' do ; sass :color3; end
+get '/color4.css' do ; sass :color4; end
+get '/color5.css' do ; sass :color5; end
+
get '/main.js' do
coffee :main
end
View
@@ -12,11 +12,17 @@
%li
=link_to "feed", "/feed"
- .color_panel
+ #color_panel
.color.c1 1
.color.c2 2
.color.c3 3
.color.c4 4
.color.c5 5
- .color.c6 6
- .color.c7 7
+
+ %select#color-select
+ %option 1
+ %option 2
+ %option 3
+ %option 4
+ %option 5
+
View
@@ -1,4 +1,4 @@
-#article
+.article
%h1= @article.title
=@article.get_content
View
@@ -0,0 +1,37 @@
+body
+ background: $c_1
+ color: $c_5
+nav
+ background: $c_4
+ #container
+ a
+ color: white
+ &:hover
+ color: $c_2
+#warper
+ background: $c_2
+footer
+ background: $c_5
+ color: $c_2
+a
+ color: $c_4
+ &:hover
+ color: $c_5
+
+#color_panel
+ .c1
+ background: $c_1
+ .c2
+ background: $c_2
+ .c3
+ background: $c_3
+ .c4
+ background: $c_4
+ .c5
+ background: $c_5
+
+hr
+ border: 1px solid $c_5
+.time-stamp
+ color: $c_3
+
View
@@ -0,0 +1,8 @@
+// base color
+$c_1: #D5D1B4
+$c_2: #D5CC92
+$c_3: #BBA146
+$c_4: #844341
+$c_5: #383636
+
+@import "color.sass"
View
@@ -0,0 +1,8 @@
+// base color
+$c_1: white
+$c_2: white
+$c_3: white
+$c_4: black
+$c_5: black
+
+@import "color.sass"
View
@@ -0,0 +1,8 @@
+// base color
+$c_1: #f2f2f2
+$c_2: #bed9a9
+$c_3: #103959
+$c_4: #388c78
+$c_5: #021947
+
+@import "color.sass"
View
@@ -0,0 +1,8 @@
+// base color
+$c_1: #ffffff
+$c_2: whiteSmoke
+$c_3: #D14836
+$c_4: #2d2d2d
+$c_5: #666
+
+@import "color.sass"
View
@@ -0,0 +1,8 @@
+// base color
+$c_1: #cae6e8
+$c_2: #a2aba5
+$c_3: #595855
+$c_4: #313f54
+$c_5: #2b2e2e
+
+@import "color.sass"
View
@@ -3,7 +3,7 @@
%h1#article-title
=link_to article.show_title, "/article/#{article.title}", true
- #article
+ .article
=article.get_content
= partial :_stamp, :locals => {:article => article}
View
@@ -6,14 +6,15 @@
<meta name="author" content="halida" />
<link rel="stylesheet" type="text/css" href="/pygments-default.css" media="screen" />
<link rel="stylesheet" type="text/css" href="/main.css" media="screen" />
+ <link rel="stylesheet" type="text/css" id="color-css" href="/color1.css"/>
<link rel="alternate" type="application/rss+xml" title="网络寻租 - RSS" href="http://blog.linjunhalida.com/feed" />
<script src="/jquery.js"></script>
<script src="/jquery.pjax.js"></script>
<script src="/jquery.appear-1.1.1.min.js"></script>
<script src="/main.js"></script>
:javascript
- $(function(){init_pjax();});
+ $(function(){init();});
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26509244-1']);
_gaq.push(['_trackPageview', '_trackPageLoadTime']);
View
@@ -1,8 +1,7 @@
window.init = ()->
- ret = (event, data, status, xhr)->
- event.preventDefault()
- $.ajax {url: this, data:"_pjax=true", success: (data)-> $("#content").html(data)}
- $('a.js-pjax').live "click", ret
+ init_pjax()
+ $('select#color-select').change ()->
+ $('#color-css').attr('href', '/color'+$(this).val()+'.css')
window.init_pjax = ()->
error_func = (xhr, err)-> $('.error').text('Something went wrong: ' + err)
View
@@ -15,37 +15,8 @@
=font-footer
font: 10px Arial, Helvetica, sans-serif
-// base color
-$c_1: #844341
-$c_2: #D5CC92
-$c_3: #BBA146
-$c_4: #897B26
-$c_5: #55591C
-$c_6: #D5D1B4
-$c_7: #383636
-body
- background: $c_6
- color: $c_7
-nav
- background: $c_1
- #container
- a
- color: white
- &:hover
- color: $c_2
-#warper
- background: $c_2
- font-color: $c_3
-footer
- background: $c_7
- color: $c_2
-a
- color: $c_1
- &:hover
- color: $c_5
-
-.color_panel
+#color_panel
margin-top: 3px
float: right
.color
@@ -54,26 +25,13 @@ a
width: 20px
height: 20px
border: 1px solid #000000
- .c1
- background: $c_1
- .c2
- background: $c_2
- .c3
- background: $c_3
- .c4
- background: $c_4
- .c5
- background: $c_5
- .c6
- background: $c_6
- .c7
- background: $c_7
-
+#color-select
+ float: right
//format
h1
+font-header
- margin: 15px 0px 0px 0px
+ /* margin: 15px 0px 0px 0px
p
line-height: 22px
@@ -93,11 +51,6 @@ a
outline: none
&:visited
// Default style for visited links
-hr
- border: 1px solid $c_5
-
-.time-stamp
- color: $c_4
body
+font-default

0 comments on commit 6b9c9e1

Please sign in to comment.