aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js')
-rw-r--r--web/js/fixmystreet.js7
-rw-r--r--web/js/jquery.placeholder.min.js2
-rw-r--r--web/js/map-OpenLayers.js9
-rw-r--r--web/js/placeholder_polyfill/placeholder_polyfill.jquery.min.js23
-rw-r--r--web/js/placeholder_polyfill/placeholder_polyfill.min.css2
-rw-r--r--web/js/southampton.js16
6 files changed, 20 insertions, 39 deletions
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js
index b1a8f1889..834aa4ed3 100644
--- a/web/js/fixmystreet.js
+++ b/web/js/fixmystreet.js
@@ -8,7 +8,7 @@ function form_category_onchange() {
var args = {
category: cat.val()
};
-
+
if ( typeof fixmystreet !== 'undefined' ) {
args.latitude = fixmystreet.latitude;
args.longitude = fixmystreet.longitude;
@@ -159,8 +159,9 @@ $(function(){
timer = window.setTimeout(email_alert_close, 2000);
});
-
- $('#form_category').change( form_category_onchange );
+ // Using delegate here because we *might* be running under a cobrand which isn't jQuery 1.7+
+ // Delegation is necessary because #form_category may be replaced during the lifetime of the page
+ $("#problem_form").delegate("select#form_category", "change", form_category_onchange );
// Geolocation
if (geo_position_js.init()) {
diff --git a/web/js/jquery.placeholder.min.js b/web/js/jquery.placeholder.min.js
new file mode 100644
index 000000000..122277a31
--- /dev/null
+++ b/web/js/jquery.placeholder.min.js
@@ -0,0 +1,2 @@
+/*! http://mths.be/placeholder v2.0.5 by @mathias */
+;(function(f,h,$){var a='placeholder' in h.createElement('input'),d='placeholder' in h.createElement('textarea'),i=$.fn,c=$.valHooks,k,j;if(a&&d){j=i.placeholder=function(){return this};j.input=j.textarea=true}else{j=i.placeholder=function(){var l=this;l.filter((a?'textarea':':input')+'[placeholder]').not('.placeholder').bind({'focus.placeholder':b,'blur.placeholder':e}).data('placeholder-enabled',true).trigger('blur.placeholder');return l};j.input=a;j.textarea=d;k={get:function(m){var l=$(m);return l.data('placeholder-enabled')&&l.hasClass('placeholder')?'':m.value},set:function(m,n){var l=$(m);if(!l.data('placeholder-enabled')){return m.value=n}if(n==''){m.value=n;if(m!=h.activeElement){e.call(m)}}else{if(l.hasClass('placeholder')){b.call(m,true,n)||(m.value=n)}else{m.value=n}}return l}};a||(c.input=k);d||(c.textarea=k);$(function(){$(h).delegate('form','submit.placeholder',function(){var l=$('.placeholder',this).each(b);setTimeout(function(){l.each(e)},10)})});$(f).bind('beforeunload.placeholder',function(){$('.placeholder').each(function(){this.value=''})})}function g(m){var l={},n=/^jQuery\d+$/;$.each(m.attributes,function(p,o){if(o.specified&&!n.test(o.name)){l[o.name]=o.value}});return l}function b(m,n){var l=this,o=$(l);if(l.value==o.attr('placeholder')&&o.hasClass('placeholder')){if(o.data('placeholder-password')){o=o.hide().next().show().attr('id',o.removeAttr('id').data('placeholder-id'));if(m===true){return o[0].value=n}o.focus()}else{l.value='';o.removeClass('placeholder')}}}function e(){var q,l=this,p=$(l),m=p,o=this.id;if(l.value==''){if(l.type=='password'){if(!p.data('placeholder-textinput')){try{q=p.clone().attr({type:'text'})}catch(n){q=$('<input>').attr($.extend(g(this),{type:'text'}))}q.removeAttr('name').data({'placeholder-password':true,'placeholder-id':o}).bind('focus.placeholder',b);p.data({'placeholder-textinput':q,'placeholder-id':o}).before(q)}p=p.removeAttr('id').hide().prev().attr('id',o).show()}p.addClass('placeholder');p[0].value=p.attr('placeholder')}else{p.removeClass('placeholder')}}}(this,document,jQuery)); \ No newline at end of file
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 6ffcb5c1d..89c862847 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -210,6 +210,10 @@ $(function(){
displayProjection: new OpenLayers.Projection("EPSG:4326")
});
+ if ($('html').hasClass('mobile')) {
+ $('#fms_pan_zoom').css({ top: '2.75em !important' });
+ }
+
fixmystreet.layer_options = OpenLayers.Util.extend({
zoomOffset: fixmystreet.zoomOffset,
transitionEffect: 'resize',
@@ -428,11 +432,6 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
}, function(data) {
$('#councils_text').html(data.councils_text);
$('#form_category_row').html(data.category);
- /* Need to reset this here as it gets removed when we replace
- the HTML for the dropdown */
- if ( data.has_open311 > 0 ) {
- $('#form_category').change( form_category_onchange );
- }
});
$('#side-form, #site-logo').show();
diff --git a/web/js/placeholder_polyfill/placeholder_polyfill.jquery.min.js b/web/js/placeholder_polyfill/placeholder_polyfill.jquery.min.js
deleted file mode 100644
index 0c2f19be5..000000000
--- a/web/js/placeholder_polyfill/placeholder_polyfill.jquery.min.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
-* HTML5 placeholder polyfill
-*
-* code: https://github.com/ginader/HTML5-placeholder-polyfill
-* please report issues at: https://github.com/ginader/HTML5-placeholder-polyfill/issues
-*
-* Copyright (c) 2012 Dirk Ginader (ginader.de)
-* Dual licensed under the MIT and GPL licenses:
-* http://www.opensource.org/licenses/mit-license.php
-* http://www.gnu.org/licenses/gpl.html
-*
-* Version: 1.8
-*/
-(function(e){var b=false;function c(f,g){if(e.trim(f.val())===""){f.data("placeholder").removeClass(g.hideClass);}else{f.data("placeholder").addClass(g.hideClass);
-}}function a(h,g){var f=g.is("textarea");h.css({width:g.innerWidth()-(f?20:4),height:g.innerHeight()-6,lineHeight:g.css("line-height"),whiteSpace:f?"normal":"nowrap",overflow:"hidden"}).offset(g.offset());
-}function d(f){if(b&&window.console&&window.console.log){window.console.log(f);}}e.fn.placeHolder=function(f){var g=this;this.options=e.extend({className:"placeholder",visibleToScreenreaders:true,visibleToScreenreadersHideClass:"placeholder-hide-exept-screenreader",visibleToNoneHideClass:"placeholder-hide"},f);
-this.options.hideClass=this.options.visibleToScreenreaders?this.options.visibleToScreenreadersHideClass:this.options.visibleToNoneHideClass;return e(this).each(function(){var h=e(this),l=h.attr("placeholder"),m=h.attr("id"),i,k,j;
-i=h.closest("label")[0];h.attr("placeholder","");if(!i&&!m){d("the input element with the placeholder needs an id!");return;}i=i||e('label[for="'+m+'"]');
-if(!i){d("the input element with the placeholder needs a label!");return;}i.removeClass("visuallyhidden").addClass("visuallyhidden-with-placeholder");k=e('<span class="'+g.options.className+'">'+l+"</span>").appendTo(i);
-j=(k.width()>h.width());if(j){k.attr("title",l);}a(k,h);h.data("placeholder",k);k.data("input",k);k.click(function(){e(this).data("input").focus();});h.focusin(function(){e(this).data("placeholder").addClass(g.options.hideClass);
-});h.focusout(function(){c(e(this),g.options);});c(h,g.options);e(document).bind("fontresize",function(){a(k,h);});if(e.event.special.resize){e("textarea").bind("resize",function(n){a(k,h);
-});}else{e("textarea").css("resize","none");}});};e(function(){if("placeholder" in e("<input>")[0]){return;}e("input[placeholder], textarea[placeholder]").placeHolder({visibleToScreenreaders:true});
-});})(jQuery); \ No newline at end of file
diff --git a/web/js/placeholder_polyfill/placeholder_polyfill.min.css b/web/js/placeholder_polyfill/placeholder_polyfill.min.css
deleted file mode 100644
index 602cf1fe3..000000000
--- a/web/js/placeholder_polyfill/placeholder_polyfill.min.css
+++ /dev/null
@@ -1,2 +0,0 @@
-label span.placeholder{position:absolute;font-size:75%;color:#999;font-family:sans-serif;padding:4px 3px;z-index:1}label span.placeholder-hide-exept-screenreader{clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px);padding:0!important;border:0!important;height:1px!important;width:1px!important;overflow:hidden}
-label span.placeholder-hide{display:none}label.visuallyhidden-with-placeholder{clip:auto!important;height:auto!important;overflow:visible!important;position:absolute!important;left:-999em} \ No newline at end of file
diff --git a/web/js/southampton.js b/web/js/southampton.js
index 1f3e16105..c0fa48b06 100644
--- a/web/js/southampton.js
+++ b/web/js/southampton.js
@@ -15,13 +15,16 @@ $(function(){
}
}).blur(function(){
var input = $(this);
- if (input.val() == '' || input.val() == input.attr('placeholder')) {
+ if (input.val() === '' || input.val() == input.attr('placeholder')) {
input.css({ 'color': '#999999' });
input.val(input.attr('placeholder'));
}
}).blur();
-
- $('#form_category').change(function(){
+
+ // use on() here because the #form_category may be replaced
+ // during the page's lifetime
+ $("#problem_form").on("change.southampton", "select#form_category",
+ function() {
var category = $(this).val();
if ('Potholes' == category) {
if (!$('#potholes_extra').length) {
@@ -39,12 +42,13 @@ $(function(){
'<option>Deeper than a tennis ball' +
'</select></div></div>';
$('#form_title').closest('div.form-field').after(qns);
- }
+ }
$('#potholes_extra').show('fast');
} else {
$('#potholes_extra').hide('fast');
- }
- }).change();
+ }
+ }
+ ).change(); // change called to trigger (in case we've come in with potholes selected)
});