equal
deleted
inserted
replaced
2563 * This callback is used to initialize modal's viewport size |
2563 * This callback is used to initialize modal's viewport size |
2564 */ |
2564 */ |
2565 shown: function(e) { |
2565 shown: function(e) { |
2566 |
2566 |
2567 function resetViewport(ev) { |
2567 function resetViewport(ev) { |
2568 var top = $('.scrollmarker.top', viewport); |
2568 var top = $('.scrollmarker.top', viewport), |
2569 var topPosition = viewport.scrollTop(); |
2569 topPosition = viewport.scrollTop(); |
2570 if (topPosition > 0) { |
2570 if (topPosition > 0) { |
2571 top.show(); |
2571 top.show(); |
2572 } else { |
2572 } else { |
2573 top.hide(); |
2573 top.hide(); |
2574 } |
2574 } |
2578 } else { |
2578 } else { |
2579 bottom.show(); |
2579 bottom.show(); |
2580 } |
2580 } |
2581 } |
2581 } |
2582 |
2582 |
2583 var modal = e.target; |
2583 var modal = e.target, |
2584 var viewport = $('.modal-viewport', modal); |
2584 viewport = $('.modal-viewport', modal); |
2585 if (viewport.exists()) { |
2585 if (viewport.exists()) { |
2586 var maxHeight = parseInt(viewport.css('max-height')); |
2586 var maxHeight = parseInt(viewport.css('max-height')), |
2587 var barWidth = $.scrollbarWidth(); |
2587 barWidth = $.scrollbarWidth(); |
2588 if ((viewport.css('overflow') !== 'hidden') && |
2588 if ((viewport.css('overflow') !== 'hidden') && |
2589 (viewport.height() === maxHeight)) { |
2589 (viewport.height() === maxHeight)) { |
2590 $('<div></div>').addClass('scrollmarker') |
2590 $('<div></div>').addClass('scrollmarker') |
2591 .addClass('top') |
2591 .addClass('top') |
2592 .css('top', 0) |
2592 .css('top', 0) |
2612 if (callback) { |
2612 if (callback) { |
2613 callback.call(modal, this); |
2613 callback.call(modal, this); |
2614 } |
2614 } |
2615 }); |
2615 }); |
2616 // Call shown callbacks registered for this dialog |
2616 // Call shown callbacks registered for this dialog |
2617 var index; |
2617 var index, |
2618 var callbacks = $('.modal-dialog', modal).data('shown-callbacks'); |
2618 callbacks = $('.modal-dialog', modal).data('shown-callbacks'); |
2619 if (callbacks) { |
2619 if (callbacks) { |
2620 for (index=0; index < callbacks.length; index++) { |
2620 for (index=0; index < callbacks.length; index++) { |
2621 callbacks[index].call(modal); |
2621 callbacks[index].call(modal); |
2622 } |
2622 } |
2623 } |
2623 } |
5251 } else { |
5251 } else { |
5252 $('i', source).attr('class', table.data('ams-' + attribute + '-icon-off') || 'fa fa-fw fa-check-square txt-color-silver opacity-75'); |
5252 $('i', source).attr('class', table.data('ams-' + attribute + '-icon-off') || 'fa fa-fw fa-check-square txt-color-silver opacity-75'); |
5253 } |
5253 } |
5254 }); |
5254 }); |
5255 } |
5255 } |
|
5256 }, |
|
5257 |
|
5258 /** |
|
5259 * Export table to CSV |
|
5260 */ |
|
5261 exportTableToTSV: function() { |
|
5262 return function() { |
|
5263 var source = $(this); |
|
5264 ams.ajax && ams.ajax.check(globals.saveAs, |
|
5265 ams.baseURL + 'ext/js-filesaver' + ams.devext + '.js', |
|
5266 function() { |
|
5267 var table = $('table.datatable', source.parents('.ams-widget:first')); |
|
5268 var datatable = table.dataTable(); |
|
5269 var output = ''; |
|
5270 $('th', table).each(function(index) { |
|
5271 if (index > 0) { |
|
5272 output += '\t'; |
|
5273 } |
|
5274 output += $(this).text(); |
|
5275 }); |
|
5276 output += '\n'; |
|
5277 $(datatable.fnGetData()).each(function() { |
|
5278 $(this).each(function(index) { |
|
5279 if (index > 0) { |
|
5280 output += '\t'; |
|
5281 } |
|
5282 output += this; |
|
5283 }); |
|
5284 output += '\n'; |
|
5285 }); |
|
5286 var blob = new Blob([output], {type: 'text/tsv; charset=utf-8'}); |
|
5287 saveAs(blob, "export.tsv"); |
|
5288 }); |
|
5289 } |
5256 } |
5290 } |
5257 }; |
5291 }; |
5258 |
5292 |
5259 })(jQuery, this); |
5293 })(jQuery, this); |
5260 |
5294 |