1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-22 12:53:23 +02:00

kss - fixing doc

This commit is contained in:
Luis Sacristán
2017-09-30 18:47:44 +02:00
parent b0d1caeb7e
commit 8d0e58b2db
88 changed files with 18993 additions and 46 deletions

View File

@@ -0,0 +1,40 @@
(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);