Remove unused code
This commit is contained in:
parent
98c3a0a871
commit
022bc1007d
17 changed files with 1 additions and 451 deletions
145
app/assets/javascripts/bootstrap-scrollspy-custom.js
vendored
145
app/assets/javascripts/bootstrap-scrollspy-custom.js
vendored
|
|
@ -1,145 +0,0 @@
|
|||
/* =============================================================
|
||||
* bootstrap-scrollspy.js v2.0.3
|
||||
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
|
||||
* =============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ============================================================== */
|
||||
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* SCROLLSPY CLASS DEFINITION
|
||||
* ========================== */
|
||||
|
||||
function ScrollSpy( element, options) {
|
||||
var process = $.proxy(this.process, this)
|
||||
, $element = $(element).is('body') ? $(window) : $(element)
|
||||
, href
|
||||
this.options = $.extend({}, $.fn.scrollspy.defaults, options)
|
||||
this.$scrollElement = $element.on('scroll.scroll.data-api', process)
|
||||
this.selector = (this.options.target
|
||||
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||
|| '')
|
||||
this.$body = $('body')
|
||||
this.refresh()
|
||||
this.process()
|
||||
}
|
||||
|
||||
ScrollSpy.prototype = {
|
||||
|
||||
constructor: ScrollSpy
|
||||
|
||||
, refresh: function () {
|
||||
var self = this
|
||||
, $targets
|
||||
|
||||
this.offsets = $([])
|
||||
this.targets = $([])
|
||||
|
||||
$targets = this.$body
|
||||
.find(this.selector)
|
||||
.map(function () {
|
||||
var $el = $(this)
|
||||
, href = $el.data('target') || $el.attr('href')
|
||||
, $href = /^#\w/.test(href) && $(href)
|
||||
return ( $href
|
||||
&& href.length
|
||||
&& [[ $href.position().top, href ]] ) || null
|
||||
})
|
||||
.sort(function (a, b) { return a[0] - b[0] })
|
||||
.each(function () {
|
||||
self.offsets.push(this[0])
|
||||
self.targets.push(this[1])
|
||||
})
|
||||
}
|
||||
|
||||
, process: function () {
|
||||
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
||||
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
||||
, maxScroll = scrollHeight - this.$scrollElement.height()
|
||||
, offsets = this.offsets
|
||||
, targets = this.targets
|
||||
, activeTarget = this.activeTarget
|
||||
, i
|
||||
|
||||
if (scrollTop >= maxScroll) {
|
||||
return activeTarget != (i = targets.last()[0])
|
||||
&& this.activate ( i )
|
||||
}
|
||||
|
||||
for (i = offsets.length; i--;) {
|
||||
activeTarget != targets[i]
|
||||
&& scrollTop >= offsets[i]
|
||||
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
||||
&& this.activate( targets[i] )
|
||||
}
|
||||
}
|
||||
|
||||
, activate: function (target) {
|
||||
var active
|
||||
, selector
|
||||
|
||||
this.activeTarget = target
|
||||
|
||||
$(this.selector)
|
||||
.removeClass('active')
|
||||
|
||||
selector = this.selector
|
||||
+ '[data-target="' + target + '"],'
|
||||
+ this.selector + '[href="' + target + '"]'
|
||||
|
||||
active = $(selector)
|
||||
.addClass('active')
|
||||
|
||||
active.trigger('activate')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* SCROLLSPY PLUGIN DEFINITION
|
||||
* =========================== */
|
||||
|
||||
$.fn.scrollspy = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('scrollspy')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.scrollspy.Constructor = ScrollSpy
|
||||
|
||||
$.fn.scrollspy.defaults = {
|
||||
offset: 10
|
||||
}
|
||||
|
||||
|
||||
/* SCROLLSPY DATA-API
|
||||
* ================== */
|
||||
|
||||
$(function () {
|
||||
$('[data-spy="scroll"]').each(function () {
|
||||
var $spy = $(this)
|
||||
$spy.scrollspy($spy.data())
|
||||
})
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
|
|
@ -2,23 +2,6 @@
|
|||
// licensed under the Affero General Public License version 3 or later. See
|
||||
// the COPYRIGHT file.
|
||||
|
||||
var ContactEdit = {
|
||||
inviteFriend: function(li, evt) {
|
||||
$.post('/services/inviter/facebook.json', {
|
||||
"aspect_id" : li.data("aspect_id"),
|
||||
"uid" : li.parent().data("service_uid")
|
||||
}, function(data){
|
||||
ContactEdit.processSuccess(li, evt, data);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
TODO remove me
|
||||
ContactEdit.toggleCheckbox(li);
|
||||
Diaspora.page.publish("aspectDropdown/updated", [li.parent().data("person_id"), li.parents(".dropdown").parent(".right").html()]);
|
||||
*/
|
||||
|
||||
/**
|
||||
* TEMPORARY SOLUTION
|
||||
* TODO remove me, when the contacts section is done with Backbone.js ...
|
||||
|
|
|
|||
|
|
@ -1,5 +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.
|
||||
*/
|
||||
//= require friend-finder
|
||||
|
|
@ -1,25 +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 FriendFinder = {
|
||||
|
||||
initialize: function() {
|
||||
$('.contact_list .button').click(function(){
|
||||
$this = $(this);
|
||||
var uid = $this.parents('li').attr("uid");
|
||||
$this.parents('ul').children("#options_"+uid).slideToggle(function(){
|
||||
if($this.text() == 'Done'){
|
||||
$this.text($this.attr('old-text'));
|
||||
} else {
|
||||
$this.attr('old-text', $this.text());
|
||||
$this.text('Done');
|
||||
}
|
||||
$(this).toggleClass('hidden');
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(FriendFinder.initialize);
|
||||
|
|
@ -3,10 +3,8 @@
|
|||
//= require templates
|
||||
//= require main
|
||||
//= require home
|
||||
//= require finder
|
||||
//= require inbox
|
||||
//= require mobile
|
||||
//= require profile
|
||||
//= require people
|
||||
//= require photos
|
||||
//= require sinon
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
//= require punycode
|
||||
//= require parse_url
|
||||
//= require clear-form
|
||||
//= require validation
|
||||
//= require app/app
|
||||
//= require diaspora
|
||||
//= require_tree ./helpers
|
||||
|
|
@ -39,7 +38,6 @@
|
|||
//= require bootstrap-tooltip
|
||||
//= require bootstrap-popover
|
||||
//= require bootstrap-dropdown
|
||||
//= require bootstrap-scrollspy-custom
|
||||
//= require bootstrap-modal
|
||||
//= require osmlocator
|
||||
//= require flexime
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
Diaspora.Pages.FeaturedUsersIndex = function() {
|
||||
var self = this;
|
||||
|
||||
this.subscribe("page/ready", function(evt, document) {
|
||||
self.infiniteScroll = self.instantiate("InfiniteScroll");
|
||||
});
|
||||
};
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
Diaspora.Pages.ServicesFinder = function() {
|
||||
var self = this;
|
||||
|
||||
this.subscribe("page/ready", function(evt, document) {
|
||||
self.infiniteScroll = self.instantiate("InfiniteScroll");
|
||||
});
|
||||
};
|
||||
|
|
@ -1,72 +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.
|
||||
*/
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
//edit photo
|
||||
$("#edit_photo_toggle").bind('click', function(evt) {
|
||||
evt.preventDefault();
|
||||
$("#photo_edit_options").toggle();
|
||||
$(".edit_photo input:text").first().focus();
|
||||
});
|
||||
|
||||
$('.edit_photo').bind('ajax:loading', function(data, json, xhr) {
|
||||
$("#photo_edit_options").toggle();
|
||||
$("#photo_spinner").show();
|
||||
$("#show_photo").find("img").fadeTo(200,0.3);
|
||||
});
|
||||
|
||||
$('.edit_photo').bind('ajax:failure', function(data, json, xhr) {
|
||||
Diaspora.Alert.show("Failed to delete photo.", "Are you sure you own this?");
|
||||
$("#show_photo").find("img").fadeTo(200,1);
|
||||
$("#photo_spinner").hide();
|
||||
});
|
||||
|
||||
$('.edit_photo').bind('ajax:success', function(data, json, xhr) {
|
||||
json = $.parseJSON(json);
|
||||
$(".edit_photo input:text").val(json.photo.text);
|
||||
$("#caption").html(json.photo.text);
|
||||
$("#show_photo").find("img").fadeTo(200,1);
|
||||
$("#photo_spinner").hide();
|
||||
});
|
||||
|
||||
// make profile photo
|
||||
$('.make_profile_photo').bind('ajax:loading', function(data, json, xhr) {
|
||||
var person_id = $(this).closest(".photo_options").attr('data-actor_person');
|
||||
|
||||
$("img[data-person_id='" + person_id + "']").fadeTo(200, 0.3);
|
||||
});
|
||||
|
||||
$('.make_profile_photo').bind('ajax:success', function(data, json, xhr) {
|
||||
json = $.parseJSON(json);
|
||||
|
||||
$("img[data-person_id='" + json.person_id + "']").fadeTo(200, 1).attr('src', json.image_url_small);
|
||||
});
|
||||
|
||||
$('.make_profile_photo').bind('ajax:failure', function(data, json, xhr) {
|
||||
var person_id = $(this).closest(".photo_options").attr('data-actor_person');
|
||||
Diaspora.Alert.show("Failed to update profile photo!");
|
||||
$("img[data-person_id='" + person_id + "']").fadeTo(200, 1);
|
||||
});
|
||||
|
||||
// right/left hotkeys
|
||||
$(document).keyup(function(e){
|
||||
if(!$(e.target).hasClass('comment_box')){
|
||||
//left
|
||||
if(e.keyCode == 37) {
|
||||
if( $("#photo_show_left").length > 0 ){
|
||||
document.location = $("#photo_show_left").attr('href');
|
||||
}
|
||||
|
||||
//right
|
||||
} else if(e.keyCode == 39) {
|
||||
if( $("#photo_show_right").length > 0 ){
|
||||
document.location = $("#photo_show_right").attr('href');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -1,5 +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.
|
||||
*/
|
||||
//= require photo-show
|
||||
|
|
@ -1,48 +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 Validation = {
|
||||
rules: {
|
||||
username: {
|
||||
characters: /^(|[A-Za-z0-9_]{0,32})$/,
|
||||
length: [6, 32]
|
||||
},
|
||||
email: {
|
||||
characters: /^(([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,}))(, *(([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})))*$/
|
||||
}
|
||||
},
|
||||
whiteListed: function(keyCode) {
|
||||
var keyCodes = [0, 37, 38, 39, 40, 8, 9];
|
||||
return $.grep(keyCodes, function(element) { return keyCode !== element; }).length === keyCodes.length - 1;
|
||||
},
|
||||
|
||||
events: {
|
||||
usernameKeypress: function(evt) {
|
||||
if(Validation.whiteListed(evt.keyCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!Validation.rules.username.characters.test(this.value + String.fromCharCode(evt.keyCode))) {
|
||||
evt.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
emailKeypress: function(evt) {
|
||||
if(Validation.whiteListed(evt.keyCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!Validation.rules.email.characters.test(this.value + String.fromCharCode(evt.keyCode))) {
|
||||
$('#user_email').css('border-color', '#8B0000');
|
||||
} else {
|
||||
$('#user_email').css('border-color', '#666666');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//$(function() {
|
||||
// $("#user_username").keypress(Validation.events.usernameKeypress);
|
||||
// $("#user_email").keypress(Validation.events.emailKeypress);
|
||||
//});
|
||||
|
|
@ -1145,22 +1145,6 @@ a.toggle_selector
|
|||
&:hover
|
||||
:color $link-grey
|
||||
|
||||
.cubbies_collage
|
||||
:position absolute
|
||||
:right 50px
|
||||
:top -50px
|
||||
:z-index -1
|
||||
|
||||
.cubbies_screenshot
|
||||
:position absolute
|
||||
:right -20px
|
||||
:z-index 1
|
||||
|
||||
.cubbies_infographic
|
||||
:height 450px
|
||||
:margin
|
||||
:top 30px
|
||||
|
||||
#community_spotlight
|
||||
.avatar
|
||||
:height 140px
|
||||
|
|
@ -1221,44 +1205,6 @@ a.toggle_selector
|
|||
a
|
||||
:display inline-block
|
||||
|
||||
.cubbies_images
|
||||
:margin-left 15px
|
||||
|
||||
.cubbies_user_page_small
|
||||
:position absolute
|
||||
:left 270px
|
||||
|
||||
#featured_users_pane
|
||||
:padding 10px 0
|
||||
|
||||
.featured_user_card_small
|
||||
:height 30px
|
||||
|
||||
:vertical-align top
|
||||
:position relative
|
||||
|
||||
:border
|
||||
:bottom 1px solid $border-grey
|
||||
|
||||
:padding 5px
|
||||
:margin
|
||||
:bottom 5px
|
||||
|
||||
a
|
||||
:font
|
||||
:weight bold
|
||||
|
||||
.tags
|
||||
a
|
||||
:color $text-grey
|
||||
|
||||
.avatar
|
||||
:height 30px
|
||||
:width 30px
|
||||
:margin
|
||||
:right 5px
|
||||
:float left
|
||||
|
||||
.action_item
|
||||
:padding-right 5px
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ module Diaspora
|
|||
config.assets.precompile += %w{
|
||||
aspect-contacts.js
|
||||
contact-list.js
|
||||
finder.js
|
||||
home.js
|
||||
ie.js
|
||||
inbox.js
|
||||
|
|
@ -73,7 +72,6 @@ module Diaspora
|
|||
mobile.js
|
||||
profile.js
|
||||
people.js
|
||||
photos.js
|
||||
profile.js
|
||||
publisher.js
|
||||
templates.js
|
||||
|
|
|
|||
|
|
@ -193,10 +193,6 @@ Diaspora::Application.routes.draw do
|
|||
match ':provider/callback' => :create
|
||||
match :failure
|
||||
end
|
||||
scope 'services' do
|
||||
match 'inviter/:provider' => :inviter, :as => 'service_inviter'
|
||||
match 'finder/:provider' => :finder, :as => 'friend_finder'
|
||||
end
|
||||
end
|
||||
|
||||
scope 'api/v0', :controller => :apis do
|
||||
|
|
|
|||
|
|
@ -91,4 +91,4 @@ Feature: User manages contacts
|
|||
|
||||
And I click on my name in the header
|
||||
When I follow "Contacts"
|
||||
Then I should not see "Featured Users" within "#section_header"
|
||||
Then I should not see "Community Spotlight" within ".span9"
|
||||
|
|
|
|||
|
|
@ -1,52 +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.
|
||||
*/
|
||||
|
||||
describe("Validation", function() {
|
||||
describe("rules", function() {
|
||||
describe("username", function() {
|
||||
describe("characters", function() {
|
||||
it("is the regex for checking if we allow what the user typed", function() {
|
||||
expect((typeof Validation.rules.username.characters.test === "function")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("email", function() {
|
||||
describe("characters", function() {
|
||||
it("is the regex for checking if the input is a valid list of e-mail addresses", function() {
|
||||
expect((typeof Validation.rules.email.characters.test === "function")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("whiteListed", function() {
|
||||
it("returns true if the keyCode is whitelisted", function() {
|
||||
expect(Validation.whiteListed(0)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("returns false if it's not", function() {
|
||||
expect(Validation.whiteListed(9001)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
describe("events", function() {
|
||||
describe("usernameKeypress", function() {
|
||||
it("doesn't allow the user to type anything but letters, numbers and underscores", function() {
|
||||
expect(Validation.rules.username.characters.test("*")).toBeFalsy();
|
||||
expect(Validation.rules.username.characters.test("Aa_")).toBeTruthy();
|
||||
expect(Validation.rules.username.characters.test("ffffffffffffffffffffffffffffffffff")).toBeFalsy();
|
||||
});
|
||||
});
|
||||
describe("emailKeypress", function() {
|
||||
it("colors the border red if the input seems to be a invalid list", function() {
|
||||
expect(Validation.rules.email.characters.test("user@example.com")).toBeTruthy();
|
||||
expect(Validation.rules.email.characters.test("user@example.com, user@example.com")).toBeTruthy();
|
||||
expect(Validation.rules.email.characters.test("user@example.com, user@example.com, user@example.com")).toBeTruthy();
|
||||
expect(Validation.rules.email.characters.test("user@example.com user@example.com")).toBeFalsy();
|
||||
expect(Validation.rules.email.characters.test("user@examplecom")).toBeFalsy();
|
||||
expect(Validation.rules.email.characters.test("userexample.com")).toBeFalsy();
|
||||
expect(Validation.rules.email.characters.test("userexamplecom")).toBeFalsy();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -168,9 +168,6 @@ describe Statistics do
|
|||
describe '#completed_getting_started_count_sql' do
|
||||
end
|
||||
|
||||
describe 'used_cubbies_sql' do
|
||||
end
|
||||
|
||||
describe '.sign_up_method_sql' do
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue