diff options
Diffstat (limited to '_templates')
-rw-r--r-- | _templates/post_excerpt.mako | 3 | ||||
-rw-r--r-- | _templates/site.mako | 28 |
2 files changed, 30 insertions, 1 deletions
diff --git a/_templates/post_excerpt.mako b/_templates/post_excerpt.mako index f2158c0..c96f792 100644 --- a/_templates/post_excerpt.mako +++ b/_templates/post_excerpt.mako @@ -14,7 +14,8 @@ ${", ".join(category_links)} </div> <div class="post_excerpt"> - ${post.summary} <i><a href="${post.permapath()}">Read more...</a></i> + <div class="post_shown post_sum">${post.summary} <i><a href="${post.permapath()}" class="post_more">Read more...</a></i></div> + <div class="post_hidden post_all"><i><a href="javascript:void(0);" class="post_hide">Hide</a></i> <br />${post.content}</div> </div> </div> diff --git a/_templates/site.mako b/_templates/site.mako index cac66d5..1d47b0d 100644 --- a/_templates/site.mako +++ b/_templates/site.mako @@ -24,6 +24,34 @@ <div id="footer" class="footer"> ${self.footer()} </div> <!-- End Footer --> + <script type="text/javascript"> + window.onload = function(){ + + var i, rm, rh, + read_mores = document.getElementsByClassName("post_more"), + read_hides = document.getElementsByClassName("post_hide"), + read_sum = document.getElementsByClassName("post_sum"), + read_all = document.getElementsByClassName("post_all"); + for(i=0;i<read_mores.length;i++){ + + rh = read_hides[i], + rm = read_mores[i]; + rm.href = "javascript:void(0);"; + rm.data = rh.data = {}; + rm.data.related_s = rh.data.related_s = read_sum[i]; + rm.data.related_a = rh.data.related_a = read_all[i]; + rm.onclick = rh.onclick = function(){ + + var sum = this.data.related_s, + all = this.data.related_a; + sum.className = (sum.className.indexOf("post_shown")!==-1) ? "post_hidden" : "post_shown"; + sum.className += " post_sum"; + all.className = (all.className.indexOf("post_shown")!==-1) ? "post_hidden" : "post_shown"; + all.className += " post_all"; + }; + } + }; + </script> </body> </html> <%def name="head()"> |