From ba56d99e8b4bc58a67f0e167d0bce35cbe8fe758 Mon Sep 17 00:00:00 2001 From: Matthias Mees Date: Wed, 25 Jun 2014 13:07:40 +0200 Subject: [PATCH] Remove AccessifyHTML5 and details polyfill. These are now included in plugins.js by gruntipity.php. No need to keep them in serendipity_editor.js.tpl. References #189 --- .../2k11/admin/serendipity_editor.js.tpl | 197 +----------------- 1 file changed, 1 insertion(+), 196 deletions(-) diff --git a/templates/2k11/admin/serendipity_editor.js.tpl b/templates/2k11/admin/serendipity_editor.js.tpl index 85b878e7..681edc2a 100644 --- a/templates/2k11/admin/serendipity_editor.js.tpl +++ b/templates/2k11/admin/serendipity_editor.js.tpl @@ -754,202 +754,7 @@ $(target).toggleClass(stateClass); } -}( window.serendipity = window.serendipity || {}, jQuery )); - -// Source: https://github.com/yatil/accessifyhtml5.js -var AccessifyHTML5 = function (defaults, more_fixes) { - "use strict"; - - var fixes = { - 'article' : { 'role': 'article' }, - 'aside' : { 'role': 'complementary' }, - 'nav' : { 'role': 'navigation' }, - 'main' : { 'role': 'main' }, - 'output' : { 'aria-live': 'polite' }, - 'section' : { 'role': 'region' }, - '[required]': { 'aria-required': 'true' } - }, - fix, elems, attr, value, key, obj, i, mo, by_match, el_label, - ATTR_SECURE = /aria-[a-z]+|role|tabindex|title|alt|data-[\w\-]+|lang|style|maxlength|placeholder|pattern|type/, - ID_PREFIX = "acfy-id-", - n_label = 0, - Doc = document; - - if (Doc.querySelectorAll) { - - if (defaults) { - if (defaults.header) { - fixes[defaults.header] = { - 'role': 'banner' - }; - } - if (defaults.footer) { - fixes[defaults.footer] = { - 'role': 'contentinfo' - }; - } - if (defaults.main) { - fixes[defaults.main] = { - 'role': 'main' - }; - fixes.main = { - 'role': '' - }; - } - } - - for (mo in more_fixes) { - fixes[mo] = more_fixes[mo]; - } - - for (fix in fixes) { - if (fixes.hasOwnProperty(fix)) { - - elems = Doc.querySelectorAll(fix); - obj = fixes[fix]; - - for (i = 0; i < elems.length; i++) { - - for (key in obj) { - if (obj.hasOwnProperty(key)) { - - attr = key; - value = obj[key]; - - if (!attr.match(ATTR_SECURE)) { - continue; - } - if (!(typeof value).match(/string|number/)) { - continue; - } - - by_match = attr.match(/(describ|label)l?edby/); - if (by_match) { - el_label = Doc.querySelector(value); - - if (! el_label) { continue; } - - if (! el_label.id) { - el_label.id = ID_PREFIX + n_label; - } - - value = el_label.id; - attr = "aria-" + ("label" === by_match[1] ? "labelledby" : "describedby"); - - n_label++; - } - - if (!elems[i].hasAttribute(attr)) { - elems[i].setAttribute(attr, value); - } - } - } - } - } - } - } -}; - -// mths.be/details -; -(function(a, f) { - var e = f.fn, - d, c = Object.prototype.toString.call(window.opera) == '[object Opera]', - g = (function(l) { - var j = l.createElement('details'), - i, h, k; - if (!('open' in j)) { - return false - } - h = l.body || (function() { - var m = l.documentElement; - i = true; - return m.insertBefore(l.createElement('body'), m.firstElementChild || m.firstChild) - }()); - j.innerHTML = 'ab'; - j.style.display = 'block'; - h.appendChild(j); - k = j.offsetHeight; - j.open = true; - k = k != j.offsetHeight; - h.removeChild(j); - if (i) { - h.parentNode.removeChild(h) - } - return k - }(a)), - b = function(i, l, k, h) { - var j = i.prop('open'), - m = j && h || !j && !h; - if (m) { - i.removeClass('open').prop('open', false).triggerHandler('close.details'); - l.attr('aria-expanded', false); - k.hide() - } else { - i.addClass('open').prop('open', true).triggerHandler('open.details'); - l.attr('aria-expanded', true); - k.show() - } - }; - e.noSelect = function() { - var h = 'none'; - return this.bind('selectstart dragstart mousedown', function() { - return false - }).css({ - MozUserSelect: h, - msUserSelect: h, - webkitUserSelect: h, - userSelect: h - }) - }; - if (g) { - d = e.details = function() { - return this.each(function() { - var i = f(this), - h = f('summary', i).first(); - h.attr({ - role: 'button', - 'aria-expanded': i.prop('open') - }).on('click', function() { - var j = i.prop('open'); - h.attr('aria-expanded', !j); - i.triggerHandler((j ? 'close' : 'open') + '.details') - }) - }) - }; - d.support = g - } else { - d = e.details = function() { - return this.each(function() { - var h = f(this), - j = f('summary', h).first(), - i = h.children(':not(summary)'), - k = h.contents(':not(summary)'); - if (!j.length) { - j = f('').text('Details').prependTo(h) - } - if (i.length != k.length) { - k.filter(function() { - return this.nodeType == 3 && /[^ \t\n\f\r]/.test(this.data) - }).wrap(''); - i = h.children(':not(summary)') - } - h.prop('open', typeof h.attr('open') == 'string'); - b(h, j, i); - j.attr('role', 'button').noSelect().prop('tabIndex', 0).on('click', function() { - j.focus(); - b(h, j, i, true) - }).keyup(function(l) { - if (32 == l.keyCode || (13 == l.keyCode && !c)) { - l.preventDefault(); - j.click() - } - }) - }) - }; - d.support = g - } -}(document, jQuery)); +}( window.serendipity = window.serendipity || {}, jQuery )) {literal} /*! IndexedDBShim - v0.1.2 - 2014-06-14 */