Browse Source

JSlint cleanups

Jordi Boggiano 11 years ago
parent
commit
bc8b249e67

+ 9 - 7
src/Packagist/WebBundle/Resources/public/js/search.js

@@ -1,6 +1,8 @@
-"use strict";
-
+/*jslint browser: true */
+/*global jQuery: true */
 (function ($) {
+    "use strict";
+
     var list = $('.search-list'),
         form = $('form#search-form'),
         showResults,
@@ -37,11 +39,11 @@
             return;
         }
 
-        if (history.pushState) {
-            if (typeof previousQuery === 'undefined') {
-                history.pushState(null, "Search", "/search/?q=" + $('input[type="search"]', form).val());
+        if (window.history.pushState) {
+            if (previousQuery === undefined) {
+                window.history.pushState(null, "Search", "/search/?q=" + $('input[type="search"]', form).val());
             } else {
-                history.replaceState(null, "Search", "/search/?q=" + $('input[type="search"]', form).val());
+                window.history.replaceState(null, "Search", "/search/?q=" + $('input[type="search"]', form).val());
             }
         }
 
@@ -111,4 +113,4 @@
             }
         }
     });
-})(jQuery);
+}(jQuery));

+ 1 - 1
src/Packagist/WebBundle/Resources/views/layout.html.twig

@@ -119,7 +119,7 @@
         <script src="{{ asset('js/libs/humane.min.js?v=2') }}"></script>
         <script src="{{ asset('js/libs/ZeroClipboard.min.js') }}"></script>
         <script src="{{ asset('bundles/packagistweb/js/layout.js?v=2') }}"></script>
-        <script src="{{ asset('bundles/packagistweb/js/search.js?v=3')}}"></script>
+        <script src="{{ asset('bundles/packagistweb/js/search.js?v=4')}}"></script>
 
         {% if not app.debug and google_analytics.ga_key %}
             <script>