Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bf6e440651 | ||
|
46c02e2bb3 | ||
|
b4ea41fd8c | ||
|
6a9568d46d | ||
|
05db1c175b | ||
|
4d121390fe | ||
|
cf55bea9c1 | ||
|
1a7fa8e210 | ||
|
bf3ca076ff | ||
|
d961d1cf00 | ||
|
42977a5b55 | ||
|
a0338001b6 | ||
|
5f61af3c2c | ||
|
5850cf5c42 | ||
|
44b58955ba | ||
|
3d655c6ff2 | ||
|
510a469b93 | ||
|
87ce498997 | ||
|
c5a2332273 | ||
|
bb63305744 | ||
|
e9f4ad855c | ||
|
baa49ad871 | ||
|
32472240b2 | ||
|
2d21a77d7e | ||
|
f042bbd439 | ||
|
8ec55e0dd9 | ||
|
2f8c070f62 | ||
|
9ac51eaa9c |
53
README.md
Normal file
53
README.md
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# Chrome Extension - LMS Answers
|
||||||
|
* #### Небольшое расширение для легкого выполнения тестов в среде Cambridge LMS.
|
||||||
|
|
||||||
|
## Последнюю версию всегда можно найти в разделе [releases](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/releases)
|
||||||
|
***
|
||||||
|
***
|
||||||
|
## Быстрое перемещение по документу
|
||||||
|
|
||||||
|
> * ### [Функционал](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/blob/master/README.md#%D0%A4%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D0%BE%D0%BD%D0%B0%D0%BB-1)
|
||||||
|
> * #### [Меню расширения](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/blob/master/README.md#%D0%9F%D1%80%D0%B8-%D0%BD%D0%B0%D0%B6%D0%B0%D1%82%D0%B8%D0%B8-%D0%BD%D0%B0-%D0%B8%D0%BA%D0%BE%D0%BD%D0%BA%D1%83-%D1%80%D0%B0%D1%81%D1%88%D0%B8%D1%80%D0%B5%D0%BD%D0%B8%D1%8F-%D0%BF%D0%BE%D1%8F%D0%B2%D0%B8%D1%82%D1%81%D1%8F-%D0%BC%D0%B5%D0%BD%D1%8E-%D1%80%D0%B0%D1%81%D1%88%D0%B8%D1%80%D0%B5%D0%BD%D0%B8%D1%8F)
|
||||||
|
> * #### [Возможности](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/blob/master/README.md#%D0%A7%D1%82%D0%BE-%D0%BC%D0%BE%D0%B6%D0%BD%D0%BE-%D1%81%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C-%D0%B8%D0%B7-%D1%8D%D1%82%D0%BE%D0%B3%D0%BE-%D0%BC%D0%B5%D0%BD%D1%8E)
|
||||||
|
> * [Автопоказ ответов](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/blob/master/README.md#%D0%9C%D0%BE%D0%B6%D0%BD%D0%BE-%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D1%82%D1%8C-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC-%D0%90%D0%B2%D1%82%D0%BE%D0%BC%D0%B0%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC---%D0%B1%D0%BE%D0%BB%D1%8C%D1%88%D0%B0%D1%8F-%D1%87%D0%B0%D1%81%D1%82%D1%8C-%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2-%D0%B1%D1%83%D0%B4%D0%B5%D1%82-%D0%B0%D0%B2%D1%82%D0%BE%D0%BC%D0%B0%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8-%D0%B7%D0%B0%D0%BF%D0%BE%D0%BB%D0%BD%D1%8F%D1%82%D1%8C%D1%81%D1%8F)
|
||||||
|
> * [Автоматический режим(beta)](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/blob/master/README.md#%D0%9C%D0%BE%D0%B6%D0%BD%D0%BE-%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D1%82%D1%8C-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC-%D0%90%D0%B2%D1%82%D0%BE%D0%BC%D0%B0%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC---%D0%B1%D0%BE%D0%BB%D1%8C%D1%88%D0%B0%D1%8F-%D1%87%D0%B0%D1%81%D1%82%D1%8C-%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2-%D0%B1%D1%83%D0%B4%D0%B5%D1%82-%D0%B0%D0%B2%D1%82%D0%BE%D0%BC%D0%B0%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8-%D0%B7%D0%B0%D0%BF%D0%BE%D0%BB%D0%BD%D1%8F%D1%82%D1%8C%D1%81%D1%8F)
|
||||||
|
> * [Упрощенная страница](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/blob/master/README.md#%D0%9C%D0%BE%D0%B6%D0%BD%D0%BE-%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D1%82%D1%8C-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC-%D0%A3%D0%BF%D1%80%D0%BE%D1%89%D0%B5%D0%BD%D0%BD%D0%B0%D1%8F-%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0---%D0%B2%D0%BE-%D0%B2%D1%80%D0%B5%D0%BC%D1%8F-%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2-%D0%B1%D1%83%D0%B4%D0%B5%D1%82-%D0%BE%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B0%D1%82%D1%8C%D1%81%D1%8F-%D1%82%D0%BE%D0%BB%D1%8C%D0%BA%D0%BE-%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%BD%D0%B0%D1%8F-%D1%87%D0%B0%D1%81%D1%82%D1%8C)
|
||||||
|
> * [Максимальные баллы](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/blob/master/README.md#%D0%9C%D0%BE%D0%B6%D0%BD%D0%BE-%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D1%82%D1%8C-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC-%D0%9C%D0%B0%D0%BA%D1%81%D0%B8%D0%BC%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5-%D0%B1%D0%B0%D0%BB%D0%BB%D1%8B---%D0%BF%D1%80%D0%B8-%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B5-%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D0%BE%D0%B2-%D0%B2%D1%81%D0%B5%D0%B3%D0%B4%D0%B0-%D0%B1%D1%83%D0%B4%D0%B5%D1%82-%D0%BF%D0%BE%D0%BB%D0%BD%D1%8B%D0%B9-%D0%B1%D0%B0%D0%BB%D0%BB)
|
||||||
|
> * #### [Пример работы](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/blob/master/README.md#%D0%9F%D1%80%D0%B8%D0%BC%D0%B5%D1%80-%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D1%8B-%D1%80%D0%B0%D1%81%D1%88%D0%B8%D1%80%D0%B5%D0%BD%D0%B8%D1%8F-%D0%BF%D1%80%D0%B8-%D0%B2%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%BD%D0%BD%D0%BE%D0%BC-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC%D0%B5-%D0%BC%D0%B0%D0%BA%D1%81%D0%B8%D0%BC%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5-%D0%B1%D0%B0%D0%BB%D0%BB%D1%8B)
|
||||||
|
> * ### [Инструкция по установке](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/blob/master/README.md#%D0%98%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BA%D1%86%D0%B8%D1%8F-%D0%BF%D0%BE-%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BA%D0%B5-1)
|
||||||
|
|
||||||
|
***
|
||||||
|
***
|
||||||
|
|
||||||
|
## Функционал:
|
||||||
|
### При нажатии на иконку расширения появится меню расширения
|
||||||
|

|
||||||
|
|
||||||
|
### Что можно сделать из этого меню?
|
||||||
|
* #### Можно выбрать режим "Показывать ответы" - при открытии страницы с тестом ответы автоматически появятся
|
||||||
|
* Если этого не сделать, то всегда можно нажать на кнопку "Показать ответы"
|
||||||
|
* #### Можно выбрать режим "Автоматический режим" - большая часть тестов будет автоматически заполняться
|
||||||
|
* Возможны ошибки, но их вероятность мала
|
||||||
|
* #### Можно выбрать режим "Упрощенная страница" - во время тестов будет отображаться только основная часть
|
||||||
|
* Основной частью считается само задание и кнопки перехода к предыдущему и следующему заданиям
|
||||||
|
* #### Можно выбрать режим "Максимальные баллы" - при проверке ответов всегда будет полный балл
|
||||||
|
* Однако преподаватель будет видеть, что поля для ответов пустые, поэтому лучше не оставлять поля пустыми.
|
||||||
|
* После включения и выключения надо обновить страницу для того, чтобы расширение начало действовать
|
||||||
|
|
||||||
|
### Пример работы расширения при включенном режиме "максимальные баллы":
|
||||||
|

|
||||||
|
|
||||||
|
***
|
||||||
|
***
|
||||||
|
|
||||||
|
## Инструкция по установке
|
||||||
|
1. Скачиваем последнюю версию расширения в разделе [releases](https://github.com/FutureXpo/Chrome-Extension-LMS-Answers/releases)
|
||||||
|

|
||||||
|
1. Распаковываем архив в любое место, запоминаем пусть к нему
|
||||||
|
1. Открываем Google Chrome, идем во вкладку расширения
|
||||||
|

|
||||||
|
1. Включаем режим разработчика. Нажимаем "Загрузить распакованное расширение". Выбираем папку LMS, которую распаковали из архива
|
||||||
|
 
|
||||||
|
1. В списке расширений появилось новое - LMS Answers. Активируем его
|
||||||
|

|
||||||
|
1. Все готово, можно начинать пользоваться!
|
@ -1,20 +0,0 @@
|
|||||||
chrome.storage.sync.get(['choise','simple'], function(items) {
|
|
||||||
var choise=items['choise'];
|
|
||||||
if(choise == undefined) choise = true;
|
|
||||||
if(choise) chrome.browserAction.setBadgeText({text: "on"});
|
|
||||||
else chrome.browserAction.setBadgeText({text: "off"});
|
|
||||||
});
|
|
||||||
|
|
||||||
chrome.contextMenus.create({"title": "Показать ответы","onclick" : show});
|
|
||||||
|
|
||||||
function show(info) {
|
|
||||||
var url = info.pageUrl;
|
|
||||||
var url_ = "www.cambridgelms.org";
|
|
||||||
if(JSON.stringify(url).includes(url_))
|
|
||||||
{
|
|
||||||
var query = { active: true, currentWindow: true };
|
|
||||||
chrome.tabs.query(query, function(tabs) {
|
|
||||||
chrome.tabs.sendMessage(tabs[0].id, {command: "show"});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
1
js/_metadata/verified_contents.json
Normal file
1
js/_metadata/verified_contents.json
Normal 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"}]}}]
|
289
js/auto_mode.js
Normal file
289
js/auto_mode.js
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
//По окончании загрузки документа вызывается функция
|
||||||
|
$(document).ready(function() {
|
||||||
|
var path = window.location.pathname;
|
||||||
|
var page = path.split("/").pop();
|
||||||
|
if(page === 'index.html') {
|
||||||
|
//При получении команды 'auto_mode' заполняет ответы
|
||||||
|
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||||
|
if(request.command==="auto_mode") {
|
||||||
|
auto_mode();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//Если выбрана функция автоматического показа ответов запускается функция заполнения ответов
|
||||||
|
chrome.storage.sync.get(['auto_mode'], function(items) {
|
||||||
|
var choise=items['auto_mode'];
|
||||||
|
if(choise == undefined) choise = false;
|
||||||
|
if(choise){
|
||||||
|
var timerId = setInterval(auto_mode, 2000);
|
||||||
|
setTimeout(function() {
|
||||||
|
clearInterval(timerId);
|
||||||
|
}, 7000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
var init = 0;
|
||||||
|
//Заполнить ответы
|
||||||
|
function auto_mode() {
|
||||||
|
var test,answers;
|
||||||
|
//select box
|
||||||
|
test = document.getElementsByClassName('selectBox');
|
||||||
|
answers = document.getElementsByTagName('b');
|
||||||
|
if(test&&answers) fill_selectbox(test,answers);
|
||||||
|
//phrases
|
||||||
|
test = document.getElementsByClassName('all-items-drop');
|
||||||
|
answers = document.getElementsByClassName('correctAnswer');
|
||||||
|
if(test&&answers) fill_phrases(test,answers);
|
||||||
|
//radio_columns
|
||||||
|
test = document.getElementsByTagName('input');
|
||||||
|
if(test) fill_columns(test);
|
||||||
|
//radio button
|
||||||
|
test = document.getElementsByClassName('option_horizontal');
|
||||||
|
answers = document.getElementsByClassName('correct-answers');
|
||||||
|
if(test&&answers) fill_radio(test,answers);
|
||||||
|
//crossword
|
||||||
|
test = document.getElementsByClassName('word-Box')[0];
|
||||||
|
answers = document.getElementsByClassName('all-words-Answer')[0];
|
||||||
|
if(test&&answers) fill_crossword(test,answers);
|
||||||
|
//pronunciation
|
||||||
|
test = document.getElementsByClassName('categories')[0];
|
||||||
|
answers = document.getElementsByClassName('categories')[1];
|
||||||
|
if(test&&answers) fill_pronunciation(test,answers);
|
||||||
|
//text input
|
||||||
|
test = document.getElementsByClassName('inputBox');
|
||||||
|
answers = document.getElementsByClassName('correctAnsDiv');
|
||||||
|
if(test&&answers) fill_input(test,answers);
|
||||||
|
//editDiv
|
||||||
|
test = document.getElementsByClassName('editableDiv');
|
||||||
|
answers = document.getElementsByClassName('correctAnsDiv');
|
||||||
|
if(test&&answers) fill_editable(test,answers);
|
||||||
|
//moveToken
|
||||||
|
test = document.getElementsByClassName('moveToken');
|
||||||
|
answers = document.getElementsByClassName('answerSentClass');
|
||||||
|
if(test&&answers) fill_sorting(test,answers);
|
||||||
|
}
|
||||||
|
//Заполнить задания, где есть selectBox
|
||||||
|
function fill_selectbox(test,answers) {
|
||||||
|
var test_arr = Array.prototype.slice.call(test);
|
||||||
|
var answers_arr = Array.prototype.slice.call(answers);
|
||||||
|
if(answers_arr&&test_arr)answers_arr.forEach(function(item, i) {
|
||||||
|
var a = item.innerHTML.replace(/(^\s*)|(\s*)$/g, '');;
|
||||||
|
if(test_arr[i])
|
||||||
|
Array.prototype.slice.call(test_arr[i].options).forEach(function(item) {
|
||||||
|
if(item.value.includes(a)) {
|
||||||
|
var b = item.value.replace(a, '');
|
||||||
|
if( b.search(/[a-zA-Z]/) === -1 ) test_arr[i].value = item.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Заполнить задания, где есть inputBox
|
||||||
|
function fill_input(test,answers) {
|
||||||
|
var test_arr = Array.prototype.slice.call(test);
|
||||||
|
var answers_arr = Array.prototype.slice.call(answers);
|
||||||
|
var txt_answers_arr = [];
|
||||||
|
if(answers_arr&&test_arr)answers_arr.forEach(function(item, i) {
|
||||||
|
txt_answers_arr = push_answer_b(item.getElementsByClassName("showAnswersentenseClass"),txt_answers_arr);
|
||||||
|
});
|
||||||
|
if(answers_arr&&test_arr)test_arr.forEach(function(item, i) {
|
||||||
|
if(item.getAttribute("type")!=="radio"&&item.getAttribute("class")!=="inputBox ng-scope ng-valid ng-dirty"){
|
||||||
|
item.setAttribute("class","inputBox ng-scope ng-valid ng-dirty");
|
||||||
|
item.value = txt_answers_arr[i]+"-";//.innerHTML + "-";
|
||||||
|
if(init===0)alert("Не забудьте убрать знак '-' в каждом задании");
|
||||||
|
init = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Заполнить задания, где есть radio buttons
|
||||||
|
function fill_radio(test,answers) {
|
||||||
|
var test_arr = Array.prototype.slice.call(test);
|
||||||
|
var answers_arr = Array.prototype.slice.call(answers);
|
||||||
|
if(answers_arr&&test_arr)answers_arr.forEach(function(item, i) {
|
||||||
|
var radio_arr = Array.prototype.slice.call(test_arr[i].getElementsByTagName('input'));
|
||||||
|
var text_answers_arr = Array.prototype.slice.call(answers_arr[i].getElementsByTagName('b'));
|
||||||
|
var answer = "";
|
||||||
|
if(text_answers_arr) text_answers_arr.forEach(function(item1) {
|
||||||
|
if(item1.innerHTML.search(/[a-zA-Z]/)===-1)answer=answer.substring(0,answer.length-1);
|
||||||
|
answer+=item1.innerHTML.replace(/(^\s*)|(\s*)$/g, '');
|
||||||
|
if(item1.innerHTML!=='-')answer+=' ';
|
||||||
|
});
|
||||||
|
answer=answer.replace('/','').replace(/(^\s*)|(\s*)$/g, '');
|
||||||
|
var text_test_arr = Array.prototype.slice.call(test_arr[i].getElementsByClassName('optionText'));
|
||||||
|
if(text_test_arr) text_test_arr.forEach(function(item1,j) {
|
||||||
|
if(item1.innerText.includes(answer)) {
|
||||||
|
var c = item1.innerText.replace(answer, '');
|
||||||
|
if( c.search(/[a-zA-Z]/) === -1 ) radio_arr[j].click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Заполнить кроссворд
|
||||||
|
function fill_crossword(test,answers) {
|
||||||
|
var table_test = test.getElementsByTagName('table')[0];
|
||||||
|
var answers_test = answers.getElementsByTagName('table')[0];
|
||||||
|
var table_test_arr = Array.prototype.slice.call(table_test.getElementsByTagName('div'));
|
||||||
|
var answers_test_arr = Array.prototype.slice.call(answers_test.getElementsByTagName('div'));
|
||||||
|
if(table_test_arr&&answers_test_arr) table_test_arr.forEach(function(item,i) {
|
||||||
|
item.innerHTML = answers_test_arr[i].innerHTML;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Заполнить произношение
|
||||||
|
function fill_pronunciation(test,answers) {
|
||||||
|
var test_choises = document.getElementsByClassName('all-items-container')[0].getElementsByClassName('dragger');
|
||||||
|
var text_test_choises = Array.prototype.slice.call(document.getElementsByClassName('all-items-container')[0].getElementsByClassName('ng-binding'));
|
||||||
|
var table_test = test.getElementsByClassName('category-box');
|
||||||
|
var table_answers = answers.getElementsByClassName('category-correctans-box');
|
||||||
|
var table_test_arr = Array.prototype.slice.call(table_test);
|
||||||
|
var answers_test_arr = Array.prototype.slice.call(table_answers);
|
||||||
|
if(answers_test_arr&&table_test_arr) answers_test_arr.forEach(function(item,i) {
|
||||||
|
var answers = Array.prototype.slice.call(item.getElementsByClassName('dragger'));
|
||||||
|
if(answers) answers.forEach(function(item) {
|
||||||
|
var a = item.getElementsByClassName('ng-binding')[0].innerHTML;
|
||||||
|
if(text_test_choises) text_test_choises.forEach(function(item,j) {
|
||||||
|
if(item.innerHTML === a&&test_choises[j].getAttribute("class")!=="dragger draggable ng-scope ui-draggable cloneDropped opacityDiv") {
|
||||||
|
test_choises[j].setAttribute("class","dragger draggable ng-scope ui-draggable cloneDropped opacityDiv");
|
||||||
|
var b = test_choises[j].cloneNode(true);
|
||||||
|
b.setAttribute("class","dragger draggable ng-scope ui-draggable cloneDropped clone");
|
||||||
|
table_test_arr[i].getElementsByClassName('all-items-drop dropped-items drop-dest')[0].append(b);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Заполнить фразы словами
|
||||||
|
function fill_phrases(test,answers) {
|
||||||
|
var test_arr = Array.prototype.slice.call(test);
|
||||||
|
var answers_arr = Array.prototype.slice.call(answers);
|
||||||
|
var d = [];
|
||||||
|
if(answers_arr&&test_arr)answers_arr.forEach(function(item, i) {
|
||||||
|
Array.prototype.slice.call(item.getElementsByClassName('dndAnswerLineClass')).forEach(function(item) {d.push(item);});;
|
||||||
|
});
|
||||||
|
if(d.length>0)answers_arr=d;
|
||||||
|
var test_choises = document.getElementsByClassName('all-items-container')[0];
|
||||||
|
var txt_answers_arr = [];
|
||||||
|
if(test_choises){
|
||||||
|
var text_test_choises = Array.prototype.slice.call(test_choises.getElementsByClassName('ng-binding'));
|
||||||
|
test_choises=test_choises.getElementsByClassName('dragger');
|
||||||
|
}
|
||||||
|
if(answers_arr&&test_arr)txt_answers_arr = push_answer_b(answers,txt_answers_arr);
|
||||||
|
if(answers_arr&&test_arr)test_arr.forEach(function(item, i) {
|
||||||
|
var lil = 0;
|
||||||
|
/*var text_answers_arr = Array.prototype.slice.call(answers_arr[i].getElementsByTagName('b'));
|
||||||
|
var a = "";
|
||||||
|
if(text_answers_arr) text_answers_arr.forEach(function(item1) {
|
||||||
|
if(item1.innerHTML.search(/[a-zA-Z]/)===-1)a=a.substring(0,a.length-1);
|
||||||
|
a+=item1.innerHTML.replace(/(^\s*)|(\s*)$/g, '');
|
||||||
|
if(item1.innerHTML!=='-')a+=' ';
|
||||||
|
});
|
||||||
|
a=a.replace(/(^\s*)|(\s*)$/g, '');*/
|
||||||
|
var a = txt_answers_arr[i];
|
||||||
|
if(text_test_choises) text_test_choises.forEach(function(item,j) {
|
||||||
|
if(item.innerHTML.includes(a)) {
|
||||||
|
var b = item.innerHTML.replace(a, '');
|
||||||
|
if( b.search(/[a-zA-Z]/) === -1 )
|
||||||
|
if(lil===0&&test_choises[j].getAttribute("class")!=="dragger draggable ng-scope ui-draggable cloneDropped opacityDiv") {
|
||||||
|
test_choises[j].setAttribute("class","dragger draggable ng-scope ui-draggable cloneDropped opacityDiv");
|
||||||
|
var b = test_choises[j].cloneNode(true);
|
||||||
|
test_arr[i].append(b);
|
||||||
|
test_arr[i].setAttribute("style",b.getAttribute("style"));
|
||||||
|
test_arr[i].setAttribute("class","drop-dest droppable-Item all-items-drop dropped-items ui-droppable droppableWhiteBG droppableTransparentBG");
|
||||||
|
b.setAttribute("class","dragger draggable ng-scope ui-draggable cloneDropped clone");
|
||||||
|
b.setAttribute("style",b.getAttribute("style")+"position: relative; left: 0px; top: 0px;");
|
||||||
|
lil=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Заполнить задания, где есть radio columns
|
||||||
|
function fill_columns(test) {
|
||||||
|
var test_arr = Array.prototype.slice.call(test);
|
||||||
|
if(test_arr)test_arr.forEach(function(item, i) {
|
||||||
|
if(test_arr[i+test_arr.length/2])if(test_arr[i+test_arr.length/2].checked)item.click();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Заполнить задания, где надо перемещать
|
||||||
|
function fill_sorting(test,answers) {
|
||||||
|
var test_arr = Array.prototype.slice.call(test);
|
||||||
|
var answers_arr = Array.prototype.slice.call(answers);
|
||||||
|
if(test_arr&&answers_arr)test_arr.forEach(function(item, i) {
|
||||||
|
var text_test_choises = Array.prototype.slice.call(item.getElementsByClassName('ng-binding'));
|
||||||
|
var test_choises = Array.prototype.slice.call(item.getElementsByClassName('sorting_li ng-scope'));
|
||||||
|
var answer = answers_arr[i].innerHTML.replace(/<[^>]+>/g,'').replace(/(^\s*)|(\s*)$/g, '');
|
||||||
|
var size = text_test_choises.length;
|
||||||
|
var a = answer;
|
||||||
|
var b = "";
|
||||||
|
while (size > 0){
|
||||||
|
text_test_choises.forEach(function(item1, i) {
|
||||||
|
if(item1.innerHTML.toUpperCase().includes(a.toUpperCase())){
|
||||||
|
size--;
|
||||||
|
answer=answer.substring(a.length,answer.length).replace(/(^\s*)|(\s*)$/g, '');
|
||||||
|
a=answer;
|
||||||
|
b = b + test_choises[i].outerHTML;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
a = a.substring(0,a.length-1);
|
||||||
|
}
|
||||||
|
item.innerHTML = b;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Заполнить задания, где надо исправить ошибки
|
||||||
|
function fill_editable(test,answers) {
|
||||||
|
var test_buttons = document.getElementsByClassName('buttonContainer');
|
||||||
|
var test_arr = Array.prototype.slice.call(test);
|
||||||
|
var answers_arr = Array.prototype.slice.call(answers);
|
||||||
|
if(test_arr&&answers_arr)test_arr.forEach(function(item, i) {
|
||||||
|
test_buttons[i].getElementsByTagName('button')[0].click();
|
||||||
|
if(!answers_arr[i].innerHTML.includes("No change"))
|
||||||
|
item.innerHTML=answers_arr[i].innerHTML.replace(/<[^>]+>/g,'');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Найти ответы в строке(для inputBox)
|
||||||
|
function push_answer_b(answer_arr,answers_arr){
|
||||||
|
var answers = Array.prototype.slice.call(answer_arr);
|
||||||
|
if(answers)answers.forEach(function(answers) {
|
||||||
|
if(answers){
|
||||||
|
var txt = answers.innerHTML+" ";
|
||||||
|
var answer = " ";
|
||||||
|
var mode = 0;
|
||||||
|
var i = 0;
|
||||||
|
for(var i=0; i<txt.length;i++) {
|
||||||
|
var a = txt[i];
|
||||||
|
switch(mode){
|
||||||
|
case 0:
|
||||||
|
if(a === "<"){
|
||||||
|
var b = txt.substring(i,txt.length);
|
||||||
|
if(b.startsWith("<b>")){
|
||||||
|
mode = 2;
|
||||||
|
answer+=" ";
|
||||||
|
if(answer.endsWith(" - "))answer=answer.substring(0,answer.length-3)+"-";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if(a === "<"){
|
||||||
|
var b = txt.substring(i,txt.length);
|
||||||
|
if(b.startsWith("</b>")){
|
||||||
|
if(answer.endsWith(" .")||answer.endsWith(" ,"))answer=answer.substring(0,answer.length-2)+answer.substring(answer.length-1,answer.length);
|
||||||
|
mode = 0;
|
||||||
|
if(!(b.startsWith("</b><b>")||b.startsWith("</b> <b>"))){
|
||||||
|
answer=answer.replace(/(^\s*)|(\s*)$/g, '');
|
||||||
|
answers_arr.push(answer);
|
||||||
|
answer = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else answer += a;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(a === ">"){
|
||||||
|
mode = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return answers_arr;
|
||||||
|
}
|
32
js/background.js
Normal file
32
js/background.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
chrome.storage.sync.get(['show_mode','simple_mode','true_mode','auto_mode'], function(items) {
|
||||||
|
var choise=items['show_mode'];
|
||||||
|
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_mode'];
|
||||||
|
if(choise == undefined) choise = false;
|
||||||
|
if(choise) chrome.browserAction.setBadgeText({text: "on"});
|
||||||
|
|
||||||
|
choise=items['auto_mode'];
|
||||||
|
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";
|
||||||
|
if(JSON.stringify(url).includes(url_))
|
||||||
|
{
|
||||||
|
var query = { active: true, currentWindow: true };
|
||||||
|
chrome.tabs.query(query, function(tabs) {
|
||||||
|
chrome.tabs.sendMessage(tabs[0].id, {command: "show"});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
0
jquery.js → js/jquery.js
vendored
0
jquery.js → js/jquery.js
vendored
@ -10,8 +10,8 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//Если выбрана функция автоматического показа ответов заппускается функция показа ответов
|
//Если выбрана функция автоматического показа ответов заппускается функция показа ответов
|
||||||
chrome.storage.sync.get(['choise'], function(items) {
|
chrome.storage.sync.get(['show_mode'], function(items) {
|
||||||
var choise=items['choise'];
|
var choise=items['show_mode'];
|
||||||
if(choise == undefined) choise = true;
|
if(choise == undefined) choise = true;
|
||||||
if(choise){
|
if(choise){
|
||||||
var timerId = setInterval(show, 2000);
|
var timerId = setInterval(show, 2000);
|
||||||
@ -25,7 +25,8 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
//Показать ответы
|
//Показать ответы
|
||||||
function show() {
|
function show() {
|
||||||
$('*[class^="correct"]').show().removeClass("ng-hide").parent().show().removeClass("ng-hide");
|
$('*[class^="correct"]').show().removeClass('ng-hide').parent().show().removeClass('ng-hide');
|
||||||
$("table.ng-hide").removeClass("ng-hide");
|
$('*[ng-show^="doShowAnswer"]').removeClass("ng-hide").has('input').find('input').remove();
|
||||||
$("section").css("user-select","initial");
|
$('table.ng-hide').removeClass('ng-hide');
|
||||||
|
$('section').css('user-select','initial');
|
||||||
}
|
}
|
63
js/simple_mode.js
Normal file
63
js/simple_mode.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
chrome.storage.sync.get(['simple_mode'], function(items) {
|
||||||
|
var choise=items['simple_mode'];
|
||||||
|
if(choise == undefined) choise = false;
|
||||||
|
if(choise) simple_mode_on();
|
||||||
|
document.getElementById('autologout-cache-check').remove();
|
||||||
|
});
|
||||||
|
//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_mode.js
Normal file
34
js/true_mode.js
Normal file
File diff suppressed because one or more lines are too long
@ -1,25 +1,34 @@
|
|||||||
{
|
{
|
||||||
"name": "LMS helper ♥",
|
"name": "LMS helper ♥",
|
||||||
|
"homepage_url": "https://github.com/FutureXpo/Chrome-Extension-LMS-Answers",
|
||||||
"description": "Easy answers from your heart. Made with love by FutureX",
|
"description": "Easy answers from your heart. Made with love by FutureX",
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "icon.png",
|
"16": "icons/icon.png",
|
||||||
"32": "icon.png",
|
"32": "icons/icon.png",
|
||||||
"48": "icon.png",
|
"48": "icons/icon.png",
|
||||||
"128": "icon.png"
|
"128": "icons/icon.png"
|
||||||
},
|
},
|
||||||
"version": "1.4.8.8",
|
"version": "1.4.8.8",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"default_icon": "icon.png",
|
"default_icon": "icons/icon.png",
|
||||||
"default_popup": "popup.html"
|
"default_popup": "popup/popup.html"
|
||||||
|
},
|
||||||
|
"options_ui": {
|
||||||
|
"page": "popup/popup.html",
|
||||||
|
"open_in_tab": false
|
||||||
},
|
},
|
||||||
"background": {
|
"background": {
|
||||||
"scripts": ["background.js"]
|
"scripts": ["js/background.js", "js/true_mode.js" ]
|
||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": [ "*://www.cambridgelms.org/*" ],
|
"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_mode.js", "js/auto_mode.js" ],
|
||||||
"run_at": "document_idle",
|
"run_at": "document_idle",
|
||||||
"all_frames": true
|
"all_frames": true
|
||||||
}
|
}
|
||||||
@ -27,6 +36,11 @@
|
|||||||
"permissions": [
|
"permissions": [
|
||||||
"tabs",
|
"tabs",
|
||||||
"contextMenus",
|
"contextMenus",
|
||||||
"storage"
|
"storage",
|
||||||
|
"webRequest",
|
||||||
|
"webRequestBlocking",
|
||||||
|
"*://www.cambridgelms.org/*",
|
||||||
|
"activeTab",
|
||||||
|
"management"
|
||||||
]
|
]
|
||||||
}
|
}
|
22
popup.html
22
popup.html
@ -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>
|
|
37
popup.js
37
popup.js
@ -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"});
|
|
||||||
});
|
|
||||||
}
|
|
40
popup/popup.html
Normal file
40
popup/popup.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<!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_4">
|
||||||
|
<input id="show_mode" type="checkbox">
|
||||||
|
<label for="show_mode" data-text="Показывать ответы"></label>
|
||||||
|
<div class="button-add__icon"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="button-add style style_1">
|
||||||
|
<input id="auto_mode" type="checkbox">
|
||||||
|
<label for="auto_mode" data-text="Автоматический режим(β)"></label>
|
||||||
|
<div class="button-add__icon"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="button-add style style_3">
|
||||||
|
<input id="true_mode" type="checkbox">
|
||||||
|
<label for="true_mode" data-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-text="Упрощенная страница"></label>
|
||||||
|
<div class="button-add__icon"></div>
|
||||||
|
</div>
|
||||||
|
<div class="">
|
||||||
|
<button id="showBtn">Показать ответы</button>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
109
popup/popup.js
Normal file
109
popup/popup.js
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
loadOptions();
|
||||||
|
var showButton = document.getElementById('showBtn');
|
||||||
|
showButton.addEventListener('click', function() {
|
||||||
|
show();
|
||||||
|
}, false);
|
||||||
|
var autoChecker = document.getElementById('auto_mode');
|
||||||
|
autoChecker.addEventListener('change', function() {
|
||||||
|
saveOptions();
|
||||||
|
auto_mode();
|
||||||
|
}, false);
|
||||||
|
var showChecker = document.getElementById('show_mode');
|
||||||
|
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_mode');
|
||||||
|
trueChecker.addEventListener('change', function() {
|
||||||
|
saveOptions();
|
||||||
|
true_mode();
|
||||||
|
}, false);
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
function loadOptions() {
|
||||||
|
chrome.storage.sync.get(['show_mode','simple_mode','true_mode','auto_mode'], function(items) {
|
||||||
|
var choise=items['show_mode'];
|
||||||
|
if(choise == undefined) choise = true;
|
||||||
|
var select = document.getElementById("show_mode");
|
||||||
|
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_mode'];
|
||||||
|
if(choise == undefined) choise = false;
|
||||||
|
var select = document.getElementById("true_mode");
|
||||||
|
select.checked = choise;
|
||||||
|
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
|
||||||
|
|
||||||
|
choise=items['auto_mode'];
|
||||||
|
if(choise == undefined) choise = false;
|
||||||
|
var select = document.getElementById("auto_mode");
|
||||||
|
select.checked = choise;
|
||||||
|
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveOptions() {
|
||||||
|
var select = document.getElementById("show_mode");
|
||||||
|
chrome.storage.sync.set({'show_mode': 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_mode");
|
||||||
|
chrome.storage.sync.set({'true_mode': select.checked});
|
||||||
|
if(select.checked) chrome.browserAction.setBadgeText({text: "on"});
|
||||||
|
|
||||||
|
select = document.getElementById("auto_mode");
|
||||||
|
chrome.storage.sync.set({'auto_mode': 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 auto_mode() {
|
||||||
|
var query = { active: true, currentWindow: true };
|
||||||
|
chrome.tabs.query(query, function(tabs) {
|
||||||
|
chrome.tabs.sendMessage(tabs[0].id, {command: "auto_mode"});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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 true_mode() {
|
||||||
|
alert("Чтобы обновления вступили в силу обновите страницу");
|
||||||
|
var select = document.getElementById("true_mode");
|
||||||
|
if(select.checked===true)
|
||||||
|
chrome.runtime.sendMessage({msg: "auto_on"})
|
||||||
|
else
|
||||||
|
chrome.runtime.sendMessage({msg: "auto_off"});
|
||||||
|
}
|
@ -55,16 +55,13 @@ body {
|
|||||||
transition: 0.2s ease-out; }
|
transition: 0.2s ease-out; }
|
||||||
|
|
||||||
.style label {
|
.style label {
|
||||||
|
will-change: transform;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
border-radius: 2rem; }
|
border-radius: 2rem; }
|
||||||
.style label:before {
|
|
||||||
content: attr(data-on-text); }
|
|
||||||
.style label:after {
|
|
||||||
content: attr(data-off-text); }
|
|
||||||
|
|
||||||
.style input[type=checkbox] + label {
|
.style input[type=checkbox] ~ label {
|
||||||
width: 210px;
|
width: 210px;
|
||||||
background: #FF5335; }
|
background: #FF5335; }
|
||||||
|
|
||||||
@ -79,40 +76,43 @@ body {
|
|||||||
.style input[type=checkbox]:checked ~ .button-add__icon:after {
|
.style input[type=checkbox]:checked ~ .button-add__icon:after {
|
||||||
transform: translate(30%) rotate(-45deg); }
|
transform: translate(30%) rotate(-45deg); }
|
||||||
|
|
||||||
.style .button-add__icon {
|
.button-add__icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
width: 30px; }
|
width: 30px; }
|
||||||
.style .button-add__icon:before, .style .button-add__icon:after {
|
.button-add__icon:before, .button-add__icon:after {
|
||||||
height: 3px;
|
height: 3px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); }
|
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); }
|
||||||
.style .button-add__icon:before {
|
.button-add__icon:before {
|
||||||
width: 17px;
|
width: 17px;
|
||||||
transform: rotate(90deg); }
|
transform: rotate(90deg); }
|
||||||
.style .button-add__icon:after {
|
.button-add__icon:after {
|
||||||
width: 17px;
|
width: 17px;
|
||||||
transform: rotate(0); }
|
transform: rotate(0); }
|
||||||
|
|
||||||
.style_1 label:before, .style_1 label:after {
|
.style_1 label:before, .style_1 label:after {
|
||||||
|
content: attr(data-text);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0.9rem;
|
right: 0.4rem; }
|
||||||
transition: all 0.2s .15s ease-out; }
|
|
||||||
.style_2 label:before, .style_2 label:after {
|
.style_2 label:before, .style_2 label:after {
|
||||||
|
content: attr(data-text);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 1.3rem;
|
right: 1.3rem; }
|
||||||
transition: all 0.2s .15s ease-out; }
|
|
||||||
.style_3 label:before, .style_3 label:after {
|
.style_3 label:before, .style_3 label:after {
|
||||||
|
content: attr(data-text);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 1.4rem;
|
right: 1.4rem; }
|
||||||
transition: all 0.2s .15s ease-out; }
|
.style_4 label:before, .style_4 label:after {
|
||||||
|
content: attr(data-text);
|
||||||
|
position: absolute;
|
||||||
|
right: 1.9rem; }
|
||||||
|
|
||||||
button {
|
button {
|
||||||
|
will-change: transform;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
display: inline-block;
|
display: inline-block;
|
Reference in New Issue
Block a user