GitHub PullRequestReviewCommentEvent at 2014-01-24 09:17:03
Repository: zamboni
Actor: magopian
Payload: {"comment":{"url":"https://api.github.com/repos/mozilla/zamboni/pulls/comments/9143106","id":9143106,"diff_hunk":"@@ -1,172 +1,189 @@\n-function autofillPlatform(context) {\n-    var $context = $(context || document.body);\n-    $('#search', $context).bind('autofill', function(e) {\n-        var $this = $(this);\n-\n-        // Bail if we're searching within apps.\n-        if (!$this.find('#id_appver').length) {\n-            return;\n-        }\n+(function () {\n+    var storage = z.Storage('search');\n+    var appver_input = $('#id_appver');\n+    var platform_input = $('#id_platform');\n \n-        // Populate search form with browser version and OS.\n-        var gv = z.getVars(),\n-            appver = '',\n-            platform = '',\n-            appver_defined = typeof gv.appver !== 'undefined',\n-            platform_defined = typeof gv.platform !== 'undefined';\n-        if (appver_defined) {\n-            appver = gv.appver;\n-        }\n-        if (platform_defined) {\n-            platform = gv.platform;\n-        }\n-        if (z.appMatchesUserAgent) {\n-            if (!appver_defined) {\n-                appver = z.browserVersion;\n+    function autofillPlatform(context) {\n+        var $context = $(context || document.body);\n+\n+        $('#search', $context).bind('autofill', function(e) {\n+            var $this = $(this);\n+\n+            // Bail if we're searching within apps.\n+            if (!appver_input.length) {\n+                return;\n             }\n-            if (!platform_defined) {\n-                platform = z.platform;\n+\n+            // Populate search form with browser version and OS.\n+            var gv = z.getVars(),\n+                appver = '',\n+                platform = '',\n+                appver_defined = typeof gv.appver !== 'undefined',\n+                platform_defined = typeof gv.platform !== 'undefined';\n+\n+            var appver_saved = storage.get('appver');\n+            var platform_saved = storage.get('platform');\n+\n+            // Facets are either the ones defined in the URL, or the ones\n+            // stored in the local storage.\n+            // If none of them is defined, default to detected browser version\n+            // and platform.\n+            if (appver_defined) {\n+                storage.set('appver', gv.appver);\n+                appver_input.val(gv.appver);\n+            } else if (appver_saved !== null) {\n+                appver_input.val(appver_saved);\n+            } else if (z.appMatchesUserAgent) {\n+                appver_input.val(z.browserVersion);\n             }\n-        }\n-        $this.find('#id_appver').val(appver);\n-        $this.find('#id_platform').val(platform);\n-    }).trigger('autofill');\n-}\n+\n+            if (platform_defined) {\n+                storage.set('platform', gv.platform);\n+                platform_input.val(gv.platform);\n+            } else if (platform_saved !== null) {\n+                platform_input.val(platform_saved);\n+            } else if (z.appMatchesUserAgent) {\n+                platform_input.val(z.platform);\n+            }\n+        }).trigger('autofill');\n+    }\n \n \n-autofillPlatform();\n+    autofillPlatform();\n \n \n-$(function() {\n-    $('#search-facets').delegate('li.facet', 'click', function(e) {\n-        var $this = $(this);\n-        if ($this.hasClass('active')) {\n-            if ($(e.target).is('a')) {\n-                return;\n+    $(function() {\n+        $('#search-facets').delegate('li.facet', 'click', function(e) {","path":"media/js/impala/search.js","position":94,"original_position":94,"commit_id":"c51b780436d6e8d8451d48298c3ae052724b624a","original_commit_id":"c51b780436d6e8d8451d48298c3ae052724b624a","user":{"login":"magopian","id":167767,"avatar_url":"https://gravatar.com/avatar/9b35c43d59d44db55b7e4dc8b5e3626b?d=https%3A%2F%2Fidenticons.github.com%2F749876a01ad730ff2dd3c8f133927352.png&r=x","gravatar_id":"9b35c43d59d44db55b7e4dc8b5e3626b","url":"https://api.github.com/users/magopian","html_url":"https://github.com/magopian","followers_url":"https://api.github.com/users/magopian/followers","following_url":"https://api.github.com/users/magopian/following{/other_user}","gists_url":"https://api.github.com/users/magopian/gists{/gist_id}","starred_url":"https://api.github.com/users/magopian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magopian/subscriptions","organizations_url":"https://api.github.com/users/magopian/orgs","repos_url":"https://api.github.com/users/magopian/repos","events_url":"https://api.github.com/users/magopian/events{/privacy}","received_events_url":"https://api.github.com/users/magopian/received_events","type":"User","site_admin":false},"body":"yep, according to the jquery documentation, ```on()``` is only available from jquery version 1.7.0, and we're using jquery 1.6.4.","created_at":"2014-01-24T09:17:03Z","updated_at":"2014-01-24T09:17:03Z","html_url":"https://github.com/mozilla/zamboni/pull/1594#discussion_r9143106","pull_request_url":"https://api.github.com/repos/mozilla/zamboni/pulls/1594","_links":{"self":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/comments/9143106"},"html":{"href":"https://github.com/mozilla/zamboni/pull/1594#discussion_r9143106"},"pull_request":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/1594"}}}}