Permalink
Browse files

First commit and upload

  • Loading branch information...
0 parents commit 593dbf86e7ca533371520ac7e8fc6e90cbb292d5 Mashery committed Jun 5, 2011
Showing with 1,021 additions and 0 deletions.
  1. +25 −0 LICENSE.txt
  2. +92 −0 README.txt
  3. +84 −0 css/hk.css
  4. BIN img/0.png
  5. BIN img/1.png
  6. BIN img/10.png
  7. BIN img/2.png
  8. BIN img/3.png
  9. BIN img/3taps_104x62.png
  10. BIN img/4.png
  11. BIN img/5.png
  12. BIN img/6.png
  13. BIN img/7.png
  14. BIN img/8.png
  15. BIN img/9.png
  16. BIN img/above.png
  17. BIN img/airport.gif
  18. BIN img/airport2.gif
  19. BIN img/ajax-loader.gif
  20. BIN img/atm.gif
  21. BIN img/atm.png
  22. BIN img/big-bullseye.png
  23. BIN img/blue-dot.gif
  24. BIN img/bluePin.png
  25. BIN img/bottom.png
  26. BIN img/bus.gif
  27. BIN img/car1.gif
  28. BIN img/check.gif
  29. BIN img/check.png
  30. BIN img/close.png
  31. BIN img/coffee.gif
  32. BIN img/coffee.png
  33. BIN img/comic.png
  34. BIN img/cone1.gif
  35. BIN img/cone2.gif
  36. BIN img/cross-hair.png
  37. BIN img/customBottom.png
  38. BIN img/customBottom2.png
  39. BIN img/customCap.png
  40. BIN img/customCap2.png
  41. BIN img/customSelected.png
  42. BIN img/customSelected2.png
  43. BIN img/customUnSelected.png
  44. BIN img/customUnSelected2.png
  45. BIN img/decarta_160x44.png
  46. BIN img/doubleGreenDot.png
  47. BIN img/doubleGreenDot31.png
  48. BIN img/draw-tool-circle-selected.png
  49. BIN img/draw-tool-circle.png
  50. BIN img/draw-tool-drag-selected.png
  51. BIN img/draw-tool-drag.png
  52. BIN img/draw-tool-line-selected.png
  53. BIN img/draw-tool-line.png
  54. BIN img/draw-tool-pin-selected.png
  55. BIN img/draw-tool-pin.png
  56. BIN img/draw-tool-poly-selected.png
  57. BIN img/draw-tool-poly.png
  58. BIN img/e.png
  59. BIN img/end.gif
  60. BIN img/exit.gif
  61. BIN img/food.gif
  62. BIN img/food2.gif
  63. BIN img/gas-gray.png
  64. BIN img/gas-green.png
  65. BIN img/gas-red.png
  66. BIN img/gas.gif
  67. BIN img/gas.png
  68. BIN img/gas1.gif
  69. BIN img/green-dot.gif
  70. BIN img/green-numbered.png
  71. BIN img/green.png
  72. BIN img/greenDot.png
  73. BIN img/greenPin.png
  74. BIN img/h150.png
  75. BIN img/hk.png
  76. BIN img/incident.gif
  77. BIN img/incident.png
  78. BIN img/incident.png.png
  79. BIN img/info-bl.png
  80. BIN img/info-bottom.png
  81. BIN img/info-br.png
  82. BIN img/info-middle.png
  83. BIN img/info-pointer.png
  84. BIN img/info-tl.png
  85. BIN img/info-top.png
  86. BIN img/info-tr.png
  87. BIN img/info-window-128x110.gif
  88. BIN img/info-window-128x66.gif
  89. BIN img/info.png
  90. BIN img/information1.gif
  91. BIN img/infotr.png
  92. BIN img/klout.png
  93. BIN img/left-turn.gif
  94. BIN img/loading-ball.gif
  95. BIN img/logo.png
  96. BIN img/map_overview_hide.png
  97. BIN img/map_overview_show.png
  98. BIN img/marker.png
  99. BIN img/marker2.png
  100. BIN img/marker_black.png
  101. BIN img/marker_green.png
  102. BIN img/marker_purple.png
  103. BIN img/marker_red.png
  104. BIN img/marker_yellow.png
  105. BIN img/mashery.png
  106. BIN img/merge-left.gif
  107. BIN img/merge-right.gif
  108. BIN img/merge.gif
  109. BIN img/mp-tbl-bottom.jpg
  110. BIN img/mp-tbl-mid.jpg
  111. BIN img/mp-tbl-top.jpg
  112. BIN img/n.png
  113. BIN img/no-img.gif
  114. BIN img/num-1.png
  115. BIN img/num-2.png
  116. BIN img/num-green-1.png
  117. BIN img/num-purple-1.png
  118. BIN img/num-red-1.png
  119. BIN img/num-yellow-1.png
  120. BIN img/numbered.png
  121. BIN img/orange-dot.gif
  122. BIN img/orangePin.png
  123. BIN img/pan-center.png
  124. BIN img/pan-east.png
  125. BIN img/pan-north.png
  126. BIN img/pan-south.png
  127. BIN img/pan-west.png
  128. BIN img/parking.gif
  129. BIN img/parking2.gif
  130. BIN img/pin.png
  131. BIN img/progress.gif
  132. BIN img/purple-dot.gif
  133. BIN img/purple-numbered.png
  134. BIN img/purplePin.png
  135. BIN img/ramp.gif
  136. BIN img/red-dot.gif
  137. BIN img/red.gif
  138. BIN img/red.png
  139. BIN img/redDot.png
  140. BIN img/redPin.png
  141. BIN img/right-turn.gif
  142. BIN img/round.png
  143. BIN img/ruleBottom.png
  144. BIN img/ruleCap.png
  145. BIN img/ruleSelected.png
  146. BIN img/rulerSelected.png
  147. BIN img/rulerUnselected.png
  148. BIN img/s.png
  149. BIN img/scale.png
  150. BIN img/smaller-info-window.png
  151. BIN img/start.gif
  152. BIN img/straight.gif
  153. BIN img/tbl-bottom.jpg
  154. BIN img/tbl-mid.jpg
  155. BIN img/tbl-top.jpg
  156. BIN img/thought.png
  157. BIN img/tile.png
  158. BIN img/tmobile-atms.png
  159. BIN img/tmobile-drinks.png
  160. BIN img/tmobile-food.png
  161. BIN img/tmobile-shopping.png
  162. BIN img/topbar.jpg
  163. BIN img/trafficInfo.png
  164. BIN img/truck1.gif
  165. BIN img/truck2.gif
  166. BIN img/turn-back.gif
  167. BIN img/twitter.png
  168. BIN img/u-turn.png
  169. BIN img/w.png
  170. BIN img/watermark.png
  171. BIN img/window-close.gif
  172. BIN img/x.gif
  173. BIN img/yellow-dot.gif
  174. BIN img/yellow-numbered.png
  175. BIN img/z2t_pan_center_gray.png
  176. BIN img/z2t_pan_east.png
  177. BIN img/z2t_pan_north.png
  178. BIN img/z2t_pan_south.png
  179. BIN img/z2t_pan_west.png
  180. BIN img/z2t_zoom_bottom_gray.png
  181. BIN img/z2t_zoom_gray.png
  182. BIN img/z2t_zoom_rail_gray.png
  183. BIN img/z2t_zoom_selected_gray.png
  184. BIN img/z2t_zoom_top_gray.png
  185. BIN img/zDown.png
  186. BIN img/zUp.png
  187. BIN img/zbottom.png
  188. BIN img/zipFlag.png
  189. BIN img/zoom.png
  190. BIN img/zoomBottom.png
  191. BIN img/zoomChecked.png
  192. BIN img/zoomDown.png
  193. BIN img/zoomIn2.png
  194. BIN img/zoomOut2.png
  195. BIN img/zoomPillar.png
  196. BIN img/zoomSlider.png
  197. BIN img/zoomTop.png
  198. BIN img/zoomUp.png
  199. BIN img/zoomin.png
  200. BIN img/zoomout.png
  201. BIN img/zselected.png
  202. BIN img/ztop.png
  203. BIN img/zunselected.png
  204. +137 −0 index.htm
  205. +248 −0 js/3taps_new.js
  206. +34 −0 js/CONFIG.js
  207. +22 −0 js/deCarta.js
  208. +266 −0 js/hk.js
  209. +113 −0 js/parseaddress.jquery.js
