mirror of
https://github.com/PlagiarismCheck/moodle-plagiarism_pchkorg.git
synced 2024-12-22 04:10:07 +00:00
Fix for widget
This commit is contained in:
parent
e1b7ea48a3
commit
8187645ee1
87
lib.php
87
lib.php
@ -330,47 +330,66 @@ window.plagiarism_check_full_report = function (action, token) {
|
|||||||
form.submit();
|
form.submit();
|
||||||
};
|
};
|
||||||
|
|
||||||
require([], function () {
|
require(['jquery'], function ($) {
|
||||||
|
$(function () {
|
||||||
var spans = window.document.getElementsByClassName('plagiarism-pchkorg-widget');
|
var spans = window.document.getElementsByClassName('plagiarism-pchkorg-widget');
|
||||||
for (var span of spans) {
|
for (var s in spans) {
|
||||||
for (var classname of span.classList) {
|
var span = spans[s];
|
||||||
if (classname.includes('plagiarism-pchkorg-widget-id-')) {
|
if (span) {
|
||||||
var id = classname.replace('plagiarism-pchkorg-widget-id-', '');
|
for (var c in span.classList) {
|
||||||
if (id) {
|
var classname = span.classList[c];
|
||||||
for (var data of window.plagiarism_check_data) {
|
if (classname && classname.includes('plagiarism-pchkorg-widget-id-')) {
|
||||||
if (data.id == id) {
|
var id = classname.replace('plagiarism-pchkorg-widget-id-', '');
|
||||||
var a = document.createElement('a');
|
if (id) {
|
||||||
a.setAttribute('href', '#');
|
for (var d in window.plagiarism_check_data) {
|
||||||
a.setAttribute('title', data.title);
|
var data = window.plagiarism_check_data[d];
|
||||||
a.style.padding = '5px 3px';
|
if (data && data.id == id) {
|
||||||
a.style.textDecoration = 'none';
|
var a = document.createElement('a');
|
||||||
a.style.backgroundColor = data.color;
|
a.setAttribute('href', '#');
|
||||||
a.style.color = 'black';
|
a.setAttribute('title', data.title);
|
||||||
a.style.cursor = 'pointer';
|
a.setAttribute('data-id', data.id);
|
||||||
a.style.borderRadius = '3px 3px 3px 3px';
|
a.style.padding = '5px 3px';
|
||||||
a.style.margin = '4px';
|
a.style.textDecoration = 'none';
|
||||||
a.style.display = 'inline-block';
|
a.style.backgroundColor = data.color;
|
||||||
a.onclick = function() {
|
a.style.color = 'black';
|
||||||
window.plagiarism_check_full_report(data.action, data.token);
|
a.style.cursor = 'pointer';
|
||||||
return false;
|
a.style.borderRadius = '3px 3px 3px 3px';
|
||||||
};
|
a.style.margin = '4px';
|
||||||
var label = document.createTextNode(data.label);
|
a.style.display = 'inline-block';
|
||||||
var img = document.createElement('img');
|
var label = document.createTextNode(data.label);
|
||||||
img.setAttribute('alt', 'PlagiarismCheck.org');
|
var img = document.createElement('img');
|
||||||
img.setAttribute('src', data.image);
|
img.setAttribute('alt', 'PlagiarismCheck.org');
|
||||||
img.setAttribute('width', '20');
|
img.setAttribute('src', data.image);
|
||||||
a.appendChild(img);
|
img.setAttribute('width', '20');
|
||||||
a.appendChild(label);
|
a.appendChild(img);
|
||||||
span.appendChild(a);
|
a.appendChild(label);
|
||||||
break;
|
span.appendChild(a);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});"
|
|
||||||
|
$(window.document.body).on('click', '.plagiarism-pchkorg-widget', function(e) {
|
||||||
|
var id = $(e.target).closest('a').attr('data-id')
|
||||||
|
if (id) {
|
||||||
|
for (var d in window.plagiarism_check_data) {
|
||||||
|
var data = window.plagiarism_check_data[d];
|
||||||
|
if (data && data.id == id) {
|
||||||
|
window.plagiarism_check_full_report(data.action, data.token);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ defined('MOODLE_INTERNAL') || die();
|
|||||||
if (!isset($plugin)) {
|
if (!isset($plugin)) {
|
||||||
$plugin = new stdClass();
|
$plugin = new stdClass();
|
||||||
}
|
}
|
||||||
$plugin->version = 2022060211;
|
$plugin->version = 2022061418;
|
||||||
$plugin->requires = 2020061501; // Requires Moodle 3.9 .
|
$plugin->requires = 2020061501; // Requires Moodle 3.9 .
|
||||||
$plugin->release = 'v3.9.5';
|
$plugin->release = 'v3.9.6';
|
||||||
$plugin->component = 'plagiarism_pchkorg';
|
$plugin->component = 'plagiarism_pchkorg';
|
||||||
$plugin->maturity = MATURITY_STABLE;
|
$plugin->maturity = MATURITY_STABLE;
|
||||||
$plugin->dependencies = array(
|
$plugin->dependencies = array(
|
||||||
|
Loading…
Reference in New Issue
Block a user