// ==UserScript== // @name Runtastic mass exporter // @namespace http://www.barszcz.info/ // @description Export all your workouts from Runtastic // @include https://www.runtastic.com/en/users/* // @version 1.0.2 // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // ==/UserScript== jQuery.noConflict(true); jQuery(document).ready(function($) { if ($('#calendar_overview_js').length) { var $cal = $('#calendar_overview_js'), $button = $('Export This Workouts'), downloadURL = function downloadURL(url, index) { var hiddenIFrameID = 'hiddenDownloader' + index, iframe = document.getElementById(hiddenIFrameID); if (iframe === null) { iframe = document.createElement('iframe'); iframe.id = hiddenIFrameID; iframe.style.display = 'none'; document.body.appendChild(iframe); } iframe.src = url; }; $('head').append( ''); $cal.parent().next().css({position: 'relative'}).append($button.css({position: 'absolute', left: -90, top: 0})); $button.click( function(e) { e.preventDefault(); var $links = $cal.find('tbody td.type a'), $overlay = $(''), $modal = $('#facebox'), linkIndex = 0, exportInterval; if (!$links.length) { alert("There are no workouts to download."); return; } $('body').append($overlay); if (!$modal.length) { $modal = $('
'); $('body').append($modal); } var content = '

Export Workouts

' + '

There are ' + $links.length + ' sessions to be downloaded.

' + '

Choose one of the file formats in which you want to download your data:

' + '

Important notice: before starting export, configure your browser to automatically save files of type chosen above (gpx, tcx or kml).
You can do this by going to this link, then click on "Download", then on "Export as .... file".
When your browser asks you what to do, select "Save file" and check "Remember for this type of files"
(texts in your browser may be slightly different but they should mean the same).
If your browser is configured properly you can start exporting your data.

' + '

Script source code and license: source of this script can be viewed on GitHub, script is released under MIT license.

' + 'Export close' + '
'; $modal.find('.popup .content').html(content); $modal.css({display: 'block', visibility: 'hidden'}); $modal.css({position: 'fixed', top: 30, left: $(window).width() / 2 - $modal.outerWidth() / 2, width: $modal.outerWidth(), display: 'none', visibility: 'visible' }); $modal.fadeIn(); $overlay.fadeIn(); $modal.find('.close-export').click( function () { $modal.fadeOut(); $overlay.fadeOut(); } ); $modal.find('.stop-export').click( function () { clearInterval(exportInterval); $modal.find('#export_results').append('

Stopped

'); $(this).hide().prev().show(); } ); $modal.find('.start-export').click( function() { e.preventDefault(); $(this).hide().next().show(); $modal.find('#export_results').html(''); var filetype = $modal.find('[name=filetype]:checked').val(); exportInterval = setInterval( function() { if (linkIndex >= $links.length) { clearInterval(exportInterval); $modal.find('#export_results').append('

Finished

'); $modal.find('.stop-export').hide(); return; } downloadURL('https://www.runtastic.com' + $($links[linkIndex]).attr('href') + '.' + filetype, linkIndex); linkIndex ++; $modal.find('#export_results').append(' ' + linkIndex + ' '); }, 2000 ); } ); } ); } });