aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js')
-rw-r--r--web/js/fixmystreet.js88
-rw-r--r--web/js/map-OpenLayers.js10
-rw-r--r--web/js/map-bing.js2
-rw-r--r--web/js/map-google.js2
4 files changed, 42 insertions, 60 deletions
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js
index 50ccb2ac3..4b19dc53e 100644
--- a/web/js/fixmystreet.js
+++ b/web/js/fixmystreet.js
@@ -3,76 +3,58 @@
* FixMyStreet JavaScript
*/
+$(function(){
-YAHOO.util.Event.onContentReady('pc', function() {
- if (this.id && this.value == this.defaultValue) {
- this.focus();
- }
-});
+ $('#pc').focus();
-YAHOO.util.Event.onContentReady('mapForm', function() {
- this.onsubmit = function() {
+ $('input[type=submit]').removeAttr('disabled');
+ $('#mapForm').submit(function() {
if (this.submit_problem) {
- this.onsubmit = function() { return false; };
+ $('input[type=submit]', this).prop("disabled", true);
}
-
- /* XXX Should be in Tilma code only */
- if (this.x) {
- this.x.value = fixmystreet.x + 3;
- this.y.value = fixmystreet.y + 3;
- }
-
return true;
- }
-});
+ });
-YAHOO.util.Event.onContentReady('another_qn', function() {
- if (!document.getElementById('been_fixed_no').checked && !document.getElementById('been_fixed_unknown').checked) {
- YAHOO.util.Dom.setStyle(this, 'display', 'none');
+ if (!$('#been_fixed_no').prop('checked') && !$('#been_fixed_unknown').prop('checked')) {
+ $('#another_qn').hide();
}
- YAHOO.util.Event.addListener('been_fixed_no', 'click', function(e) {
- YAHOO.util.Dom.setStyle('another_qn', 'display', 'block');
+ $('#been_fixed_no').click(function() {
+ $('#another_qn').show('fast');
});
- YAHOO.util.Event.addListener('been_fixed_unknown', 'click', function(e) {
- YAHOO.util.Dom.setStyle('another_qn', 'display', 'block');
+ $('#been_fixed_unknown').click(function() {
+ $('#another_qn').show('fast');
});
- YAHOO.util.Event.addListener('been_fixed_yes', 'click', function(e) {
- YAHOO.util.Dom.setStyle('another_qn', 'display', 'none');
+ $('#been_fixed_yes').click(function() {
+ $('#another_qn').hide('fast');
});
-});
-var timer;
-function email_alert_close() {
- YAHOO.util.Dom.setStyle('email_alert_box', 'display', 'none');
-}
-YAHOO.util.Event.onContentReady('email_alert', function() {
- YAHOO.util.Event.addListener(this, 'click', function(e) {
- if (!document.getElementById('email_alert_box'))
+ var timer;
+ function email_alert_close() {
+ $('#email_alert_box').hide('fast');
+ }
+
+ $('#email_alert').click(function(e) {
+ if (!$('#email_alert_box').length)
return true;
- YAHOO.util.Event.preventDefault(e);
- if (YAHOO.util.Dom.getStyle('email_alert_box', 'display') == 'block') {
+ e.preventDefault();
+ if ($('#email_alert_box').is(':visible')) {
email_alert_close();
} else {
- var pos = YAHOO.util.Dom.getXY(this);
- pos[0] -= 20; pos[1] += 20;
- YAHOO.util.Dom.setStyle('email_alert_box', 'display', 'block');
- YAHOO.util.Dom.setXY('email_alert_box', pos);
- document.getElementById('alert_rznvy').focus();
+ var pos = $(this).position();
+ $('#email_alert_box').css( { 'left': ( pos.left - 20 ) + 'px', 'top': ( pos.top + 20 ) + 'px' } );
+ $('#email_alert_box').show('fast');
+ $('#alert_rznvy').focus();
}
- });
- YAHOO.util.Event.addListener(this, 'mouseout', function(e) {
- timer = window.setTimeout(email_alert_close, 2000);
- });
- YAHOO.util.Event.addListener(this, 'mouseover', function(e) {
+ }).hover(function() {
window.clearTimeout(timer);
+ }, function() {
+ timer = window.setTimeout(email_alert_close, 2000);
});
-});
-YAHOO.util.Event.onContentReady('email_alert_box', function() {
- YAHOO.util.Event.addListener(this, 'mouseout', function(e) {
- timer = window.setTimeout(email_alert_close, 2000);
- });
- YAHOO.util.Event.addListener(this, 'mouseover', function(e) {
+
+ $('#email_alert_box').hover(function() {
window.clearTimeout(timer);
+ }, function() {
+ timer = window.setTimeout(email_alert_close, 2000);
});
-});
+});
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index a1d870483..948e4829f 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -1,4 +1,4 @@
-YAHOO.util.Event.onContentReady('map', function() {
+$(function(){
var perm = new OpenLayers.Control.Permalink();
set_map_config(perm);
@@ -122,8 +122,8 @@ function fms_markers_list(pins, transform) {
return markers;
}
-YAHOO.util.Event.addListener('hide_pins_link', 'click', function(e) {
- YAHOO.util.Event.preventDefault(e);
+$('#hide_pins_link').click(function(e) {
+ e.preventDefault();
var showhide = [
'Show pins', 'Hide pins',
'Dangos pinnau', 'Cuddio pinnau',
@@ -140,8 +140,8 @@ YAHOO.util.Event.addListener('hide_pins_link', 'click', function(e) {
}
});
-YAHOO.util.Event.addListener('all_pins_link', 'click', function(e) {
- YAHOO.util.Event.preventDefault(e);
+$('#all_pins_link').click(function(e) {
+ e.preventDefault();
fixmystreet.markers.setVisibility(true);
var welsh = 0;
var texts = [
diff --git a/web/js/map-bing.js b/web/js/map-bing.js
index 748a03525..856e4f188 100644
--- a/web/js/map-bing.js
+++ b/web/js/map-bing.js
@@ -1,4 +1,4 @@
-YAHOO.util.Event.onContentReady('map', function() {
+$(function(){
var centre = new Microsoft.Maps.Location( fixmystreet.latitude, fixmystreet.longitude );
var map = new Microsoft.Maps.Map(document.getElementById("map"), {
credentials: fixmystreet.key,
diff --git a/web/js/map-google.js b/web/js/map-google.js
index ab9bb9042..742b55d47 100644
--- a/web/js/map-google.js
+++ b/web/js/map-google.js
@@ -1,4 +1,4 @@
-YAHOO.util.Event.onContentReady('map', function() {
+$(function(){
var centre = new google.maps.LatLng( fixmystreet.latitude, fixmystreet.longitude );
var map = new google.maps.Map(document.getElementById("map"), {
mapTypeId: google.maps.MapTypeId.ROADMAP,