From 2e0baf1c1d9fad8447ba2c94154319038e7af6c6 Mon Sep 17 00:00:00 2001 From: Georg Fischer Date: Fri, 11 Apr 2014 21:26:50 +0200 Subject: [PATCH] update sharing links to close upon changing the controls, as rquested by @andsynchrony --- scripts/src/upload-imgur.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/src/upload-imgur.js b/scripts/src/upload-imgur.js index a596314..97f60c5 100644 --- a/scripts/src/upload-imgur.js +++ b/scripts/src/upload-imgur.js @@ -13,6 +13,7 @@ define( var facebook_link; var reddit_link; var is_uploading = false; + var is_showing_links = false; function init( shared ) { @@ -28,6 +29,8 @@ define( imgur_button.addEventListener( 'click', buttonClicked, false ); imgur_url_input.addEventListener( 'click', selectInput, false ); + + signals['control-updated'].add( controlsUpdated ); } function buttonClicked( event ) @@ -101,6 +104,8 @@ define( twitter_link.href = 'https://twitter.com/intent/tweet?text=' + encodeURIComponent( twitter_share_url_text ); facebook_link.href = facebook_share_url; reddit_link.href = 'http://www.reddit.com/submit?url=' + encodeURIComponent( response.data.link ) + '&title=Glitch!'; + + is_showing_links = true; } else @@ -116,6 +121,19 @@ define( imgur_url_container.classList.add( 'is-active', 'upload-failed' ); } + function controlsUpdated() + { + if ( is_showing_links ) + { + imgur_url_container.classList.remove( 'is-active' ); + imgur_url_container.classList.remove( 'upload-failed' ); + imgur_url_container.classList.remove( 'upload-successful' ); + imgur_button.classList.remove( 'is-uploading' ); + + is_showing_links = false; + } + } + return { init: init }; } ); \ No newline at end of file