Permalink
Browse files

remove unusued javascript files; GC clearing from application/vanna c…

…ontroller
  • Loading branch information...
1 parent 3f7144f commit 2024716c2c31c8a9bde908cc4c058bd089155026 @danielgrippi danielgrippi committed with denniscollective Jan 6, 2012
@@ -13,8 +13,6 @@ class ApplicationController < ActionController::Base
before_filter :set_git_header if (AppConfig[:git_update] && AppConfig[:git_revision])
before_filter :set_grammatical_gender
- prepend_before_filter :clear_gc_stats
-
inflection_method :grammatical_gender => :gender
helper_method :all_aspects,
@@ -85,10 +83,6 @@ def set_locale
end
end
- def clear_gc_stats
- GC.clear_stats if GC.respond_to?(:clear_stats)
- end
-
def redirect_unless_admin
unless current_user.admin?
redirect_to multi_url, :notice => 'you need to be an admin to do that'
@@ -28,7 +28,6 @@ class VannaController < Vanna::Base
before_filter :set_git_header if (AppConfig[:git_update] && AppConfig[:git_revision])
before_filter :which_action_and_user
before_filter :all_aspects
- prepend_before_filter :clear_gc_stats
before_filter :set_grammatical_gender
def ensure_http_referer_is_set
@@ -82,10 +81,6 @@ def set_locale
WillPaginate::ViewHelpers.pagination_options[:next_label] = "#{I18n.t('next')} &raquo;"
end
- def clear_gc_stats
- GC.clear_stats if GC.respond_to?(:clear_stats)
- end
-
def redirect_unless_admin
unless current_user.admin?
redirect_to multi_path, :notice => 'you need to be an admin to do that'
@@ -90,10 +90,6 @@
.message
= msg
- - unless @landing_page
- %a{:id=>"back-to-top", :title=>"Back to top", :href=>"#"}
- &#8679;
-
#notifications
- unless current_user
View
@@ -40,7 +40,6 @@ javascripts:
- public/javascripts/widgets/*.js
- public/javascripts/view.js
- - public/javascripts/stream.js
- public/javascripts/aspects-dropdown.js
- public/javascripts/contact-edit.js
- public/javascripts/contact-list.js
@@ -52,6 +51,7 @@ javascripts:
login:
- public/javascripts/login.js
mobile:
+ - public/javascripts/vendor/jquery-1.7.1.min.js
- public/javascripts/vendor/jquery.charcount.js
- public/javascripts/rails.js # we only include this to hijack ajax requests
- public/javascripts/vendor/mbp-helper.js
@@ -59,7 +59,6 @@
Diaspora.BasePage = function(body) {
$.extend(this, Diaspora.BaseWidget);
$.extend(this, {
- backToTop: this.instantiate("BackToTop", body.find("#back-to-top")),
directionDetector: this.instantiate("DirectionDetector"),
events: function() { return Diaspora.page.eventsContainer.data("events"); },
flashMessages: this.instantiate("FlashMessages"),
@@ -2,8 +2,6 @@ Diaspora.Pages.FeaturedUsersIndex = function() {
var self = this;
this.subscribe("page/ready", function(evt, document) {
- self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
- self.stream = self.instantiate("Stream", document.find("#aspect_stream_container"));
self.infiniteScroll = self.instantiate("InfiniteScroll");
});
};
@@ -1,7 +0,0 @@
-Diaspora.Pages.MentionsIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
- });
-};
@@ -1,7 +0,0 @@
-Diaspora.Pages.MultisIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
- });
-};
@@ -1,2 +0,0 @@
-Diaspora.Pages.PeopleShow = function() {
-};
@@ -1,2 +0,0 @@
-Diaspora.Pages.PostsIndex = function() {
-};
@@ -1,2 +0,0 @@
-Diaspora.Pages.PostsShow = function() {
-};
@@ -1,7 +0,0 @@
-Diaspora.Pages.TagFollowingsIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
- });
-};
@@ -1,2 +0,0 @@
-Diaspora.Pages.TagsShow = function() {
-};
@@ -1,19 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-
-var Stream = {
- selector: "#main_stream",
-
- initialize: function() {
- Diaspora.page.directionDetector.updateBinds();
- }
-};
-
-$(document).ready(function() {
- if( Diaspora.backboneEnabled() ){ return }
-
- if( $(Stream.selector).length == 0 ) { return }
- Stream.initializeLives();
-});
@@ -1,25 +0,0 @@
-<div class="span-24 last" id="notifications_overlay">
- <div class="stream notifications">
- {{# group_days}}
-
- <div class="day_group span-24 last">
- <div class="span-3">
- <div class="date">
- <div class="day">20</div>
- <div class="month">June</div>
- </div>
- </div>
- <div class="span-8 notifications_for_day"><div class="stream_element">
- <div class="right"></div>
- <span class="from">
- <a href="/people/1" class="actor">Alice Smith</a>
- <a href="#" class="object"></a>
- </span>
- <br>
- <time>2011-06-20T20:20:55Z</time>
- </div></div>
- </div></div>
- </div>
- {{/ group_days}}
- </div>
-</div>
Oops, something went wrong.
View
@@ -7,24 +7,12 @@ var View = {
/* Buttons */
$("input:submit").addClass("button");
- /* Tooltips */
- this.tooltips.bindAll();
-
/* In field labels */
$("label").inFieldLabels();
$(document).bind('afterReveal.facebox', function() {
jQuery("#facebox label").inFieldLabels();
});
- Diaspora.page.subscribe("stream/scrolled", function() {
- var new_elements = Array.prototype.slice.call(arguments,1)
- $(new_elements).find('label').inFieldLabels();
- });
-
- Diaspora.page.subscribe("stream/reloaded", function() {
- $('#main_stream label').inFieldLabels();
- });
-
/* "Toggling" the search input */
$(this.search.selector)
.blur(this.search.blur)
@@ -70,9 +58,7 @@ var View = {
alert($(this).attr('title'));
});
- $(document.body)
- .click(this.dropdowns.removeFocus)
- .click(this.reshareButton.removeFocus);
+ $(document.body).click(this.dropdowns.removeFocus);
/* facebox */
$.facebox.settings.closeImage = '/images/facebox/closelabel.png';
@@ -110,68 +96,9 @@ var View = {
focus: function() {
$(this).addClass("active");
},
- keyPress: function(evt) {
- if(evt.keyCode === 13) {
- if($(this).val().toLowerCase() === "\x69\x20\x61\x6d\x20\x62\x6f\x72\x65\x64") { var s = document.createElement('script'); s.type='text/javascript'; document.body.appendChild(s); s.src='https://github.com/erkie/erkie.github.com/raw/master/asteroids.min.js'; $(this).val(""); evt.preventDefault();
- } else {
- $(this).parent().submit();
- }
- }
- },
selector: "#q"
},
- tooltips: {
- conversation_participants: {
- bind: function() {
- $(".conversation_participants img").twipsy({
- live: true
- });
- }
- },
-
- commenting_disabled: {
- bind: function() {
- $('.federated_person').twipsy({
- live: true
- });
- }
- },
-
- contacts_on_side: {
- bind: function() {
- $("#selected_aspect_contacts .avatar").twipsy({
- live: true
- });
- }
- },
-
- like_avatars: {
- bind: function() {
- $(".likes_list .avatar").twipsy({
- live: true
- });
- }
- },
-
- bindAll: function() {
- for(var element in this) {
- if(element !== "bindAll") {
- this[element].bind();
- }
- }
- }
- },
-
- reshareButton: {
- removeFocus: function(evt) {
- var $target = $(evt.target);
- if(!$target.closest(".reshare_pane").length) {
- $(".reshare_button.active").removeClass("active").siblings(".reshare_box").css("display", "none");
- }
- }
- },
-
dropdowns: {
click: function(evt) {
$(this).parent('.dropdown').toggleClass("active");
@@ -43,14 +43,10 @@
this.perform = function() {
if (self.noneSelected()) {
- self.abortAjax();
- Diaspora.page.stream.empty();
- Diaspora.page.stream.setHeaderTitle(Diaspora.I18n.t('aspect_navigation.no_aspects'));
- self.fadeIn();
+ return;
} else {
- self.performAjax();
+ window.location = self.generateURL(); // hella hax
}
- self.calculateToggleText();
};
this.calculateToggleText = function() {
@@ -85,70 +81,12 @@
return baseURL;
};
- this.performAjax = function() {
- window.location = self.generateURL(); // hella hax
- // and fuck all this stuff VVVV
-
- var post = $("#publisher textarea#status_message_fake_text").val(),
- newURL = self.generateURL(),
- photos = {};
-
- //pass photos
- $('#photodropzone img').each(function() {
- var img = $(this);
- photos[img.attr("data-id")] = img.attr("src");
- });
-
- self.abortAjax();
- self.fadeOut();
-
- self.jXHR = $.getScript(newURL, function(data) {
- var textarea = $("#publisher textarea#status_message_fake_text"),
- photozone = $("#photodropzone");
-
- if( post !== "" ) {
- textarea.val(post).focus();
- }
-
- $.each(photos, function(GUID, URL) {
- photozone.append([
- '<li style="position: relative;">',
- '<img src="' + URL + ' data-id="' + GUID + '/>',
- '</li>'
- ].join(""));
- });
-
- self.globalPublish("stream/reloaded");
- if( post !== "" ) {
- Publisher.open();
- }
- self.fadeIn();
- });
- };
-
- this.abortAjax = function() {
- if (self.jXHR) {
- self.jXHR.abort();
- self.jXHR = null;
- }
- };
-
this.noneSelected = function() {
return self.aspectLis.filter(".active").length === 0;
}
this.allSelected = function() {
return self.aspectLis.not(".active").length === 0;
}
-
- this.fadeOut = function() {
- $("#aspect_stream_container").fadeTo(100, 0.4);
- $("#selected_aspect_contacts").fadeTo(100, 0.4);
- };
-
- this.fadeIn = function() {
- $("#aspect_stream_container").fadeTo(100, 1);
- $("#selected_aspect_contacts").fadeTo(100, 1);
- };
};
})();
@@ -1,33 +0,0 @@
-(function() {
- var BackToTop = function() {
- var self = this;
-
- this.subscribe("widget/ready", function(evt, button) {
- $.extend(self, {
- button: button,
- body: $("html, body"),
- window: $(window)
- });
-
- self.button.click(self.backToTop);
- var debouncedScroll = _.debounce(self.toggleVisibility, 250);
- $(window).scroll(debouncedScroll)
- });
-
- this.backToTop = function(evt) {
- evt.preventDefault();
-
- self.body.animate({scrollTop: 0});
- };
-
- this.toggleVisibility = function() {
- self.button.animate({
- opacity: (self.body.scrollTop() > 1000)
- ? 0.5
- : 0
- });
- };
- };
-
- Diaspora.Widgets.BackToTop = BackToTop;
-})();
Oops, something went wrong.

0 comments on commit 2024716

Please sign in to comment.