summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-03-28 03:05:10 +0200
committerDylan William Hardison <dylan@hardison.net>2017-04-04 03:43:30 +0200
commit9f9e989704b5274afba6a1de0b7bdcc6e7296314 (patch)
tree01cc75a06bfb6cf60960fa72de90ad1084a6dfdb /js
parent30c35b3aefc582e1bb123b309f9c4971c04094ee (diff)
downloadbugzilla-9f9e989704b5274afba6a1de0b7bdcc6e7296314.tar.gz
bugzilla-9f9e989704b5274afba6a1de0b7bdcc6e7296314.tar.xz
Bug 1350909 - Make index.cgi cache-friendly for logged out requests
Diffstat (limited to 'js')
-rw-r--r--js/global.js52
1 files changed, 47 insertions, 5 deletions
diff --git a/js/global.js b/js/global.js
index a997821f4..651d10241 100644
--- a/js/global.js
+++ b/js/global.js
@@ -16,6 +16,8 @@
*
*/
+var BUGZILLA = $('head').data('bugzilla');
+
$(function () {
$('.show_mini_login_form').on("click", function (event) {
return show_mini_login_form($(this).data('qs-suffix'));
@@ -32,15 +34,55 @@ $(function () {
$('.check_mini_login_fields').on("click", function (event) {
return check_mini_login_fields($(this).data('qs-suffix'));
});
- $('form .quicksearch_check_empty').on("submit", function (event) {
+ $('.quicksearch_check_empty').on("submit", function (event) {
if (this.quicksearch.value == '') {
- alert('Please enter one or more search terms first.');
- return false;
+ alert('Please enter one or more search terms first.');
+ event.preventDefault();
}
- return true;
});
+
+ unhide_language_selector();
+ $("#lob_action").on("change", update_text);
+ $("#lob_newqueryname").on("keyup", manage_old_lists);
});
+function unhide_language_selector() {
+ $('#lang_links_container').removeClass('bz_default_hidden');
+}
+
+function update_text() {
+ // 'lob' means list_of_bugs.
+ var lob_action = document.getElementById('lob_action');
+ var action = lob_action.options[lob_action.selectedIndex].value;
+ var text = document.getElementById('lob_direction');
+ var new_query_text = document.getElementById('lob_new_query_text');
+
+ if (action == "add") {
+ text.innerHTML = "to";
+ new_query_text.style.display = 'inline';
+ }
+ else {
+ text.innerHTML = "from";
+ new_query_text.style.display = 'none';
+ }
+}
+
+function manage_old_lists() {
+ var old_lists = document.getElementById('lob_oldqueryname');
+ // If there is no saved searches available, returns.
+ if (!old_lists) return;
+
+ var new_query = document.getElementById('lob_newqueryname').value;
+
+ if (new_query != "") {
+ old_lists.disabled = true;
+ }
+ else {
+ old_lists.disabled = false;
+ }
+}
+
+
function show_mini_login_form( suffix ) {
$('#login_link' + suffix).addClass('bz_default_hidden');
$('#mini_login' + suffix).removeClass('bz_default_hidden');
@@ -148,4 +190,4 @@ $().ready(function() {
$(window).on('pageshow', function(event) {
$('.bz_autocomplete').attr('autocomplete', 'off');
});
-});
+}); \ No newline at end of file