Use css spinner instead of gif

This commit is contained in:
Steffen van Bergerem 2015-07-31 14:39:42 +02:00
parent 248fa9213b
commit 8e99a240c9
19 changed files with 88 additions and 107 deletions

View file

@ -9,8 +9,8 @@ app.views.Location = Backbone.View.extend({
this.getLocation(); this.getLocation();
}, },
render: function(){ render: function() {
$("<img/>", { alt: "ajax-loader", src: ImagePaths.get("ajax-loader2.gif") }).appendTo(this.el); $("<div class=\"loader\"><div class=\"spinner\"></div></div>").appendTo(this.el);
}, },
getLocation: function(){ getLocation: function(){

View file

@ -14,7 +14,7 @@ app.views.NotificationDropdown = app.views.Base.extend({
this.badge = this.$el; this.badge = this.$el;
this.dropdown = $("#notification-dropdown"); this.dropdown = $("#notification-dropdown");
this.dropdownNotifications = this.dropdown.find(".notifications"); this.dropdownNotifications = this.dropdown.find(".notifications");
this.ajaxLoader = this.dropdown.find(".ajax_loader"); this.ajaxLoader = this.dropdown.find(".ajax-loader");
this.perfectScrollbarInitialized = false; this.perfectScrollbarInitialized = false;
}, },
@ -86,9 +86,9 @@ app.views.NotificationDropdown = app.views.Base.extend({
hideAjaxLoader: function(){ hideAjaxLoader: function(){
var self = this; var self = this;
this.ajaxLoader.find("img").fadeTo(200, 0, function(){ this.ajaxLoader.find(".spinner").fadeTo(200, 0, function(){
self.ajaxLoader.hide(200, function(){ self.ajaxLoader.hide(200, function(){
self.ajaxLoader.find("img").css("opacity", 1); self.ajaxLoader.find(".spinner").css("opacity", 1);
}); });
}); });
}, },

View file

@ -1,61 +0,0 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
(function() {
var InfiniteScroll = function() {
var self = this;
this.options = {
bufferPx: 500,
debug: false,
donetext: Diaspora.I18n.t("infinite_scroll.no_more"),
loadingText: "",
loadingImg: ImagePaths.get("ajax-loader2.gif"),
navSelector: "#pagination",
nextSelector: ".paginate",
itemSelector: ".stream_element",
pathParse: function(pathStr) {
var newPath = pathStr.replace("?", "?only_posts=true&"),
lastTime = $('#main_stream .stream_element').last().find(".time").attr("integer");
if(lastTime === undefined){
lastTime = $('#main_stream').data('time_for_scroll');
}
return newPath.replace(/max_time=\d+/, "max_time=" + lastTime);
}
};
this.subscribe("widget/ready", function(evt, opts) {
$.extend(self.options, opts);
if($('#main_stream').length !== 0) {
$('#main_stream').infinitescroll(self.options, function(newElements) {
self.globalPublish("stream/scrolled", newElements);
});
} else if($('#people_stream').length !== 0) {
$("#people_stream").infinitescroll($.extend(self.options, {
navSelector : ".pagination",
nextSelector : ".next_page",
pathParse : function(pathStr, nextPage) {
return pathStr.replace("page=2", "page=" + nextPage);
}
}), function(newElements) {
self.globalPublish("stream/scrolled", newElements);
});
}
});
this.reInitialize = function() {
$("#main_stream").infinitescroll("destroy");
self.publish("widget/ready");
};
this.globalSubscribe("stream/reloaded", self.reInitialize, this);
};
Diaspora.Widgets.InfiniteScroll = InfiniteScroll;
})();
// @license-end

View file

@ -16,7 +16,7 @@
@import 'hovercard'; @import 'hovercard';
@import 'new_styles/base'; @import 'new_styles/base';
@import 'new_styles/interactions'; @import 'new_styles/interactions';
@import 'new_styles/spinner'; @import 'spinner';
@import 'lightbox'; @import 'lightbox';
@import 'timeago'; @import 'timeago';
@import 'vendor/fileuploader'; @import 'vendor/fileuploader';

View file

@ -42,9 +42,18 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.ac_loading { .ac_input + .spinner {
background: white image-url('ajax-loader2.gif') right 5px center no-repeat; display: none;
background-size: 18px; }
.ac_input.ac_loading + .spinner {
display: inline-block;
height: 18px;
margin-left: -26px;
margin-right: 8px;
margin-top: 7px;
position: absolute;
width: 18px;
} }
.ac_odd { .ac_odd {

View file

@ -58,9 +58,13 @@ header > .dark-header > nav {
} }
& > .pull-right > .aspect_membership_dropdown { display: none; } & > .pull-right > .aspect_membership_dropdown { display: none; }
} }
.ajax_loader { .ajax-loader {
border-bottom: 1px solid $border-grey; border-bottom: 1px solid $border-grey;
padding: 10px; padding: 10px;
.spinner {
height: 30px;
width: 30px;
}
} }
.view_all { .view_all {
background-color: $link-color; background-color: $link-color;

View file

@ -1,7 +1,13 @@
/* flash message animations - header height is about 50px */ /* flash message animations - header height is about 50px */
@keyframes expose { @keyframes expose {
0% { top : -100px; } 0% { top : -100px; }
15% { top : 44px; } 15% { top : 44px; }
85% { top : 44px; } 85% { top : 44px; }
100% { top : -100px; } 100% { top : -100px; }
}
/* spinner animation */
@keyframes spinner {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
} }

View file

@ -1,20 +0,0 @@
#paginate, #infscr-loading {
margin-top: 10px;
padding: 8px 0;
text-align: center;
width: 100%;
display: block;
clear: both;
}
.loader {
background-image : image-url("ajax-loader2.gif");
display: inline-block;
width : 32px;
height: 32px;
&.hidden{
display : none;
}
}

View file

@ -24,6 +24,7 @@
#fileInfo { display: none !important; } #fileInfo { display: none !important; }
#publisher_spinner { #publisher_spinner {
margin: 20px;
text-align: center; text-align: center;
} }
@ -105,12 +106,20 @@
} }
} }
&.with_location .loader {
height: 20px;
width: 20px;
}
&.with_location #location_container { &.with_location #location_container {
height: 30px; height: 30px;
margin-bottom: 0;
border-top: 1px dashed $border-grey; border-top: 1px dashed $border-grey;
input[type='text'] { input[type='text'] {
margin-bottom: 0; border: none;
color: $text-grey; color: $text-grey;
height: 20px;
margin-bottom: 0;
padding: 0;
} }
} }
&.active #button_container { &.active #button_container {

