2020-03-08 12:30:03 +01:00
|
|
|
|
/**
|
|
|
|
|
* Main Updates Page
|
2020-06-30 18:41:58 +02:00
|
|
|
|
* Belongs to LocalCDN (since 2020-02-26)
|
|
|
|
|
* (Origin: Decentraleyes)
|
2020-03-08 12:30:03 +01:00
|
|
|
|
*
|
2020-06-30 18:41:58 +02:00
|
|
|
|
* @author nobody
|
2020-03-08 12:30:03 +01:00
|
|
|
|
* @since 2020-03-08
|
2020-06-30 18:41:58 +02:00
|
|
|
|
*
|
2020-03-08 12:30:03 +01:00
|
|
|
|
* @license MPL 2.0
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2021-02-17 07:01:08 +01:00
|
|
|
|
|
2020-03-08 12:30:03 +01:00
|
|
|
|
/**
|
|
|
|
|
* Updates
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
var updates = {};
|
|
|
|
|
|
2021-02-17 07:01:08 +01:00
|
|
|
|
|
2020-03-08 12:30:03 +01:00
|
|
|
|
/**
|
|
|
|
|
* Private Methods
|
|
|
|
|
*/
|
2020-07-09 20:55:05 +02:00
|
|
|
|
|
2020-08-13 08:07:04 +02:00
|
|
|
|
updates._openHistoryReleaseNotes = function () {
|
2021-02-17 07:01:08 +01:00
|
|
|
|
let container, toggle;
|
|
|
|
|
|
|
|
|
|
container = document.getElementById('history-release-notes');
|
|
|
|
|
toggle = document.getElementById('history-indicator');
|
2020-07-09 20:55:05 +02:00
|
|
|
|
|
|
|
|
|
if (container.style.display === 'none') {
|
|
|
|
|
container.style.display = 'block';
|
|
|
|
|
toggle.textContent = '–';
|
|
|
|
|
} else {
|
|
|
|
|
container.style.display = 'none';
|
|
|
|
|
toggle.textContent = '+';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
updates._onDocumentLoaded = function () {
|
2021-02-17 07:01:08 +01:00
|
|
|
|
let updateElements, urlParams;
|
|
|
|
|
|
2020-07-09 20:55:05 +02:00
|
|
|
|
document.getElementById('generate-ublock-rules').checked = false;
|
|
|
|
|
document.getElementById('generate-umatrix-rules').checked = false;
|
2020-09-19 08:01:31 +02:00
|
|
|
|
document.getElementById('generate-adguard-rules').checked = false;
|
2020-07-09 20:55:05 +02:00
|
|
|
|
|
2021-10-17 07:44:18 +02:00
|
|
|
|
updates._openHistoryReleaseNotes();
|
|
|
|
|
|
2021-02-17 07:01:08 +01:00
|
|
|
|
updateElements = {
|
2020-08-13 08:07:04 +02:00
|
|
|
|
['ruleSets']: document.getElementsByName('rule-sets'),
|
|
|
|
|
['copyRuleSet']: document.getElementById('button-copy-rule-set'),
|
2020-07-09 20:55:05 +02:00
|
|
|
|
};
|
|
|
|
|
|
2021-08-02 06:27:02 +02:00
|
|
|
|
for (let ruleSets of updateElements.ruleSets) {
|
|
|
|
|
ruleSets.addEventListener('change', ruleGenerator.openRuleSet);
|
2020-07-09 20:55:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-29 09:56:11 +02:00
|
|
|
|
updateElements.copyRuleSet.addEventListener('click', ruleGenerator.copyRuleSet);
|
2020-07-09 20:55:05 +02:00
|
|
|
|
|
|
|
|
|
document.getElementById('history').addEventListener('click', updates._openHistoryReleaseNotes);
|
2020-07-24 08:16:25 +02:00
|
|
|
|
|
|
|
|
|
// GET parameter to display the rule set generator
|
2021-02-17 07:01:08 +01:00
|
|
|
|
urlParams = new URLSearchParams(window.location.search);
|
2020-07-24 08:16:25 +02:00
|
|
|
|
if (urlParams.get('mappingupdate') === 'true') {
|
|
|
|
|
document.getElementById('generator-section').style.display = 'block';
|
|
|
|
|
}
|
2020-07-09 20:55:05 +02:00
|
|
|
|
};
|
|
|
|
|
|
2020-03-08 12:30:03 +01:00
|
|
|
|
document.addEventListener('DOMContentLoaded', updates._onDocumentLoaded);
|