From 00cce0574f97171d99f848a4ceed7fb55552c886 Mon Sep 17 00:00:00 2001 From: Gregory Koberger Date: Thu, 17 May 2012 00:24:06 -0700 Subject: [PATCH] Allow pre-filling of manifest URL box --- media/js/devreg/devhub.js | 18 ++++++++++++++++-- media/js/impala/capabilities.js | 8 ++++++++ media/js/mkt/capabilities.js | 8 ++++++++ mkt/asset_bundles.py | 1 + 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/media/js/devreg/devhub.js b/media/js/devreg/devhub.js index d1174c7684..4137f18416 100644 --- a/media/js/devreg/devhub.js +++ b/media/js/devreg/devhub.js @@ -2,6 +2,12 @@ $(document).ready(function() { // Edit Add-on $("#edit-addon").exists(initEditAddon); + // Save manifest if passed in + var params = z.getVars(); + if('manifest' in params && z.capabilities.sessionStorage) { + window.sessionStorage['manifest_url'] = params['manifest']; + } + //Ownership $("#author_list").exists(function() { initAuthorFields(); @@ -47,8 +53,9 @@ $(document).ready(function() { $('#upload-addon').addonUploader(opt); } - if($('#upload-webapp-url').exists()) { - $('#upload-webapp-url').bind("keyup change paste blur", function(e) { + var $webapp_url = $('#upload-webapp-url'); + if($webapp_url.exists()) { + $webapp_url.bind("keyup change paste blur", function(e) { var $this = $(this), $button = $('#validate_app'), // Ensure it's at least "protocol://host/something". @@ -172,6 +179,12 @@ $(document).ready(function() { } } } + + if(z.capabilities.sessionStorage && window.sessionStorage['manifest_url'] && !$webapp_url.val()) { + $webapp_url.val(window.sessionStorage['manifest_url']); + $webapp_url.trigger('change'); + $('#validate_app').trigger('click'); + } } $('.invisible-upload a').click(_pd); @@ -1113,3 +1126,4 @@ function initInAppConfig($dom) { setProtocol(); } + diff --git a/media/js/impala/capabilities.js b/media/js/impala/capabilities.js index d7f4623eb6..15a2949ae2 100644 --- a/media/js/impala/capabilities.js +++ b/media/js/impala/capabilities.js @@ -5,6 +5,7 @@ z.capabilities = { 'console': window.console && (typeof window.console.log == 'function'), 'replaceState': typeof history.replaceState === 'function', 'localStorage': false, + 'sessionStorage': false, 'webApps': !!(navigator.mozApps && navigator.mozApps.install), 'app_runtime': !!( navigator.mozApps && @@ -20,3 +21,10 @@ try { } } catch (e) { } + +try { + if ('sessionStorage' in window && window['sessionStorage'] !== null) { + z.capabilities.sessionStorage = true; + } +} catch (e) { +} diff --git a/media/js/mkt/capabilities.js b/media/js/mkt/capabilities.js index 7a9f9e117b..281a57b274 100644 --- a/media/js/mkt/capabilities.js +++ b/media/js/mkt/capabilities.js @@ -5,6 +5,7 @@ z.capabilities = { 'console': window.console && (typeof window.console.log == 'function'), 'replaceState': typeof history.replaceState === 'function', 'localStorage': false, + 'sessionStorage': false, 'webApps': !!(navigator.mozApps && navigator.mozApps.install), 'app_runtime': !!( navigator.mozApps && @@ -21,3 +22,10 @@ try { } } catch (e) { } + +try { + if ('sessionStorage' in window && window['sessionStorage'] !== null) { + z.capabilities.sessionStorage = true; + } +} catch (e) { +} diff --git a/mkt/asset_bundles.py b/mkt/asset_bundles.py index 0ba0d50271..159abf3a8f 100644 --- a/mkt/asset_bundles.py +++ b/mkt/asset_bundles.py @@ -129,6 +129,7 @@ JS = { 'js/lib/jquery.cookie.js', 'js/zamboni/storage.js', 'js/zamboni/tabs.js', + 'js/impala/serializers.js', # jQuery UI. 'js/lib/jquery-ui/jquery.ui.core.js',