From f4c697895eb9ea6953eea04378b13a62972b9100 Mon Sep 17 00:00:00 2001 From: Bree Date: Sat, 7 Apr 2018 17:34:59 -0700 Subject: [PATCH] published if else --- .DS_Store | Bin 0 -> 8196 bytes index.html | 4 ++-- paperbuzzviz.js | 15 +++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d8e125c42b8d32bec278860b14df9a64a0689023 GIT binary patch literal 8196 zcmeHMU2GIp6h3EL%3Ppyia@8(h1F6mxM2Tm#RA#>(nb+vTUuJQ%D4?njjCp81=yyjlB4zo_p`Kc3YbGq!Q+C?mhRO zpL_2)^Ua*OvjBjdd7}|P0|138r|Md2Zc(_L*JULVaJU_kJ-F$V?WSm?F4GMeVFbbm zgb@fM5Jn)3!2crxl(TtJR>=EO8n$5s!U)`v5#Y~<7*$Ra0iBgpJUXZmM*yOw#1@76 z;^m)cj5CNP0y--xaj2j)B`QrZIAUOMc0g%P@mtq6gqIDzAAFw5+Lq@xG+f6>N$IMx)e2(@D`!t6$K8pfulsqgQ_qd^ z(GlGrPX+w}*R>b=dg_>EPK>D=yIjZDEyv6WW6Ll}<;0NX816);n|BOP%#)M?vCx=W zJw4sj+8mFyv^31bW7CZdEiE)?Zk?H7N>yFs{{EAhvs2U0%$&O@VgndFmY_n87uq+e zx5!7^D|AU8Be{7Wzx~_CwOViG!M-t7&3ooi)7E{fV0P=i>5Zus9y!~ecAX`j+c>$IP5Z zl(8%8Hf`BnTfe)hZC}S+`T7dAasy){6cop|PFZGdaKbYD@#DIeHXXxqP7f6<&q~?m zfTL&3N*rNKSZ%J-wBdZpI+M5jvudrP%&F@u%2|!Jjj30a69(<_kZbT64I$BLw0jg~ zl=HiCCbg2y>a_cqsw)E??O0B+i^ZAhv4N-Q%1P4)SfipEY|z$IrY%`5tW{ATVM7J! zmSpZ_?Mfxa*>Kv;WXK;+vJYqpMg2^9lCS-!?)itarbEkf-#cqG?KtOm7=~#mic*`X zmzT6Q(I7i2&sfzEhXc?HBXkEjFaa;adAI-<;a&I;K7woTDSQE6!dLJ$+<@=l2lx?w zf?wcQ_zi9%Aj37d7OOCZcVjK?z@6BH&G;a;Vmo$Y4<5umd<=(h7)Njv(`aJ`vv>xl z@Hu=QU&NR24SX9f;bpvnAK+EICU+K@$6~)6&$svq^@_0=+;5SgTVXNUyYb+T{{)LS z)=2=~wQXNC>>n5lpMMY-Q0w0+Ttp61LUV z95#y3-X4oaRgM=q+))>0DiWlbknXG_X(W*C-b1nyLa&rHHM6L?ihwFD+a6*}EhQvN z>Aw9WEhEe-bJbPaX4c8N8NZ!WxCQ7|gxouD89pYseFN9wJA&HJ1he1a4=ly?xEVFv ziZvL;d$AsO;r$pVkhS4nd{_XjR{-sCOyVFOBeJ9{QNab2y973fP^; z3-}7Yim&18_?Cp$0^s`Qp(ZK5UktcHGUwQ?bDFpuqH8FTIFwXOn1nqrPRSwzc5z~X zOQg3r2}R(kWhsRxpT#;AkOiHp2{}kX9;WD5ptYuGm1WiueTg-LqtF8#&<%%(?x8&y z#e2e=ODt%3dzKQpZH>PJ^sM~-|Mqk)+;td%FarN50$AFe?CvDh`4@+!R{X3Tqk57m zFI;a{Qei@kIF1t)$8n+ye;86fMylK<5ztvli9_XI{}906SHt`t=6}K-eJi?S^Z#Ga C-D=|i literal 0 HcmV?d00001 diff --git a/index.html b/index.html index 2feada9..6a7dcf6 100755 --- a/index.html +++ b/index.html @@ -46,10 +46,10 @@

Paperbuzz Visualizations

} var paperbuzzviz = undefined; - var doi = '10.1371/journal.pmed.0020124'; + //var doi = '10.1371/journal.pmed.0020124'; // var doi = '10.1007/s00266-017-0820-4'; - // var doi = '10.7287/peerj.preprints.3119v1'; + var doi = '10.7287/peerj.preprints.3119v1'; d3.json('https://api.paperbuzz.org/v0/doi/' + doi, function(data) { options.paperbuzzStatsJson = data paperbuzzviz = new PaperbuzzViz(options); diff --git a/paperbuzzviz.js b/paperbuzzviz.js index 8071af9..b315d37 100755 --- a/paperbuzzviz.js +++ b/paperbuzzviz.js @@ -29,10 +29,17 @@ function PaperbuzzViz(options) { console.log(data); // TODO: Fix to work when no pub date is available. Use earliest event - var year = data.metadata["published-online"]["date-parts"][0][0]; - var month = data.metadata["published-online"]["date-parts"][0][1]; - var day = data.metadata["published-online"]["date-parts"][0][2]; - var published_date = year+"-"+month+"-"+day; + if (data.metadata['published-online']) { + var year = data.metadata["published-online"]["date-parts"][0][0]; + var month = data.metadata["published-online"]["date-parts"][0][1]; + var day = data.metadata["published-online"]["date-parts"][0][2]; + var published_date = year+"-"+month+"-"+day; + } else { + var year = data.metadata["issued"]["date-parts"][0][0]; + var month = data.metadata["issued"]["date-parts"][0][1]; + var day = data.metadata["issued"]["date-parts"][0][2]; + var published_date = year+"-"+month+"-"+day; + } // extract publication date var pub_date = parseDate(published_date);