From d3cfe48b3c9b49948248d4e91f068dae21e1ce79 Mon Sep 17 00:00:00 2001
From: M Somerville
Date: Mon, 8 Feb 2021 19:49:05 +0000
Subject: [PATCH] Move inline JS as jQuery no longer present there.
---
www/docs/admin/banner.php | 29 ++++++++-------
www/docs/js/main.js | 36 +++++++++++++++++++
.../templates/html/mp/divisions.php | 29 +++++----------
.../templates/html/people/index.php | 13 ++-----
.../templates/html/search/form_options.php | 29 +--------------
5 files changed, 65 insertions(+), 71 deletions(-)
diff --git a/www/docs/admin/banner.php b/www/docs/admin/banner.php
index dc49eda80f..234de8619c 100644
--- a/www/docs/admin/banner.php
+++ b/www/docs/admin/banner.php
@@ -21,22 +21,25 @@
print $out;
?>
diff --git a/www/docs/js/main.js b/www/docs/js/main.js
index 7d0959d61f..b3866de727 100644
--- a/www/docs/js/main.js
+++ b/www/docs/js/main.js
@@ -372,6 +372,42 @@ $(function(){
t.parent().next(".nav-menu").toggleClass('closed');
});
+ $('.js-show-all-votes').on('click', function(){
+ $(this).fadeOut();
+ $('.policy-vote--minor').slideDown();
+ $('#policy-votes-type').text('All');
+ });
+
+ $('a[href="#past-list-dates"]').on('click', function(e){
+ e.preventDefault();
+ $(this).trigger('blur');
+ $('#past-list-dates').slideToggle();
+ })
+
+ // Move advanced search options to appear *before* results.
+ // (This means non-javascript users don't have to scroll past it
+ // to see their search results.)
+ $('.js-search-form-without-options').replaceWith( $('.js-search-form-with-options') );
+
+ // Show/hide advanced search options.
+ $('.js-toggle-search-options').on('click', function(e){
+ e.preventDefault();
+ var id = $(this).attr('href'); // #options
+ if($(id).is(':visible')){
+ $('.js-toggle-search-options[href="' + id + '"]').removeClass('toggled');
+ $(id).slideUp(250, function(){
+ // Disable the inputs *after* they're hidden (less distracting).
+ $(id).find(':input').attr('disabled', 'disabled');
+ });
+ } else {
+ $('.js-toggle-search-options[href="' + id + '"]').addClass('toggled');
+ $(id).find(':input:disabled').removeAttr('disabled');
+ $(id).slideDown(250);
+ }
+ });
+ if (!$('#options').data('advanced')) {
+ $("#options").find(":input").attr("disabled", "disabled");
+ }
});
// Backwards-compatible functions for the click/submit trackers on MP pages
diff --git a/www/includes/easyparliament/templates/html/mp/divisions.php b/www/includes/easyparliament/templates/html/mp/divisions.php
index c4400712ef..65f68e77f8 100644
--- a/www/includes/easyparliament/templates/html/mp/divisions.php
+++ b/www/includes/easyparliament/templates/html/mp/divisions.php
@@ -39,6 +39,12 @@
+
@@ -73,7 +79,9 @@
data on PublicWhip.org.uk.
-
+
We don’t have enough information to calculate = $full_name ?>’s position on this issue
@@ -85,12 +93,6 @@
-
-
diff --git a/www/includes/easyparliament/templates/html/people/index.php b/www/includes/easyparliament/templates/html/people/index.php
index 9652257186..1d308f7f9c 100644
--- a/www/includes/easyparliament/templates/html/people/index.php
+++ b/www/includes/easyparliament/templates/html/people/index.php
@@ -209,6 +209,9 @@
suitable for Excel
+
-
MSPs at 2011 election
diff --git a/www/includes/easyparliament/templates/html/search/form_options.php b/www/includes/easyparliament/templates/html/search/form_options.php
index f50bbb542c..3f1df32679 100644
--- a/www/includes/easyparliament/templates/html/search/form_options.php
+++ b/www/includes/easyparliament/templates/html/search/form_options.php
@@ -1,4 +1,4 @@
-