WO=window.WO||{}; WO.Widgets={}; WO.Widgets.PlaceEncounters = function(widgetOptions) { this.widgetOptions = widgetOptions; this.widgetData = { "default_url" : "http://wildobs.com/place/Coal-Creek-Canyon-CO", "encounters" : [ {"user":{"updated_at":"2010/07/30 14:03:18 +0000","id":1,"image":{"name":"adam_jack","updated_at":"2010/07/24 07:21:32 +0000","url":"http://a0.twimg.com/profile_images/44213692/AdamJack3_bigger.png","id":15082,"mimetype":"image/png","height":73,"right":{"name":"adam_jack","text":"Copyright","id":2,"link":"http://neukadye.com"},"created_at":"2010/07/24 07:21:32 +0000","width":73},"login":"adam_jack","created_at":"2008/05/22 11:23:14 +0000"},"updated_at":"2010/07/19 14:45:22 +0000","comments":0,"public":true,"title":"Fledged at last...","entity":{"name":"White Breasted Nuthatch","updated_at":"2009/04/22 16:12:03 +0000","category":{"encounters":24,"name":"White Breasted Nuthatch","updated_at":"2008/07/30 13:14:20 +0000","stats":{"regions":17,"wishlists":0,"wishlists_rank":708},"relationships":[{"predicate":"is_a","object":"Bird"}],"generic":false,"id":75,"aliases":[],"link":"http://en.wikipedia.org/wiki/White-breasted_Nuthatch","image":{"name":"White Breasted Nuthatch","updated_at":"2009/04/26 07:00:48 +0000","url":"http://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Sitta-carolinensis-001.jpg/256px-Sitta-carolinensis-001.jpg","id":172,"mimetype":"image/jpeg","height":256,"right":{"name":"Wikispecies","text":"Copyright","id":1,"link":"http://species.wikimedia.org"},"created_at":"2008/08/11 20:26:06 +0000","width":256},"created_at":"2008/07/30 13:13:05 +0000","ukey":"White-Breasted-Nuthatch"},"id":72,"created_at":"2008/07/30 16:47:52 +0000"},"tags":["fledged"],"uuid":"--- !ruby/object:Guid \nbytes: \"\\x8F\\xD6\\xCA\\xCF\\x89\\x10\\xF3\\xFE\\x0F\\xE8\\x81\\xD6\\xCDhf\\xCE\"\n","rating_average":0.0,"id":8726,"description":"The noisy bird box, home to the family of white breasted nuthatches, is finally quiet. Now these guys are loosed on the world, and today are tootling around the yard.","experienced_at":"2010/07/19 08:24:00 +0000","rating_count":0,"views":21,"location":{"latitude":39.9179,"region":{"name":"Coal Creek Canyon, CO","updated_at":"2008/11/08 20:37:53 +0000","latitude":39.8775,"id":17,"longitude":-105.274,"image":{"name":"Coal Creek Canyon","updated_at":"2010/06/20 07:26:25 +0000","url":"http://coalcreek.com/CCC-Entrance.jpg","id":214,"height":584,"created_at":"2008/09/09 15:29:27 +0000","width":898},"created_at":"2008/07/19 02:22:27 +0000","ukey":"Coal-Creek-Canyon-CO"},"placemark":"320 Tunnel 19 Road, Golden, Colorado","id":1,"longitude":-105.352,"alias":"home","manually_placed":false,"created_at":"2008/06/30 16:41:03 +0000"},"created_at":"2010/07/19 14:26:07 +0000","syndicate":true,"ukey":"Fledged-at-last"} ,{"user":{"updated_at":"2010/07/30 14:03:18 +0000","id":1,"image":{"name":"adam_jack","updated_at":"2010/07/24 07:21:32 +0000","url":"http://a0.twimg.com/profile_images/44213692/AdamJack3_bigger.png","id":15082,"mimetype":"image/png","height":73,"right":{"name":"adam_jack","text":"Copyright","id":2,"link":"http://neukadye.com"},"created_at":"2010/07/24 07:21:32 +0000","width":73},"login":"adam_jack","created_at":"2008/05/22 11:23:14 +0000"},"updated_at":"2010/07/14 18:35:20 +0000","comments":0,"public":true,"title":"Hard workers, long hours, long months...","entity":{"name":"White-breasted Nuthatch","updated_at":"2010/07/14 18:19:15 +0000","category":{"encounters":24,"name":"White Breasted Nuthatch","updated_at":"2008/07/30 13:14:20 +0000","stats":{"regions":17,"wishlists":0,"wishlists_rank":708},"relationships":[{"predicate":"is_a","object":"Bird"}],"generic":false,"id":75,"aliases":[],"link":"http://en.wikipedia.org/wiki/White-breasted_Nuthatch","image":{"name":"White Breasted Nuthatch","updated_at":"2009/04/26 07:00:48 +0000","url":"http://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Sitta-carolinensis-001.jpg/256px-Sitta-carolinensis-001.jpg","id":172,"mimetype":"image/jpeg","height":256,"right":{"name":"Wikispecies","text":"Copyright","id":1,"link":"http://species.wikimedia.org"},"created_at":"2008/08/11 20:26:06 +0000","width":256},"created_at":"2008/07/30 13:13:05 +0000","ukey":"White-Breasted-Nuthatch"},"id":6274,"created_at":"2010/07/14 18:19:02 +0000"},"uuid":"--- !ruby/object:Guid \nbytes: \"\\xB8+\\xCC\\xDC\\x1D\\x98:\\xF7;\\xF4\\r\\x10\\x88\\xF2\\xE2\\xF3\"\n","rating_average":0.0,"id":8713,"description":"I don't recall exactly when the white-breasted nuthatches began their nesting but it was way back in the days of snow, long before other birds were even back from migration. \r\n\r\nSince the chicks have hatched I am amazed how I see these birds 'everywhere' in my yard, constantly gathering food. Very industrious!\r\n\r\nHere they are though, still working hard at this. The nestlings must be close to becoming fledglings.","experienced_at":"2010/07/14 12:15:00 +0000","rating_count":0,"views":28,"location":{"latitude":39.9179,"region":{"name":"Coal Creek Canyon, CO","updated_at":"2008/11/08 20:37:53 +0000","latitude":39.8775,"id":17,"longitude":-105.274,"image":{"name":"Coal Creek Canyon","updated_at":"2010/06/20 07:26:25 +0000","url":"http://coalcreek.com/CCC-Entrance.jpg","id":214,"height":584,"created_at":"2008/09/09 15:29:27 +0000","width":898},"created_at":"2008/07/19 02:22:27 +0000","ukey":"Coal-Creek-Canyon-CO"},"placemark":"320 Tunnel 19 Road, Golden, Colorado","id":1,"longitude":-105.352,"alias":"home","manually_placed":false,"created_at":"2008/06/30 16:41:03 +0000"},"created_at":"2010/07/14 18:19:02 +0000","syndicate":true,"ukey":"Hard-workers-long-hours-long-months"} ,{"user":{"updated_at":"2010/07/30 14:03:18 +0000","id":1,"image":{"name":"adam_jack","updated_at":"2010/07/24 07:21:32 +0000","url":"http://a0.twimg.com/profile_images/44213692/AdamJack3_bigger.png","id":15082,"mimetype":"image/png","height":73,"right":{"name":"adam_jack","text":"Copyright","id":2,"link":"http://neukadye.com"},"created_at":"2010/07/24 07:21:32 +0000","width":73},"login":"adam_jack","created_at":"2008/05/22 11:23:14 +0000"},"updated_at":"2010/06/27 01:20:23 +0000","comments":0,"public":true,"title":"Huge Hairy Moth","entity":{"name":"Moth","updated_at":"2010/06/27 01:17:56 +0000","category":{"encounters":30,"name":"Moth","updated_at":"2008/10/05 20:15:29 +0000","stats":{"regions":7,"wishlists":0,"wishlists_rank":725},"relationships":[{"predicate":"is_a","object":"Invertebrate"}],"generic":false,"id":118,"aliases":[],"link":"http://en.wikipedia.org/wiki/Moth","image":{"name":"Moth","updated_at":"2008/10/05 20:15:29 +0000","url":"http://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Emperor_Gum_Moth.jpg/200px-Emperor_Gum_Moth.jpg","id":286,"mimetype":"image/jpeg","height":147,"right":{"name":"Wikispecies","text":"Copyright","id":1,"link":"http://species.wikimedia.org"},"created_at":"2008/10/05 20:15:29 +0000","width":200},"created_at":"2008/10/05 20:15:29 +0000","ukey":"Moth"},"id":119,"created_at":"2008/10/05 20:21:24 +0000"},"uuid":"--- !ruby/object:Guid \nbytes: \"\\xD6\\x1A\\x12\\xA00\\x13\\xC5\\xD3!K0\\xB8\\xC3JD\\x8A\"\n","rating_average":0.0,"id":8449,"description":"This wonderful creature chose my garage wall as it's hang out for the day.","experienced_at":"2010/06/26 13:16:00 +0000","rating_count":0,"views":155,"image":{"name":"Moth","updated_at":"2010/06/27 01:17:56 +0000","url":"http://assets.wildobs.com/uploads/adam_jack/photos/LargeMoth.jpg","id":14186,"mimetype":"image/jpeg","height":907,"medium_url":"http://assets.wildobs.com/uploads/adam_jack/mediums/LargeMoth.jpg","right":{"name":"adam_jack","text":"Copyright","id":2,"link":"http://neukadye.com"},"thumbnail_url":"http://assets.wildobs.com/uploads/adam_jack/thumbnails/LargeMoth.jpg","created_at":"2010/06/27 01:17:54 +0000","width":1280},"location":{"latitude":39.9179,"region":{"name":"Coal Creek Canyon, CO","updated_at":"2008/11/08 20:37:53 +0000","latitude":39.8775,"id":17,"longitude":-105.274,"image":{"name":"Coal Creek Canyon","updated_at":"2010/06/20 07:26:25 +0000","url":"http://coalcreek.com/CCC-Entrance.jpg","id":214,"height":584,"created_at":"2008/09/09 15:29:27 +0000","width":898},"created_at":"2008/07/19 02:22:27 +0000","ukey":"Coal-Creek-Canyon-CO"},"placemark":"320 Tunnel 19 Road, Golden, Colorado","id":1,"longitude":-105.352,"alias":"home","manually_placed":false,"created_at":"2008/06/30 16:41:03 +0000"},"created_at":"2010/06/27 01:17:23 +0000","syndicate":true,"ukey":"Huge-Hairy-Moth"} ,{"user":{"updated_at":"2010/07/30 14:03:18 +0000","id":1,"image":{"name":"adam_jack","updated_at":"2010/07/24 07:21:32 +0000","url":"http://a0.twimg.com/profile_images/44213692/AdamJack3_bigger.png","id":15082,"mimetype":"image/png","height":73,"right":{"name":"adam_jack","text":"Copyright","id":2,"link":"http://neukadye.com"},"created_at":"2010/07/24 07:21:32 +0000","width":73},"login":"adam_jack","created_at":"2008/05/22 11:23:14 +0000"},"updated_at":"2010/06/11 15:20:46 +0000","comments":0,"public":true,"title":"Turkey Off The Roof","entity":{"name":"Turkey","updated_at":"2010/06/11 15:18:00 +0000","category":{"encounters":61,"name":"Turkey","updated_at":"2008/07/30 13:14:20 +0000","stats":{"regions":15,"wishlists":0,"wishlists_rank":743},"relationships":[{"predicate":"is_a","object":"Bird"},{"predicate":"see_also","object":{"encounters":4,"name":"Blue Grouse","updated_at":"2008/07/30 13:14:20 +0000","stats":{"regions":2,"wishlists":0,"wishlists_rank":471},"generic":false,"id":67,"link":"http://en.wikipedia.org/wiki/Blue_Grouse","image":{"name":"Blue Grouse","updated_at":"2009/04/26 07:00:45 +0000","url":"http://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Dendragapus_obscurus_USNPS.jpg/240px-Dendragapus_obscurus_USNPS.jpg","id":164,"height":153,"created_at":"2008/08/11 20:26:06 +0000","width":240},"created_at":"2008/07/30 13:13:05 +0000","ukey":"Blue-Grouse"}}],"generic":false,"id":32,"aliases":[],"link":"http://en.wikipedia.org/wiki/Turkey_(bird)","image":{"name":"Turkey","updated_at":"2009/04/26 07:00:34 +0000","url":"http://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Meleagris_gallopavo_Wild_Turkey.jpg/180px-Meleagris_gallopavo_Wild_Turkey.jpg","id":132,"mimetype":"image/jpeg","height":189,"right":{"name":"Wikispecies","text":"Copyright","id":1,"link":"http://species.wikimedia.org"},"created_at":"2008/08/11 20:26:06 +0000","width":180},"created_at":"2008/07/30 13:13:05 +0000","ukey":"Turkey"},"id":24,"created_at":"2008/07/12 18:53:05 +0000"},"uuid":"--- !ruby/object:Guid \nbytes: \"w\\xDFz\\xB2\\x8D\\x8EP\\xD3\\xB5l\\xE9\\xDBA\\xEBn\\xE8\"\n","rating_average":0.0,"id":8310,"description":"Not a great shot, but these guys doing their best flying ... i.e. downhill! :)","experienced_at":"2010/06/11 09:17:00 +0000","rating_count":0,"views":56,"image":{"name":"Turkey","updated_at":"2010/06/11 15:17:59 +0000","url":"http://assets.wildobs.com/uploads/adam_jack/photos/TurkeyOffTheRoof.jpg","id":13651,"mimetype":"image/jpeg","height":622,"medium_url":"http://assets.wildobs.com/uploads/adam_jack/mediums/TurkeyOffTheRoof.jpg","right":{"name":"adam_jack","text":"Copyright","id":2,"link":"http://neukadye.com"},"thumbnail_url":"http://assets.wildobs.com/uploads/adam_jack/thumbnails/TurkeyOffTheRoof.jpg","created_at":"2010/06/11 15:17:56 +0000","width":1280},"location":{"latitude":39.9179,"region":{"name":"Coal Creek Canyon, CO","updated_at":"2008/11/08 20:37:53 +0000","latitude":39.8775,"id":17,"longitude":-105.274,"image":{"name":"Coal Creek Canyon","updated_at":"2010/06/20 07:26:25 +0000","url":"http://coalcreek.com/CCC-Entrance.jpg","id":214,"height":584,"created_at":"2008/09/09 15:29:27 +0000","width":898},"created_at":"2008/07/19 02:22:27 +0000","ukey":"Coal-Creek-Canyon-CO"},"placemark":"320 Tunnel 19 Road, Golden, Colorado","id":1,"longitude":-105.352,"alias":"home","manually_placed":false,"created_at":"2008/06/30 16:41:03 +0000"},"created_at":"2010/06/11 15:17:33 +0000","syndicate":true,"ukey":"Turkey-Off-The-Roof"} ,{"user":{"updated_at":"2010/07/30 14:03:18 +0000","id":1,"image":{"name":"adam_jack","updated_at":"2010/07/24 07:21:32 +0000","url":"http://a0.twimg.com/profile_images/44213692/AdamJack3_bigger.png","id":15082,"mimetype":"image/png","height":73,"right":{"name":"adam_jack","text":"Copyright","id":2,"link":"http://neukadye.com"},"created_at":"2010/07/24 07:21:32 +0000","width":73},"login":"adam_jack","created_at":"2008/05/22 11:23:14 +0000"},"updated_at":"2010/06/11 15:15:42 +0000","comments":0,"public":true,"title":"Turkey on the Roof","entity":{"name":"Turkey","updated_at":"2010/06/11 15:18:00 +0000","category":{"encounters":61,"name":"Turkey","updated_at":"2008/07/30 13:14:20 +0000","stats":{"regions":15,"wishlists":0,"wishlists_rank":743},"relationships":[{"predicate":"is_a","object":"Bird"},{"predicate":"see_also","object":{"encounters":4,"name":"Blue Grouse","updated_at":"2008/07/30 13:14:20 +0000","stats":{"regions":2,"wishlists":0,"wishlists_rank":471},"generic":false,"id":67,"link":"http://en.wikipedia.org/wiki/Blue_Grouse","image":{"name":"Blue Grouse","updated_at":"2009/04/26 07:00:45 +0000","url":"http://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Dendragapus_obscurus_USNPS.jpg/240px-Dendragapus_obscurus_USNPS.jpg","id":164,"height":153,"created_at":"2008/08/11 20:26:06 +0000","width":240},"created_at":"2008/07/30 13:13:05 +0000","ukey":"Blue-Grouse"}}],"generic":false,"id":32,"aliases":[],"link":"http://en.wikipedia.org/wiki/Turkey_(bird)","image":{"name":"Turkey","updated_at":"2009/04/26 07:00:34 +0000","url":"http://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Meleagris_gallopavo_Wild_Turkey.jpg/180px-Meleagris_gallopavo_Wild_Turkey.jpg","id":132,"mimetype":"image/jpeg","height":189,"right":{"name":"Wikispecies","text":"Copyright","id":1,"link":"http://species.wikimedia.org"},"created_at":"2008/08/11 20:26:06 +0000","width":180},"created_at":"2008/07/30 13:13:05 +0000","ukey":"Turkey"},"id":24,"created_at":"2008/07/12 18:53:05 +0000"},"uuid":"--- !ruby/object:Guid \nbytes: \"?\\x03(\\xF7\\xC9\\x05h\\xC4\\x96@\\x81\\xF4\\xB5\\xD9t\\xDF\"\n","rating_average":0.0,"id":8309,"description":"We get Turkey around all the time, but not normally on the roof! Our garage connects with the ground at the back of the house, so these two were able to just walk up. What was really fun was watching them fly down ... yes, these birds can fly. :)","experienced_at":"2010/06/11 09:13:00 +0000","rating_count":0,"views":84,"image":{"name":"Turkey","updated_at":"2010/06/11 15:15:39 +0000","url":"http://assets.wildobs.com/uploads/adam_jack/photos/TurkeyOnTheRoof.jpg","id":13650,"mimetype":"image/jpeg","height":638,"medium_url":"http://assets.wildobs.com/uploads/adam_jack/mediums/TurkeyOnTheRoof.jpg","right":{"name":"adam_jack","text":"Copyright","id":2,"link":"http://neukadye.com"},"thumbnail_url":"http://assets.wildobs.com/uploads/adam_jack/thumbnails/TurkeyOnTheRoof.jpg","created_at":"2010/06/11 15:15:36 +0000","width":1280},"location":{"latitude":39.9179,"region":{"name":"Coal Creek Canyon, CO","updated_at":"2008/11/08 20:37:53 +0000","latitude":39.8775,"id":17,"longitude":-105.274,"image":{"name":"Coal Creek Canyon","updated_at":"2010/06/20 07:26:25 +0000","url":"http://coalcreek.com/CCC-Entrance.jpg","id":214,"height":584,"created_at":"2008/09/09 15:29:27 +0000","width":898},"created_at":"2008/07/19 02:22:27 +0000","ukey":"Coal-Creek-Canyon-CO"},"placemark":"320 Tunnel 19 Road, Golden, Colorado","id":1,"longitude":-105.352,"alias":"home","manually_placed":false,"created_at":"2008/06/30 16:41:03 +0000"},"created_at":"2010/06/11 15:15:15 +0000","syndicate":true,"ukey":"Turkey-on-the-Roof"} ]}; } // widget constructor function WO.Widgets.PlaceEncounters.prototype.render = function() { var styleHTML = ''; var widget_id=Math.floor(Math.random()*10000); // Drop in the widget's id styleHTML = styleHTML.replace(/#wo-widget/g,"#wo-widget-"+widget_id); document.write(styleHTML); document.write('
'); // Create header widget DOM fragment var header = document.createElement('div'); var encounterList = document.createElement('div'); var widget = document.getElementById('wo-widget-'+widget_id); header.className = "wo-header"; header.innerHTML = ''+this.widgetOptions.title_1+''; var encounterListHTML = '
'; for (var i = 0; i < this.widgetData.encounters.length; i++) { var encounter = this.widgetData.encounters[i]; // Get the image... var img_url = null; var image = null; if ( !!encounter.image ) { image = encounter.image; img_url = !image.thumbnail_url ? image.url : image.thumbnail_url; } else if ( !!encounter.entity && !!encounter.entity.category && !!encounter.entity.category.image ) { image = encounter.entity.category.image; img_url = !image.thumbnail_url ? image.url : image.thumbnail_url; } else img_url = 'http://assets.wildobs.com/images/unknown.jpg'; var truncatedDescription = ''; if ( !!encounter.description ) { // Truncate to the limit... var descriptionLength = (1 < this.widgetOptions.version ) ? this.widgetOptions.desc_length : 100; truncatedDescription = encounter.description.substring(0, Math.min(descriptionLength,encounter.description.length)); if (encounter.description.length > descriptionLength) { truncatedDescription += '...'; } } textHTML = ''+encounter.title+''; if ( !!encounter.description) { textHTML += '
'; textHTML += '
' + truncatedDescription + ''; } if ( !!encounter.entity && !!encounter.entity.category ) { textHTML += '
' + encounter.entity.category.name + ''; } // Calculate TD width from Image width plus some... var imageWidth = (1 < this.widgetOptions.version ) ? this.widgetOptions.style.images_width : 45; var imageTableDataWidth = imageWidth + 6; encounterListHTML += '' encounterListHTML += ' '; encounterListHTML += ' '; encounterListHTML += '
'+encounter.title+'
'+textHTML+'
'; } encounterList.innerHTML = encounterListHTML; widget.appendChild(header); widget.appendChild(encounterList); }