3 Commits
1.1.0 ... 1.1.2

Author SHA1 Message Date
FutureX
8ec55e0dd9 Version 1.1.2
Добавил режим, в котором на странице кроме основной части ничего не отображается.

Раньше не отображались ответы к некоторым типам заданий(например кроссворд)
2018-04-13 15:58:22 +03:00
FutureX
2f8c070f62 Небольшое описание 2018-04-13 01:17:20 +03:00
FutureX
9ac51eaa9c Version 1.1.1
Распределил файлы по папкам

Добавил функцию из другого расширения - при нажатии кнопки проверить у вас будут верны все ответы, даже если все поля пустые(так лучше не делать, поскольку преподователи видят это)
2018-04-13 00:25:58 +03:00
14 changed files with 265 additions and 77 deletions

10
README.md Normal file
View File

@@ -0,0 +1,10 @@
# Chrome Extension - LMS Answers
> Небольшое расширение для легкого выполнения тестов в среде Cambridge LMS.
## Функционал:
> ### При нажатии на иконку расширения появится меню:
>>>> ![Картика](https://image.ibb.co/fthye7/image.png)
* ### Можно выбрать автоматический режим - при открытии страницы с тестом ответы автоматически появятся
* ### Если это не сделать, то всегда можно нажать на кнопку "Показать ответы"
* ### Можно выбрать режим "Максимальные баллы" - при проверке ответов всегда будет полный балл

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -0,0 +1 @@
[{"description":"treehash per file","signed_content":{"payload":"eyJjb250ZW50X2hhc2hlcyI6W3siYmxvY2tfc2l6ZSI6NDA5NiwiZGlnZXN0Ijoic2hhMjU2IiwiZmlsZXMiOlt7InBhdGgiOiJpY29uLnBuZyIsInJvb3RfaGFzaCI6InZYSzRsclYwcDdlZGhRdTdpRUVoY1Eza2xaYU8xVU9lM1lHTXQtbm1XdzQifSx7InBhdGgiOiJpbmplY3QuanMiLCJyb290X2hhc2giOiI2WmdFbGhhLUR4ZWRXc2FWY0hpV3ZFMEt2cVZXdGVyZ1F0blhYM0JyNGVBIn0seyJjYW5vbmljYWxfanNvbl9yb290X2hhc2giOiJCeWZIczFha1ZUX0VpeW9WQXlTTmYydFQ3bkZLVG92ak96OGVjQXhpNjdrIiwicGF0aCI6Im1hbmlmZXN0Lmpzb24iLCJyb290X2hhc2giOiJxc1JKdm45dnBybHNUdTE4ZFFkMm8zRnE4TUxIQTlSclRtNzdHd185bmlrIn1dLCJmb3JtYXQiOiJ0cmVlaGFzaCIsImhhc2hfYmxvY2tfc2l6ZSI6NDA5Nn1dLCJpdGVtX2lkIjoiYWVtZ2hwbXBpY25vZ2JhZGRhYmljZWNiaWVob2VoYmIiLCJpdGVtX3ZlcnNpb24iOiI2LjY2IiwicHJvdG9jb2xfdmVyc2lvbiI6MX0","signatures":[{"header":{"kid":"publisher"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"QoEO2p82NrNNQBbKAJAmjlSSMmTSPzX9lkFTKwEAZ37p8xIYnaL7_NydUA_QVu0vxp8jkpQrBCjY-UwfffnoMiHROhuzY57iS2pj2q3_rp5at-sjMlE43cZrKINcamCFKQN7A4tGThd30D_RngRNDhh4Kmu4fxd1CWKSRrD2rBvv29nk0ODjpsCoJ6i5OjXLRFjj7ocPpz227tSRg5ACJRUY3fQa0U6l-ZRwIwT0sVQN-hkNV-0qWtwiTpWU2807N3RZTY4CgeA-2-YO9pmDHTkFaWtg4fPOEZSdWe_Trheh_2U7n-CeTxruPrGr_jf7L3znmIB8OItiilcVXEI_qg"},{"header":{"kid":"webstore"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"YbWAdtSJm-YNi1GO1s8Xm1cPIYXhlQ0CxmzGPoXoafbPz9EuwnpRsL6pOWi7MragwJ3rkwgonbrqkba7xuWDj9Vzd8PWSSywyHttPOJeFBBLyfXVjHbLUNb9kKCkgYOdlnhadgGcaXXe1Y5O-1KVWgXqyzY8jxfD-jJivhsxsfFV1QA0w1BJOngqygF5O4X7dx9m4k4UeyNvbAYJu2_tYObzJVkcjSQa96sLPd5rwC6LaJaS10yCsC--qvOrKr4KY5KEvF1M4dwQhv5NvRRbYLuGgkf5t_3ccjAhHXGYIb_H7g3Ilj71eg95NMNcjw5vIqEEtfX8POsEg_Ca55v8DQ"}]}}]

View File

@@ -1,12 +1,20 @@
chrome.storage.sync.get(['choise','simple'], function(items) {
var choise=items['choise'];
chrome.storage.sync.get(['show_answers','simple_mode','true_answers'], function(items) {
var choise=items['show_answers'];
if(choise == undefined) choise = true;
if(choise) chrome.browserAction.setBadgeText({text: "on"});
else chrome.browserAction.setBadgeText({text: "off"});
choise=items['simple_mode'];
if(choise == undefined) choise = false;
if(choise) chrome.browserAction.setBadgeText({text: "on"});
choise=items['true_answers'];
if(choise == undefined) choise = false;
if(choise) chrome.browserAction.setBadgeText({text: "on"});
});
//Создать контекстное меню
chrome.contextMenus.create({"title": "Показать ответы","onclick" : show});
//Показать ответы
function show(info) {
var url = info.pageUrl;
var url_ = "www.cambridgelms.org";

View File

View File

@@ -10,8 +10,8 @@ $(document).ready(function() {
}
});
//Если выбрана функция автоматического показа ответов заппускается функция показа ответов
chrome.storage.sync.get(['choise'], function(items) {
var choise=items['choise'];
chrome.storage.sync.get(['show_answers'], function(items) {
var choise=items['show_answers'];
if(choise == undefined) choise = true;
if(choise){
var timerId = setInterval(show, 2000);
@@ -25,7 +25,8 @@ $(document).ready(function() {
//Показать ответы
function show() {
$('*[class^="correct"]').show().removeClass("ng-hide").parent().show().removeClass("ng-hide");
$("table.ng-hide").removeClass("ng-hide");
$("section").css("user-select","initial");
$('*[class^="correct"]').show().removeClass('ng-hide').parent().show().removeClass('ng-hide');
$('*[ng-show^="doShowAnswer"]').removeClass('ng-hide');
$('table.ng-hide').removeClass('ng-hide');
$('section').css('user-select','initial');
}

62
js/simple_mode.js Normal file
View File

@@ -0,0 +1,62 @@
chrome.storage.sync.get(['simple_mode'], function(items) {
var choise=items['simple_mode'];
if(choise == undefined) choise = false;
if(choise) simple_mode_on();
});
//id и class ненужных элементов
var massiv_id = ['header','dashboard-toogle','skip-link','tools-iframe','cboxOverlay','colorbox','autologout-cache-check'];
var massiv_name = ['content-page-header','header-content scorm-header clearfix','region region-footer','left-nav hide','ipad-popup','top-btn save ipad-pos f-right disableMultipleClick-processed'];
//Включить простого вида
function simple_mode_on() {
var a;
a = document.getElementsByClassName('header-content scorm-header clearfix addBorder-top')[0];
if(a) a.setAttribute("class", "header-content scorm-header clearfix");
a = document.getElementsByClassName('main-content remove-pad hide clearfix')[0];
if(a) a.setAttribute("style", "display:block;");
a = document.getElementsByClassName('header-content scorm-header clearfix addBorder-top')[0];
if(a) a.setAttribute("class", "header-content scorm-header clearfix");
a = document.getElementById('content');
if(a) a.setAttribute('id','content_');
a = document.getElementsByClassName("scromoverlaydiv")[0];
if(a) a.remove();
a = document.getElementById('content-iframe');
if(a) a.setAttribute("style", "position:relative;display:block;height:93vh;visibility: visible;margin-left:-0.7%")
//Убираем отображение всех элементов из массивов
massiv_id.forEach(function(item, i, arr) {
a = document.getElementById(item);
if(a) a.setAttribute("style","transform: scale(0);margin-top:-9%");
});
massiv_name.forEach(function(item, i, arr) {
a = document.getElementsByClassName(item)[0];
if(a) a.setAttribute("style","transform: scale(0);");
});
}
//Выключить простого вида
function simple_mode_off() {
var a;
a = document.getElementsByClassName('dashboard-toggle-bg')[0];
if(a) a.innerHTML = "Hide Dashboard";
a = document.getElementById('content_');
if(a) a.setAttribute('id','content');
if(a) a.removeAttribute("style");
a = document.getElementById('content-iframe');
if(a) a.setAttribute("style", "position:relative;display:block;height:93vh;visibility: visible;");
//Возвращаем отображение всех элементов из массивов
massiv_id.forEach(function(item, i, arr) {
a = document.getElementById(item);
if(a) a.removeAttribute("style");
});
massiv_name.forEach(function(item, i, arr) {
a = document.getElementsByClassName(item)[0];
if(a) a.removeAttribute("style");
});
}
//Ожидание команд
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
if(request.command==="simple_mode_on") {
simple_mode_on();
}
if(request.command==="simple_mode_off") {
simple_mode_off();
}
});

34
js/true_answers.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -2,24 +2,28 @@
"name": "LMS helper ♥",
"description": "Easy answers from your heart. Made with love by FutureX",
"icons": {
"16": "icon.png",
"32": "icon.png",
"48": "icon.png",
"128": "icon.png"
"16": "icons/icon.png",
"32": "icons/icon.png",
"48": "icons/icon.png",
"128": "icons/icon.png"
},
"version": "1.4.8.8",
"manifest_version": 2,
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
"default_icon": "icons/icon.png",
"default_popup": "popup/popup.html"
},
"background": {
"scripts": ["background.js"]
"scripts": ["js/background.js", "js/true_answers.js" ]
},
"content_scripts": [
{
"matches": [ "*://www.cambridgelms.org/*" ],
"js": [ "jquery.js", "inject.js" ],
"js": [ "js/simple_mode.js" ],
"run_at": "document_end"
},{
"matches": [ "*://www.cambridgelms.org/*" ],
"js": [ "js/jquery.js", "js/show_answers.js" ],
"run_at": "document_idle",
"all_frames": true
}
@@ -27,6 +31,11 @@
"permissions": [
"tabs",
"contextMenus",
"storage"
"storage",
"webRequest",
"webRequestBlocking",
"*://www.cambridgelms.org/*",
"activeTab",
"management"
]
}

View File

@@ -1,22 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<html>
<head>
<title>LMS Answers</title>
<link rel="stylesheet" href="popup_style.css">
<script type="text/javascript" src="popup.js"> </script>
</head>
<body>
<div class="shadow title_text">
<h1>LMS Answers</h1>
</div>
<div class="button-add style style_1">
<input id="choiser" type="checkbox">
<label for="choiser" data-on-text="Автоматический режим" data-off-text="Автоматический режим"></label>
<div class="button-add__icon"></div>
</div>
<div class="">
<button id="showBtn">Показать ответы</button>
</div>
</body>
</html>

View File

@@ -1,37 +0,0 @@
document.addEventListener('DOMContentLoaded', function() {
loadOptions();
var showButton = document.getElementById('showBtn');
showButton.addEventListener('click', function() {
show();
}, false);
var showChecker = document.getElementById('choiser');
showChecker.addEventListener('change', function() {
saveOptions();
show();
}, false);
}, false);
function loadOptions() {
chrome.storage.sync.get(['choise'], function(items) {
var choise=items['choise'];
if(choise == undefined) choise = true;
var select = document.getElementById("choiser");
select.checked = choise;
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
else chrome.browserAction.setBadgeText({text: "off"});
});
}
function saveOptions() {
var select = document.getElementById("choiser");
chrome.storage.sync.set({'choise': select.checked});
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
else chrome.browserAction.setBadgeText({text: "off"});
}
function show() {
var query = { active: true, currentWindow: true };
chrome.tabs.query(query, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {command: "show"});
});
}

35
popup/popup.html Normal file
View File

@@ -0,0 +1,35 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<html>
<head>
<title>LMS Answers</title>
<link rel="stylesheet" href="popup_style.css">
<script type="text/javascript" src="popup.js"> </script>
</head>
<body>
<div class="shadow title_text">
<h1>LMS Answers</h1>
</div>
<div class="button-add style style_1">
<input id="show_answers" type="checkbox">
<label for="show_answers" data-on-text="Автоматический режим" data-off-text="Автоматический режим"></label>
<div class="button-add__icon"></div>
</div>
<div class="button-add style style_2">
<input id="simple_mode" type="checkbox">
<label for="simple_mode" data-on-text="Упрощенная страница" data-off-text="Упрощенная страница"></label>
<div class="button-add__icon"></div>
</div>
<div class="button-add style style_3">
<input id="true_answers" type="checkbox">
<label for="true_answers" data-on-text="Максимальные баллы" data-off-text="Максимальные баллы"></label>
<div class="button-add__icon"></div>
</div>
<div class="">
<button id="showBtn">Показать ответы</button>
</div>
</body>
</html>

87
popup/popup.js Normal file
View File

@@ -0,0 +1,87 @@
document.addEventListener('DOMContentLoaded', function() {
loadOptions();
var showButton = document.getElementById('showBtn');
showButton.addEventListener('click', function() {
show();
}, false);
var showChecker = document.getElementById('show_answers');
showChecker.addEventListener('change', function() {
saveOptions();
if(showChecker.checked)show();
}, false);
var simpleChecker = document.getElementById('simple_mode');
simpleChecker.addEventListener('change', function() {
saveOptions();
simple_mode();
}, false);
var trueChecker = document.getElementById('true_answers');
trueChecker.addEventListener('change', function() {
saveOptions();
autotrue();
}, false);
}, false);
function loadOptions() {
chrome.storage.sync.get(['show_answers','simple_mode','true_answers'], function(items) {
var choise=items['show_answers'];
if(choise == undefined) choise = true;
var select = document.getElementById("show_answers");
select.checked = choise;
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
else chrome.browserAction.setBadgeText({text: "off"});
choise=items['simple_mode'];
if(choise == undefined) choise = false;
var select = document.getElementById("simple_mode");
select.checked = choise;
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
choise=items['true_answers'];
if(choise == undefined) choise = false;
var select = document.getElementById("true_answers");
select.checked = choise;
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
});
}
function saveOptions() {
var select = document.getElementById("show_answers");
chrome.storage.sync.set({'show_answers': select.checked});
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
else chrome.browserAction.setBadgeText({text: "off"});
select = document.getElementById("simple_mode");
chrome.storage.sync.set({'simple_mode': select.checked});
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
select = document.getElementById("true_answers");
chrome.storage.sync.set({'true_answers': select.checked});
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
}
function show() {
var query = { active: true, currentWindow: true };
chrome.tabs.query(query, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {command: "show"});
});
}
function simple_mode() {
var select = document.getElementById("simple_mode");
var query = { active: true, currentWindow: true };
chrome.tabs.query(query, function(tabs) {
if(select.checked===true)
chrome.tabs.sendMessage(tabs[0].id, {command: "simple_mode_on"})
else
chrome.tabs.sendMessage(tabs[0].id, {command: "simple_mode_off"})
});
}
function autotrue() {
alert("Чтобы обновления вступили в силу обновите страницу");
var select = document.getElementById("true_answers");
if(select.checked===true)
chrome.runtime.sendMessage({msg: "auto_on"})
else
chrome.runtime.sendMessage({msg: "auto_off"});
}