View file

@ -0,0 +1,28 @@
#paginate, #infscr-loading {
margin-top: 10px;
padding: 8px 0;
text-align: center;
width: 100%;
display: block;
clear: both;
}
.loader {
display: inline-block;
width : 32px;
height: 32px;
}
.spinner {
width: 100%;
height: 100%;
margin: auto;
border-radius: 50%;
border-width: 3px;
border-style: solid;
border-color: $border-dark-grey transparent $border-dark-grey $border-dark-grey;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-name: spinner;
animation-timing-function: linear;
}

View file

@ -10,10 +10,6 @@ ul.as-selections {
padding: 0; padding: 0;
} }
ul.as-selections.loading {
background: asset_path("ajax-loader2.gif") right center no-repeat;
}
ul.as-selections li { ul.as-selections li {
float: left; float: left;
margin: 1px 4px 1px 0; margin: 1px 4px 1px 0;

View file

@ -47,8 +47,8 @@
</h4> </h4>
</div> </div>
<div class="notifications"> <div class="notifications">
<div class="ajax_loader"> <div class="ajax-loader">
<img class="img-responsive center-block" alt="Ajax-loader" src="{{imageUrl "ajax-loader2.gif"}}"> <div class="spinner"></div>
</div> </div>
</div> </div>
<div class="view_all"> <div class="view_all">
@ -102,6 +102,7 @@
<form id="header-search-form" accept-charset="UTF-8" action="/search" class="navbar-form navbar-right" role="search" method="get"> <form id="header-search-form" accept-charset="UTF-8" action="/search" class="navbar-form navbar-right" role="search" method="get">
<div class="form-group"> <div class="form-group">
<input id="q" name="q" placeholder="{{t "header.search"}}" results="5" type="search" autocomplete="off" class="ac_input form-control input-sm"> <input id="q" name="q" placeholder="{{t "header.search"}}" results="5" type="search" autocomplete="off" class="ac_input form-control input-sm">
<div class="spinner"></div>
</div> </div>
<input name="utf8" type="hidden" value="✓"> <input name="utf8" type="hidden" value="✓">
</form> </form>

View file

@ -15,6 +15,7 @@
#paginate #paginate
%span.loader.hidden %span.loader.hidden
.spinner
- if current_user.contacts.size < 2 - if current_user.contacts.size < 2
= render 'aspects/no_contacts_message' = render 'aspects/no_contacts_message'

View file

@ -25,8 +25,9 @@
} ); } );
%p %p
= t('.searching') = t(".searching")
= image_tag('ajax-loader2.gif', class: 'loader') .loader
.spinner
- else - else
%p %p
= t('.no_one_found') = t('.no_one_found')

