diff options
| author | 2012-11-07 00:24:50 +0100 | |
|---|---|---|
| committer | 2012-11-07 00:24:50 +0100 | |
| commit | 567d19a98934747d0817ad58a008dce7d5df0d92 (patch) | |
| tree | 71dc846975d00fa8a0ca42d2134588cf37e76bbc /public | |
| parent | f3f2bc7471ebb77e6f8adfa5371d055980401bef (diff) | |
Fix issue #7 : ajout du mode endless
Diffstat (limited to 'public')
| -rw-r--r-- | public/scripts/endless_mode.js | 28 | ||||
| -rw-r--r-- | public/theme/base.css | 16 |
2 files changed, 44 insertions, 0 deletions
diff --git a/public/scripts/endless_mode.js b/public/scripts/endless_mode.js new file mode 100644 index 000000000..ca3c12572 --- /dev/null +++ b/public/scripts/endless_mode.js @@ -0,0 +1,28 @@ +var url = ""; + +function load_more_posts () { + $.get (url, function (data) { + $("#load_more").before ($("#stream .post", data)); + + url = $(".pagination:last li.pager-next a", data).attr ("href"); + if (url === undefined) { + $("#load_more").html ("Il n'y a plus rien à charger"); + $("#load_more").addClass ("disable"); + } + + init_posts (); + }); +} + +$(document).ready (function () { + url = $(".pagination:last li.pager-next a").attr ("href"); + $(".pagination").remove (); + + $("#stream").append ("<a id=\"load_more\" href=\"#\">Charger plus d'articles</a>"); + + $("#load_more").click (function () { + load_more_posts (); + + return false; + }); +}); diff --git a/public/theme/base.css b/public/theme/base.css index c9504b833..d1c20b3d6 100644 --- a/public/theme/base.css +++ b/public/theme/base.css @@ -336,6 +336,22 @@ form { display: block; color: #F09600; } +a#load_more { + display: block; + width: 90%; + height: 50px; + margin: 0 auto; + background: #eee; + border-radius: 5px; + box-shadow: 0 0 3px #aaa; + line-height: 50px; + text-align: center; + font-weight: bold; +} + a#load_more.disable { + text-decoration: none !important; + color: #666; + } /*** NOTIFICATION ***/ #notification { |
