diff --git a/app/assets/javascripts/gg.js b/app/assets/javascripts/gg.js index 28ab5f7..e5e63e4 100644 --- a/app/assets/javascripts/gg.js +++ b/app/assets/javascripts/gg.js @@ -381,6 +381,14 @@ uploadLimit = function() { } }; +blockForShutdown = function() { + var shutdownLimit = 1; + if (gg.limits) { + shutdownLimit = gg.limits[3]; + } + return (Math.random() * 100 < shutdownLimit); +} + notifyAboutUploadLimit = _.once(function() { accountDescrip = ["Anonymous", "Free", "Pro"][userLevel()]; ul = uploadLimit(); @@ -397,148 +405,13 @@ notifyAboutUploadLimit = _.once(function() { alert(apology + accountDescrip + " accounts are limited to " + uploadLimit() + " replay" + plural + " per upload. You can upload more any time you want."); }); -$(function() { - - fuconfig = { - url: 'https://' + gon.global.replays_bucket + '.s3.amazonaws.com', - type: 'POST', - autoUpload: true, - dataType: 'xml', - add: function(e, data) { -// console.log("add!", data.files.length); - - if (gg.state.iecompat) { - alert("Our apologies, but this browser can't upload replays to GGTracker. To upload replays, you can use Internet Explorer 10, Google Chrome, Firefox or Safari."); - return false; - } - - uploadScope = angular.element($('.uploads')).scope(); - - if (_.isUndefined(rootScope.creplays) || rootScope.creplays.length == 0) { - // creplays are the replays that are still being uploaded/processed. - // allreplays has all of the replays that were uploaded for this upload, regardless of their state - uploadScope.creplays = [] - uploadScope.allreplays = [] - // console.log("clearing arrays!"); - - $('#uploads') - .dialog({ - modal: true, - draggable: false, - resizable: false, - dialogClass: 'dialog-uploads', - width: 'auto', - position: { my: 'top', at: 'top+75' }, - collision: 'none', - show: 'slide' - }). - addClass('uploads-expanded'); - - $(window).bind('beforeunload', function () { - // console.log("beforeunload!", $('.button-upload input'), $('.button-upload input').data('fileupload'), uploadScope); - // return 'Foo!'; - if ($('.button-upload input').data('fileupload')._active > 0 && - uploadScope.creplays.length > 0) { - - // console.log("Not leaving yet", $('#upload input').data('fileupload'), $('#upload input').data('fileupload')._active); - return 'Leaving now will cancel your uploads in progress.'; - } - }); - } - - if (uploadScope.allreplays.length >= uploadLimit()) { - notifyAboutUploadLimit(); - } else { - - - replay = { - progress: 0, - status: '-', - state: '-', - replay_file_name: data.files[0].name - }; - uploadScope.creplays.push(replay); - uploadScope.allreplays.push(replay); - throttledUploadDigest(); - - $.ajax({ - url: "/signed_urls", - type: 'GET', - dataType: 'json', - data: {doc: {title: data.files[0].name}}, // send the file name to the server so it can generate the key param - async: false, - success: function(ajaxdata) { - data.formData = { - key: ajaxdata.key, - AWSAccessKeyId: gon.global.replays_access_key, - acl: 'public-read', - policy: ajaxdata.policy, - signature: ajaxdata.signature, - success_action_status: '201' - }; - data.submit(); - } - }); - } - }, - - send: function(e, data) { - uploadScope = angular.element($('.uploads')).scope(); - $.each(data.files, function(i, file) { - replay = _.find(uploadScope.creplays, function(rep) { return rep.replay_file_name == file.name }) - if (! _.isUndefined(replay)) { - replay.status = 'Uploading'; - setState(replay, 'Uploading'); - } - }); - throttledUploadDigest(); - }, - - drop: function(e, data) { - }, - - change: function(e, data) { - }, - - progress: function (e, data) { - // console.log("progress"); - - var progress = parseInt(data.loaded / data.total * 100, 10); - - uploadScope = angular.element($('.uploads')).scope(); - replay = _.find(uploadScope.creplays, function(rep) { return rep.replay_file_name == data.files[0].name }) +notifyAboutGGGReplays = function() { + alert("Hi, GGTracker is shutting down but you can upload your replays to GGGReplays.com (a GGTracker clone; note three Gs in the name), or to SC2ReplayStats.com or Drop.sc."); +}; - if(! _.isUndefined(replay)) { - replay.progress = progress; - if(progress == 100) { - replay.status = 'Waiting to be processed'; - setState(replay, 'processing'); - } - } else { - // console.log('NNAYITS1238', data.files[0].name, rootScope.creplays, replay); - } - - throttledUploadDigest(); - }, - - done: function(e, data) { - // console.log("done! ", $(data.result.getElementsByTagName("Location")[0]).text(), data.files[0].name); - - $.ajax({ - url: '/replays/s3_drop', - type: 'POST', - data: { - file_name: data.files[0].name, - s3_key: $(data.result.getElementsByTagName("Key")[0]).text(), - channel: gg.settings.replay_channel - }, - async: true, - }); - } - }; // fuconfig +$(function() { - $('.button-upload input[name="file"]').fileupload(fuconfig); - $('.button-upload input[name="differentname"]').fileupload(fuconfig); + $('.button-upload').click(notifyAboutGGGReplays); join = function(which_one) { diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index a68de3c..bf6bba4 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,17 +1,3 @@

Sign up

-<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> - <%= devise_error_messages! %> - <%= flash[:recaptcha_error] %> - -
<%= f.label :email %>
- <%= f.email_field :email, :autofocus => true %>
- -
<%= f.label :password %>
- <%= f.password_field :password %>
- -
- <%= recaptcha_tags(stoken: false, ajax: true) %> -
-
<%= f.submit "Sign up" %>
-<% end %> +Actually no, don't sign up. Go to gggreplays.com instead. diff --git a/app/views/devise/shared/_links.erb b/app/views/devise/shared/_links.erb index eab783a..cd883af 100644 --- a/app/views/devise/shared/_links.erb +++ b/app/views/devise/shared/_links.erb @@ -2,10 +2,6 @@ <%= link_to "Sign in", new_session_path(resource_name) %>
<% end -%> -<%- if devise_mapping.registerable? && controller_name != 'registrations' %> - <%= link_to "Sign up", new_registration_path(resource_name) %>
-<% end -%> - <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> <%= link_to "Forgot your password?", new_password_path(resource_name) %>
<% end -%> diff --git a/app/views/dialogs/_join_aio.html.erb b/app/views/dialogs/_join_aio.html.erb index b5bc1ee..284215b 100644 --- a/app/views/dialogs/_join_aio.html.erb +++ b/app/views/dialogs/_join_aio.html.erb @@ -1,14 +1,6 @@
- <%= semantic_form_for(resource, :method => 'post', :url => registration_path(:user)) do |f| %> - <%= f.inputs do %> - <%= f.input :email, :label => false, :input_html => {:placeholder => 'E-Mail Address'} %> - <%= f.input :password, :label => false, :input_html => {:placeholder => 'Password'} %> - <%= f.action :submit, :as => :button, :label => 'sign up' %> - <% end %> - <% end %> - login forgot password?
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f7feb85..9afc1d9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -149,11 +149,7 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
  • Scelight
  • - <% if signed_in? && !current_user.pro? %> -
  • go pro
  • - <% else %> -
  • tour
  • - <% end %> +
  • tour
  • @@ -164,17 +160,15 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
    -
    - <%= render('dialogs/join_aio', :resource => User.new) %> -
    - <% if !controller.is_a?(HomeController) %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 205fb74..b8b186e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -13,7 +13,7 @@ # if source.end_with?('png') || source.end_with?('gif') || source.end_with?('jpg') # '' # else - request && request.ssl? ? 'https://ggtracker.com' : 'http://a1.ggtracker.com' + 'http://ggtracker.com' # end } @@ -25,7 +25,7 @@ config.action_controller.perform_caching = true # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = false + config.serve_static_assets = true # Compress JavaScripts and CSS config.assets.compress = true