View file

@ -31,6 +31,7 @@
#paginate #paginate
%span.loader.hidden %span.loader.hidden
.spinner
%a{id:"back-to-top", title:"#{t('layouts.application.back_to_top')}", href:"#"} %a{id:"back-to-top", title:"#{t('layouts.application.back_to_top')}", href:"#"}
&#8679; &#8679;

View file

@ -48,7 +48,8 @@
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s = hidden_field_tag 'aspect_ids[]', aspect_id.to_s
#publisher_spinner{class: 'hidden'} #publisher_spinner{class: 'hidden'}
= image_tag 'ajax-loader2.gif' .loader
.spinner
.options_and_submit.col-sm-12 .options_and_submit.col-sm-12
.public_toggle .public_toggle
.btn.btn-default.pull-left#hide_publisher{title: t('shared.publisher.discard_post')} .btn.btn-default.pull-left#hide_publisher{title: t('shared.publisher.discard_post')}

View file

@ -12,4 +12,6 @@
%h3.modal-title{id: "#{id}Label"} %h3.modal-title{id: "#{id}Label"}
= title = title
.modal-body .modal-body
= image_tag("ajax-loader2.gif", id: "modalWaiter", class: "img-responsive center-block") #modalWaiter.text-center
.loader
.spinner

View file

@ -32,6 +32,7 @@
#paginate #paginate
%span.loader.hidden %span.loader.hidden
.spinner
%a{id:"back-to-top", title:"#{t('layouts.application.back_to_top')}", href:"#"} %a{id:"back-to-top", title:"#{t('layouts.application.back_to_top')}", href:"#"}
&#8679; &#8679;

View file

@ -24,7 +24,9 @@
= label_tag 'profile[first_name]', t('profiles.edit.your_name') = label_tag 'profile[first_name]', t('profiles.edit.your_name')
= text_field_tag 'profile[first_name]', current_user.first_name, class: "form-control" = text_field_tag 'profile[first_name]', current_user.first_name, class: "form-control"
.form-group .form-group
= image_tag 'ajax-loader2.gif', id: "gs-name-form-spinner", class: "hidden" #gs-name-form-spinner.hidden
.loader
.spinner
= label_tag :your_photo, t('profiles.edit.your_photo') = label_tag :your_photo, t('profiles.edit.your_photo')
= render 'photos/new_profile_photo', aspect: :getting_started, person: current_user.person = render 'photos/new_profile_photo', aspect: :getting_started, person: current_user.person