mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
26 lines
668 B
CoffeeScript
26 lines
668 B
CoffeeScript
|
define [
|
||
|
"base"
|
||
|
], (App) ->
|
||
|
App.factory 'pdfSpinner', [() ->
|
||
|
|
||
|
class pdfSpinner
|
||
|
|
||
|
constructor: () ->
|
||
|
# handler for spinners
|
||
|
|
||
|
add: (element) ->
|
||
|
h = element.height()
|
||
|
w = element.width()
|
||
|
size = Math.floor(0.5 * Math.min(h, w))
|
||
|
spinner = $('<div class="pdfng-spinner" style="position: absolute; top: 50%; left:50%; transform: translateX(-50%) translateY(-50%);"><i class="fa fa-spinner fa-spin" style="color: #999"></i></div>')
|
||
|
spinner.css({'font-size' : size + 'px'})
|
||
|
element.append(spinner)
|
||
|
|
||
|
stop: (element) ->
|
||
|
element.find('.fa-spin').removeClass('fa-spin')
|
||
|
|
||
|
remove: (element) ->
|
||
|
element.find('.fa-spin').remove()
|
||
|
|
||
|
]
|