mirror of
https://github.com/dokku/dokku.git
synced 2026-02-23 19:50:34 +01:00
use addEventListener wrapper where necessary to add simple support for older browsers
This commit is contained in:
@@ -220,7 +220,7 @@
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/1.3.0/anchor.js"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function (e) {
|
||||
document.addEventListener('DOMContentLoaded', function (e) {
|
||||
var markdownBody = document.querySelectorAll('.markdown-body')[0],
|
||||
isRedirect = markdownBody.innerHTML.trim().indexOf('<p>See the <a href=') === 0;
|
||||
if (isRedirect) {
|
||||
@@ -245,6 +245,17 @@
|
||||
el.className += ' ' + className;
|
||||
}
|
||||
},
|
||||
addListener = function (elem, type, fn) {
|
||||
if (elem.addEventListener) {
|
||||
elem.addEventListener(type, fn, false);
|
||||
} else if (elem.attachEvent) {
|
||||
elem.attachEvent("on" + type, function() {
|
||||
return fn.call(elem, window.event);
|
||||
});
|
||||
} else {
|
||||
elem["on" + type] = fn;
|
||||
}
|
||||
},
|
||||
hasClass = function(el, className) {
|
||||
if (el.classList) {
|
||||
return el.classList.contains(className);
|
||||
@@ -288,7 +299,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
currentVersionEl.addEventListener('click', function() {
|
||||
addListener(currentVersionEl, 'click', function() {
|
||||
if (hasClass(versionContainer, 'shift-up')) {
|
||||
removeClass(versionContainer, 'shift-up');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user