Add enable/disable links back as hidden #17

This commit is contained in:
Jason Barnabe 2015-02-17 13:01:15 -06:00
parent e6df389f59
commit bd83d65da6
2 changed files with 7 additions and 1 deletions

View File

@ -35,6 +35,10 @@
#unavailable { #unavailable {
display: none; display: none;
} }
/* Never shown, but can be enabled with a style */
.enable, .disable {
display: none;
}
</style> </style>
<script src="localization.js"></script> <script src="localization.js"></script>

View File

@ -1,5 +1,5 @@
var styleTemplate = document.createElement("div"); var styleTemplate = document.createElement("div");
styleTemplate.innerHTML = "<input class='checker' type='checkbox'><div class='style-name'></div><div class='actions'><a class='style-edit-link' href='edit.html?id='>" + t('editStyleLabel') + "</a> <a href='#' class='delete'>" + t('deleteStyleLabel') + "</a></div>"; styleTemplate.innerHTML = "<input class='checker' type='checkbox'><div class='style-name'></div><div class='actions'><a href='#' class='enable'>" + t('enableStyleLabel') + "</a> <a href='#' class='disable'>" + t('disableStyleLabel') + "</a> <a class='style-edit-link' href='edit.html?id='>" + t('editStyleLabel') + "</a> <a href='#' class='delete'>" + t('deleteStyleLabel') + "</a></div>";
var writeStyleTemplate = document.createElement("a"); var writeStyleTemplate = document.createElement("a");
writeStyleTemplate.className = "write-style-link"; writeStyleTemplate.className = "write-style-link";
@ -78,6 +78,8 @@ function createStyleElement(style) {
styleName.addEventListener("click", function() { enable(event, !event.target.previousSibling.checked); }, false); styleName.addEventListener("click", function() { enable(event, !event.target.previousSibling.checked); }, false);
// clicking the checkbox will toggle it, and this will run after that happens // clicking the checkbox will toggle it, and this will run after that happens
checkbox.addEventListener("click", function() { enable(event, event.target.checked); }, false); checkbox.addEventListener("click", function() { enable(event, event.target.checked); }, false);
e.querySelector(".enable").addEventListener("click", function() { enable(event, true); }, false);
e.querySelector(".disable").addEventListener("click", function() { enable(event, false); }, false);
e.querySelector(".delete").addEventListener("click", function() { doDelete(event, false); }, false); e.querySelector(".delete").addEventListener("click", function() { doDelete(event, false); }, false);
return e; return e;