Last active
March 7, 2019 21:53
-
-
Save met/02594ee8244b2be70349d351796ac87b to your computer and use it in GitHub Desktop.
Backup of Supermemo.com to TSV (on page with Course editor choose Change Order and run this script in console, it will export only selected section of selected course)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var dataPole=[]; | |
document.querySelectorAll(".course-editor-browser-page-item").forEach( | |
function(line) { | |
var c1=line.querySelectorAll("div.page-item-content")[0].querySelector("div").innerText; | |
var c2=line.querySelectorAll("div.page-item-content")[1].querySelector("div").innerText; | |
/* transform enters */ | |
c1 = c1.replace(/\n/g,"\\n"); | |
c2 = c2.replace(/\n/g,"\\n"); | |
dataPole.push([c1, c2]); | |
} | |
) | |
/* we gattered data, now format export */ | |
var exportPole = []; | |
dataPole.forEach(function(item) { exportPole.push(item.join("\t")); }); | |
var tsv=exportPole.join("\n") | |
console.log(tsv); | |
window.open("data:text/tab-separated-values," + encodeURIComponent(tsv)); | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment