Forum export for surveys on Prolific
当前为
// ==UserScript==
// @name Prolific Export
// @namespace https://kadauchi.com/
// @version 1.0.0
// @description Forum export for surveys on Prolific
// @author Kadauchi
// @icon http://i.imgur.com/oGRQwPN.png
// @include https://www.prolific.ac/studies*
// @grant GM_log
// @grant GM_setClipboard
// @require https://code.jquery.com/jquery-3.1.1.min.js
// ==/UserScript==
for (var study of $('.study')) {
var id = $(study).data('study-id');
$(study).prepend('<button class="exporter" type="button" data-id="' + id + '">Forum Export</button>');
}
function export_study (id) {
var $study = $('#' + id);
var link = $study.find('a[href^="/studies/"]').prop('href');
var title = $study.find('h3').text();
var researcher = $study.find('li:eq(0)').text().split(':')[1];
var reward = $study.find('li:eq(1)').text().split(':')[1];
var perhour = $study.find('li:eq(2)').text().split(':')[1];
var available = $study.find('li:eq(3)').text().split(':')[1];
var time = $study.find('li:eq(4)').text().split(':')[1];
var completion = $study.find('li:eq(5)').text().split(':')[1];
var exportcode = '[table][tr][td]'+
'[b][SIZE=5][COLOR=red]PROLIFIC STUDY[/COLOR][/SIZE][/b]\n' +
'[b]Title:[/b] [URL=' + link + ']' + title + '[/URL]\n' +
'[b]Hosted by : [/b] ' + researcher + '\n' +
'[b]Reward : [/b][COLOR=green][b] ' + reward + '[/b][/COLOR]\n' +
'[b]Avg. Reward Per Hour : [/b] ' + perhour + '\n' +
'[b]Available Places : [/b] ' + available + '\n' +
'[b]Maximum Allowed Time : [/b] ' + time + '\n' +
'[b]Avg. Completion Time : [/b] ' + completion + '\n' +
'[/td][/tr][/table]';
GM_setClipboard(exportcode);
alert('Forum export has been copied to your clipboard.');
}
$('.exporter').click(function() {
export_study($(this).data('id'));
});