com web/php: Disable the search autocomplete for IE ≤ 8.: include/header.inc js/common.js js/search.js
| From: | Adam Harvey | Date: | Tue, 25 Mar 2014 17:13:22 +0000 |
| Subject: | com web/php: Disable the search autocomplete for IE ≤ 8.: include/header.inc js/common.js js/search.js | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-18590@lists.php.net to get a copy of this message | ||
Commit: 70231d3b448ae1aa06ad7c29bca234427a5e7827
Author: Adam Harvey <aharvey@php.net> Tue, 25 Mar 2014 10:12:01 -0700
Parents: 4eae7951d60d6a391ff0095473d75e8b202a0c34
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=70231d3b448ae1aa06ad7c29bca234427a5e7827
Log:
Disable the search autocomplete for IE ≤ 8.
Fixes the JS fail in bug #66207, but does nothing about the styling.
Bugs:
https://bugs.php.net/66207
Changed paths:
M include/header.inc
M js/common.js
M js/search.js
Diff:
diff --git a/include/header.inc b/include/header.inc
index 6960081..71d19ae 100644
--- a/include/header.inc
+++ b/include/header.inc
@@ -65,6 +65,12 @@ if ($config["cache"]) {
<link rel="stylesheet" type="text/css" href="<?php echo $MYSITE
?>styles/workarounds.ie7.css" media="screen" />
<![endif]-->
+ <!--[if lte IE 8]>
+ <script type="text/javascript">
+ window.brokenIE = true;
+ </script>
+ <![endif]-->
+
<!--[if lte IE 9]>
<link rel="stylesheet" type="text/css" href="<?php echo $MYSITE
?>styles/workarounds.ie9.css" media="screen" />
<![endif]-->
diff --git a/js/common.js b/js/common.js
index 6b2127c..455a629 100755
--- a/js/common.js
+++ b/js/common.js
@@ -510,11 +510,13 @@ $(document).ready(function() {
);
/*}}}*/
- // Search box autocomplete.
- jQuery("#topsearch .search-query").search({
- language: getLanguage(),
- limit: 30
- });
+ // Search box autocomplete (for browsers that aren't IE <= 8, anyway).
+ if (typeof window.brokenIE === "undefined") {
+ jQuery("#topsearch .search-query").search({
+ language: getLanguage(),
+ limit: 30
+ });
+ }
/* {{{ Negative user notes fade-out */
var usernotes = document.getElementById('usernotes');
diff --git a/js/search.js b/js/search.js
index 146dbe1...4ceaf20 100644
--- a/js/search.js
+++ b/js/search.js
@@ -16,7 +16,6 @@
this.elements = {};
};
-
/**
* Adds an item to the backend.
*
@@ -245,12 +244,19 @@
var backends = processIndex(data);
// Cache the data if we can.
if (canCache()) {
- window.localStorage.setItem(key,
- JSON.stringify({
- data: backends,
- time: new Date().getTime()
- })
- );
+ /* This may fail in IE 8 due to exceeding the local
+ * storage limit. If so, squash the exception: this
+ * isn't a required part of the system. */
+ try {
+ window.localStorage.setItem(key,
+ JSON.stringify({
+ data: backends,
+ time: new Date().getTime()
+ })
+ );
+ } catch (e) {
+ // Derp.
+ }
}
success(backends);
},