Commits

Sachirou Inoue committed 4ce7775

Fix style (larger font, border between navitem, round header) and better page switching.

  • Participants
  • Parent commits f1be8b7

Comments (0)

Files changed (4)

 source :gemcutter
 
-gem 'sinatra', '~>1.3.2'
-gem 'haml', '3.1.4'
+gem 'sinatra', '~>1.3.3'
+gem 'haml', '~>3.1.7'
 gem 'rack-rewrite'
 
 group :development do
 GEM
   remote: http://rubygems.org/
   specs:
-    haml (3.1.4)
+    haml (3.1.7)
     rack (1.4.1)
-    rack-protection (1.2.0)
+    rack-protection (1.3.2)
       rack
-    rack-rewrite (1.1.0)
+    rack-rewrite (1.3.2)
     shotgun (0.9)
       rack (>= 1.0)
-    sinatra (1.3.2)
+    sinatra (1.3.3)
       rack (~> 1.3, >= 1.3.6)
       rack-protection (~> 1.2)
       tilt (~> 1.3, >= 1.3.3)
   ruby
 
 DEPENDENCIES
-  haml (= 3.1.4)
+  haml (~> 3.1.7)
   rack-rewrite
   shotgun
-  sinatra (~> 1.3.2)
+  sinatra (~> 1.3.3)
   background-image: url("clover1.png");
   background-repeat: no-repeat;
   background-attachment: fixed;
-  font-size: 7pt; }
+  font-size: 8pt; }
+
+b {
+  color: #c00; }
+
+a:visited {
+  color: rgb(64, 128, 255); }
 
 .container {
   background-color: #fff;
   background-color: rgba(153, 187, 221, 0.8);
   background-image: url("clover2.png");
   background-repeat: no-repeat;
-  background-position: 837px 0; }
+  background-position: 837px 0;
+  border-radius: 5px; }
 
 h1 {
   color: #093;
 h2 {
   color: #30c; }
 
-b {
-  color: #c00; }
-
-#navbar {}
-
 #navbar .navbaritem {
   height: 31px;
   text-align: center;
 #navbar .navbaritem:focus {
   background-position: 0 -31px; }
 
+#navbar .navbaritem + .navbaritem {
+  border-left: 1px #ddd solid; }
+
 #navbar .navbaritem a {
   display: block;
   width: 100%;
     uu.query('.contents')[0].innerHTML = contentsHTML;
   }
 
-  var cache = movePage.contentsCache,
+  function ajaxCallback (response) {
+    if (!response.ok) {
+      location.href = targetLocation;
+    } else {
+      _cache[targetLocation] = response.rv;
+      insertContents(response.rv);
+    }
+  }
+
+  var _cache = movePage.contentsCache,
       contentsName;
 
-  if (cache[targetLocation]) {
-    insertContents(cache[targetLocation]);
-  }
-  contentsName = '/contents' + replaceHrefString(targetLocation);
-  if (contentsName[contentsName.length - 1] === '/') {
-    contentsName += 'index';
+  if (_cache[targetLocation]) {
+    insertContents(_cache[targetLocation]);
+  } else {
+    contentsName = '/contents' + replaceHrefString(targetLocation);
+    if (contentsName[contentsName.length - 1] === '/') {
+      contentsName += 'index';
+    }
+    uu.ajax(contentsName, {timeout: 4}, ajaxCallback);
   }
-  uu.ajax(contentsName,
-    {
-      timeout: 10
-    },
-    function (response) {
-      if (!response.ok) {
-        location.href = targetLocation;
-        return;
-      }
-      cache[targetLocation] = response.rv;
-      insertContents(response.rv);
-    });
 }
 movePage.contentsCache = {};
 
  * @param {MouseEvent} evt
  */
 function clickItem (evt) {
+  var targetHref = evt.target.href;
+
   evt.preventDefault();
-  if (evt.target.href === location.href) {
+  if (targetHref === location.href) {
     return;
   }
-  movePage(evt.target.href);
-  history.pushState({}, 'せとメンタルクリニック', evt.target.href);
+  movePage(targetHref);
+  history.pushState({}, 'せとメンタルクリニック', targetHref);
 }