From 8140e16474d9a4f9f779e4fb82bf179428cf6ae9 Mon Sep 17 00:00:00 2001 From: hideheader Date: Tue, 10 Mar 2015 11:45:13 -0400 Subject: [PATCH] Fix 'dirty' indicator on 'Code' boxes Toggle a class on the container instead of changing label text. --- edit.html | 4 ++++ edit.js | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/edit.html b/edit.html index 63383e4f..848eab0b 100644 --- a/edit.html +++ b/edit.html @@ -67,6 +67,10 @@ #sections > div:not(:first-child) { border-top: 2px solid black; } + .dirty > label::before { + content: "*"; + font-weight: bold; + } #basic-info label { display: inline-block; width: 10em; diff --git a/edit.js b/edit.js index f775ddc7..4e9afa34 100644 --- a/edit.js +++ b/edit.js @@ -85,10 +85,7 @@ function indicateCodeChange(cm) { var clean = cm.isClean(cm.lastChange); if (clean != cm.lastClean) { cm.lastClean = clean; - var label = cm.getTextArea().previousElementSibling; - if (label) { - label.textContent = label.textContent.replace(/\*?$/, clean ? '' : '*'); - } + cm.getTextArea().parentNode.classList[clean ? "remove" : "add"]("dirty"); } };