Skip to content

Commit

Permalink
upload popup spinner (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
vankasteelj committed Apr 28, 2016
1 parent ec25159 commit 66a73ef
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,13 @@ input[type=checkbox]:checked:before {
left: calc(50% - 240px);
}

#upload-spin {
color: #ffffff;
font-size: 60px;
margin: 200px 490px;
position: fixed;
}

#modal-line {
position: absolute;
width: 480px;
Expand Down
2 changes: 2 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@

<!-- popup div for upload warnings and results -->
<section id="upload-popup">
<div id="upload-spin" class="fa fa-cog fa-spin"></div>

<div id="upload-modal">
<div id="modal-line"></div>
<div id="modal-content"></div>
Expand Down
11 changes: 11 additions & 0 deletions app/js/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,17 @@ var interface = {
$('#modal-buttons .modal-'+btright).addClass('right').show();
$('#upload-popup').show().css('opacity', 1);
},
spinner: function (show) {
if (show) {
$('#upload-modal').hide();
$('#upload-popup').show().css('opacity', 1);
$('#upload-spin').show();
} else {
$('#upload-spin').hide();
$('#upload-popup').css('opacity', 0).hide();
$('#upload-modal').show();
}
},
searchPopup: function () {
console.debug('Opening IMDB search popup');
$(document).bind('mouseup', interface.leavePopup);
Expand Down
3 changes: 3 additions & 0 deletions app/js/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ var opensubtitles = {
console.debug('Trying to upload subtitle...');
opensubtitles.isUploading = true;
$('#button-upload i, #button-upload span').addClass('pulse');
interface.spinner(true);
OS.upload(obj_data).then(function (response) {
opensubtitles.isUploading = false;
interface.spinner(false);
$('#button-upload i, #button-upload span').removeClass('pulse');
if (response && response.status.match(/200/)) {
//console.warn(response)
Expand All @@ -253,6 +255,7 @@ var opensubtitles = {
}
}).catch(function(err) {
opensubtitles.isUploading = false;
interface.spinner(false);
$('#button-upload i, #button-upload span').removeClass('pulse');
console.error(err);
var error;
Expand Down

0 comments on commit 66a73ef

Please sign in to comment.