25 LICENSE.txt
@@ -0,0 +1,25 @@
+License:
+
+ Open Source Initiative OSI - The MIT License (MIT)
+ Licensing: The MIT License (MIT)
+ Copyright (c) 2011 Neil Mansilla
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
92 README.txt
@@ -0,0 +1,92 @@
+HousingKlout
+
+Synopsis:
+
+ A fun little JavaScript hack that mashes up:
+
+ 1. 3Taps - Craigslist home/apt listings in SF
+ 2. Google Maps - Find lat/lon based on unformatted address string
+ 3. Twitter - Geo-tagged tweets near within radius of each listing
+ 4. Klout - Average Klout score of each tweeter from tweets above
+ 5. deCarta - Plot tweets and pin home listings with Klout scores
+ and hyperlinked back to Craigslist listings.
+
+ What you end up with is a map with a bunch of real estate listings
+ along with a Klout score. Silly? Yes. But mashing up completely
+ disparate data that only has lat/lon in common makes it interesting.
+
+Requirements:
+
+ 1. 3Taps API key - http://register.3taps.com/member/register
+ 2. Klout API key - http://developer.klout.com
+
+ The two above you'll paste into the HTML form.
+
+ 3. Google Maps API key - http://code.google.com/apis/maps/signup.html
+
+ The Google Maps API key/script-src you'll paste into index.htm
+ source - around line 54)
+
+ This has been tested on the most recent versions of Firefox,
+ Safari and Chrome (MSIE not tested) and it seems to work fine.
+
+Bundled:
+
+ 1. parseaddress jQuery plugin - quick and dirty unformatted
+ address string resolver/parser that uses Google Maps API
+ src: http://bit.ly/9zqTUE
+
+ 2. deCarta.js and CONFIG.js - deCarta mapping JS files
+ borrowed from their sample documentation
+ src: http://developer.decarta.com
+
+ 3. 3taps JS - 3Taps JavaScript SDK
+ src: http://3taps.com
+
+Caveats:
+
+ This was a hackathon project built from soup to nuts in just
+ a few hours. It's being made available so that people can see
+ five APIs converge into one project in a few chunks of
+ JavaScript code.
+
+ Please feel free fix/report bugs as you find them, or refactor
+ the slop. :)
+
+Author:
+
+ Neil Mansilla
+ Email: neil@mansilla.com
+ Twitter: @mansillaDEV
+
+ http://developer.mashery.com
+
+License:
+
+ Open Source Initiative OSI - The MIT License (MIT)
+ Licensing: The MIT License (MIT)
+ Copyright (c) 2011 Neil Mansilla
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ All logos and tradenames represented are the intellectual property
+ of the respective owners, including:
+
+ Mashery, deCarta, Twitter, 3Taps and Klout.
84 css/hk.css
@@ -0,0 +1,84 @@
+body {
+ font-family: Helvetica;
+ font-size: 10pt;
+}
+
+.hkTitle {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 25pt;
+}
+
+.pinMsg {
+ color: black;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 10pt;
+}
+
+#bodyTop {
+ display: inline-block;
+ width: 100%;
+ margin-bottom: 10px;
+}
+
+.titleSubText {
+ font-family: "Century Gothic";
+ font-size: 10pt;
+ position: absolute;
+ margin-top: -10px;
+ margin-left: 5px;
+}
+
+#bTleft {
+ position: relative;
+ float: left;
+ width: 49%;
+ display: inline-block;
+}
+
+#bTright {
+ position: relative;
+ float: right;
+ width: 49%;
+ text-align: right;
+ display: inline-block;
+}
+
+#formData {
+ display: inline-block;
+}
+
+label {
+ width: 150px;
+ float: left;
+ text-align: right;
+ margin-right: 0.5em;
+ display: block;
+}
+
+#lowPrice, #highPrice, #lowKlout {
+ width: 50px;
+}
+
+p {
+ margin-top: -5px;
+}
+
+input {
+ width: 175px;
+}
+
+#footer {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 9pt;
+ color: #777777;
+ margin-top: 50px;
+}
+
+#footer a {
+ color: #777777;
+}
+
+.tip {
+ background: url(./h150.png) repeat-x;
+}
+
BIN img/0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/3taps_104x62.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/above.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/airport.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/airport2.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/ajax-loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/atm.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/atm.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/big-bullseye.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/blue-dot.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/bluePin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/bottom.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/bus.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/car1.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/check.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN img/check.png
Diff not rendered.
BIN img/close.png
Diff not rendered.
BIN img/coffee.gif
Diff not rendered.
BIN img/coffee.png
Diff not rendered.
BIN img/comic.png
Diff not rendered.
BIN img/cone1.gif
Diff not rendered.
BIN img/cone2.gif
Diff not rendered.
BIN img/cross-hair.png
Diff not rendered.
BIN img/customBottom.png
Diff not rendered.
BIN img/customBottom2.png
Diff not rendered.
BIN img/customCap.png
Diff not rendered.
BIN img/customCap2.png
Diff not rendered.
BIN img/customSelected.png
Diff not rendered.
BIN img/customSelected2.png
Diff not rendered.
BIN img/customUnSelected.png
Diff not rendered.
BIN img/customUnSelected2.png
Diff not rendered.
BIN img/decarta_160x44.png
Diff not rendered.
BIN img/doubleGreenDot.png
Diff not rendered.
BIN img/doubleGreenDot31.png
Diff not rendered.
BIN img/draw-tool-circle-selected.png
Diff not rendered.
BIN img/draw-tool-circle.png
Diff not rendered.
BIN img/draw-tool-drag-selected.png
Diff not rendered.
BIN img/draw-tool-drag.png
Diff not rendered.
BIN img/draw-tool-line-selected.png
Diff not rendered.
BIN img/draw-tool-line.png
Diff not rendered.
BIN img/draw-tool-pin-selected.png
Diff not rendered.
BIN img/draw-tool-pin.png
Diff not rendered.
BIN img/draw-tool-poly-selected.png
Diff not rendered.
BIN img/draw-tool-poly.png
Diff not rendered.
BIN img/e.png
Diff not rendered.
BIN img/end.gif
Diff not rendered.
BIN img/exit.gif
Diff not rendered.
BIN img/food.gif
Diff not rendered.
BIN img/food2.gif
Diff not rendered.
BIN img/gas-gray.png
Diff not rendered.
BIN img/gas-green.png
Diff not rendered.
BIN img/gas-red.png
Diff not rendered.
BIN img/gas.gif
Diff not rendered.
BIN img/gas.png
Diff not rendered.
BIN img/gas1.gif
Diff not rendered.
BIN img/green-dot.gif
Diff not rendered.
BIN img/green-numbered.png
Diff not rendered.
BIN img/green.png
Diff not rendered.
BIN img/greenDot.png
Diff not rendered.
BIN img/greenPin.png
Diff not rendered.
BIN img/h150.png
Diff not rendered.
BIN img/hk.png
Diff not rendered.
BIN img/incident.gif
Diff not rendered.
BIN img/incident.png
Diff not rendered.
BIN img/incident.png.png
Diff not rendered.
BIN img/info-bl.png
Diff not rendered.
BIN img/info-bottom.png
Diff not rendered.
BIN img/info-br.png
Diff not rendered.
BIN img/info-middle.png
Diff not rendered.
BIN img/info-pointer.png
Diff not rendered.
BIN img/info-tl.png
Diff not rendered.
BIN img/info-top.png
Diff not rendered.
BIN img/info-tr.png
Diff not rendered.
BIN img/info-window-128x110.gif
Diff not rendered.
BIN img/info-window-128x66.gif
Diff not rendered.
BIN img/info.png
Diff not rendered.
BIN img/information1.gif
Diff not rendered.
BIN img/infotr.png
Diff not rendered.
BIN img/klout.png
Diff not rendered.
BIN img/left-turn.gif
Diff not rendered.
BIN img/loading-ball.gif
Diff not rendered.
BIN img/logo.png
Diff not rendered.
BIN img/map_overview_hide.png
Diff not rendered.
BIN img/map_overview_show.png
Diff not rendered.
BIN img/marker.png
Diff not rendered.
BIN img/marker2.png
Diff not rendered.
BIN img/marker_black.png
Diff not rendered.
BIN img/marker_green.png
Diff not rendered.
BIN img/marker_purple.png
Diff not rendered.
BIN img/marker_red.png
Diff not rendered.
BIN img/marker_yellow.png
Diff not rendered.
BIN img/mashery.png
Diff not rendered.
BIN img/merge-left.gif
Diff not rendered.
BIN img/merge-right.gif
Diff not rendered.
BIN img/merge.gif
Diff not rendered.
BIN img/mp-tbl-bottom.jpg
Diff not rendered.
BIN img/mp-tbl-mid.jpg
Diff not rendered.
BIN img/mp-tbl-top.jpg
Diff not rendered.
BIN img/n.png
Diff not rendered.
BIN img/no-img.gif
Diff not rendered.
BIN img/num-1.png
Diff not rendered.
BIN img/num-2.png
Diff not rendered.
BIN img/num-green-1.png
Diff not rendered.
BIN img/num-purple-1.png
Diff not rendered.
BIN img/num-red-1.png
Diff not rendered.
BIN img/num-yellow-1.png
Diff not rendered.
BIN img/numbered.png
Diff not rendered.
BIN img/orange-dot.gif
Diff not rendered.
BIN img/orangePin.png
Diff not rendered.
BIN img/pan-center.png
Diff not rendered.
BIN img/pan-east.png
Diff not rendered.
BIN img/pan-north.png
Diff not rendered.
BIN img/pan-south.png
Diff not rendered.
BIN img/pan-west.png
Diff not rendered.
BIN img/parking.gif
Diff not rendered.
BIN img/parking2.gif
Diff not rendered.
BIN img/pin.png
Diff not rendered.
BIN img/progress.gif
Diff not rendered.
BIN img/purple-dot.gif
Diff not rendered.
BIN img/purple-numbered.png
Diff not rendered.
BIN img/purplePin.png
Diff not rendered.
BIN img/ramp.gif
Diff not rendered.
BIN img/red-dot.gif
Diff not rendered.
BIN img/red.gif
Diff not rendered.
BIN img/red.png
Diff not rendered.
BIN img/redDot.png
Diff not rendered.
BIN img/redPin.png
Diff not rendered.
BIN img/right-turn.gif
Diff not rendered.
BIN img/round.png
Diff not rendered.
BIN img/ruleBottom.png
Diff not rendered.
BIN img/ruleCap.png
Diff not rendered.
BIN img/ruleSelected.png
Diff not rendered.
BIN img/rulerSelected.png
Diff not rendered.
BIN img/rulerUnselected.png
Diff not rendered.
BIN img/s.png
Diff not rendered.
BIN img/scale.png
Diff not rendered.
BIN img/smaller-info-window.png
Diff not rendered.
BIN img/start.gif
Diff not rendered.
BIN img/straight.gif
Diff not rendered.
BIN img/tbl-bottom.jpg
Diff not rendered.
BIN img/tbl-mid.jpg
Diff not rendered.
BIN img/tbl-top.jpg
Diff not rendered.
BIN img/thought.png
Diff not rendered.
BIN img/tile.png
Diff not rendered.
BIN img/tmobile-atms.png
Diff not rendered.
BIN img/tmobile-drinks.png
Diff not rendered.
BIN img/tmobile-food.png
Diff not rendered.
BIN img/tmobile-shopping.png
Diff not rendered.
BIN img/topbar.jpg
Diff not rendered.
BIN img/trafficInfo.png
Diff not rendered.
BIN img/truck1.gif
Diff not rendered.
BIN img/truck2.gif
Diff not rendered.
BIN img/turn-back.gif
Diff not rendered.
BIN img/twitter.png
Diff not rendered.
BIN img/u-turn.png
Diff not rendered.
BIN img/w.png
Diff not rendered.
BIN img/watermark.png
Diff not rendered.
BIN img/window-close.gif
Diff not rendered.
BIN img/x.gif
Diff not rendered.
BIN img/yellow-dot.gif
Diff not rendered.
BIN img/yellow-numbered.png
Diff not rendered.
BIN img/z2t_pan_center_gray.png
Diff not rendered.
BIN img/z2t_pan_east.png
Diff not rendered.
BIN img/z2t_pan_north.png
Diff not rendered.
BIN img/z2t_pan_south.png
Diff not rendered.
BIN img/z2t_pan_west.png
Diff not rendered.
BIN img/z2t_zoom_bottom_gray.png
Diff not rendered.
BIN img/z2t_zoom_gray.png
Diff not rendered.
BIN img/z2t_zoom_rail_gray.png
Diff not rendered.
BIN img/z2t_zoom_selected_gray.png
Diff not rendered.
BIN img/z2t_zoom_top_gray.png
Diff not rendered.
BIN img/zDown.png
Diff not rendered.
BIN img/zUp.png
Diff not rendered.
BIN img/zbottom.png
Diff not rendered.
BIN img/zipFlag.png
Diff not rendered.
BIN img/zoom.png
Diff not rendered.
BIN img/zoomBottom.png
Diff not rendered.
BIN img/zoomChecked.png
Diff not rendered.
BIN img/zoomDown.png
Diff not rendered.
BIN img/zoomIn2.png
Diff not rendered.
BIN img/zoomOut2.png
Diff not rendered.
BIN img/zoomPillar.png
Diff not rendered.
BIN img/zoomSlider.png
Diff not rendered.
BIN img/zoomTop.png
Diff not rendered.
BIN img/zoomUp.png
Diff not rendered.
BIN img/zoomin.png
Diff not rendered.
BIN img/zoomout.png
Diff not rendered.
BIN img/zselected.png
Diff not rendered.
BIN img/ztop.png
Diff not rendered.
BIN img/zunselected.png
Diff not rendered.
137 index.htm
@@ -0,0 +1,137 @@
+<!DOCTYPE html>
+<!--
+HousingKlout
+Open Source Initiative OSI - The MIT License (MIT):Licensing
+The MIT License (MIT)
+Copyright (c) 2011 Neil Mansilla
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+----
+All logos represented are the intellectual property of the respective owners, including:
+Mashery, deCarta, Twitter, 3Taps and Klout.
+-----
+Now, legalities aside, this was a hackathon entry for the 3Taps hackathon, created on
+4/30/2011. That being said, it could probably be optimized, feature enhanced, and refactored
+to the umpteenth degree (which you're welcome to do). So, sloppy as it may be, it was selected
+as the winner!
+It's an all-JavaScript hack that does the following:
+1. Searches for Craigslist apt/rental-home listings in San Francisco via 3Taps API.
+2. From the 3Taps payload, we snag the lat/long of each listing using either:
+(a) the Google Maps "loc" parameter from Craigslist listing and pull the lat/lon
+via the Google Maps API [first choice]
+or
+(b) the lat/lon meta-data from the 3Taps payload [if (a) is not available]
+3. We use the Twitter search API to find all geo tweets within a radius of that lat/long
+(a) we also plot a little pink circle/dot on the DeCarta map
+4. We find the average Klout score for the twitter-er's above
+5. If it meets our minimum Klout score criteria, we plot it on the DeCarta map with
+a pin, a description, and a hyperlinked title (back to Craigslist)
+// -->
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>HousingKlout - The App To Find Out If Your New Home Is Hip!</title>
+ <script language="JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js">
+ </script>
+ <!-- 3Taps JavaScript SDK -->
+ <script language="JavaScript" src="./js/3taps_new.js">
+ </script>
+ <!-- DeCarta JS SDK - pulled it from their docs/demo scripts -->
+ <script language="JavaScript" src="./js/deCarta.js">
+ </script>
+ <script language="JavaScript" src="./js/CONFIG.js">
+ </script>
+ <script src="http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js?foo">
+ </script>
+ <!-- Google Maps parseaddress jquery plugin - handy to take a string
+ that contains some address information and get the full geo info
+ Pulled from: http://blog.nerdburn.com/entries/code/how-to-parse-google-maps-returned-address-data-a-simple-jquery-plugin -->
+ <script src="./js/parseaddress.jquery.js">
+ </script>
+ <!-- Google Maps - you'll need your own key.. you can get one free at:
+ http://code.google.com/apis/maps/signup.html -->
+ <script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAA9Hrr6tkKuGxfRHuyIpietBQ7Xg9Ta2yeHpAqGBGjsEdHdZsJLRTluI9qA-Kn-VHt_6Rh6NRVWIR6Ew" type="text/javascript">
+ </script>
+ <script src="./js/hk.js">
+ </script>
+ <link media="all" type="text/css" rel="stylesheet" href="./css/hk.css" />
+ </head>
+ <BODY onload="init();bigger();">
+ <!-- "addy" is just placeholder variable used for the
+ parseaddress jquery plugin -->
+ <div id="bodyTop">
+ <div id="bTleft">
+ <img src="./img/hk.png" />
+ <br/>
+ <span class="titleSubText">The App To Find Out If Your New Home Is Hip!</span>
+ </div>
+ <div id="bTright">
+ <a href="http://developer.mashery.com" target="_blank"><img border="0" src="./img/mashery.png" /></a>&nbsp;<a href="http://register.3taps.com/member/register" target="_blank"><img border="0" style="margin-bottom: 5px;" src="./img/3taps_104x62.png" /></a>&nbsp;<a href="http://developer.klout.com/" target="_blank"><img border="0" style="margin-bottom: 10px;" src="./img/klout.png" /></a>&nbsp;<a href="http://developer.decarta.com" target="_blank"><img border="0" style="margin-bottom: 15px;" src="./img/decarta_160x44.png" /></a>&nbsp;<a href="http://dev.twitter.com" target="_blank"><img style="margin-bottom: 10px;" src="./img/twitter.png" /></a>
+ </div>
+ </div>
+ <div id="formData">
+ <input type="hidden" name="addy" id="addy" value="" />
+ <p>
+ <label for="3TapsKey">
+ 3Taps API Key
+ </label>
+ <input type="text" id="3TapsKey" title="Your 3Taps API key - need one? <a href='http://register.3taps.com/member/register' target='_blank'>Click here</a> to register for one. It's free." />
+ </p>
+ <p>
+ <label for="KloutKey">
+ Klout API Key
+ </label>
+ <input type="text" id="KloutKey" title="Your Klout API Key - need one? <a href='http://developer.klout.com/' target='_blank'>Click here</a> to register for one. It's free." />
+ </p>
+ <p>
+ <label for="priceRange">
+ Price Range ($)
+ </label>
+ <span id="priceRange"><input type="number" id="lowPrice" value="1500" title="" />- <input title="" type="text" id="highPrice" value="8500" /></span>
+ </p>
+ <p>
+ <label for="lowKlout">
+ Minimum Klout Score
+ </label>
+ <input name="lowKlout" type="number" min="0" max="99" id="lowKlout" value="25" title="Minimum Klout Score (from 0 to 99)"/>
+ </p>
+ <p>
+ <label for="fresh">&nbsp;</label>
+ </p>
+ <button id="fresh" onclick="HK();">
+ Submit &gt;&gt;
+ </button>
+ </div>
+ <div id="map" style="width:800px; height:500px;position:relative;display:none;">
+ </div>
+ <canvas id="canvas">
+ </canvas>
+ <div id="apiKeys" style="display: none;" class="window">
+ </div>
+ <div id="footer">
+ Copyright &copy; 2011 Neil Mansilla
+ <a href="http://twitter.com/mansilladev" target="_blank">@mansillaDEV</a>
+ </div>
+ <script>
+ // Tool Tips for the API Keys
+ $(function(){
+ $("#3TapsKey,#KloutKey,#lowKlout").tooltip({
+
+ // place tooltip on the right edge
+ position: "center right",
+
+ // a little tweaking of the position
+ offset: [2, 10],
+
+ // use the built-in fadeIn/fadeOut effect
+ effect: "fade",
+
+ // custom opacity setting
+ opacity: 0.7
+
+ });
+ });
+ </script>
+ </BODY>
+</HTML>
248 js/3taps_new.js
@@ -0,0 +1,248 @@
+if (typeof jQuery == 'undefined') alert('jQuery required');
+
+var threeTapsClient = function(authId) {
+ this.authId = authId || '';
+
+ for (var type in threeTapsClient.clients) {
+ var client = threeTapsClient.clients[type];
+ this[type] = new client(this);
+ }
+};
+
+threeTapsClient.clients = {};
+
+threeTapsClient.register = function(type, client) {
+ threeTapsClient.clients[type] = client;
+};
+
+threeTapsClient.prototype = {
+ authId: null,
+ response: null,
+
+ request: function(path, method, params, callback) {
+ params = params || {};
+
+ var url = 'http://api.3taps.com' + path + method + (method.indexOf('?') == -1 ? '?' : '') + 'authID=' + this.authId + '&callback=?';
+
+ $.getJSON(url, params, function(response) {
+ callback(response);
+ });
+
+ return true;
+ }
+};
+
+var threeTapsReferenceClient = function(authId) {
+ if (authId instanceof threeTapsClient) {
+ this.client = authId;
+ } else {
+ this.client = new threeTapsClient(authId);
+ }
+};
+
+threeTapsReferenceClient.prototype = {
+ client: null,
+
+ path: '/reference/',
+
+ category: function(callback, code, annotations) {
+ code = code || '';
+ return this.client.request(this.path, 'category/' + code + '?annotations=' + annotations + '&', null, function(results) {
+ callback(results);
+ });
+ },
+
+ location: function(callback, code) {
+ code = code || '';
+ return this.client.request(this.path, 'location/' + code, null, function(results) {
+ callback(results);
+ });
+ },
+
+ source: function(callback, code) {
+ code = code || '';
+ return this.client.request(this.path, 'source/' + code, null, function(results) {
+ callback(results);
+ });
+ }
+};
+
+threeTapsClient.register('reference', threeTapsReferenceClient);
+
+
+var threeTapsPostingClient = function(authId) {
+ if (authId instanceof threeTapsClient) {
+ this.client = authId;
+ } else {
+ this.client = new threeTapsClient(authId);
+ }
+};
+
+threeTapsPostingClient.prototype = {
+ client: null,
+
+ path: '/posting/',
+
+ 'delete': function(data, callback) {
+ var params = {
+ data: JSON.stringify(data)
+ };
+ return this.client.request(this.path, 'delete', params, function(results) {
+ callback(results);
+ });
+ },
+
+ get: function(postKey, callback) {
+ return this.client.request(this.path, 'get/' + postKey, null, function(results) {
+ callback(results);
+ });
+ },
+
+ create: function(data, callback) {
+ var params = {
+ data: JSON.stringify(data)
+ };
+ return this.client.request(this.path, 'create', params, function(results) {
+ callback(results);
+ });
+ },
+
+ update: function(data, callback) {
+ var params = {
+ data: JSON.stringify(data)
+ };
+ return this.client.request(this.path, 'update', params, function(results) {
+ callback(results);
+ });
+ }
+};
+
+threeTapsClient.register('posting', threeTapsPostingClient);
+
+var threeTapsNotificationsClient = function(authId) {
+ if (authId instanceof threeTapsClient) {
+ this.client = authId;
+ } else {
+ this.client = new threeTapsClient(authId);
+ }
+};
+
+threeTapsNotificationsClient.prototype = {
+ client: null,
+
+ path: '/notifications/',
+
+ firehose: function(params, callback) {
+ return this.client.request(this.path, 'firehose', params, function(results) {
+ callback(results);
+ });
+ },
+
+ 'delete': function(params, callback) {
+ return this.client.request(this.path, 'delete', params, function(results) {
+ callback(results);
+ });
+ },
+
+ 'get': function(params, callback) {
+ return this.client.request(this.path, 'get', params, function(results) {
+ callback(results);
+ });
+ },
+
+ create: function(params, callback) {
+ return this.client.request(this.path, 'create', params, function(results) {
+ callback(results);
+ });
+ }
+};
+
+threeTapsClient.register('notifications', threeTapsNotificationsClient);
+
+var threeTapsSearchClient = function(authId) {
+ if (authId instanceof threeTapsClient) {
+ this.client = authId;
+ } else {
+ this.client = new threeTapsClient(authId);
+ }
+};
+
+threeTapsSearchClient.prototype = {
+ client: null,
+
+ path: '/search/',
+
+ 'search': function(params, callback) {
+ return this.client.request(this.path, '', params, function(results) {
+ callback(results);
+ });
+ },
+
+ range: function(params, callback) {
+ return this.client.request(this.path, 'range', params, function(results) {
+ callback(results);
+ });
+ },
+
+ summary: function(params, callback) {
+ return this.client.request(this.path, 'summary', params, function(results) {
+ callback(results);
+ });
+ },
+
+ count: function(params, callback) {
+ return this.client.request(this.path, 'count', params, function(results) {
+ callback(results);
+ });
+ },
+};
+
+threeTapsClient.register('search', threeTapsSearchClient);
+
+var threeTapsStatusClient = function(authId) {
+ if (authId instanceof threeTapsClient) {
+ this.client = authId;
+ } else {
+ this.client = new threeTapsClient(authId);
+ }
+};
+
+threeTapsStatusClient.prototype = {
+ client: null,
+
+ path: '/status/',
+
+ update: function(postings, callback) {
+ params = {postings: JSON.stringify(postings)};
+ return this.client.request(this.path, 'update', params, function(results) {
+ callback(results);
+ });
+ },
+
+ get: function(postings, callback) {
+ params = {postings: JSON.stringify(postings)};
+ return this.client.request(this.path, 'get', params, function(results) {
+ callback(results);
+ });
+ },
+
+ system: function(callback) {
+ return this.client.request(this.path, 'system', null, function(results) {
+ callback(results);
+ });
+ }
+};
+
+threeTapsClient.register('status', threeTapsStatusClient);
+
+// Override date to have threetaps format
+Date.formatThreeTaps = function (date) {
+ var formatted = date.getFullYear() + '/'
+ + (date.getMonth() + 1) + '/'
+ + date.getDate() + ' '
+ + date.getHours() + ':'
+ + date.getMinutes() + ':'
+ + date.getSeconds();
+
+ return formatted;
+};
34 js/CONFIG.js
@@ -0,0 +1,34 @@
+/**
+ * deCarta confidential and proprietary.
+ * Copyright 2006-2009 deCarta. All rights reserved.
+ *
+ * Enter the clientName and ClientPassword you received when registering
+ * on the developer zone.
+ */
+
+function CONFIG() {}
+ CONFIG.clientName ="livepages";
+ CONFIG.clientPassword ="livepages";
+ Credentials.configuration = "global-decarta"
+
+// By default, the JSAPI points to the Developer Zone.
+// If you are using a self-hosted version of the DDS, the following
+// are the most basic configuration settings that you should use.
+// To have good looking maps, you'll need to modify your Web Services
+// configuration to use a JSAPI appropriate DDS Image Settings.
+// CONFIG.clientName = "someclient";
+// CONFIG.clientPassword = "abc123";
+// Credentials.url = "http://localhost:8080/openls/openls";
+// Credentials.configuration = "old-english-tile";
+// Following settings will need to be changed if you are using hybrid maps.
+// In order to access the SATELLITE layer of images, you will need a Digital
+// Globe access key. Please contact sales or support about getting this key.
+// Credentials.dgkey = "";
+// In order to access the HYBRID layer of images, you will need to set a
+// valid transparent overlay configuration:
+// Credentials.transparentConfiguration = "transparent-tile";
+// To push down the fleet features to PND client via FCS Gateway from fleet
+// sample applications, an URL for FCS gateway is set here.
+// Before turning on this value please make sure the fleet extension has been
+// enabled in web services and FCS gateway has been launched.
+// CONFIG.fcsUrl = "http://localhost:8088/openls/JSON";
22 js/deCarta.js
22 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
266 js/hk.js
@@ -0,0 +1,266 @@
+/**
+ * HousingKlout
+ * Copyright (c) 2011 Neil Mansilla
+ * For license information see the README file
+ */
+
+ var map;
+ // var kscoreAvg = 0;
+ // var kmin = 10;
+ var zoom = new ZoomController(4);
+ function goPin(map1, pos, msg, msg2){
+ var over = new TextOverlay(msg2, 9, 4, "#000000", "8pt", "courier");
+ var icon = new Icon("img/num-2.png", 2, 35, 150, 36, over);
+ map1.centerOnPosition(pos, function(pos){
+ if (pos) {
+ var pin = new Pin(pos, msg, '', icon);
+ EventRegistry.addListener(pin, "click", infoShow);
+ map1.addPin(pin);
+ // pin.setMessage(msg);
+ pin.showInfoWindow();
+ // console.log("pos = "+pos);
+ }
+ else {
+ console.log("nope");
+ }
+ })
+ }
+
+ function infoShow(p){
+ map.panToPosition(p.position);
+ p.showInfoWindow();
+ }
+
+ function init(){
+ // alert("init");
+ map = new Map(document.getElementById("map"));
+ JSRequest.setDynamicScriptTagMode();
+ map.setShapeRendering("client");
+ map.authenticate(CONFIG.clientName, CONFIG.clientPassword);
+ map.addCopyrightMessage("&#169; 2009 deCarta, Inc. Map and Imagery data &#169; 2009 NAVTEQ or Tele Atlas or DigitalGlobe");
+ var zoom = new ZoomController(8); // zoom 1-17
+ map.addZoomController(zoom);
+ map.addMapTypeController(new MapTypeController());
+ map.addMapOverviewController(new MapOverviewController());
+ }
+
+ function HK(){
+
+ if (!$("#3TapsKey").val()) {
+ alert("Paste in your 3Taps developer key. If you don't\nhave one head over to:\n\nhttp://register.3taps.com/member/register");
+ $("#3TapsKey").select();
+ $("#3TapsKey").focus();
+ return false;
+ }
+
+ if (!$("#KloutKey").val()) {
+ alert("Paste in your Klout developer key. If you don't\nhave one head over to\n\nhttp://developer.klout.com");
+ $("#KloutKey").select();
+ $("#KloutKey").focus();
+ return false;
+ }
+
+ $("#map").show();
+
+ // Clear all existing pins from the map
+ map.removeAllPins();
+
+ // These are the search settings for 3Taps
+ var lowPrice = $('#lowPrice').val();
+ var highPrice = $('#highPrice').val();
+
+ // This is the minimum Klout score that a listing
+ // can have.
+ var kmin = $('#lowKlout').val();
+
+ // This is the Twitter search radius for geo-based tweets
+ // used on the geocode parameter.
+ // More info here: http://dev.twitter.com/doc/get/search
+ var radius = '0.75mi';
+
+ // 3Taps - Instantiate 3Taps JS Client
+ var client = new threeTapsClient($("#3TapsKey").val());
+
+ // 3Taps - Initiate a rental home search on 3Taps with the parameters below.
+ // Maximum results per page is set to 100 (rpp)
+ // Category RHFR = rental estate home for rent
+ // Location SFO = San Francisco
+ // More information on the 3Taps search API here:
+ // http://developers.3taps.net/methods/search
+
+ var items = client.search.search({
+ price: lowPrice + '-' + highPrice,
+ category: 'RHFR',
+ location: 'SFO',
+ retvals: 'price,location,longitude,latitude,heading,annotations,timestamp,trustedAnnotations,externalURL',
+ rpp: '100'
+ }, function(TapsResults){
+
+
+ // 3Taps - Iterate through each home for rent.
+ $.each(TapsResults.results, function(TapsKey, TapsValue){
+ var pos = "";
+ var poss = "";
+ var lat = "";
+ var lon = "";
+ if (typeof TapsValue.annotations.original_map_google === 'string') {
+
+ // On a Craigslist listing, if a Google Maps link exists,
+ // we pull out the "loc" parameter and pass it back through
+ // the parseaddress function (jquery plugin that uses Google Maps
+ // http://maps.google.com/maps/geo API call.
+
+ var temp = TapsValue.annotations.original_map_google.replace("http://maps.google.com/?q=loc%3A+", "");
+ $("#addy").val(temp);
+ $("#addy").parseaddress(function(cleanaddress){
+ lat = cleanaddress['lat'];
+ lon = cleanaddress['lon'];
+ pos = new Position(lat + " " + lon);
+ poss = lat + " " + lon;
+ // We have coordinates -- so pull down the tweets
+ pullTweet(TapsValue, kmin, lat, lon, radius, pos, poss);
+
+ });
+ }
+
+ else {
+
+ pos = new Position(TapsValue.latitude + " " + TapsValue.longitude);
+ poss = TapsValue.latitude + " " + TapsValue.longitude;
+ lat = TapsValue.latitude;
+ lon = TapsValue.longitude;
+
+ // We have coordinates (just using the lat/lon meta-data from 3Taps)
+ // so lets pull down the tweets
+ pullTweet(TapsValue, kmin, lat, lon, radius, pos, poss);
+ }
+ })
+ });
+ map.centerOnPosition(new Position("37.77493 -122.41942", function(){
+ }));
+ }
+
+ // pullTweet is called whenever we have a 3Taps/Craigslist listing
+ // with lat/lon coordinates. This uses the Twitter Search API
+ // with the 'geocode' param (lat,lon,radius).
+ function pullTweet(value, kmin, lat, lon, radius, pos, poss){
+ var twit = $.getJSON('http://search.twitter.com/search.json?geocode=' + lat + ',' + lon + ',' + radius + '&callback=?', function(dataTwit){
+ var twitUsers = new Array();
+ $.each(dataTwit.results, function(TwitKey, TwitVal){
+ if (jQuery.inArray(TwitVal.from_user, twitUsers) == -1) {
+ twitUsers.push(TwitVal.from_user);
+ }
+
+ if (TwitVal.geo != null) {
+
+ // DeCarta - plot a pink circle on the map.
+ if (TwitVal.geo.coordinates[0]) {
+ var nP = new Position(TwitVal.geo.coordinates[0] + " " + TwitVal.geo.coordinates[1]);
+ var circle = new DDSCircle();
+ circle.setPosition(nP);
+ circle.setRadius(new Radius(0.04, new UOM("KM")));
+ circle.setBorderColor("(255.0.255)");
+ circle.setBorderWidth("1");
+ circle.setFillColor("(255.0.255)");
+ map.addOverlay(circle);
+ }
+ }
+ });
+
+ // Klout - Search for Klout score for all unique Twitter usernames that tweeted
+ // based on the Twitter geo-lat/lon search.
+ if (twitUsers) {
+ var klout = $.getJSON('http://api.klout.com/1/klout.json?key=' + $("#KloutKey").val() + '&users=' + twitUsers.join() + '&callback=?', function(dataKlout){
+
+ var kscoreSum = 0;
+ // For each user, add up their Klout score.
+ $.each(dataKlout.users, function(KloutKey, KloutVal){
+ kscoreSum += KloutVal.kscore;
+ })
+
+ // Average out the Klout score for all users two tweeted at that geo-radius
+ var kscoreAvg = Math.round((kscoreSum / dataKlout.users.length) * 100) / 100;
+ if (kscoreAvg >= kmin) {
+
+ // Add the msg/msg2 HTML spans below and pin them up on the DeCarta map.
+ // That is, if the average Klout score is high enough.
+ var msg = "<span class='pinMsg'><a href=\"" + value.externalURL + "\" target='_blank'>" + value.heading + "</a><br />Price: $" + value.price + "<br />House Klout Score: " + kscoreAvg + "</span>";
+ var msg2 = "<span class='pinMsg'>$" + value.price + " Klout " + kscoreAvg + "</span>";
+ goPin(map, pos, msg, msg2);
+ }
+ });
+ }
+ else {
+ console.log("No tweets here");
+ }
+ });
+ }
+
+ // Series of DeCarta functions borrowed from their docs
+ function bigger(){
+ map.resize(500, 1220, function(p){
+ // map.removeAllPins();
+ map.addPin(new Pin(p));
+ });
+ }
+
+ function toggleMapOverview(){
+ var overview = map.getMapOverviewController();
+ if (overview.mapVisible) {
+ overview.close();
+ }
+ else {
+ overview.open();
+ }
+ }
+
+ function resizeMap(){
+ // IE and mozilla resize differently, to avoid too much recursion I block the resize function
+ if (Utilities.ie) {
+ if (!lock)
+ setTimeout(resizeMapWithPause, 1000);
+ lock = true;
+ }
+ else {
+ var size = calculate();
+ map.resize(size[0], size[1])
+ }
+ }
+
+ function resizeMapWithPause(){
+ var size = calculate();
+ map.resize(size[0], size[1]);
+ lock = false;
+ }
+
+ function calculate(){
+ var frameWidth, frameHeight;
+ if (self.innerWidth) {
+ frameWidth = self.innerWidth;
+ frameHeight = self.innerHeight;
+ }
+ else
+ if (document.documentElement && document.documentElement.clientWidth) {
+ frameWidth = document.documentElement.clientWidth;
+ frameHeight = document.documentElement.clientHeight;
+ }
+ else
+ if (document.body) {
+ frameWidth = document.body.clientWidth;
+ frameHeight = document.body.clientHeight;
+ }
+ // pad the border
+ var padding = 15;
+ // get the map div offsets from the top left corner
+ var top = (Utilities.getAbsoluteTop(document.getElementById("map")));
+ var left = (Utilities.getAbsoluteLeft(document.getElementById("map")));
+ var totTop = frameHeight - top - padding;
+ var totLeft = frameWidth - left - padding;
+ // make sure x and y are even numbers
+ if (totTop % 2 != 0)
+ totTop++;
+ if (totLeft % 2 != 0)
+ totLeft++;
+ return [totTop, totLeft]; // array x y
+ }
+
113 js/parseaddress.jquery.js
@@ -0,0 +1,113 @@
+
+$.fn.parseaddress = function(respondwith){
+
+ // this refers to the object that we attached the parseaddress() function to
+ var address = this.val();
+
+ // create new google geocoding object
+ var geocoder;
+ geocoder = new GClientGeocoder();
+
+ // call google's getLocations() function - it accepts two params:
+ // 1st, an address to geocode, 2nd, a function to send the response to asynchronously
+ geocoder.getLocations(address, function(response) {
+
+ // create an array to house the cleaned address data
+ var cleanaddress = new Array();
+
+ // create a variable to house the response code
+ var responsecode = response.Status.code;
+
+ // console.log(response);
+
+ // create a nice new array of address data
+ //cleanaddress['country'] = check_for_country(response);
+ //cleanaddress['state'] = check_for_state(response);
+ //cleanaddress['city'] = check_for_city(response);
+ //cleanaddress['street'] = check_for_street(response);
+ //cleanaddress['zip'] = check_for_zip(response);
+ cleanaddress['lat'] = get_lat_lon(response,'lat');
+ cleanaddress['lon'] = get_lat_lon(response,'lon');
+
+ // call function to deliver back to document
+ respondwith(cleanaddress);
+
+ });
+
+};
+
+// some functions here to check the various key / value pairs in
+// the multi-dimensional hash google returns with address data
+
+function check_for_placemark(response) {
+ if(typeof(response.Placemark) == "object") {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function check_for_country(response) {
+ if(check_for_placemark(response) && response.Placemark[0].AddressDetails.Country.CountryName) {
+ return response.Placemark[0].AddressDetails.Country.CountryName;
+ } else {
+ return false;
+ }
+}
+
+function check_for_state(response) {
+ if(check_for_placemark(response) && response.Placemark[0].AddressDetails.Country.AdministrativeArea != null) {
+ return response.Placemark[0].AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
+ } else {
+ return false;
+ }
+}
+
+function check_for_city(response) {
+ if(check_for_placemark(response) && typeof(response.Placemark[0].AddressDetails.Country.AdministrativeArea.Locality) == "object") {
+ if(response.Placemark[0].AddressDetails.Country.AdministrativeArea.Locality.LocalityName) {
+ return response.Placemark[0].AddressDetails.Country.AdministrativeArea.Locality.LocalityName;
+ } else {
+ return false;
+ }
+ }
+}
+
+function check_for_street(response) {
+ if(check_for_city(response) && typeof(response.Placemark[0].AddressDetails.Country.AdministrativeArea.Locality.Thoroughfare) == "object") {
+ if(response.Placemark[0].AddressDetails.Country.AdministrativeArea.Locality.Thoroughfare.ThoroughfareName) {
+ return response.Placemark[0].AddressDetails.Country.AdministrativeArea.Locality.Thoroughfare.ThoroughfareName;
+ } else {
+ return false;
+ }
+ }
+}
+
+function check_for_zip(response) {
+ if(check_for_city(response) && typeof(response.Placemark[0].AddressDetails.Country.AdministrativeArea.Locality.PostalCode) == "object") {
+ if(response.Placemark[0].AddressDetails.Country.AdministrativeArea.Locality.PostalCode.PostalCodeNumber) {
+ return response.Placemark[0].AddressDetails.Country.AdministrativeArea.Locality.PostalCode.PostalCodeNumber;
+ } else {
+ return false;
+ }
+ }
+}
+
+function get_lat_lon(response,coord) {
+ if(check_for_placemark(response)) {
+ var points = new Array();
+ points['lat'] = response.Placemark[0].Point.coordinates[1]
+ points['lon'] = response.Placemark[0].Point.coordinates[0]
+
+ if(coord == 'lat') {
+ return points['lat'];
+ } else if(coord == 'lon') {
+ return points['lon'];
+ } else {
+ return points;
+ }
+
+ } else {
+ return false;
+ }
+}

0 comments on commit 593dbf8

Please sign in to comment.