2014-12-08 09:46:59 -05:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
App.factory 'pdfSpinner', [() ->
|
|
|
|
|
|
|
|
class pdfSpinner
|
|
|
|
|
|
|
|
constructor: () ->
|
|
|
|
# handler for spinners
|
|
|
|
|
2016-07-01 11:31:17 -04:00
|
|
|
add: (element, options) ->
|
2014-12-08 12:39:24 -05:00
|
|
|
size = 64
|
2016-07-01 11:31:17 -04:00
|
|
|
spinner = $('<div class="pdfng-spinner" style="position: absolute; top: 50%; left:50%; transform: translateX(-50%) translateY(-50%);"><i class="fa fa-spinner' + (if options?.static then '' else ' fa-spin') + '" style="color: #999"></i></div>')
|
2014-12-08 09:46:59 -05:00
|
|
|
spinner.css({'font-size' : size + 'px'})
|
|
|
|
element.append(spinner)
|
|
|
|
|
2016-07-01 11:31:17 -04:00
|
|
|
start: (element) ->
|
|
|
|
element.find('.fa-spinner').addClass('fa-spin')
|
|
|
|
|
2014-12-08 09:46:59 -05:00
|
|
|
stop: (element) ->
|
2015-05-11 09:12:24 -04:00
|
|
|
element.find('.fa-spinner').removeClass('fa-spin')
|
2014-12-08 09:46:59 -05:00
|
|
|
|
|
|
|
remove: (element) ->
|
2015-05-11 09:12:24 -04:00
|
|
|
element.find('.fa-spinner').remove()
|
2014-12-08 09:46:59 -05:00
|
|
|
|
|
|
|
]
|