mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-02-21 11:10:07 +00:00
variantgenerator: avoid accidently overwriting of existing changes #757
This commit is contained in:
parent
d159c08b16
commit
5208766085
2 changed files with 10 additions and 2 deletions
|
@ -1 +1 @@
|
||||||
7.1.1+544df5e41202b9b8bc59910fb2217ae9a2a9a4e4
|
7.1.1+d159c08b16e0c832bf9c69f4f1abd462795ce747
|
|
@ -226,7 +226,15 @@ var variants = {
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
changeColor: function (c) {
|
changeColor: function (c) {
|
||||||
var customvariantbase = window.localStorage.getItem(window.relearn.absBaseUri + '/customvariant') ?? window.localStorage.getItem(window.relearn.absBaseUri + '/variant');
|
var variant = window.localStorage.getItem(window.relearn.absBaseUri + '/variant');
|
||||||
|
var customvariantbase = window.localStorage.getItem(window.relearn.absBaseUri + '/customvariant');
|
||||||
|
|
||||||
|
if (customvariantbase && customvariantbase != variant) {
|
||||||
|
alert('You already have changes based on the "' + customvariantbase + '" variant. Please proceed editing the custom variant, reset your changes or ignore this message.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
customvariantbase = customvariantbase ?? variant;
|
||||||
|
|
||||||
var base_style = this.findLoadedStylesheet('R-format-style', [':root:not([data-r-output-format="print"])[data-r-theme-variant="' + customvariantbase + '"]']);
|
var base_style = this.findLoadedStylesheet('R-format-style', [':root:not([data-r-output-format="print"])[data-r-theme-variant="' + customvariantbase + '"]']);
|
||||||
if (!base_style) {
|
if (!base_style) {
|
||||||
alert('An auto mode variant can not be changed. Please select its light/dark variant directly to make changes');
|
alert('An auto mode variant can not be changed. Please select its light/dark variant directly to make changes');
|
||||||
|
|
Loading…
Add table
Reference in a new issue