mirror of
https://github.com/webslides/WebSlides.git
synced 2025-08-22 12:53:23 +02:00
kss - content organization
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
(function (window, document) {
|
||||
'use strict';
|
||||
|
||||
var KssMarkup = function (config) {
|
||||
this.bodyClass = config.bodyClass || 'kss-markup-mode';
|
||||
this.detailsClass = config.detailsClass || 'kss-markup';
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
KssMarkup.prototype.init = function () {
|
||||
var self = this;
|
||||
// Initialize all markup toggle buttons.
|
||||
document.querySelectorAll('a[data-kss-markup]').forEach(function (el) {
|
||||
el.onclick = self.showGuides.bind(self);
|
||||
});
|
||||
};
|
||||
|
||||
// Activation function that takes the ID of the element that will receive
|
||||
// fullscreen focus.
|
||||
KssMarkup.prototype.showGuides = function () {
|
||||
var body = document.getElementsByTagName('body')[0],
|
||||
enabled = body.classList.contains(this.bodyClass);
|
||||
|
||||
document.querySelectorAll('.' + this.detailsClass).forEach(function (el) {
|
||||
if (enabled) {
|
||||
el.removeAttribute('open');
|
||||
} else {
|
||||
el.setAttribute('open', '');
|
||||
}
|
||||
});
|
||||
|
||||
// Toggle the markup mode.
|
||||
body.classList.toggle(this.bodyClass);
|
||||
};
|
||||
|
||||
// Export to DOM global space.
|
||||
window.KssMarkup = KssMarkup;
|
||||
|
||||
})(window, document);
|
Reference in New Issue
Block a user