(function($){ $.fn.extend({showMapPopup: function(options) { var trim_string = function(str) { return str.replace(/^\s+/, "").replace(/\s+$/, ""); } options.title = trim_string(options.title); options.address = trim_string(options.address); var content = $('
'); var width = $(window).width()/3*2; var height = $(window).height()/3*2; content.css('width', width); content.css('height', height); m = content.modal(); var c = $('#modalContainer'); c.css('margin-left', ($(window).width()-width)/2+'px'); c.css('top', ($(window).height()-height)/2+'px'); $('#modalOverlay').click(function(){m.close()}); content.showMap(options); $('div.gsmsc-controls').hide(); $('.gsmsc-mapDiv', '#map').css('height', height+'px'); $('.gsmsc-idleMapDiv', '#map').css('height', height+'px'); return false; }}); $(document).ready(function(){ $('a.small', '#feed_cool_places').click(function(){ var link = $(this); return link.showMapPopup({ title: $('div', link.parent()).text(), address: link.text() }); }); $('img', 'div.posttext').each(function(){ var src = this.src; if (src.match('/blog/')) { src = src.replace('/blog/', '/large/'); $(this).wrap(''); $(this).parent().click(function(e) { e.stopPropagation(); var img = $(''); img.load(function(e) { var m = img.modal(); var c = $('#modalContainer'); c.css('margin-left', ($(window).width()-c.width())/2+'px'); c.css('top', ($(window).height()-c.height())/2+'px'); img.click(function(){m.close()}); $('#modalOverlay').click(function(){m.close()}); }); return false; }); } }); }); $.fa.extend({ preview: function(field, plugin, options) { field.css('height', '10em'); var url = '/ajax/preview'; var last = new Date().getTime() var updatePreview = function() { var current = new Date().getTime(); if (current > last + 500) { last = current; $.post(url, {comment:field.val()}, function(data) { if (!plugin.hasClass('ui-widget-content')) { plugin.addClass('ui-widget-content ui-corner-all'); plugin.css('margin-top', '0.5em'); plugin.css('padding-left', '0.5em'); } plugin.html(data.html); }, "json"); } } field.keyup(updatePreview); field.blur(function() { last=0; updatePreview();}); if (field.val()) field.blur(); } }); }(jQuery));