From 77d0e3934e1a77e941473d02f9b55685a9d57d83 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 21 Jul 2011 16:22:39 +0100 Subject: Pothole updates for Southampton. --- web/js/southampton.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 web/js/southampton.js (limited to 'web/js') diff --git a/web/js/southampton.js b/web/js/southampton.js new file mode 100644 index 000000000..da9552f05 --- /dev/null +++ b/web/js/southampton.js @@ -0,0 +1,35 @@ +/* + * southampton.js + * FixMyStreet JavaScript for Southampton + */ + + +$(function(){ + + $('#form_category').change(function(){ + var category = $(this).val(); + if ('Potholes' == category) { + if (!$('#potholes_extra').length) { + var qns = ''; + $('#form_title').closest('div.form-field').after(qns); + } + $('#potholes_extra').show('fast'); + } else { + $('#potholes_extra').hide('fast'); + } + }).change(); + +}); + -- cgit v1.2.3 From 2a64bd4aa8cc0b38c1c728ba84d0b06725691100 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 22 Jul 2011 17:33:00 +0100 Subject: Delay vector loading until onload in IE only. --- web/js/map-OpenLayers.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'web/js') diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 6b4a03d7e..d00079517 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -41,6 +41,15 @@ $(function(){ return false; }); + // Vector layers must be added onload as IE sucks + if ($.browser.msie) { + $(window).load(fixmystreet_onload); + } else { + fixmystreet_onload(); + } +}); + +function fixmystreet_onload() { if ( fixmystreet.area ) { var area = new OpenLayers.Layer.Vector("KML", { strategies: [ new OpenLayers.Strategy.Fixed() ], @@ -96,8 +105,7 @@ $(function(){ var bounds = fixmystreet.markers.getDataExtent(); if (bounds) { fixmystreet.map.zoomToExtent( bounds ); } } - -}); +} function fms_markers_list(pins, transform) { var cols = { 'red':'R', 'green':'G', 'blue':'B', 'purple':'P' }; -- cgit v1.2.3 From b2209550b140a66b7f803cfcdb971dd91080ca30 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 22 Jul 2011 17:52:07 +0100 Subject: Working placeholders for Southampton site. --- web/js/southampton.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'web/js') diff --git a/web/js/southampton.js b/web/js/southampton.js index da9552f05..1f3e16105 100644 --- a/web/js/southampton.js +++ b/web/js/southampton.js @@ -6,6 +6,21 @@ $(function(){ + $('[placeholder]').focus(function(){ + var input = $(this); + if (input.val() == input.attr('placeholder')) { + input.val(''); + input.removeClass('placeholder'); + input.css({ 'color': '#000000' }); + } + }).blur(function(){ + var input = $(this); + if (input.val() == '' || input.val() == input.attr('placeholder')) { + input.css({ 'color': '#999999' }); + input.val(input.attr('placeholder')); + } + }).blur(); + $('#form_category').change(function(){ var category = $(this).val(); if ('Potholes' == category) { -- cgit v1.2.3