From 13f92f7deacb41ede6247f02fee49a0fefb70407 Mon Sep 17 00:00:00 2001 From: Glen Cheney Date: Tue, 9 Dec 2014 13:52:21 -0800 Subject: [PATCH] Add view boxes to SVGs. Fix date parsing for other browsers. --- icons/code.svg | 2 +- icons/file-binary.svg | 2 +- icons/file-code.svg | 2 +- icons/file-directory.svg | 2 +- icons/file-media.svg | 2 +- icons/file-pdf.svg | 2 +- icons/file-text.svg | 2 +- icons/file-zip.svg | 2 +- icons/file_type_coffescript.png | Bin 15369 -> 0 bytes icons/file_type_html.png | Bin 15208 -> 0 bytes icons/gear.svg | 2 +- icons/html.svg | 2 +- icons/info.svg | 3 --- icons/markdown.svg | 2 +- icons/npm.svg | 2 +- icons/ruby.svg | 2 +- icons/xml.svg | 2 +- script.js | 18 ++++++++++++++++-- style.css | 12 +++++++++++- 19 files changed, 41 insertions(+), 20 deletions(-) delete mode 100755 icons/file_type_coffescript.png delete mode 100755 icons/file_type_html.png delete mode 100755 icons/info.svg diff --git a/icons/code.svg b/icons/code.svg index e5d4ac6..350d4c2 100755 --- a/icons/code.svg +++ b/icons/code.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/file-binary.svg b/icons/file-binary.svg index 4d62886..a2bab84 100755 --- a/icons/file-binary.svg +++ b/icons/file-binary.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/file-code.svg b/icons/file-code.svg index 6e1e3ae..29cf94f 100755 --- a/icons/file-code.svg +++ b/icons/file-code.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/file-directory.svg b/icons/file-directory.svg index 81acc32..1879ce7 100755 --- a/icons/file-directory.svg +++ b/icons/file-directory.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/file-media.svg b/icons/file-media.svg index d56e8f7..ad2bf62 100755 --- a/icons/file-media.svg +++ b/icons/file-media.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/file-pdf.svg b/icons/file-pdf.svg index ed85b64..ee47c71 100755 --- a/icons/file-pdf.svg +++ b/icons/file-pdf.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/file-text.svg b/icons/file-text.svg index 1378eea..26e90a1 100755 --- a/icons/file-text.svg +++ b/icons/file-text.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/file-zip.svg b/icons/file-zip.svg index 5efe503..3d2eb0f 100755 --- a/icons/file-zip.svg +++ b/icons/file-zip.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/file_type_coffescript.png b/icons/file_type_coffescript.png deleted file mode 100755 index dd711bd1d4f53512f292a3273fb7f2e94016e45b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15369 zcmeI3eQXnD9LJw+LFaTs94Ijuj{*^d_U`(+9&Oo6fek6lt;+aA+4b(}cA@Q+-i>yP z;6(fb4ZdM?Di}=|6Jm^sm?4Tzd`Wx(Ut{xfJt?qkI-Rzq9X2)9#qwUSm*woN-EKuQtXgkE7c><~pZBPLni#<8WGWU1hj>`BG4 zmnKUrjKMfe=o<3lOZp|dRbAD()d^A-{iIFkPqFf(3FCruBO7O z8VlrhS?ef5rl~2rtC;y~l!UCNwFN#FcPXxSF&YetIt&>5(aP0X?R=Q?2rj30I1WOg4HI;cuLMz!Qa%P4e&cgT{*Q)iXyJYH*5 za>~|-j5>xrB72;5vfB&g$Y^Mj`?%1nQwr*IV$3whxca}FqC}W+shSlH?ayA*zD2t? z+soSFhOwigLQKi_q@CE+_}s(G5I0Fu9e>t>@Uv8f^&UE752C9SNw4 z(T)wa^}&Ubj%z1!Gzodf+)|ky z#IiM*8%2+K=n0c8JYtS3&q5dbH&2Rp^lwJRV$mcR5VA>ek@;XM#f1SOn-mwB52jLF z7!a~aagq68D#e8XA)6EznGdE?To@3tNpX?+U@FCh0U?_d7nu*HQd}4ivPp4~`Cux= zg#jU(6c?EfrczuO5VA>ek@;XM#f1SOn-mwB52jLF7!a~aagq68D#e8XA)6EznGdE? zTo@3tNpX?+U@FCh0U?_d7nu*HQd}4ivPp4~`Cux=g#jU(6c?EfrczuO5VA>ek@;XM z#f1SOn-mwB52jLF7!a~aagq68D#e8XA)7>8RmGP!VFJCWnMSW<{uG$G2))k9NX=~_ z0Q%+u(0?ZY7yd-YZvp7x065(VfG_~SRqBK5-dqMi*V5l8E`c9ZoCp4q*(1N-&^GJ_(T_HlPr1B&b^W4E{j)k2#!nn8pWDA-&t=a| ze{~a*joPRz{@`A$Oi`-lpTwQp19jp`{i2Y`SU#u^Op>c9Qu0Quz%hI$7?^| z{O)g;eRkns=K@=Y_qzLbZGXRI_B+qaYuxbR(|a#H6TPc{`p8ko;g}q(Ip3)4xB#|} zyg%dc=H2@j+y=_aDuwVXHyzs==w*QWiWRTdl->K@x{L3B`lf!5KVF_#@pD;o|I}^2 zY@0tU?RxaYb<<$|yeZMy-yev7_CoJe=b`(T-!)_fBggmF-v0Iq#c}qxrF!@F1A8jJ o89I6B_J@83{`y^i)PM_D{`uOB*H0}rUe;|{x+?f=W9OE?0G1TkasU7T diff --git a/icons/file_type_html.png b/icons/file_type_html.png deleted file mode 100755 index d9017facc963688d05d7ec2121a0c26e655e741f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15208 zcmeI3U2GIp6vyvERV<=J5Rjlu7BL{q&dh#vcPHBg>=xRDt);EfN{LKo?rz8K&MZ6A z?zZ|s!6^0PMPg!1iG&9d6a07~(IA2e1PL+GC`2I|j8OwT&wk~;OKn^SJRnhuLUPJ-X(3F^bI;9z6zR_*R713{Nm~%7s z6my`_y~aw&bjRD7COr$8fG5DpyjNg?VUG|91cTm{jF%Vu94~N!j}^kA-!Jk!Q+&Cj z_2^e5t0csZ*xF(`WHq|`O*12MTrQXM<)| zAlCs6eK0G-<{@+`OKM%csU|9mGa-`Yne^OYUY$f{c?vSS6bdU8LDwoaWuav1*)CmA zMGIBdUP8z;HQ80gEZeARik>r;M>t$kS?@|T7?VsGwd#@OL#$Wm;)7zqFADq$-iNBv z5u`8^ixJlqH8ETjBP9Alq7ZP#aLmMGp#D)LQ<_o~=Uhh|MHUl!HZ7S^H7z9}m(h|D zt}^JDS*|LvNl)onbXqX#i*U7u9V)xh#8%BPB~6B{u_zkwsH!6J;RN&s`hu*lPYAM7 z&@Zu4z?WbZ80r(eA;lL81Z;@$xKmygI;P8mR<{&GD=2hG2!`Z_P?!yc`Vwr=@0VFg z@cLMP10VJ!0^x8_mP?@>@~Y5JWL31&Nh!x1>+Jt+iW*_6QnjcCs?T9Z-Je8rky7nFDI;YKXmwnpyVP>!O{}~}SsJ@@MM<`Hv#4w}1XLp2gwe`rm6b)ATD^c% zqg;sZkWZc?*AF#PLlr{VvnCH>=m|3?W#O76s)?!edLimW86G~uS-XEq{SOwxkcMt; z8K%}px3Ub_p7j4ML#2x4eo0G0CCZfwxHK@el`E|0#Lg;h2-Te!vHp%k)WxWxB)fZr z2v;>$$y}Jek@;X=iVFimHYqMLAIwW}VL-?x#YN_Wc_}Uo2-&2#$b2v_#f1SOn-mwB z59Xz~Fd$@;;v)0Gyc8D(gltk=WImXe;=+KCO^S=m2lG-~7!a~aagq68UWy9?LN+Nb zG9S!KabZBnCdEbOgLx?~3<%kzxX64kFU5rcA)6EznGfcrxG*4Olj0)t!Mqd~283)< zTx33&m*T>JkWGq<%m?#QTo@3tNyJrOd1w=A=t<2SdL%Qk@8VVTI42{wbi@G|Sqi|m z9ROUviH_$17~}!Cumu3|O#tTWuRn8aEdZ{%*4Ub^{Fz@*pG@yqJ$u^^Z%At#yqwlz4u4~(uzOa7Fm-qkm!Eak{r>nyS8sFr$LW{Pcl7Qa`RF=`bhJ-57uwNod@-8UXOdC}c`?UDCa zF!K+X=N^3O$mxr|=U-gVAA4gUIDYo!nHyfYdFX+|$Br+%abMkPP`B;U*2Um=@%*P( TA3lB!u>-BmZL#+r-?IH5c3hHN diff --git a/icons/gear.svg b/icons/gear.svg index 055aa13..59dead2 100755 --- a/icons/gear.svg +++ b/icons/gear.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/html.svg b/icons/html.svg index acf3a8b..5f25ab6 100755 --- a/icons/html.svg +++ b/icons/html.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/info.svg b/icons/info.svg deleted file mode 100755 index d4cecec..0000000 --- a/icons/info.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/icons/markdown.svg b/icons/markdown.svg index 3a3bddb..6806f21 100755 --- a/icons/markdown.svg +++ b/icons/markdown.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/npm.svg b/icons/npm.svg index b5353b3..672c8f4 100755 --- a/icons/npm.svg +++ b/icons/npm.svg @@ -11,7 +11,7 @@ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="233" height="91" - id="svg2" + viewBox="0 0 233 91" version="1.1" inkscape:version="0.48.1 r9760" sodipodi:docname="npm.svg"> diff --git a/icons/ruby.svg b/icons/ruby.svg index e7afbad..a2a5202 100755 --- a/icons/ruby.svg +++ b/icons/ruby.svg @@ -1,3 +1,3 @@ - + diff --git a/icons/xml.svg b/icons/xml.svg index 7d929e3..85b9841 100755 --- a/icons/xml.svg +++ b/icons/xml.svg @@ -1,3 +1,3 @@ - + diff --git a/script.js b/script.js index 64ea609..ea7f648 100644 --- a/script.js +++ b/script.js @@ -24,11 +24,15 @@ void(function() { thead.appendChild(firstRow); table.insertBefore(thead, table.firstElementChild); + // Remove the first column and put the image in the next. var rows = toArray(table.querySelectorAll('tr')); rows.forEach(function(row) { + var div = document.createElement('div'); + div.className = 'img-wrap'; var first = row.removeChild(row.firstElementChild).firstElementChild; + div.appendChild(first); var filename = row.firstElementChild; - filename.insertBefore(first, filename.firstElementChild); + filename.insertBefore(div, filename.firstElementChild); }); // Swap special images. @@ -132,7 +136,17 @@ void(function() { var stamp = date.textContent.trim(); if (!stamp || i === 0) return; - var time = new Date(stamp); + // 2014-12-09 10:43 -> 2014, 11, 09, 10, 43, 0. + var parts = stamp.split(' '); + var day = parts[0].split('-'); + var timeOfDay = parts[1].split(':'); + var year = parseInt(day[0], 10); + var month = parseInt(day[1], 10) - 1; + var _day = parseInt(day[2], 10); + var hour = parseInt(timeOfDay[0], 10); + var minutes = parseInt(timeOfDay[1], 10); + + var time = new Date(year, month, _day, hour, minutes, 0); var difference = Math.round((now.getTime() - time.getTime()) / 1000); date.textContent = getTimeSince(difference) + ' ago'; }); diff --git a/style.css b/style.css index d4c216f..72bf0d1 100644 --- a/style.css +++ b/style.css @@ -61,16 +61,26 @@ a { text-decoration: none; color: #3498db; } + a:hover { text-decoration: underline; } + a:visited { color: #8e44ad; } -td img { + +.img-wrap { vertical-align: middle; + display: inline-block; margin-right: 8px; margin-bottom: 2px; + width: 16px; +} + +td img { + display: block; + width: 100%; height: auto; }