Skip to content

Commit 3d45f32

Browse files
committed
V2.2
- Updated naming conventions for classes - Updated naming conventions for postData - Used node_modules for dependency js files - Added callback function - Used doT as a Template Engine - Added template options - Added Layout namespace - Updated package.json - Updated README.md
1 parent de4066a commit 3d45f32

File tree

324 files changed

+50073
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

324 files changed

+50073
-347
lines changed

README.md

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Check [Demo](http://omarelgabry.github.io/Hashtegny/)
2222
## Features
2323
+ Aggregates hashtags from different social media networks.
2424
+ Displays the posts in a grid and animated layout.
25+
+ You can define your own template for posts.
2526
+ Works on different screen sizes.
2627
+ It automatically updates the time stamp of each post.
2728
+ It automatically adds recent posts if any.
@@ -54,14 +55,16 @@ Add CSS Files:
5455
Add JS Files:
5556
```html
5657
<!-- jQuery -->
57-
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
58+
<script type="text/javascript" src="node_modules/jquery/dist/jquery.min.js"></script>
59+
<!-- Grid Layout -->
60+
<script type="text/javascript" src="node_modules/masonry-layout/dist/masonry.pkgd.min.js"></script>
61+
<!-- doT.js Template Engine -->
62+
<script type="text/javascript" src="node_modules/dot/doT.min.js"></script>
63+
<!-- Twitter JS library -->
64+
<script type="text/javascript" src="node_modules/codebird/codebird.js"></script>
5865
<!-- Animation -->
5966
<script type="text/javascript" src="js/animations.min.js"></script>
6067
<script type="text/javascript" src="js/appear.min.js"></script>
61-
<!-- Grid Layout -->
62-
<script src="https://cdnjs.cloudflare.com/ajax/libs/masonry/3.3.2/masonry.pkgd.min.js"></script>
63-
<!-- Twitter JS library -->
64-
<script type="text/javascript" src="js/codebird.js"></script>
6568
<!-- Hashtegny -->
6669
<script type="text/javascript" src="js/hashtegny.js"></script>
6770
```
@@ -74,10 +77,9 @@ Finally, Run the plugin:
7477
```js
7578
<script>
7679
$(document).ready(function(){
77-
78-
// this line of code because GitHub Pages(or something else weird) changes the link tags to style tags.
79-
$("style#style").after('<link id="style" rel="stylesheet" href="css/main.grid.css" type="text/css" />').remove();
80-
80+
// this line of code because GitHub Pages(or something else weird) changes the link tags to style tags.
81+
$("style#main-style").after('<link id="main-style" rel="stylesheet" href="css/main.grid.css" type="text/css" />').remove();
82+
8183
// start the plugin & pass your options
8284
$('#hashtegny-container').hashtegny({
8385
twitter:{
@@ -100,18 +102,30 @@ Finally, Run the plugin:
100102
hashtag: "зима",
101103
count: 5
102104
},
103-
textLength: 300, // max length of post content
104-
animate: 8, // time of animation for each post in seconds
105-
refresh: 60, // add recent posts if any every 60 seconds
106-
updateTime: 60, // update post time every 60 second(1 min)
107-
background: false, // add background image
108-
showError: false // show error alert box if any error encountered
105+
textLength: 300, // max length of post content
106+
animate: 8, // time of animation for each post in seconds
107+
refresh: 60, // add recent posts if any evey 60 seconds
108+
updateTime: 60, // update post time every 60 second(1 min)
109+
template: "default.html", // filename for the post template. The 'template' has a priority over 'template_html' if not assigned to null
110+
template_html: // HTML for the post template
111+
'<div> \
112+
<img src="{{=post.attachement_src}}" width="{{=post.attachement_width}}" height="{{=post.attachement_height}}"> \
113+
<div> \
114+
<img src="{{=post.user_image}}"> \
115+
<h4>{{=post.user_name}}</h4> \
116+
<div onclick="window.open(\'{{=post.url}}\');"><p>{{=post.text}}</p></div> \
117+
<p><i class="fa fa-clock-o"></i><span> {{=post.time}}</span></p> \
118+
</div> \
119+
</div>',
120+
callback: function() { // A callback function which will fire when all the posts are fetched and displayed
121+
console.log("Posts have been fetched and displayed");
122+
},
123+
background: false, // add background image(i.e 'background.jpg'). Images are inside img folder.
124+
showError: false // show error alert box if any error encountered
109125
});
110126
});
111127
</script>
112128
```
113-
#### Want to add image background?
114-
Add your image in _img_ directory, then assign ```background``` to ```imagefilename.extension```.
115129

116130
## Support
117131
I've written this script in my free time during my studies. This is for free, unpaid. If you find it useful, please support the project by spreading the word.
@@ -122,9 +136,10 @@ Contribute by creating new issues, sending pull requests on Github or you can se
122136

123137
## Dependencies
124138
+ [Twitter JS Library](https://github.com/jublonet/codebird-js)
139+
+ [Template Engine](https://github.com/olado/doT)
125140
+ [Animations](https://github.com/joemottershaw/animations)
126141
+ [Grid Layout](https://github.com/desandro/masonry)
127142
+ [Font Awesome](https://github.com/FortAwesome/Font-Awesome)
128143

129144
## License
130-
Built under [MIT](http://www.opensource.org/licenses/mit-license.php) license.
145+
Built under [MIT](http://www.opensource.org/licenses/mit-license.php) license.

css/main.animation.css

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,28 @@ body {
1717
}
1818

1919
/* ==== Main Post Container === */
20-
.mainPost{
20+
.main-post{
2121
margin: 0 auto;
2222
margin-top: 2%;
2323
width: 85%;
2424
text-align: center;
2525
display: none;
2626
}
27-
.mainPost.no-image{
27+
.main-post.no-image{
2828
width: 65%;
2929
margin-top: 6%;
3030
}
3131

3232
/* ==== Main Image Container === */
33-
.mainImgDiv {
33+
.attachement-div {
3434
display: inline-block;
3535
vertical-align:middle;
3636
width: 45%;
3737
margin-right: 1%;
3838
}
3939

4040
/* ==== Main Image === */
41-
.mainImg{
41+
.main-attachement{
4242
min-width: 90%;
4343
max-width: 100%;
4444
min-height: 30em;
@@ -48,23 +48,23 @@ body {
4848
moz-border-radius: 5px;
4949
webkit-border-radius: 5px;
5050
}
51-
.no-image .mainImgDiv{
51+
.no-image .attachement-div{
5252
display: none;
5353
}
5454

5555
/* ==== User Info Container === */
56-
.userInfo{
56+
.user-data{
5757
display:inline-block;
5858
vertical-align:middle;
5959
width: 45%;
6060
text-align: left;
6161
}
62-
.no-image .userInfo{
62+
.no-image .user-data{
6363
width: 100%;
6464
}
6565

6666
/* ==== User Info === */
67-
.userImg{
67+
.user-image{
6868
display: inline-block;
6969
vertical-align:middle;
7070
padding: 0.7%;
@@ -75,13 +75,13 @@ body {
7575
moz-border-radius: 3px;
7676
webkit-border-radius: 3px;
7777
}
78-
.no-image .userImg{
78+
.no-image .user-image{
7979
padding: 0.3%;
8080
border: none;
8181
min-height: 10em;
8282
max-height: 10em;
8383
}
84-
.userName{
84+
.user-name{
8585
display: inline-block;
8686
vertical-align:middle;
8787
margin-left: 1%;
@@ -91,43 +91,43 @@ body {
9191
overflow: hidden;
9292
text-overflow: ellipsis;
9393
}
94-
.no-image .userName{
94+
.no-image .user-name{
9595
font-size: 1.2em;
9696
}
97-
.snImage{
97+
.network-image{
9898
display: inline-block;
9999
vertical-align:middle;
100100
width: 12%;
101101
margin-left: 25%;
102102
}
103-
.no-image .snImage{
103+
.no-image .network-image{
104104
width: 15%;
105105
margin-left: 22%;
106106
}
107-
.postText{
107+
.post-text{
108108
cursor:pointer;
109109
position: relative;
110110
margin-top: 5%;
111111
border: 1px solid black;
112112
box-shadow: 0 0 20px 0 rgba(10, 10, 10, 0.4);
113113
}
114-
.postText:hover{
114+
.post-text:hover{
115115
box-shadow: 0 0 20px 0 rgba(15, 15, 15, 0.6);
116116
-webkit-transform: scale(1.1);
117117
transform: scale(1.1);
118118
}
119-
.postText p{
119+
.post-text p{
120120
line-height: 1.5em;
121121
word-wrap: break-word;
122122
text-indent: 2.2em;
123123
padding: 2%;
124124
margin: 0;
125125
overflow: hidden;
126126
}
127-
.no-image .postText p{
127+
.no-image .post-text p{
128128
font-size: 1.4em;
129129
}
130-
.postText span{
130+
.post-text span{
131131
display: inline-block;
132132
position: absolute;
133133
top: -0.3em;
@@ -136,30 +136,30 @@ body {
136136
font-family: Cambria, Georgia, serif;
137137
font-size: 8em;
138138
}
139-
.no-image .postText span{
139+
.no-image .post-text span{
140140
font-size: 12em;
141141
}
142-
.postTime{
142+
.post-time{
143143
padding: 1.5%;
144144
}
145145

146146
/* ==== Social Networks === */
147-
.instagram .userImg,.instagram .userName,.instagram .postText,.instagram .postTime{
147+
.instagram .user-image,.instagram .user-name,.instagram .post-text,.instagram .post-time{
148148
background-color: #306088;
149149
border-color: #306088;
150150
color: white;
151151
}
152-
.twitter .userImg,.twitter .userName,.twitter .postText,.twitter .postTime{
152+
.twitter .user-image,.twitter .user-name,.twitter .post-text,.twitter .post-time{
153153
background-color: #0084B4;
154154
border-color: #0084B4;
155155
color: white;
156156
}
157-
.google .userImg,.google .userName,.google .postText,.google .postTime{
157+
.google .user-image,.google .user-name,.google .post-text,.google .post-time{
158158
background-color: #DD4B39;
159159
border-color: #DD4B39;
160160
color: white;
161161
}
162-
.vk .userImg,.vk .userName,.vk .postText,.vk .postTime{
162+
.vk .user-image,.vk .user-name,.vk .post-text,.vk .post-time{
163163
background-color: #45668e;
164164
border-color: #45668e;
165165
color: white;
@@ -228,10 +228,10 @@ body {
228228
border: solid 1px #3498db;
229229
font-family: "Avant Garde",Avantgarde,"Century Gothic",CenturyGothic,AppleGothic,sans-serif;
230230
}
231-
.header .snIcons{
231+
.header .network-icons{
232232
padding: 1%;
233233
}
234-
.snIcons, .snIcons div{
234+
.network-icons, .network-icons div{
235235
display: inline-block;
236236
vertical-align: middle;
237237
}
@@ -269,52 +269,52 @@ body {
269269

270270
/* ==== @media Query === */
271271
@media screen and (max-width: 1024px) {
272-
.mainImgDiv {
272+
.attachement-div {
273273
width: 70%;
274274
}
275-
.with-image .userInfo{
275+
.with-image .user-data{
276276
width: 70%;
277277
}
278-
.no-image .userImg{
278+
.no-image .user-image{
279279
min-height: 7em;
280280
max-height: 7em;
281281
}
282-
.no-image .userName, .no-image .postText p{
282+
.no-image .user-name, .no-image .post-text p{
283283
font-size: 1em;
284284
}
285-
.no-image .postText span{
285+
.no-image .post-text span{
286286
font-size: 8em;
287287
}
288288
.error{
289289
font-size: 0.9em;
290290
}
291291
}
292292
@media screen and (max-width: 480px) {
293-
.mainPost, .mainPost.no-image{
293+
.main-post, .main-post.no-image{
294294
width: 100%;
295295
}
296-
.mainImgDiv {
296+
.attachement-div {
297297
min-width: 100%;
298298
margin-right: 0;
299299
}
300-
.userInfo{
300+
.user-data{
301301
min-width: 100%;
302302
}
303-
.mainImg{
303+
.main-attachement{
304304
max-height: 20em;
305305
min-height: 20em;
306306
}
307-
.userImg,.no-image .userImg{
307+
.user-image,.no-image .user-image{
308308
max-height: 4.5em;
309309
min-height: 4.5em;
310310
}
311-
.userName,.postText p, .postTime, .no-image .userName, .no-image .postText p,.header{
311+
.user-name,.post-text p, .post-time, .no-image .user-name, .no-image .post-text p,.header{
312312
font-size: 0.8em;
313313
}
314-
.postText span, .no-image .postText span{
314+
.post-text span, .no-image .post-text span{
315315
font-size: 6em;
316316
}
317-
.postText:hover{
317+
.post-text:hover{
318318
-webkit-transform: scale(1);
319319
transform: scale(1);
320320
}

0 commit comments

Comments
 (0)