Moodle Turnitin:添加在作业

时间:2017-03-01 10:49:51

标签: javascript html plugins moodle

有些大学采用蓝卡计划,让有特殊学习困难的学生(SpLD)用蓝卡标记他们的工作,因此导师会在适当考虑的情况下对其进行标记。

我们需要一种让学生更容易用蓝卡标记他们的工作的方法,并且我已经提出了以下脚本,该脚本进入Moodle的站点管理中的附加HTML部分,并与Turnitin一起使用插入。 (请参阅我的其他帖子了解script that works with the Moodle Assignment functionality。)

首先,学生点击按钮添加蓝卡,插入文本"蓝卡:"在作业标题的开头。提交表单后,JavaScript会查找文本" Blue Card"在下一页上,将表格单元格颜色为蓝色,并附加阅读障碍标记指南的链接。

1 个答案:

答案 0 :(得分:0)

<script type="text/javascript">
var TurnitinBlueCardButton =  '<input type="button" id="tiibluecard" value="Flag with Blue Card"/> <a href="http://www.brookes.ac.uk/students/wellbeing/dyslexia-spld/blue-marking-cards/" class="info" target="_blank" title="What is the Blue Card scheme?">What\'s this?</a><br/>'

/* TURNITIN BLUE CARD */
if (!document.getElementById('fitem_id_submissiontype')) {
   /* do nothing */
} else {
    document.getElementById('fitem_id_submissiontype').insertAdjacentHTML('beforebegin', TurnitinBlueCardButton);
}

/* EVENT LISTENER FOR TURNITIN BLUE CARD BUTTON */
if (!document.getElementById('tiibluecard')) {
   /* do nothing */
} else {
    document.getElementById("tiibluecard").addEventListener('click', function () {  
        var title = document.getElementById('id_submissiontitle');
        /* turn off validation of title field, as it will now have a value */
        title.removeAttribute('onchange');
        if (!title.value) {
            title.value = ('Blue Card: '); 
         } else {
            title.value = ('Blue Card: ' + title.value);
         }
    });
}

/* highlight blue card in TURNITIN submission inbox table */
if (!document.getElementById('inboxTable')) {
   /* do nothing */
} else {
     var table = document.getElementById('inboxTable');
     var tbody = table.getElementsByTagName('tbody')[0];
     var cells = tbody.getElementsByTagName('td');

     for (var i=0, len=cells.length; i<len; i++){
         if (cells[i].innerHTML.includes('Blue Card')){
             cells[i].style.backgroundColor = '#99ccff';
             cells[i].innerHTML += ' [<a href="http://www.brookes.ac.uk/students/wellbeing/dyslexia-spld/blue-marking-cards/" class="info" target="_blank" title="What is the Blue Card scheme?">What\'s this?</a>]';
        }
   }
}
</script>

注意:代码按原样提供&#39;没有任何承诺使其符合目的,也没有任何承诺维护或支持。

also posted on our team blog

更新:为了让它在Internet Explorer 11中运行,我不得不改变一些事情:

/* highlight blue card in TURNITIN submission inbox table */
if (!document.getElementById('inboxTable')) {
   /* do nothing */
} else {
     var table = document.getElementById('inboxTable');
     var tbody = table.getElementsByTagName('tbody')[0];
     var cells = tbody.getElementsByTagName('td');

     for (var i=0, len=cells.length; i<len; i++){
         if (cells[i].innerText.search('Blue Card') > -1){
             cells[i].style.backgroundColor = '#99ccff';
             cells[i].getElementsByTagName('a')[0].insertAdjacentHTML('afterend', ' [<a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" class="info" target="_blank" title="What is the Blue Card scheme?">What\'s this?</a>]');
        }
   }
}