Skip to content

Commit 881c513

Browse files
committed
Added: footer now available by moving mouse to the bottom of the page
Updated: Now more obvious when stories are filtered out
1 parent 12b8f11 commit 881c513

File tree

3 files changed

+99
-19
lines changed

3 files changed

+99
-19
lines changed

hn.css

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,17 @@ table {
1111

1212
/*********** Header ******************/
1313

14+
table table img[src='http://ycombinator.com/images/y18.gif'] {
15+
padding-left: 8px;
16+
padding-right: 11px;
17+
}
18+
19+
.pagetop {
20+
text-transform: uppercase;
21+
font-size: 11px !important;
22+
}
23+
1424
.pagetop b {
15-
padding-right: 10px;
1625
display: none;
1726
}
1827

@@ -34,10 +43,59 @@ table {
3443
}
3544

3645

46+
/*********** Footer ******************/
47+
48+
.footer {
49+
position: fixed;
50+
bottom: -82px;
51+
left: 0;
52+
width: 100%;
53+
background: rgba(255,255,255,0.9);
54+
55+
-webkit-transition: bottom 1s;
56+
}
57+
58+
.footer:hover {
59+
bottom: 0;
60+
}
61+
62+
.footer td {
63+
background: transparent;
64+
width: 100%;
65+
}
66+
67+
.footer img {
68+
display: none;
69+
}
70+
71+
.footer form {
72+
color: transparent;
73+
font-size: 0;
74+
margin: 0;
75+
}
76+
77+
.footer input {
78+
width: 55%;
79+
}
80+
81+
3782
/*********** Filters *****************/
3883

3984
#menu-filters {
4085
cursor: pointer;
86+
position: relative;
87+
}
88+
89+
#menu-filters .count {
90+
position: absolute;
91+
top: -1px;
92+
left: -16px;
93+
padding: 1px 3px;
94+
background: #2279B2;
95+
font-size: 10px;
96+
color: #fff;
97+
border-radius: 2px;
98+
border-bottom: 1px solid #12405E;
4199
}
42100

43101
#filter-wrapper {
@@ -524,3 +582,15 @@ a.toggle-replies.collapsed {
524582
.icon-yelp { background-position: 0 -1479px; }
525583
.icon-yiid { background-position: 0 -1496px; }
526584
.icon-youtube { background-position: 0 -1513px; }
585+
586+
587+
588+
/* Smaller than standard 960 (devices and browsers) */
589+
@media only screen and (max-width: 959px) {
590+
591+
body > center > table {
592+
margin: 0;
593+
width: 100%;
594+
}
595+
596+
}

js/hn.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var hn = {
1111

1212
hn.setPage();
1313
hn.styleElements();
14+
hn.createSearchBar();
1415
hn.createProfileBubble();
1516
hn.createQuickReply();
1617
hn.createFilterMenu();
@@ -54,13 +55,22 @@ var hn = {
5455
hn.refreshFilters();
5556
},
5657

58+
createSearchBar: function() {
59+
var $footer = $('body > center > table > tbody > tr:nth-child(4) > td');
60+
var footer = $footer.html();
61+
$footer.remove();
62+
63+
$('body').append('<div class="footer">'+ footer +'</div>');
64+
$('.footer input').attr('placeholder', 'Search...');
65+
},
66+
5767
refreshFilters: function(){
5868

5969
var filters = hn.getFilters();
6070
var $filters = '';
6171

6272
for(var i=0, l=filters.length; i < l; i++){
63-
$filters += '<li><a class="filter remove" data-filter="'+filters[i]+'" title="Remove filter">'+filters[i]+'</a></li>'
73+
$filters += '<li><a class="filter remove" data-filter="'+filters[i]+'" title="Remove filter">'+filters[i]+'</a></li>';
6474
}
6575

6676
// show placeholder message
@@ -437,9 +447,9 @@ var hn = {
437447

438448
// show number of filtered stories in header
439449
if (count > 0) {
440-
$('#menu-filters .count').text('('+count+')');
450+
$('#menu-filters .count').text(count).fadeIn();
441451
} else {
442-
$('#menu-filters .count').text('');
452+
$('#menu-filters .count').text('').hide();
443453
}
444454
},
445455

manifest.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "HackerNew",
3-
"version": "0.4",
4-
"description": "Making Hacker News quicker and more useful since 2012.",
3+
"version": "0.5",
4+
"description": "The best Hacker News extension, making HN quicker and more useful since 2012.",
55
"background": {
66
"page": "background.html"
77
},
@@ -19,21 +19,21 @@
1919
"content_scripts": [
2020
{
2121
"matches": [
22-
"http://news.ycombinator.com/*",
23-
"http://news.ycombinator.org/*",
24-
"http://hackerne.ws/*",
25-
"https://news.ycombinator.com/*"],
26-
22+
"http://news.ycombinator.com/*",
23+
"http://news.ycombinator.org/*",
24+
"http://hackerne.ws/*",
25+
"https://news.ycombinator.com/*"
26+
],
2727
"css": [
28-
"forms.css",
29-
"hn.css"],
30-
28+
"forms.css",
29+
"hn.css"
30+
],
3131
"js": [
32-
"js/libs/jquery-1.7.1.min.js",
33-
"js/libs/jquery.hoverIntent.js",
34-
"js/libs/jquery.autogrow.js",
35-
"js/libs/twitter.text.js",
36-
"js/hn.js"
32+
"js/libs/jquery-1.7.1.min.js",
33+
"js/libs/jquery.hoverIntent.js",
34+
"js/libs/jquery.autogrow.js",
35+
"js/libs/twitter.text.js",
36+
"js/hn.js"
3737
]
3838
}
3939
]

0 commit comments

Comments
 (0)