Fixed loading feature status page queries and anchor link URLs
authorjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 18:32:09 +0000 (18:32 +0000)
committerjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 18:32:09 +0000 (18:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175156

Reviewed by Simon Fraser.

* wp-content/themes/webkit/status.php:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220280 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/webkit.org/ChangeLog
Websites/webkit.org/wp-content/themes/webkit/status.php

index af1a0d9..819cb9c 100644 (file)
@@ -1,3 +1,12 @@
+2017-08-04  Jon Davis  <jond@apple.com>
+
+        Fixed loading feature status page queries and anchor link URLs
+        https://bugs.webkit.org/show_bug.cgi?id=175156
+
+        Reviewed by Simon Fraser.
+
+        * wp-content/themes/webkit/status.php:
+
 2017-07-26  Frederic Wang  <fwang@igalia.com>
 
         Unreviewed, minor adjustments to the previous demo.
index a2d1e5e..2544c38 100644 (file)
@@ -744,6 +744,11 @@ function initializeStatusPage() {
             } else filtersForm.className += " opened";
         });
 
+        var searchTerm = searchTermFromURL();
+        if (searchTerm.length) {
+            inputField.value = searchTerm;
+            inputField.placeholder = '';
+        }
         inputField.addEventListener('input', function() { updateSearch(featuresArray); });
         
 
@@ -817,6 +822,18 @@ function initializeStatusPage() {
         return visibleCount;
     }
 
+    function searchTermFromURL()
+    {
+        var search = window.location.search;
+        var searchRegExp = /\#.*search=([^&]+)/;
+
+        var result;
+        if (result = window.location.href.match(searchRegExp))
+            return decodeURIComponent(result[1]);
+
+        return '';
+    }
+
     function isSearchMatch(feature, searchTerm)
     {
         if (feature.name.toLowerCase().indexOf(searchTerm) !== -1)
@@ -907,7 +924,7 @@ function initializeStatusPage() {
         
         updateSearch(everythingToShow);
 
-        if (window.location.hash) {
+        if (window.location.hash.length) {
             var hash = window.location.hash;
             window.location.hash = ""; // Change hash so navigation takes place
             window.location.hash = hash;
@@ -950,9 +967,12 @@ function initializeStatusPage() {
             appendDelimiter();
             searchString += 'status=' + activeStatusFilters.join(',');
         }
+        
+        if (searchString.length) {
+            var current = window.location.href;
+            window.location.href = current.replace(/\??#(.*)$/, '') + '#' + searchString;
+        }
 
-        var current = window.location.href;
-        window.location.href = current.replace(/#(.*)$/, '') + '#' + searchString;
     }