Skip to content
Snippets Groups Projects
Commit 353b7cea authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

Revert "remove extra js"

This reverts commit ebb26eab.
parent 0e0d46e4
No related branches found
No related tags found
No related merge requests found
// Modified from markdown.js from Hakim to handle external html files
(function () {
/*jslint loopfunc: true, browser: true*/
/*globals alert*/
'use strict';
var querySlidingHtml = function () {
var sections = document.querySelectorAll('[data-html]'),
section, j, jlen;
for (j = 0, jlen = sections.length; j < jlen; j++) {
section = sections[j];
if (section.getAttribute('data-html').length) {
var xhr = new XMLHttpRequest(),
url = section.getAttribute('data-html'),
cb = function () {
if (xhr.readyState === 4) {
if (xhr.status >= 200 && xhr.status < 300) {
section.innerHTML = xhr.responseText;
} else {
section.outerHTML = '<section data-state="alert">ERROR: The attempt to fetch ' + url + ' failed with the HTTP status ' + xhr.status + '. Check your browser\'s JavaScript console for more details.</p></section>';
}
}
};
xhr.onreadystatechange = cb;
xhr.open('GET', url, false);
try {
xhr.send();
} catch (e) {
alert('Failed to get file' + url + '.' + e);
}
}
}
};
querySlidingHtml();
})();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment