Skip to content

Instantly share code, notes, and snippets.

@pipitone
Last active February 19, 2018 17:22
Show Gist options
  • Save pipitone/cd5ab52ca14f39744276d654e694df14 to your computer and use it in GitHub Desktop.
Save pipitone/cd5ab52ca14f39744276d654e694df14 to your computer and use it in GitHub Desktop.
Scrapes text from Articulate Storyline 3. You'll need https://tampermonkey.net/
// ==UserScript==
// @name Unarticulate Storyline
// @namespace https://jon.pipitone.ca
// @version 0.1
// @description Scrapes text from Articulate Storyline 3 published modules at Queen's U, Canada
// @author Jon Pipitone <throwaway@pipitone.ca>
// @match https://qshare.queensu.ca/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
//transcription function
function transcribe (e) {
transcription = $('#transcription');
transcription.val('');
// important text seems to be in the aria-label attribute...
$('[aria-label]').each(function(idx, el) {
transcription.val( function(_, val){return val + $(el).attr('aria-label') + '\n'} );
});
}
// make text selectable
const css = '* { -moz-user-select: text !important; user-select: text !important }';
var style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule(css, 0);
// add a visible side textarea
$('body').css('overflow', 'visible');
$('body').prepend(
$('<button/>').attr({ type: "button", style: "height:2em; position:fixed; right:0; width:400px"}).text("Click me")
.click(transcribe),
$('<textarea/>').attr({
id:"transcription",
style:"overflow:scroll; height: 100%; width: 400px; background-color: lightblue; position:fixed; right:0; top: 2em; resize:horizontal"
})
);
// install a button to scrape text into the text area
//
// onLoad() isn't a reliable way to know when the presentation is fully loaded, so we
// attach this action to a body click.. there must be a better way.
$('body').one('click', function (e) {
$('span.relative-nav').append( // put this button in the next/prev menu bar
$('<button/>').attr(
{ type: "button", class: "btn cs-button inflexible",
value:"dearticulate" }
)
.click(transcribe)
.append($('<span class="text"/>').text('DEARTICULATE'))
);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment