mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2024-12-23 08:30:38 +01:00
Show the rule set generator only when there are new CDNs
This commit is contained in:
parent
107051e518
commit
7daee86505
11
core/main.js
11
core/main.js
@ -93,22 +93,19 @@ main._showReleaseNotes = function (details) {
|
|||||||
});
|
});
|
||||||
} else if (details.reason === chrome.runtime.OnInstalledReason.UPDATE) {
|
} else if (details.reason === chrome.runtime.OnInstalledReason.UPDATE) {
|
||||||
|
|
||||||
let newValue = lastMappingUpdate;
|
|
||||||
let oldValue = "";
|
|
||||||
|
|
||||||
// If add-on update true, check last update of mappings.js
|
// If add-on update true, check last update of mappings.js
|
||||||
chrome.storage.sync.get([Setting.LAST_MAPPING_UPDATE, Setting.HIDE_RELEASE_NOTES], function (items) {
|
chrome.storage.sync.get([Setting.LAST_MAPPING_UPDATE, Setting.HIDE_RELEASE_NOTES], function (items) {
|
||||||
|
|
||||||
oldValue = items.lastMappingUpdate;
|
let mappingUpdate = items.lastMappingUpdate !== lastMappingUpdate;
|
||||||
|
|
||||||
if (oldValue !== newValue || !items.hideReleaseNotes) {
|
if (mappingUpdate || !items.hideReleaseNotes) {
|
||||||
// Updated mappings.js
|
// Updated mappings.js
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
[Setting.LAST_MAPPING_UPDATE]: newValue
|
[Setting.LAST_MAPPING_UPDATE]: lastMappingUpdate
|
||||||
}, function() {
|
}, function() {
|
||||||
if (!items.hideReleaseNotes) {
|
if (!items.hideReleaseNotes) {
|
||||||
chrome.tabs.create({
|
chrome.tabs.create({
|
||||||
'url': chrome.extension.getURL('pages/updates/updates.html'),
|
'url': chrome.extension.getURL('pages/updates/updates.html?mappingupdate=' + mappingUpdate),
|
||||||
'active': false
|
'active': false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,6 @@ input[type=radio], label {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
#history-release-notes {
|
#generator-section {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Implemented: Hide icon setting if not supported</li>
|
<li>Implemented: Hide icon setting if not supported</li>
|
||||||
|
<li>Implemented: Show the rule set generator only when there are new CDNs (reported by <a href="https://addons.mozilla.org/en-US/firefox/addon/localcdn-fork-of-decentraleyes/reviews/1572952/">review</a>)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div id="generator-section">
|
||||||
<div class="topic-label">
|
<div class="topic-label">
|
||||||
Generate rule sets for uBlock or uMatrix
|
Generate rule sets for uBlock or uMatrix
|
||||||
</div>
|
</div>
|
||||||
@ -46,6 +48,7 @@
|
|||||||
<input id="button-copy-rule-set" type="button" value="Copy">
|
<input id="button-copy-rule-set" type="button" value="Copy">
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
</div>
|
||||||
<div id="history"><span id="history-indicator">+</span> Previous Versions</div>
|
<div id="history"><span id="history-indicator">+</span> Previous Versions</div>
|
||||||
<div id="history-release-notes" style="display: none;">
|
<div id="history-release-notes" style="display: none;">
|
||||||
<p class='release-date'>2020-07-19 (v2.2.14)</p>
|
<p class='release-date'>2020-07-19 (v2.2.14)</p>
|
||||||
|
@ -89,6 +89,12 @@ updates._onDocumentLoaded = function () {
|
|||||||
updateElements.copyRuleSet.addEventListener('click', updates._copyRuleSet);
|
updateElements.copyRuleSet.addEventListener('click', updates._copyRuleSet);
|
||||||
|
|
||||||
document.getElementById('history').addEventListener('click', updates._openHistoryReleaseNotes);
|
document.getElementById('history').addEventListener('click', updates._openHistoryReleaseNotes);
|
||||||
|
|
||||||
|
// GET parameter to display the rule set generator
|
||||||
|
let urlParams = new URLSearchParams(window.location.search);
|
||||||
|
if (urlParams.get('mappingupdate') === 'true') {
|
||||||
|
document.getElementById('generator-section').style.display = 'block';
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user