summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvic511 <>2013-12-30 00:43:43 +0100
committerBenjamin Cohen <bencoh@notk.org>2013-12-30 00:43:53 +0100
commitf48941a7551ac0def0215a2186878c5088f6423c (patch)
tree27abfa7174ff92f22d3cc5369b77c129ab199fce
parent7cd571cbe74038044b128e5f67a2562ade619f15 (diff)
[ENH] Dynamisation des annoncesHEADmaster
Les navigateurs avec js activés permettent d'afficher le poste complet en cliquant sur "Read more" sans charger une nouvelle page. Les navigateurs sans js ne sont pas impactés.
-rw-r--r--_templates/post_excerpt.mako3
-rw-r--r--_templates/site.mako28
-rw-r--r--css/site.css4
3 files changed, 34 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()">
diff --git a/css/site.css b/css/site.css
index 456ca67..b97e5b5 100644
--- a/css/site.css
+++ b/css/site.css
@@ -105,6 +105,10 @@ a:hover.title {
padding:5px;
}
+.post_hidden{
+ display: none;
+}
+
.post_prose {
text-align: justify;
background: rgba(255, 255, 255, 0.5);