【问题标题】:Moodle Turnitin: add functionality to insert extra text in assignmentsMoodle Turnitin:添加在作业中插入额外文本的功能
【发布时间】:2017-03-01 10:49:50
【问题描述】:

一些大学有蓝卡计划,让有特定学习困难 (SpLD) 的学生可以用蓝卡标记他们的工作,因此导师会给予适当的考虑。

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

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

【问题讨论】:

标签: javascript html plugins moodle


【解决方案1】:
<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>

注意:代码是“按原样”提供的,没有任何关于其适合用途的承诺,并且在提供时也没有任何维护或支持的承诺。

(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>]');
        }
   }
}

【讨论】:

  • 在 IE (Edge)、Chrome、Firefox、Windows 和 iPhone 5 的 Safari 中测试
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-10
  • 1970-01-01
  • 1970-01-01
  • 2014-11-15
  • 1970-01-01
相关资源
最近更新 更多