aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornicosomb <nicolas@loeuillet.org>2013-04-12 11:33:34 +0200
committernicosomb <nicolas@loeuillet.org>2013-04-12 11:33:34 +0200
commitb70971e06b67786bb61e863cf89b3b061b4f6467 (patch)
tree14a96f8b8a99de44bdf0726307f0f1e9ae7d0467
parentc775c8436b30fffde88e69a8c8f6bd488d66a585 (diff)
downloadwallabag-b70971e06b67786bb61e863cf89b3b061b4f6467.tar.gz
wallabag-b70971e06b67786bb61e863cf89b3b061b4f6467.tar.zst
wallabag-b70971e06b67786bb61e863cf89b3b061b4f6467.zip
corrections mise en page avec utilisation de jquery.masonry.js
-rw-r--r--css/style.css154
-rwxr-xr-xindex.php23
-rw-r--r--js/jquery.masonry.min.js10
-rw-r--r--js/poche.js10
-rwxr-xr-xtpl/footer.html2
5 files changed, 92 insertions, 107 deletions
diff --git a/css/style.css b/css/style.css
index 6a8b07b2..d53060ec 100644
--- a/css/style.css
+++ b/css/style.css
@@ -47,101 +47,14 @@ header {
47 color: #F1F1F1; 47 color: #F1F1F1;
48} 48}
49 49
50footer {
51 text-align: right;
52}
53
54/*** ***/
55/*** GRID DISPLAY ***/
56
57#content { 50#content {
58 width: 1000px; 51 width: 800px;
59 margin: 0 auto; 52 margin: 0 auto;
60} 53}
61 54
62#entries {
63 -moz-column-count: 4;
64 -moz-column-gap: 20px;
65 -webkit-column-count: 4;
66 -webkit-column-gap: 20px;
67 column-count: 4;
68 column-gap: 20px;
69 width: 1000px;
70}
71
72#entries span.content {
73 display: inline-block;
74 margin-bottom: 0px;
75 width: 100%;
76}
77 55
78@media only screen and (max-width : 1199px), 56footer {
79only screen and (max-device-width : 1199px){ 57 text-align: right;
80 #entries {
81 -moz-column-count: 5;
82 -moz-column-gap: 20px;
83 -webkit-column-count: 5;
84 -webkit-column-gap: 20px;
85 column-count: 5;
86 column-gap: 20px;
87 width: 1000px;
88 }
89
90 #content {
91 width: 1000px;
92 }
93}
94
95
96@media only screen and (max-width : 999px),
97only screen and (max-device-width : 999px){
98 #entries {
99 -moz-column-count: 4;
100 -moz-column-gap: 15px;
101 -webkit-column-count: 4;
102 -webkit-column-gap: 15px;
103 column-count: 4;
104 column-gap: 15px;
105 width: 800px;
106 }
107
108 #content {
109 width: 800px;
110 }
111}
112
113@media only screen and (max-width : 799px),
114only screen and (max-device-width : 799px){
115 #entries {
116 -moz-column-count: 3;
117 -moz-column-gap: 10px;
118 -webkit-column-count: 3;
119 -webkit-column-gap: 10px;
120 column-count: 3;
121 column-gap: 10px;
122 width: 600px;
123 }
124
125 #content {
126 width: 600px;
127 }
128}
129
130@media only screen and (max-width : 599px),
131only screen and (max-device-width : 599px){
132 #entries {
133 -moz-column-count: 2;
134 -moz-column-gap: 10px;
135 -webkit-column-count: 2;
136 -webkit-column-gap: 10px;
137 column-count: 2;
138 column-gap: 10px;
139 width: 400px;
140 }
141
142 #content {
143 width: 400px;
144 }
145} 58}
146 59
147/*** ***/ 60/*** ***/
@@ -152,32 +65,34 @@ only screen and (max-device-width : 599px){
152 cursor: pointer; 65 cursor: pointer;
153} 66}
154 67
155#main #entries { 68#main #content {
156 margin-top: 20px; 69 margin-top: 20px;
157} 70}
158 71
159#main #entries .entrie { 72#main .entrie {
160 color: rgb(46, 46, 46); 73 color: rgb(46, 46, 46);
161 position:relative; 74 position:relative;
162 background-color: #ffffff; 75 background-color: #ffffff;
163 padding: 15px; 76 padding: 15px;
164 min-height: 6em; 77 min-height: 8em;
165 -webkit-border-radius: 2px; 78 -webkit-border-radius: 2px;
166 border-radius: 2px; 79 border-radius: 2px;
167 -webkit-box-shadow: 0px 0px 2px -1px #000; 80 -webkit-box-shadow: 0px 0px 2px -1px #000;
168 box-shadow: 0px 0px 2px -1px #000; 81 box-shadow: 0px 0px 2px -1px #000;
169 list-style-type: none; 82 width: 30%;
83 margin: 10px;
84 float: left;
170} 85}
171 86
172#main #entries .entrie h2 a { 87#main .entrie h2 a {
173 text-decoration: none; 88 text-decoration: none;
174} 89}
175 90
176#main #entries .entrie h2 a:hover { 91#main .entrie h2 a:hover {
177 color: #F5BE00; 92 color: #F5BE00;
178} 93}
179 94
180#main #entries .entrie .tools { 95#main .entrie .tools {
181 position:absolute; 96 position:absolute;
182 bottom: 0; 97 bottom: 0;
183 width: 100%; 98 width: 100%;
@@ -185,7 +100,7 @@ only screen and (max-device-width : 599px){
185 margin-left: -20px; 100 margin-left: -20px;
186} 101}
187 102
188#main #entries .entrie .tools a.tool span { 103#main .entrie .tools a.tool span {
189 display: inline-block; 104 display: inline-block;
190 width: 16px; 105 width: 16px;
191 height: 16px; 106 height: 16px;
@@ -238,4 +153,45 @@ body.article {
238 text-decoration: none; 153 text-decoration: none;
239} 154}
240 155
241/*** ***/ \ No newline at end of file 156/*** ***/
157#main
158{
159 max-width: 60em; /* 960 px */
160 margin: 0 auto;
161}
162 #content
163 {
164 width: 103.125%; /* 990px */
165 overflow: hidden;
166 margin-left: -1.562%; /* 15px */
167 margin-bottom: -1.875em; /* 30px */
168 }
169 .entrie
170 {
171 width: 30.303%; /* 300px */
172 float: left;
173 margin: 0 1.515% 1.875em; /* 15px 30px */
174 }
175
176@media only screen and ( max-width: 40em ) /* 640px */
177{
178 .entrie
179 {
180 width: 46.876%; /* 305px */
181 margin-bottom: 0.938em; /* 15px */
182 }
183}
184@media only screen and ( max-width: 20em ) /* 640px */
185{
186 #content
187 {
188 width: 100%;
189 margin-left: 0;
190 }
191 .entrie
192 {
193 width: 100%;
194 margin-left: 0;
195 margin-right: 0;
196 }
197} \ No newline at end of file
diff --git a/index.php b/index.php
index abf658a3..27144de3 100755
--- a/index.php
+++ b/index.php
@@ -129,12 +129,11 @@ catch (Exception $e)
129 <li><a style="cursor: move" title="i am a bookmarklet, use me !" href="javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('<?php echo url()?>?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></li> 129 <li><a style="cursor: move" title="i am a bookmarklet, use me !" href="javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('<?php echo url()?>?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></li>
130 </ul> 130 </ul>
131 <div id="content"> 131 <div id="content">
132 <ul id="entries">
133 <?php 132 <?php
134 foreach ($entries as $entry) 133 foreach ($entries as $entry)
135 { 134 {
136 ?> 135 ?>
137 <li id="entry-<?php echo $entry['id']; ?>" class="entrie mb2"> 136 <div id="entry-<?php echo $entry['id']; ?>" class="entrie mb2">
138 <span class="content"> 137 <span class="content">
139 <h2 class="h6-like"> 138 <h2 class="h6-like">
140 <a href="readityourself.php?url=<?php echo urlencode($entry['url']); ?>"><?php echo $entry['title']; ?> 139 <a href="readityourself.php?url=<?php echo urlencode($entry['url']); ?>"><?php echo $entry['title']; ?>
@@ -145,17 +144,33 @@ catch (Exception $e)
145 <a href="?action=delete&id=<?php echo $entry['id']; ?>" title="toggle delete" onclick="return confirm('Are you sure?')" class="tool delete"><span></span></a> 144 <a href="?action=delete&id=<?php echo $entry['id']; ?>" title="toggle delete" onclick="return confirm('Are you sure?')" class="tool delete"><span></span></a>
146 </div> 145 </div>
147 </span> 146 </span>
148 </li> 147 </div>
149 <?php 148 <?php
150 } 149 }
151 ?> 150 ?>
152 </ul>
153 </div> 151 </div>
154 </div> 152 </div>
155 <footer class="mr2 mt3 smaller"> 153 <footer class="mr2 mt3 smaller">
156 <p>download poche on <a href="http://github.com/nicosomb/github">github</a><br />follow us on <a href="https://twitter.com/getpoche" title="follow us on twitter">twitter</a></p> 154 <p>download poche on <a href="http://github.com/nicosomb/github">github</a><br />follow us on <a href="https://twitter.com/getpoche" title="follow us on twitter">twitter</a></p>
157 </footer> 155 </footer>
158 <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script> 156 <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
157 <script type="text/javascript" src="js/jquery.masonry.min.js"></script>
159 <script type="text/javascript" src="js/poche.js"></script> 158 <script type="text/javascript" src="js/poche.js"></script>
159 <script type="text/javascript">
160 $( window ).load( function()
161 {
162 var columns = 3,
163 setColumns = function() { columns = $( window ).width() > 640 ? 3 : $( window ).width() > 320 ? 2 : 1; };
164
165 setColumns();
166 $( window ).resize( setColumns );
167
168 $( '#content' ).masonry(
169 {
170 itemSelector: '.entrie',
171 columnWidth: function( containerWidth ) { return containerWidth / columns; }
172 });
173 });
174 </script>
160 </body> 175 </body>
161</html> 176</html>
diff --git a/js/jquery.masonry.min.js b/js/jquery.masonry.min.js
new file mode 100644
index 00000000..57c081c6
--- /dev/null
+++ b/js/jquery.masonry.min.js
@@ -0,0 +1,10 @@
1/**
2 * jQuery Masonry v2.1.08
3 * A dynamic layout plugin for jQuery
4 * The flip-side of CSS Floats
5 * http://masonry.desandro.com
6 *
7 * Licensed under the MIT license.
8 * Copyright 2012 David DeSandro
9 */
10(function(e,t,n){"use strict";var r=t.event,i;r.special.smartresize={setup:function(){t(this).bind("resize",r.special.smartresize.handler)},teardown:function(){t(this).unbind("resize",r.special.smartresize.handler)},handler:function(e,t){var n=this,s=arguments;e.type="smartresize",i&&clearTimeout(i),i=setTimeout(function(){r.dispatch.apply(n,s)},t==="execAsap"?0:100)}},t.fn.smartresize=function(e){return e?this.bind("smartresize",e):this.trigger("smartresize",["execAsap"])},t.Mason=function(e,n){this.element=t(n),this._create(e),this._init()},t.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1,containerStyle:{position:"relative"}},t.Mason.prototype={_filterFindBricks:function(e){var t=this.options.itemSelector;return t?e.filter(t).add(e.find(t)):e},_getBricks:function(e){var t=this._filterFindBricks(e).css({position:"absolute"}).addClass("masonry-brick");return t},_create:function(n){this.options=t.extend(!0,{},t.Mason.settings,n),this.styleQueue=[];var r=this.element[0].style;this.originalStyle={height:r.height||""};var i=this.options.containerStyle;for(var s in i)this.originalStyle[s]=r[s]||"";this.element.css(i),this.horizontalDirection=this.options.isRTL?"right":"left";var o=this.element.css("padding-"+this.horizontalDirection),u=this.element.css("padding-top");this.offset={x:o?parseInt(o,10):0,y:u?parseInt(u,10):0},this.isFluid=this.options.columnWidth&&typeof this.options.columnWidth=="function";var a=this;setTimeout(function(){a.element.addClass("masonry")},0),this.options.isResizable&&t(e).bind("smartresize.masonry",function(){a.resize()}),this.reloadItems()},_init:function(e){this._getColumns(),this._reLayout(e)},option:function(e,n){t.isPlainObject(e)&&(this.options=t.extend(!0,this.options,e))},layout:function(e,t){for(var n=0,r=e.length;n<r;n++)this._placeBrick(e[n]);var i={};i.height=Math.max.apply(Math,this.colYs);if(this.options.isFitWidth){var s=0;n=this.cols;while(--n){if(this.colYs[n]!==0)break;s++}i.width=(this.cols-s)*this.columnWidth-this.options.gutterWidth}this.styleQueue.push({$el:this.element,style:i});var o=this.isLaidOut?this.options.isAnimated?"animate":"css":"css",u=this.options.animationOptions,a;for(n=0,r=this.styleQueue.length;n<r;n++)a=this.styleQueue[n],a.$el[o](a.style,u);this.styleQueue=[],t&&t.call(e),this.isLaidOut=!0},_getColumns:function(){var e=this.options.isFitWidth?this.element.parent():this.element,t=e.width();this.columnWidth=this.isFluid?this.options.columnWidth(t):this.options.columnWidth||this.$bricks.outerWidth(!0)||t,this.columnWidth+=this.options.gutterWidth,this.cols=Math.floor((t+this.options.gutterWidth)/this.columnWidth),this.cols=Math.max(this.cols,1)},_placeBrick:function(e){var n=t(e),r,i,s,o,u;r=Math.ceil(n.outerWidth(!0)/this.columnWidth),r=Math.min(r,this.cols);if(r===1)s=this.colYs;else{i=this.cols+1-r,s=[];for(u=0;u<i;u++)o=this.colYs.slice(u,u+r),s[u]=Math.max.apply(Math,o)}var a=Math.min.apply(Math,s),f=0;for(var l=0,c=s.length;l<c;l++)if(s[l]===a){f=l;break}var h={top:a+this.offset.y};h[this.horizontalDirection]=this.columnWidth*f+this.offset.x,this.styleQueue.push({$el:n,style:h});var p=a+n.outerHeight(!0),d=this.cols+1-c;for(l=0;l<d;l++)this.colYs[f+l]=p},resize:function(){var e=this.cols;this._getColumns(),(this.isFluid||this.cols!==e)&&this._reLayout()},_reLayout:function(e){var t=this.cols;this.colYs=[];while(t--)this.colYs.push(0);this.layout(this.$bricks,e)},reloadItems:function(){this.$bricks=this._getBricks(this.element.children())},reload:function(e){this.reloadItems(),this._init(e)},appended:function(e,t,n){if(t){this._filterFindBricks(e).css({top:this.element.height()});var r=this;setTimeout(function(){r._appended(e,n)},1)}else this._appended(e,n)},_appended:function(e,t){var n=this._getBricks(e);this.$bricks=this.$bricks.add(n),this.layout(n,t)},remove:function(e){this.$bricks=this.$bricks.not(e),e.remove()},destroy:function(){this.$bricks.removeClass("masonry-brick").each(function(){this.style.position="",this.style.top="",this.style.left=""});var n=this.element[0].style;for(var r in this.originalStyle)n[r]=this.originalStyle[r];this.element.unbind(".masonry").removeClass("masonry").removeData("masonry"),t(e).unbind(".masonry")}},t.fn.imagesLoaded=function(e){function u(){e.call(n,r)}function a(e){var n=e.target;n.src!==s&&t.inArray(n,o)===-1&&(o.push(n),--i<=0&&(setTimeout(u),r.unbind(".imagesLoaded",a)))}var n=this,r=n.find("img").add(n.filter("img")),i=r.length,s="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",o=[];return i||u(),r.bind("load.imagesLoaded error.imagesLoaded",a).each(function(){var e=this.src;this.src=s,this.src=e}),n};var s=function(t){e.console&&e.console.error(t)};t.fn.masonry=function(e){if(typeof e=="string"){var n=Array.prototype.slice.call(arguments,1);this.each(function(){var r=t.data(this,"masonry");if(!r){s("cannot call methods on masonry prior to initialization; attempted to call method '"+e+"'");return}if(!t.isFunction(r[e])||e.charAt(0)==="_"){s("no such method '"+e+"' for masonry instance");return}r[e].apply(r,n)})}else this.each(function(){var n=t.data(this,"masonry");n?(n.option(e||{}),n._init()):t.data(this,"masonry",new t.Mason(e,this))});return this}})(window,jQuery); \ No newline at end of file
diff --git a/js/poche.js b/js/poche.js
index 6751920a..42958e83 100644
--- a/js/poche.js
+++ b/js/poche.js
@@ -6,11 +6,15 @@ function toggle_favorite(element,id) {
6 }); 6 });
7} 7}
8 8
9
10function toggle_archive(id) { 9function toggle_archive(id) {
11 $('#entry-'+id).toggle(); 10 /*$('#entry-'+id).toggle();*/
12 $.ajax ({ 11 $.ajax ({
13 url: "process.php?action=toggle_archive", 12 url: "process.php?action=toggle_archive",
14 data:{id:id} 13 data:{id:id}
15 }); 14 });
16} 15 var obj = $('#entry-'+id);
16 $('#content').masonry('remove',obj);
17
18 $('#content').masonry('reloadItems');
19 $('#content').masonry('reload');
20} \ No newline at end of file
diff --git a/tpl/footer.html b/tpl/footer.html
index 43af7d71..8cdda21c 100755
--- a/tpl/footer.html
+++ b/tpl/footer.html
@@ -1,3 +1,3 @@
1 <footer class="mr2 mt3 smaller"> 1 <footer class="mr2 mt3 smaller">
2 <p><a href="https://twitter.com/getpoche" title="follow us on twitter">Follow @getpoche on twitter</a></p> 2 <p>download poche on <a href="http://github.com/nicosomb/github">github</a><br />follow us on <a href="https://twitter.com/getpoche" title="follow us on twitter">twitter</a></p>
3 </footer> 3 </footer>