1/*! 2 * Button visually impaired - v1.0.0 https://bvi.isvek.ru 3 * Copyright 2014-2021 Oleg Korotenko <[email protected]>. 4 * Licensed MIT (https://github.com/veks/button-visually-impaired-javascript/blob/master/LICENSE.md) 5 */ 6;(function (global, factory) { 7 typeof exports === 'object' && typeof module !== 'undefined' 8 ? (module.exports = factory()) 9 : typeof define === 'function' && define.amd 10 ? define(factory) 11 : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), 12 (global.isvek = factory())) 13})(this, function () { 14 'use strict' 15 16 function ownKeys(object, enumerableOnly) { 17 var keys = Object.keys(object) 18 19 if (Object.getOwnPropertySymbols) { 20 var symbols = Object.getOwnPropertySymbols(object) 21 22 if (enumerableOnly) { 23 symbols = symbols.filter(function (sym) { 24 return Object.getOwnPropertyDescriptor(object, sym).enumerable 25 }) 26 } 27 28 keys.push.apply(keys, symbols) 29 } 30 31 return keys 32 } 33 34 function _objectSpread2(target) { 35 for (var i = 1; i < arguments.length; i++) { 36 var source = arguments[i] != null ? arguments[i] : {} 37 38 if (i % 2) { 39 ownKeys(Object(source), true).forEach(function (key) { 40 _defineProperty(target, key, source[key]) 41 }) 42 } else if (Object.getOwnPropertyDescriptors) { 43 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) 44 } else { 45 ownKeys(Object(source)).forEach(function (key) { 46 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)) 47 }) 48 } 49 } 50 51 return target 52 } 53 54 function _typeof(obj) { 55 '@babel/helpers - typeof' 56 57 if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') { 58 _typeof = function (obj) { 59 return typeof obj 60 } 61 } else { 62 _typeof = function (obj) { 63 return obj && 64 typeof Symbol === 'function' && 65 obj.constructor === Symbol && 66 obj !== Symbol.prototype 67 ? 'symbol' 68 : typeof obj 69 } 70 } 71 72 return _typeof(obj) 73 } 74 75 function _classCallCheck(instance, Constructor) { 76 if (!(instance instanceof Constructor)) { 77 throw new TypeError('Cannot call a class as a function') 78 } 79 } 80 81 function _defineProperties(target, props) { 82 for (var i = 0; i < props.length; i++) { 83 var descriptor = props[i] 84 descriptor.enumerable = descriptor.enumerable || false 85 descriptor.configurable = true 86 if ('value' in descriptor) descriptor.writable = true 87 Object.defineProperty(target, descriptor.key, descriptor) 88 } 89 } 90 91 function _createClass(Constructor, protoProps, staticProps) { 92 if (protoProps) _defineProperties(Constructor.prototype, protoProps) 93 if (staticProps) _defineProperties(Constructor, staticProps) 94 return Constructor 95 } 96 97 function _defineProperty(obj, key, value) { 98 if (key in obj) { 99 Object.defineProperty(obj, key, { 100 value: value, 101 enumerable: true, 102 configurable: true, 103 writable: true 104 }) 105 } else { 106 obj[key] = value 107 } 108 109 return obj 110 } 111 112 function _unsupportedIterableToArray(o, minLen) { 113 if (!o) return 114 if (typeof o === 'string') return _arrayLikeToArray(o, minLen) 115 var n = Object.prototype.toString.call(o).slice(8, -1) 116 if (n === 'Object' && o.constructor) n = o.constructor.name 117 if (n === 'Map' || n === 'Set') return Array.from(o) 118 if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 119 return _arrayLikeToArray(o, minLen) 120 } 121 122 function _arrayLikeToArray(arr, len) { 123 if (len == null || len > arr.length) len = arr.length 124 125 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i] 126 127 return arr2 128 } 129 130 function _createForOfIteratorHelper(o, allowArrayLike) { 131 var it = (typeof Symbol !== 'undefined' && o[Symbol.iterator]) || o['@@iterator'] 132 133 if (!it) { 134 if ( 135 Array.isArray(o) || 136 (it = _unsupportedIterableToArray(o)) || 137 (allowArrayLike && o && typeof o.length === 'number') 138 ) { 139 if (it) o = it 140 var i = 0 141 142 var F = function () {} 143 144 return { 145 s: F, 146 n: function () { 147 if (i >= o.length) 148 return { 149 done: true 150 } 151 return { 152 done: false, 153 value: o[i++] 154 } 155 }, 156 e: function (e) { 157 throw e 158 }, 159 f: F 160 } 161 } 162 163 throw new TypeError( 164 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.' 165 ) 166 } 167 168 var normalCompletion = true, 169 didErr = false, 170 err 171 return { 172 s: function () { 173 it = it.call(o) 174 }, 175 n: function () { 176 var step = it.next() 177 normalCompletion = step.done 178 return step 179 }, 180 e: function (e) { 181 didErr = true 182 err = e 183 }, 184 f: function () { 185 try { 186 if (!normalCompletion && it.return != null) it.return() 187 } finally { 188 if (didErr) throw err 189 } 190 } 191 } 192 } 193 194 var runtime = { exports: {} } 195 196 ;(function (module) { 197 var runtime = (function (exports) { 198 var Op = Object.prototype 199 var hasOwn = Op.hasOwnProperty 200 var undefined$1 // More compressible than void 0. 201 202 var $Symbol = typeof Symbol === 'function' ? Symbol : {} 203 var iteratorSymbol = $Symbol.iterator || '@@iterator' 204 var asyncIteratorSymbol = $Symbol.asyncIterator || '@@asyncIterator' 205 var toStringTagSymbol = $Symbol.toStringTag || '@@toStringTag' 206 207 function define(obj, key, value) { 208 Object.defineProperty(obj, key, { 209 value: value, 210 enumerable: true, 211 configurable: true, 212 writable: true 213 }) 214 return obj[key] 215 } 216
217 try { 218 // IE 8 has a broken Object.defineProperty that only works on DOM objects. 219 define({}, '') 220 } catch (err) { 221 define = function define(obj, key, value) { 222 return (obj[key] = value) 223 } 224 } 225 226 function wrap(innerFn, outerFn, self, tryLocsList) { 227 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. 228 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator 229 var generator = Object.create(protoGenerator.prototype) 230 var context = new Context(tryLocsList || []) // The ._invoke method unifies the implementations of the .next, 231 // .throw, and .return methods. 232 233 generator._invoke = makeInvokeMethod(innerFn, self, context) 234 return generator 235 } 236 237 exports.wrap = wrap // Try/catch helper to minimize deoptimizations. Returns a completion 238 // record like context.tryEntries[i].completion. This interface could 239 // have been (and was previously) designed to take a closure to be 240 // invoked without arguments, but in all the cases we care about we 241 // already have an existing method we want to call, so there's no need 242 // to create a new function object. We can even get away with assuming 243 // the method takes exactly one argument, since that happens to be true 244 // in every case, so we don't have to touch the arguments object. The 245 // only additional allocation required is the completion record, which 246 // has a stable shape and so hopefully should be cheap to allocate. 247 248 function tryCatch(fn, obj, arg) { 249 try { 250 return { 251 type: 'normal', 252 arg: fn.call(obj, arg) 253 } 254 } catch (err) { 255 return { 256 type: 'throw', 257 arg: err 258 } 259 } 260 } 261 262 var GenStateSuspendedStart = 'suspendedStart' 263 var GenStateSuspendedYield = 'suspendedYield' 264 var GenStateExecuting = 'executing' 265 var GenStateCompleted = 'completed' // Returning this object from the innerFn has the same effect as 266 // breaking out of the dispatch switch statement. 267 268 var ContinueSentinel = {} // Dummy constructor functions that we use as the .constructor and 269 // .constructor.prototype properties for functions that return Generator 270 // objects. For full spec compliance, you may wish to configure your 271 // minifier not to mangle the names of these two functions. 272 273 function Generator() {} 274 275 function GeneratorFunction() {} 276 277 function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that 278 // don't natively support it. 279 280 var IteratorPrototype = {} 281 define(IteratorPrototype, iteratorSymbol, function () { 282 return this 283 }) 284 var getProto = Object.getPrototypeOf 285 var NativeIteratorPrototype = getProto && getProto(getProto(values([]))) 286 287 if ( 288 NativeIteratorPrototype && 289 NativeIteratorPrototype !== Op && 290 hasOwn.call(NativeIteratorPrototype, iteratorSymbol) 291 ) { 292 // This environment has a native %IteratorPrototype%; use it instead 293 // of the polyfill. 294 IteratorPrototype = NativeIteratorPrototype 295 } 296 297 var Gp = 298 (GeneratorFunctionPrototype.prototype = 299 Generator.prototype = 300 Object.create(IteratorPrototype)) 301 GeneratorFunction.prototype = GeneratorFunctionPrototype 302 define(Gp, 'constructor', GeneratorFunctionPrototype) 303 define(GeneratorFunctionPrototype, 'constructor', GeneratorFunction) 304 GeneratorFunction.displayName = define( 305 GeneratorFunctionPrototype, 306 toStringTagSymbol, 307 'GeneratorFunction' 308 ) // Helper for defining the .next, .throw, and .return methods of the 309 // Iterator interface in terms of a single ._invoke method. 310 311 function defineIteratorMethods(prototype) { 312 ;['next', 'throw', 'return'].forEach(function (method) { 313 define(prototype, method, function (arg) { 314 return this._invoke(method, arg) 315 }) 316 }) 317 } 318 319 exports.isGeneratorFunction = function (genFun) { 320 var ctor = typeof genFun === 'function' && genFun.constructor 321 return ctor 322 ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can 323 // do is to check its .name property. 324 (ctor.displayName || ctor.name) === 'GeneratorFunction' 325 : false 326 } 327 328 exports.mark = function (genFun) { 329 if (Object.setPrototypeOf) { 330 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) 331 } else { 332 genFun.__proto__ = GeneratorFunctionPrototype 333 define(genFun, toStringTagSymbol, 'GeneratorFunction') 334 } 335 336 genFun.prototype = Object.create(Gp) 337 return genFun 338 } // Within the body of any async function, `await x` is transformed to 339 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test 340 // `hasOwn.call(value, "__await")` to determine if the yielded value is 341 // meant to be awaited. 342 343 exports.awrap = function (arg) { 344 return { 345 __await: arg 346 } 347 } 348 349 function AsyncIterator(generator, PromiseImpl) { 350 function invoke(method, arg, resolve, reject) { 351 var record = tryCatch(generator[method], generator, arg) 352 353 if (record.type === 'throw') { 354 reject(record.arg) 355 } else { 356 var result = record.arg 357 var value = result.value 358 359 if (value && _typeof(value) === 'object' && hasOwn.call(value, '__await')) { 360 return PromiseImpl.resolve(value.__await).then( 361 function (value) { 362 invoke('next', value, resolve, reject) 363 }, 364 function (err) { 365 invoke('throw', err, resolve, reject) 366 } 367 ) 368 } 369 370 return PromiseImpl.resolve(value).then( 371 function (unwrapped) { 372 // When a yielded Promise is resolved, its final value becomes 373 // the .value of the Promise<{value,done}> result for the 374 // current iteration. 375 result.value = unwrapped 376 resolve(result) 377 }, 378 function (error) { 379 // If a rejected Promise was yielded, throw the rejection back 380 // into the async generator function so it can be handled there. 381 return invoke('throw', error, resolve, reject) 382 } 383 ) 384 } 385 } 386 387 var previousPromise 388 389 function enqueue(method, arg) { 390 function callInvokeWithMethodAndArg() { 391 return new PromiseImpl(function (resolve, reject) { 392 invoke(method, arg, resolve, reject) 393 }) 394 } 395 396 return (previousPromise = // If enqueue has been called before, then we want to wait until 397 // all previous Promises have been resolved before calling invoke, 398 // so that results are always delivered in the correct order. If 399 // enqueue has not been called before, then it is important to 400 // call invoke immediately, without waiting on a callback to fire, 401 // so that the async generator function has the opportunity to do 402 // any necessary setup in a predictable way. This predictability 403 // is why the Promise constructor synchronously invokes its 404 // executor callback, and why async functions synchronously 405 // execute code before the first await. Since we implement simple 406 // async functions in terms of async generators, it is especially 407 // important to get this right, even though it requires care. 408 previousPromise 409 ? previousPromise.then( 410 callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later 411 // invocations of the iterator. 412 callInvokeWithMethodAndArg 413 ) 414 : callInvokeWithMethodAndArg()) 415 } // Define the unified helper method that is used to implement .next, 416 // .throw, and .return (see defineIteratorMethods). 417 418 this._invoke = enqueue 419 } 420 421 defineIteratorMethods(AsyncIterator.prototype) 422 define(AsyncIterator.prototype, asyncIteratorSymbol, function () { 423 return this 424 }) 425 exports.AsyncIterator = AsyncIterator // Note that simple async functions are implemented on top of 426 // AsyncIterator objects; they just return a Promise for the value of 427 // the final result produced by the iterator. 428 429 exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { 430 if (PromiseImpl === void 0) PromiseImpl = Promise 431 var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl) 432 return exports.isGeneratorFunction(outerFn) 433 ? iter // If outerFn is a generator, return the full iterator. 434 : iter.next().then(function (result) { 435 return result.done ? result.value : iter.next() 436 }) 437 } 438 439 function makeInvokeMethod(innerFn, self, context) { 440 var state = GenStateSuspendedStart 441 return function invoke(method, arg) { 442 if (state === GenStateExecuting) { 443 throw new Error('Generator is already running') 444 } 445 446 if (state === GenStateCompleted) { 447 if (method === 'throw') { 448 throw arg 449 } // Be forgiving, per 25.3.3.3.3 of the spec: 450 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume 451 452 return doneResult() 453 } 454 455 context.method = method 456 context.arg = arg 457 458 while (true) { 459 var delegate = context.delegate 460 461 if (delegate) { 462 var delegateResult = maybeInvokeDelegate(delegate, context) 463 464 if (delegateResult) { 465 if (delegateResult === ContinueSentinel) continue 466 return delegateResult 467 } 468 } 469 470 if (context.method === 'next') { 471 // Setting context._sent for legacy support of Babel's 472 // function.sent implementation. 473 context.sent = context._sent = context.arg 474 } else if (context.method === 'throw') { 475 if (state === GenStateSuspendedStart) { 476 state = GenStateCompleted 477 throw context.arg 478 } 479 480 context.dispatchException(context.arg) 481 } else if (context.method === 'return') { 482 context.abrupt('return', context.arg) 483 } 484 485 state = GenStateExecuting 486 var record = tryCatch(innerFn, self, context) 487 488 if (record.type === 'normal') { 489 // If an exception is thrown from innerFn, we leave state === 490 // GenStateExecuting and loop back for another invocation. 491 state = context.done ? GenStateCompleted : GenStateSuspendedYield 492 493 if (record.arg === ContinueSentinel) { 494 continue 495 } 496 497 return { 498 value: record.arg, 499 done: context.done 500 } 501 } else if (record.type === 'throw') { 502 state = GenStateCompleted // Dispatch the exception by looping back around to the 503 // context.dispatchException(context.arg) call above. 504 505 context.method = 'throw' 506 context.arg = record.arg 507 } 508 } 509 } 510 } // Call delegate.iterator[context.method](context.arg) and handle the 511 // result, either by returning a { value, done } result from the 512 // delegate iterator, or by modifying context.method and context.arg, 513 // setting context.delegate to null, and returning the ContinueSentinel. 514 515 function maybeInvokeDelegate(delegate, context) { 516 var method = delegate.iterator[context.method] 517 518 if (method === undefined$1) { 519 // A .throw or .return when the delegate iterator has no .throw 520 // method always terminates the yield* loop. 521 context.delegate = null 522 523 if (context.method === 'throw') { 524 // Note: ["return"] must be used for ES3 parsing compatibility. 525 if (delegate.iterator['return']) { 526 // If the delegate iterator has a return method, give it a 527 // chance to clean up. 528 context.method = 'return' 529 context.arg = undefined$1 530 maybeInvokeDelegate(delegate, context) 531 532 if (context.method === 'throw') { 533 // If maybeInvokeDelegate(context) changed context.method from 534 // "return" to "throw", let that override the TypeError below.
535 return ContinueSentinel 536 } 537 } 538 539 context.method = 'throw' 540 context.arg = new TypeError("The iterator does not provide a 'throw' method") 541 } 542 543 return ContinueSentinel 544 } 545 546 var record = tryCatch(method, delegate.iterator, context.arg) 547 548 if (record.type === 'throw') { 549 context.method = 'throw' 550 context.arg = record.arg 551 context.delegate = null 552 return ContinueSentinel 553 } 554 555 var info = record.arg 556 557 if (!info) { 558 context.method = 'throw' 559 context.arg = new TypeError('iterator result is not an object') 560 context.delegate = null 561 return ContinueSentinel 562 } 563 564 if (info.done) { 565 // Assign the result of the finished delegate to the temporary 566 // variable specified by delegate.resultName (see delegateYield). 567 context[delegate.resultName] = info.value // Resume execution at the desired location (see delegateYield). 568 569 context.next = delegate.nextLoc // If context.method was "throw" but the delegate handled the 570 // exception, let the outer generator proceed normally. If 571 // context.method was "next", forget context.arg since it has been 572 // "consumed" by the delegate iterator. If context.method was 573 // "return", allow the original .return call to continue in the 574 // outer generator. 575 576 if (context.method !== 'return') { 577 context.method = 'next' 578 context.arg = undefined$1 579 } 580 } else { 581 // Re-yield the result returned by the delegate method. 582 return info 583 } // The delegate iterator is finished, so forget it and continue with 584 // the outer generator. 585 586 context.delegate = null 587 return ContinueSentinel 588 } // Define Generator.prototype.{next,throw,return} in terms of the 589 // unified ._invoke helper method. 590 591 defineIteratorMethods(Gp) 592 define(Gp, toStringTagSymbol, 'Generator') // A Generator should always return itself as the iterator object when the 593 // @@iterator function is called on it. Some browsers' implementations of the 594 // iterator prototype chain incorrectly implement this, causing the Generator 595 // object to not be returned from this call. This ensures that doesn't happen. 596 // See https://github.com/facebook/regenerator/issues/274 for more details. 597 598 define(Gp, iteratorSymbol, function () { 599 return this 600 }) 601 define(Gp, 'toString', function () { 602 return '[object Generator]' 603 }) 604 605 function pushTryEntry(locs) { 606 var entry = { 607 tryLoc: locs[0] 608 } 609 610 if (1 in locs) { 611 entry.catchLoc = locs[1] 612 } 613 614 if (2 in locs) { 615 entry.finallyLoc = locs[2] 616 entry.afterLoc = locs[3] 617 } 618 619 this.tryEntries.push(entry) 620 } 621 622 function resetTryEntry(entry) { 623 var record = entry.completion || {} 624 record.type = 'normal' 625 delete record.arg 626 entry.completion = record 627 } 628 629 function Context(tryLocsList) { 630 // The root entry object (effectively a try statement without a catch 631 // or a finally block) gives us a place to store values thrown from 632 // locations where there is no enclosing try statement. 633 this.tryEntries = [ 634 { 635 tryLoc: 'root' 636 } 637 ] 638 tryLocsList.forEach(pushTryEntry, this) 639 this.reset(true) 640 } 641 642 exports.keys = function (object) { 643 var keys = [] 644 645 for (var key in object) { 646 keys.push(key) 647 } 648 649 keys.reverse() // Rather than returning an object with a next method, we keep 650 // things simple and return the next function itself. 651 652 return function next() { 653 while (keys.length) { 654 var key = keys.pop() 655 656 if (key in object) { 657 next.value = key 658 next.done = false 659 return next 660 } 661 } // To avoid creating an additional object, we just hang the .value 662 // and .done properties off the next function object itself. This 663 // also ensures that the minifier will not anonymize the function. 664 665 next.done = true 666 return next 667 } 668 } 669 670 function values(iterable) { 671 if (iterable) { 672 var iteratorMethod = iterable[iteratorSymbol] 673 674 if (iteratorMethod) { 675 return iteratorMethod.call(iterable) 676 } 677 678 if (typeof iterable.next === 'function') { 679 return iterable 680 } 681 682 if (!isNaN(iterable.length)) { 683 var i = -1, 684 next = function next() { 685 while (++i < iterable.length) { 686 if (hasOwn.call(iterable, i)) { 687 next.value = iterable[i] 688 next.done = false 689 return next 690 } 691 } 692 693 next.value = undefined$1 694 next.done = true 695 return next 696 } 697 698 return (next.next = next) 699 } 700 } // Return an iterator with no values. 701 702 return { 703 next: doneResult 704 } 705 } 706 707 exports.values = values 708 709 function doneResult() { 710 return { 711 value: undefined$1, 712 done: true 713 } 714 } 715 716 Context.prototype = { 717 constructor: Context, 718 reset: function reset(skipTempReset) { 719 this.prev = 0 720 this.next = 0 // Resetting context._sent for legacy support of Babel's 721 // function.sent implementation. 722 723 this.sent = this._sent = undefined$1 724 this.done = false 725 this.delegate = null 726 this.method = 'next' 727 this.arg = undefined$1
728 this.tryEntries.forEach(resetTryEntry) 729 730 if (!skipTempReset) { 731 for (var name in this) { 732 // Not sure about the optimal order of these conditions: 733 if (name.charAt(0) === 't' && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { 734 this[name] = undefined$1 735 } 736 } 737 } 738 }, 739 stop: function stop() { 740 this.done = true 741 var rootEntry = this.tryEntries[0] 742 var rootRecord = rootEntry.completion 743 744 if (rootRecord.type === 'throw') { 745 throw rootRecord.arg 746 } 747 748 return this.rval 749 }, 750 dispatchException: function dispatchException(exception) { 751 if (this.done) { 752 throw exception 753 } 754 755 var context = this 756 757 function handle(loc, caught) { 758 record.type = 'throw' 759 record.arg = exception 760 context.next = loc 761 762 if (caught) { 763 // If the dispatched exception was caught by a catch block, 764 // then let that catch block handle the exception normally. 765 context.method = 'next' 766 context.arg = undefined$1 767 } 768 769 return !!caught 770 } 771 772 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 773 var entry = this.tryEntries[i] 774 var record = entry.completion 775 776 if (entry.tryLoc === 'root') { 777 // Exception thrown outside of any try block that could handle 778 // it, so set the completion value of the entire function to 779 // throw the exception. 780 return handle('end') 781 } 782 783 if (entry.tryLoc <= this.prev) { 784 var hasCatch = hasOwn.call(entry, 'catchLoc') 785 var hasFinally = hasOwn.call(entry, 'finallyLoc') 786 787 if (hasCatch && hasFinally) { 788 if (this.prev < entry.catchLoc) { 789 return handle(entry.catchLoc, true) 790 } else if (this.prev < entry.finallyLoc) { 791 return handle(entry.finallyLoc) 792 } 793 } else if (hasCatch) { 794 if (this.prev < entry.catchLoc) { 795 return handle(entry.catchLoc, true) 796 } 797 } else if (hasFinally) { 798 if (this.prev < entry.finallyLoc) { 799 return handle(entry.finallyLoc) 800 } 801 } else { 802 throw new Error('try statement without catch or finally') 803 } 804 } 805 } 806 }, 807 abrupt: function abrupt(type, arg) { 808 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 809 var entry = this.tryEntries[i] 810 811 if ( 812 entry.tryLoc <= this.prev && 813 hasOwn.call(entry, 'finallyLoc') && 814 this.prev < entry.finallyLoc 815 ) { 816 var finallyEntry = entry 817 break 818 } 819 } 820 821 if ( 822 finallyEntry && 823 (type === 'break' || type === 'continue') && 824 finallyEntry.tryLoc <= arg && 825 arg <= finallyEntry.finallyLoc 826 ) { 827 // Ignore the finally entry if control is not jumping to a 828 // location outside the try/catch block. 829 finallyEntry = null 830 } 831 832 var record = finallyEntry ? finallyEntry.completion : {} 833 record.type = type 834 record.arg = arg 835 836 if (finallyEntry) { 837 this.method = 'next' 838 this.next = finallyEntry.finallyLoc 839 return ContinueSentinel 840 } 841 842 return this.complete(record) 843 }, 844 complete: function complete(record, afterLoc) { 845 if (record.type === 'throw') { 846 throw record.arg 847 } 848 849 if (record.type === 'break' || record.type === 'continue') { 850 this.next = record.arg 851 } else if (record.type === 'return') { 852 this.rval = this.arg = record.arg 853 this.method = 'return' 854 this.next = 'end' 855 } else if (record.type === 'normal' && afterLoc) { 856 this.next = afterLoc 857 } 858 859 return ContinueSentinel 860 }, 861 finish: function finish(finallyLoc) { 862 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 863 var entry = this.tryEntries[i] 864 865 if (entry.finallyLoc === finallyLoc) { 866 this.complete(entry.completion, entry.afterLoc) 867 resetTryEntry(entry) 868 return ContinueSentinel 869 } 870 } 871 },
872 catch: function _catch(tryLoc) { 873 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 874 var entry = this.tryEntries[i] 875 876 if (entry.tryLoc === tryLoc) { 877 var record = entry.completion 878 879 if (record.type === 'throw') { 880 var thrown = record.arg 881 resetTryEntry(entry) 882 } 883 884 return thrown 885 } 886 } // The context.catch method must only be called with a location 887 // argument that corresponds to a known catch block. 888 889 throw new Error('illegal catch attempt') 890 }, 891 delegateYield: function delegateYield(iterable, resultName, nextLoc) { 892 this.delegate = { 893 iterator: values(iterable), 894 resultName: resultName, 895 nextLoc: nextLoc 896 } 897 898 if (this.method === 'next') { 899 // Deliberately forget the last sent value so that we don't 900 // accidentally pass it on to the delegate. 901 this.arg = undefined$1 902 } 903 904 return ContinueSentinel 905 } 906 } // Regardless of whether this script is executing as a CommonJS module 907 // or not, return the runtime object so that we can declare the variable 908 // regeneratorRuntime in the outer scope, which allows this module to be 909 // injected easily by `bin/regenerator --include-runtime script.js`. 910 911 return exports 912 })( 913 // If this script is executing as a CommonJS module, use module.exports 914 // as the regeneratorRuntime namespace. Otherwise create a new empty 915 // object. Either way, the resulting object will be used to initialize 916 // the regeneratorRuntime variable at the top of this file. 917 module.exports 918 ) 919 920 try { 921 regeneratorRuntime = runtime 922 } catch (accidentalStrictMode) { 923 // This module should not be running in strict mode, so the above 924 // assignment should always work unless something is misconfigured. Just 925 // in case runtime.js accidentally runs in strict mode, in modern engines 926 // we can explicitly access globalThis. In older engines we can escape 927 // strict mode using a global Function call. This could conceivably fail 928 // if a Content Security Policy forbids using Function, but in that case 929 // the proper solution is to fix the accidental strict mode problem. If 930 // you've misconfigured your bundler to force strict mode and applied a 931 // CSP to forbid Function, and you're not willing to fix either of those 932 // problems, please detail your unique predicament in a GitHub issue. 933 if ((typeof globalThis === 'undefined' ? 'undefined' : _typeof(globalThis)) === 'object') { 934 globalThis.regeneratorRuntime = runtime 935 } else { 936 Function('r', 'regeneratorRuntime = r')(runtime) 937 } 938 } 939 })(runtime) 940 941 /** 942 * -------------------------------------------------------------------------- 943 * Button visually impaired (v1.0.0): util/index.js 944 * Licensed under MIT (https://github.com/veks/button-visually-impaired-javascript/blob/master/LICENSE.md) 945 * -------------------------------------------------------------------------- 946 */ 947 ;(function (arr) { 948 arr.forEach(function (item) { 949 if (item.hasOwnProperty('prepend')) { 950 return 951 } 952 953 Object.defineProperty(item, 'prepend', { 954 configurable: true, 955 enumerable: true, 956 writable: true, 957 value: function prepend() { 958 var argArr = Array.prototype.slice.call(arguments), 959 docFrag = document.createDocumentFragment() 960 argArr.forEach(function (argItem) { 961 var isNode = argItem instanceof Node 962 docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem))) 963 }) 964 this.insertBefore(docFrag, this.firstChild) 965 } 966 }) 967 }) 968 })([Element.prototype, Document.prototype, DocumentFragment.prototype]) 969 970 if (window.NodeList && !NodeList.prototype.forEach) { 971 NodeList.prototype.forEach = Array.prototype.forEach 972 } 973 974 if (window.HTMLCollection && !HTMLCollection.prototype.forEach) { 975 HTMLCollection.prototype.forEach = Array.prototype.forEach 976 } 977 978 var toType = function toType(obj) { 979 if (obj === null || obj === undefined) { 980 return ''.concat(obj) 981 } 982 983 return {}.toString 984 .call(obj) 985 .match(/\s([a-z]+)/i)[1] 986 .toLowerCase() 987 } 988 989 var isElement = function isElement(obj) { 990 if (!obj || _typeof(obj) !== 'object') { 991 return false 992 } 993 994 return typeof obj.nodeType !== 'undefined' 995 } 996 997 var checkConfig = function checkConfig(config, configTypes, configOptions) {
998 Object.keys(configTypes).forEach(function (key) { 999 var expectedTypes = configTypes[key] 1000 var value = config[key] 1001 var valueType = value && isElement(value) ? 'element' : toType(value) 1002 1003 if (!new RegExp(expectedTypes).test(valueType)) { 1004 throw new TypeError( 1005 'Bvi console: \u041E\u043F\u0446\u0438\u044F "' 1006 .concat( 1007 key, 1008 '" \u043F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u043D\u044B\u0439 \u0442\u0438\u043F "' 1009 ) 1010 .concat( 1011 valueType, 1012 '", \u043E\u0436\u0438\u0434\u0430\u0435\u043C\u044B\u0439 \u0442\u0438\u043F "' 1013 ) 1014 .concat(expectedTypes, '".') 1015 ) 1016 } 1017 }) 1018 Object.keys(configOptions).forEach(function (key) { 1019 var expectedOptions = configOptions[key] 1020 var value = config[key] 1021 1022 if (!new RegExp(expectedOptions).test(value)) { 1023 throw new TypeError( 1024 'Bvi console: \u041E\u043F\u0446\u0438\u044F "' 1025 .concat(key, '" \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 "') 1026 .concat( 1027 value, 1028 '", \u043E\u0436\u0438\u0434\u0430\u0435\u043C\u044B\u0439 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 "' 1029 ) 1030 .concat(expectedOptions, '".') 1031 ) 1032 } 1033 }) 1034 } 1035 1036 var stringToBoolean = function stringToBoolean(string) { 1037 switch (string) { 1038 case 'on': 1039 case 'true': 1040 case '1': 1041 return true 1042 1043 default: 1044 return false 1045 } 1046 } 1047 1048 var wrapInner = function wrapInner(parent, wrapper, className) { 1049 if (typeof wrapper === 'string') { 1050 wrapper = document.createElement(wrapper) 1051 } 1052 1053 parent.appendChild(wrapper).className = className 1054 1055 while (parent.firstChild !== wrapper) { 1056 wrapper.appendChild(parent.firstChild) 1057 } 1058 } 1059 1060 var unwrap = function unwrap(wrapper) { 1061 var docFrag = document.createDocumentFragment() 1062 if (!wrapper) return 1063 1064 while (wrapper.firstChild) { 1065 var child = wrapper.removeChild(wrapper.firstChild) 1066 docFrag.appendChild(child) 1067 } 1068 1069 wrapper.parentNode.replaceChild(docFrag, wrapper) 1070 } 1071 1072 var getObject = function getObject(object, callback) { 1073 Object.keys(object).forEach(function (key) { 1074 if (typeof callback === 'function') { 1075 callback(key) 1076 } 1077 }) 1078 } 1079 1080 var getArray = function getArray(array, callback) { 1081 Array.from(array).forEach(function (key) { 1082 if (typeof callback === 'function') { 1083 callback(key) 1084 } 1085 }) 1086 } 1087 1088 /** 1089 * -------------------------------------------------------------------------- 1090 * Button visually impaired (v1.0.0): util/cookie.js 1091 * Licensed under MIT (https://github.com/veks/button-visually-impaired-javascript/blob/master/LICENSE.md) 1092 * -------------------------------------------------------------------------- 1093 */ 1094 var setCookie = function setCookie() { 1095 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '' 1096 var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '' 1097 var now = new Date() 1098 var time = now.getTime() 1099 time += 24 * 60 * 60 * 1000 1100 now.setTime(time) 1101 document.cookie = 'bvi_' 1102 .concat(name, '=') 1103 .concat(value, ';path=/;expires=') 1104 .concat(now.toUTCString(), ';domain=') 1105 .concat(location.host) 1106 } 1107 1108 var getCookie = function getCookie() { 1109 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '' 1110 name = 'bvi_'.concat(name, '=') 1111 var decodedCookie = decodeURIComponent(document.cookie) 1112 var cookies = decodedCookie.split(';') 1113 1114 for (var i = 0; i < cookies.length; i++) { 1115 var cookie = cookies[i].trim() 1116 1117 if (cookie.indexOf(name) !== -1) { 1118 return cookie.substring(name.length, cookie.length) 1119 } 1120 } 1121 } 1122 1123 var removeCookie = function removeCookie() { 1124 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '' 1125 document.cookie = 'bvi_' 1126 .concat(name, '=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=') 1127 .concat(location.host) 1128 } 1129 1130 /** 1131 * --------------------------------------------------------------------------
1132 * Button visually impaired (v1.0.0): i18n.js 1133 * Licensed under MIT (https://github.com/veks/button-visually-impaired-javascript/blob/master/LICENSE.md) 1134 * -------------------------------------------------------------------------- 1135 */ 1136 var lang = { 1137 'ru-RU': { 1138 text: { 1139 fontSize: 'Ð Ð°Ð·Ð¼ÐµÑ ÑÑиÑÑа', 1140 siteColors: 'ЦвеÑа ÑайÑа', 1141 images: 'ÐзобÑажениÑ', 1142 settings: 'ÐаÑÑÑойки', 1143 regularVersionOfTheSite: 'ÐбÑÑÐ½Ð°Ñ Ð²ÐµÑÑÐ¸Ñ ÑайÑа', 1144 letterSpacing: 'ÐежбÑквенное ÑаÑÑÑоÑние', 1145 normal: 'СÑандаÑÑнÑй', 1146 average: 'СÑедний', 1147 big: 'ÐолÑÑой', 1148 lineHeight: 'ÐежÑÑÑоÑнÑй инÑеÑвал', 1149 font: 'ШÑиÑÑ', 1150 arial: 'Ðез заÑеÑек', 1151 times: 'С заÑеÑками', 1152 builtElements: 'ÐÑÑÑоеннÑе ÑлеменÑÑ (Ðидео, каÑÑÑ Ð¸ Ñд.)', 1153 on: 'ÐклÑÑиÑÑ', 1154 off: 'ÐÑклÑÑиÑÑ', 1155 reset: 'СбÑоÑиÑÑ Ð½Ð°ÑÑÑойки', 1156 plural_0: 'пикÑелÑ', 1157 plural_1: 'пекÑелÑ', 1158 plural_2: 'пикÑелей' 1159 }, 1160 voice: { 1161 fontSizePlus: 'Ð Ð°Ð·Ð¼ÐµÑ ÑÑиÑÑа ÑвелиÌÑен', 1162 fontSizeMinus: 'Ð Ð°Ð·Ð¼ÐµÑ ÑÑиÑÑа ÑмеÌнÑÑен', 1163 siteColorBlackOnWhite: 'Ð¦Ð²ÐµÑ ÑайÑа ÑеÑнÑм по беломÑ', 1164 siteColorWhiteOnBlack: 'Ð¦Ð²ÐµÑ ÑайÑа белÑм по ÑеÑномÑ', 1165 siteColorDarkBlueOnBlue: 'Ð¦Ð²ÐµÑ ÑайÑа ÑÑмно-Ñиним по голÑбомÑ', 1166 siteColorBeigeBrown: 'Ð¦Ð²ÐµÑ ÑайÑа коÑиÌÑневÑм по беÌжевомÑ', 1167 siteColorGreenOnDarkBrown: 'Ð¦Ð²ÐµÑ ÑайÑа зеленÑм по ÑÑмно-коÑиÑневомÑ', 1168 imagesOn: 'ÐзобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð²ÐºÐ»ÑÑенÑ', 1169 imagesOFF: 'ÐзобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð²ÑклÑÑенÑ', 1170 imagesGrayscale: 'ÐзобÑÐ°Ð¶ÐµÐ½Ð¸Ñ ÑÑÑно-белÑе', 1171 lineHeightNormal: 'ÐежÑÑÑоÑнÑй инÑеÑвал ÑÑандаÑÑнÑй', 1172 lineHeightAverage: 'ÐежÑÑÑоÑнÑй инÑеÑвал ÑÑедний', 1173 lineHeightBig: 'ÐежÑÑÑоÑнÑй инÑеÑвал болÑÑой', 1174 LetterSpacingNormal: 'ÐнÑеÑвал Ð¼ÐµÐ¶Ð´Ñ Ð±Ñквами ÑÑандаÑÑнÑй', 1175 LetterSpacingAverage: 'ÐнÑеÑвал Ð¼ÐµÐ¶Ð´Ñ Ð±Ñквами ÑÑедний', 1176 LetterSpacingBig: 'ÐнÑеÑвал Ð¼ÐµÐ¶Ð´Ñ Ð±Ñквами болÑÑой', 1177 fontArial: 'ШÑиÑÑ Ð±ÐµÐ· заÑеÑек', 1178 fontTimes: 'ШÑиÑÑ Ñ Ð·Ð°ÑеÑками', 1179 builtElementsOn: 'ÐÑÑÑоеннÑе ÑлеменÑÑ Ð²ÐºÐ»ÑÑенÑ', 1180 builtElementsOFF: 'ÐÑÑÑоеннÑе ÑлеменÑÑ Ð²ÑклÑÑенÑ', 1181 resetSettings: 'УÑÑÐ°Ð½Ð¾Ð²Ð»ÐµÐ½Ñ Ð½Ð°ÑÑÑойки по ÑмолÑаÌниÑ', 1182 panelShow: 'ÐÐ°Ð½ÐµÐ»Ñ Ð¾ÑкÑÑÑа', 1183 panelHide: 'ÐÐ°Ð½ÐµÐ»Ñ ÑкÑÑÑа', 1184 panelOn: 'ÐеÑÑÐ¸Ñ ÑайÑа Ð´Ð»Ñ ÑлабовиÌдÑÑий', 1185 panelOff: 'ÐбÑÑÐ½Ð°Ñ Ð²ÐµÑÑÐ¸Ñ ÑайÑа' 1186 } 1187 }, 1188 'en-US': { 1189 text: { 1190 fontSize: 'Font size', 1191 siteColors: 'Site colors', 1192 images: 'Images', 1193 settings: 'Settings', 1194 regularVersionOfTheSite: 'Regular version Of The site', 1195 letterSpacing: 'Letter spacing', 1196 normal: 'Single', 1197 average: 'One and a half', 1198 big: 'Double', 1199 lineHeight: 'Line spacing', 1200 font: 'Font', 1201 arial: 'Sans Serif - Arial', 1202 times: 'Serif - Times New Roman', 1203 builtElements: 'Include inline elements (Videos, maps, etc.)', 1204 on: 'Enable', 1205 off: 'Disabled', 1206 reset: 'Reset settings', 1207 plural_0: 'pixel', 1208 plural_1: 'pixels', 1209 plural_2: 'pixels' 1210 }, 1211 voice: { 1212 fontSizePlus: 'Font size increased', 1213 fontSizeMinus: 'Font size reduced', 1214 siteColorBlackOnWhite: 'Site color black on white', 1215 siteColorWhiteOnBlack: 'Site color white on black', 1216 siteColorDarkBlueOnBlue: 'Site color dark blue on cyan', 1217 siteColorBeigeBrown: 'SiteColorBeigeBrown', 1218 siteColorGreenOnDarkBrown: 'Site color green on dark brown', 1219 imagesOn: 'Images enable', 1220 imagesOFF: 'Images disabled', 1221 imagesGrayscale: 'Images gray scale', 1222 lineHeightNormal: 'Line spacing single', 1223 lineHeightAverage: 'Line spacing one and a half', 1224 lineHeightBig: 'Line spacing double', 1225 LetterSpacingNormal: 'Letter spacing single', 1226 LetterSpacingAverage: 'Letter spacing one and a half', 1227 LetterSpacingBig: 'Letter spacing letter double',
1228 fontArial: 'Sans Serif - Arial', 1229 fontTimes: 'Serif - Times New Roman', 1230 builtElementsOn: 'Include inline elements are enabled', 1231 builtElementsOFF: 'Include inline elements are disabled', 1232 resetSettings: 'Default settings have been set', 1233 panelShow: 'Panel show', 1234 panelHide: 'Panel hide', 1235 panelOn: 'Site version for visually impaired', 1236 panelOff: 'Regular version of the site' 1237 } 1238 } 1239 } 1240 1241 var I18n = /*#__PURE__*/ (function () { 1242 function I18n(options) { 1243 _classCallCheck(this, I18n) 1244 1245 this._config = options 1246 } 1247 1248 _createClass(I18n, [ 1249 { 1250 key: 't', 1251 value: function t(key) { 1252 return lang[this._config.lang]['text'][key] 1253 } 1254 }, 1255 { 1256 key: 'v', 1257 value: function v(key) { 1258 return lang[this._config.lang]['voice'][key] 1259 } 1260 } 1261 ]) 1262 1263 return I18n 1264 })() 1265 1266 /** 1267 * ------------------------------------------------------------------------ 1268 * Constants 1269 * ------------------------------------------------------------------------ 1270 */ 1271 1272 var Default = { 1273 target: '.bvi-open', 1274 fontSize: 16, 1275 theme: 'white', 1276 images: 'grayscale', 1277 letterSpacing: 'normal', 1278 lineHeight: 'normal', 1279 fontFamily: 'arial', 1280 builtElements: false, 1281 panelFixed: true, 1282 panelHide: false, 1283 reload: false, 1284 lang: 'ru-RU' 1285 } 1286 var DefaultType = { 1287 target: 'string', 1288 fontSize: 'number', 1289 theme: 'string', 1290 images: '(string|boolean)', 1291 letterSpacing: 'string', 1292 lineHeight: 'string', 1293 fontFamily: 'string', 1294 builtElements: 'boolean', 1295 panelFixed: 'boolean', 1296 panelHide: 'boolean', 1297 reload: 'boolean', 1298 lang: 'string' 1299 } 1300 var DefaultOptions = { 1301 target: '', 1302 fontSize: '(^[1-9]$|^[1-3][0-9]?$|^39$)', 1303 theme: '(white|black|blue|brown|green)', 1304 images: '(true|false|grayscale)', 1305 letterSpacing: '(normal|average|big)', 1306 lineHeight: '(normal|average|big)', 1307 fontFamily: '(arial|times)', 1308 builtElements: '(true|false)', 1309 panelFixed: '(true|false)', 1310 panelHide: '(true|false)', 1311 reload: '(true|false)', 1312 lang: '(ru-RU|en-US)' 1313 } 1314 /** 1315 * ------------------------------------------------------------------------ 1316 * Class Definition 1317 * ------------------------------------------------------------------------ 1318 */ 1319 1320 var Bvi = /*#__PURE__*/ (function () { 1321 function Bvi(options) { 1322 _classCallCheck(this, Bvi) 1323 1324 this._config = this._getConfig(options) 1325 this._elements = document.querySelectorAll(this._config.target) 1326 this._i18n = new I18n({ 1327 lang: this._config.lang 1328 }) 1329 1330 this._addEventListeners() 1331 1332 this._init() 1333 } // Private 1334 1335 _createClass(Bvi, [ 1336 { 1337 key: '_init', 1338 value: function _init() { 1339 getObject(this._config, function (key) { 1340 if (typeof getCookie(key) === 'undefined') { 1341 removeCookie('panelActive') 1342 } 1343 }) 1344 1345 if (stringToBoolean(getCookie('panelActive'))) { 1346 this._set() 1347 1348 this._getPanel() 1349 1350 this._addEventListenersPanel() 1351 1352 this._images() 1353 } else { 1354 this._remove() 1355 } 1356 } 1357 }, 1358 { 1359 key: '_addEventListeners', 1360 value: function _addEventListeners() { 1361 var _this = this 1362 1363 if (!this._elements) { 1364 return false 1365 } 1366 1367 this._elements.forEach(function (element) { 1368 element.addEventListener('click', function (event) { 1369 event.preventDefault() 1370 getObject(_this._config, function (key) { 1371 return setCookie(key, _this._config[key]) 1372 }) 1373 setCookie('panelActive', true) 1374 1375 _this._init() 1376 }) 1377 }) 1378 } 1379 }, 1380 { 1381 key: '_addEventListenersPanel', 1382 value: function _addEventListenersPanel() { 1383 var _this2 = this 1384 1385 var elements = { 1386 fontSizeMinus: document.querySelector('.bvi-fontSize-minus'), 1387 fontSizePlus: document.querySelector('.bvi-fontSize-plus'), 1388 themeWhite: document.querySelector('.bvi-theme-white'), 1389 themeBlack: document.querySelector('.bvi-theme-black'), 1390 themeBlue: document.querySelector('.bvi-theme-blue'), 1391 themeBrown: document.querySelector('.bvi-theme-brown'), 1392 themeGreen: document.querySelector('.bvi-theme-green'), 1393 imagesOn: document.querySelector('.bvi-images-on'), 1394 imagesOff: document.querySelector('.bvi-images-off'), 1395 imagesGrayscale: document.querySelector('.bvi-images-grayscale'), 1396 lineHeightNormal: document.querySelector('.bvi-line-height-normal'), 1397 lineHeightAverage: document.querySelector('.bvi-line-height-average'), 1398 lineHeightBig: document.querySelector('.bvi-line-height-big'), 1399 letterSpacingNormal: document.querySelector('.bvi-letter-spacing-normal'), 1400 letterSpacingAverage: document.querySelector('.bvi-letter-spacing-average'), 1401 letterSpacingBig: document.querySelector('.bvi-letter-spacing-big'),
1402 fontFamilyArial: document.querySelector('.bvi-font-family-arial'), 1403 fontFamilyTimes: document.querySelector('.bvi-font-family-times'), 1404 builtElementsOn: document.querySelector('.bvi-built-elements-on'), 1405 builtElementsOff: document.querySelector('.bvi-built-elements-off'), 1406 reset: document.querySelector('.bvi-reset'), 1407 links: document.querySelectorAll('.bvi-link'), 1408 modal: document.querySelector('.bvi-modal') 1409 } 1410 1411 var activeLink = function activeLink(element) { 1412 var _iterator = _createForOfIteratorHelper(element.parentNode.children), 1413 _step 1414 1415 try { 1416 for (_iterator.s(); !(_step = _iterator.n()).done; ) { 1417 var sibling = _step.value 1418 sibling.classList.remove('active') 1419 } 1420 } catch (err) { 1421 _iterator.e(err) 1422 } finally { 1423 _iterator.f() 1424 } 1425 1426 element.classList.add('active') 1427 } 1428 1429 var click = function click(element, callback) { 1430 element.addEventListener('click', function (event) { 1431 event.preventDefault() 1432 1433 if (typeof callback === 'function') { 1434 callback(event) 1435 } 1436 }) 1437 } 1438 1439 var activeAll = function activeAll() { 1440 var links = document.querySelectorAll('.bvi-link') 1441 links.forEach(function (link) { 1442 link.classList.remove('active') 1443 }) 1444 getObject(_this2._config, function (key) { 1445 if (key === 'theme') { 1446 var value = getCookie(key) 1447 document.querySelector('.bvi-theme-'.concat(value)).classList.add('active') 1448 } 1449 1450 if (key === 'images') { 1451 var _value = 1452 getCookie(key) === 'grayscale' 1453 ? 'grayscale' 1454 : stringToBoolean(getCookie(key)) 1455 ? 'on' 1456 : 'off' 1457 1458 document.querySelector('.bvi-images-'.concat(_value)).classList.add('active') 1459 } 1460 1461 if (key === 'lineHeight') { 1462 var _value3 = getCookie(key) 1463 1464 document.querySelector('.bvi-line-height-'.concat(_value3)).classList.add('active') 1465 } 1466 1467 if (key === 'letterSpacing') { 1468 var _value4 = getCookie(key) 1469 1470 document 1471 .querySelector('.bvi-letter-spacing-'.concat(_value4)) 1472 .classList.add('active') 1473 } 1474 1475 if (key === 'fontFamily') { 1476 var _value5 = getCookie(key) 1477 1478 document.querySelector('.bvi-font-family-'.concat(_value5)).classList.add('active') 1479 } 1480 1481 if (key === 'builtElements') { 1482 var _value6 = stringToBoolean(getCookie(key)) ? 'on' : 'off' 1483 1484 document 1485 .querySelector('.bvi-built-elements-'.concat(_value6)) 1486 .classList.add('active') 1487 } 1488 }) 1489 } 1490 1491 activeAll() // Font size 1492 1493 click(elements.fontSizeMinus, function () { 1494 var size = parseFloat(getCookie('fontSize')) - 1 1495 1496 if (size !== 0) { 1497 _this2._setAttrDataBviBody('fontSize', size) 1498 1499 setCookie('fontSize', size) 1500 1501 activeLink(elements.fontSizeMinus) 1502 } 1503 }) 1504 click(elements.fontSizePlus, function () { 1505 var size = parseFloat(getCookie('fontSize')) + 1 1506 1507 if (size !== 40) { 1508 _this2._setAttrDataBviBody('fontSize', size) 1509 1510 setCookie('fontSize', size) 1511 1512 activeLink(elements.fontSizePlus) 1513 } 1514 }) // Theme 1515 1516 click(elements.themeWhite, function () { 1517 _this2._setAttrDataBviBody('theme', 'white') 1518 1519 setCookie('theme', 'white') 1520 1521 activeLink(elements.themeWhite) 1522 }) 1523 click(elements.themeBlack, function () {
1524 _this2._setAttrDataBviBody('theme', 'black') 1525 1526 setCookie('theme', 'black') 1527 1528 activeLink(elements.themeBlack) 1529 }) 1530 click(elements.themeBlue, function () { 1531 _this2._setAttrDataBviBody('theme', 'blue') 1532 1533 setCookie('theme', 'blue') 1534 1535 activeLink(elements.themeBlue) 1536 }) 1537 click(elements.themeBrown, function () { 1538 _this2._setAttrDataBviBody('theme', 'brown') 1539 1540 setCookie('theme', 'brown') 1541 1542 activeLink(elements.themeBrown) 1543 }) 1544 click(elements.themeGreen, function () { 1545 _this2._setAttrDataBviBody('theme', 'green') 1546 1547 setCookie('theme', 'green') 1548 1549 activeLink(elements.themeGreen) 1550 }) // Images 1551 1552 click(elements.imagesOn, function () { 1553 _this2._setAttrDataBviBody('images', 'true') 1554 1555 setCookie('images', 'true') 1556 1557 activeLink(elements.imagesOn) 1558 }) 1559 click(elements.imagesOff, function () { 1560 _this2._setAttrDataBviBody('images', 'false') 1561 1562 setCookie('images', 'false') 1563 1564 activeLink(elements.imagesOff) 1565 }) 1566 click(elements.imagesGrayscale, function () { 1567 _this2._setAttrDataBviBody('images', 'grayscale') 1568 1569 setCookie('images', 'grayscale') 1570 1571 activeLink(elements.imagesGrayscale) 1572 }) 1573 1574 click(elements.lineHeightNormal, function () { 1575 _this2._setAttrDataBviBody('lineHeight', 'normal') 1576 1577 setCookie('lineHeight', 'normal') 1578 1579 activeLink(elements.lineHeightNormal) 1580 }) 1581 click(elements.lineHeightAverage, function () { 1582 _this2._setAttrDataBviBody('lineHeight', 'average') 1583 1584 setCookie('lineHeight', 'average') 1585 1586 activeLink(elements.lineHeightAverage) 1587 }) 1588 click(elements.lineHeightBig, function () { 1589 _this2._setAttrDataBviBody('lineHeight', 'big') 1590 1591 setCookie('lineHeight', 'big') 1592 1593 activeLink(elements.lineHeightBig) 1594 }) // Letter spacing 1595 1596 click(elements.letterSpacingNormal, function () { 1597 _this2._setAttrDataBviBody('letterSpacing', 'normal') 1598 1599 setCookie('letterSpacing', 'normal') 1600 1601 activeLink(elements.letterSpacingNormal) 1602 }) 1603 click(elements.letterSpacingAverage, function () { 1604 _this2._setAttrDataBviBody('letterSpacing', 'average') 1605 1606 setCookie('letterSpacing', 'average') 1607 1608 activeLink(elements.letterSpacingAverage) 1609 }) 1610 click(elements.letterSpacingBig, function () { 1611 _this2._setAttrDataBviBody('letterSpacing', 'big') 1612 1613 setCookie('letterSpacing', 'big') 1614 1615 activeLink(elements.letterSpacingBig) 1616 }) // Font family 1617 1618 click(elements.fontFamilyArial, function () { 1619 _this2._setAttrDataBviBody('fontFamily', 'arial') 1620 1621 setCookie('fontFamily', 'arial') 1622 1623 activeLink(elements.fontFamilyArial) 1624 }) 1625 click(elements.fontFamilyTimes, function () { 1626 _this2._setAttrDataBviBody('fontFamily', 'times') 1627 1628 setCookie('fontFamily', 'times') 1629 1630 activeLink(elements.fontFamilyTimes) 1631 }) // Built elements 1632 1633 click(elements.builtElementsOn, function () { 1634 _this2._setAttrDataBviBody('builtElements', 'true') 1635 1636 setCookie('builtElements', 'true') 1637 1638 activeLink(elements.builtElementsOn) 1639 }) 1640 click(elements.builtElementsOff, function () { 1641 _this2._setAttrDataBviBody('builtElements', 'false') 1642 1643 setCookie('builtElements', 'false') 1644 1645 activeLink(elements.builtElementsOff) 1646 }) // Reset 1647 1648 click(elements.reset, function () { 1649 getObject(_this2._config, function (key) { 1650 _this2._setAttrDataBviBody(key, _this2._config[key]) 1651 1652 setCookie(key, _this2._config[key]) 1653 activeAll() 1654 }) 1655 }) 1656 getArray(elements.links, function (element) { 1657 click(element, function (event) { 1658 var target = event.target.getAttribute('data-bvi') 1659 1660 if (target === 'close') {
1661 _this2._setAttrDataBviBody('panelActive', 'false') 1662 1663 setCookie('panelActive', 'false') 1664 1665 _this2._init() 1666 } 1667 1668 if (target === 'modal') { 1669 document.body.style.overflow = 'hidden' 1670 document.body.classList.add('bvi-noscroll') 1671 elements.modal.classList.toggle('show') 1672 } 1673 1674 if (target === 'modal-close') { 1675 document.body.classList.remove('bvi-noscroll') 1676 document.body.style.overflow = '' 1677 elements.modal.classList.remove('show') 1678 } 1679 1680 if (target === 'panel-hide') { 1681 document.querySelector('.bvi-panel').classList.add('bvi-panel-hide') 1682 document.querySelector('.bvi-link-fixed-top').classList.remove('bvi-hide') 1683 document.querySelector('.bvi-link-fixed-top').classList.add('bvi-show') 1684 setCookie('panelHide', 'true') 1685 } 1686 1687 if (target === 'panel-show') { 1688 document.querySelector('.bvi-link-fixed-top').classList.remove('bvi-show') 1689 document.querySelector('.bvi-link-fixed-top').classList.add('bvi-hide') 1690 document.querySelector('.bvi-panel').classList.remove('bvi-panel-hide') 1691 setCookie('panelHide', 'false') 1692 } 1693 }) 1694 }) 1695 click(elements.modal, function (event) { 1696 if (event.target.contains(elements.modal)) { 1697 document.body.classList.remove('bvi-noscroll') 1698 document.body.style.overflow = '' 1699 elements.modal.classList.remove('show') 1700 } 1701 }) 1702 } 1703 }, 1704 { 1705 key: '_getPanel', 1706 value: function _getPanel() { 1707 var scroll = function scroll() { 1708 var scroll = 1709 window.pageYOffset !== undefined 1710 ? window.pageYOffset 1711 : (document.documentElement || document.body.parentNode || document.body).scrollTop 1712 1713 if (stringToBoolean(getCookie('panelFixed'))) { 1714 if (scroll > 200) { 1715 document.querySelector('.bvi-panel').classList.add('bvi-fixed-top') 1716 } else { 1717 document.querySelector('.bvi-panel').classList.remove('bvi-fixed-top') 1718 } 1719 } 1720 } 1721 1722 var panelHide = stringToBoolean(getCookie('panelHide')) ? ' bvi-panel-hide' : '' 1723 var linkHide = !stringToBoolean(getCookie('panelHide')) ? ' bvi-hide' : 'bvi-show' 1724 var html = "\n <div class='bvi-panel" 1725 .concat( 1726 panelHide, 1727 '\'>\n <div class="bvi-blocks bvi-block-center">\n <div class="bvi-block">\n <div class="bvi-block-title">' 1728 ) 1729 .concat( 1730 this._i18n.t('fontSize'), 1731 '</div>\n <a class="bvi-link bvi-fontSize-minus">\u0410-</a>\n <a class="bvi-link bvi-fontSize-plus">\u0410+</a>\n </div>\n <div class="bvi-block">\n <div class="bvi-block-title">' 1732 ) 1733 .concat( 1734 this._i18n.t('siteColors'), 1735 '</div>\n <a href="#" class="bvi-link bvi-theme-white">\u0426</a>\n <a href="#" class="bvi-link bvi-theme-black">\u0426</a>\n <a href="#" class="bvi-link bvi-theme-blue">\u0426</a>\n <a href="#" class="bvi-link bvi-theme-brown">\u0426</a>\n <a href="#" class="bvi-link bvi-theme-green">\u0426</a>\n </div>\n <div class="bvi-block">\n <div class="bvi-block-title">' 1736 ) 1737 .concat( 1738 this._i18n.t('images'), 1739 '</div>\n <a href="#" class="bvi-link bvi-images-on">\n <i class="bvi-images bvi-images-image"></i>\n </a>\n <a href="#" class="bvi-link bvi-images-off">\n <i class="bvi-images bvi-images-minus-circle"></i>\n </a>\n <a href="#" class="bvi-link bvi-images-grayscale">\n <i class="bvi-images bvi-images-adjust"></i>\n </a>\n </div>\n <div class="bvi-block">\n <div class="bvi-block-title">' 1740 ) 1741 .concat( 1742 this._i18n.t('settings'), 1743 '</div>\n <a href="#" class="bvi-link" data-bvi="modal">\n <i class="bvi-images bvi-images-cog"></i>\n </a>\n <a href="#" class="bvi-link" data-bvi="close">\n ' 1744 ) 1745 .concat( 1746 this._i18n.t('regularVersionOfTheSite'), 1747 '\n </a>\n <a href="#" class="bvi-link" data-bvi="panel-hide">\n <i class="bvi-images bvi-images-minus"></i>\n </a>\n </div>\n </div>\n <div class="bvi-modal">\n <div class="bvi-modal-dialog">\n <div class="bvi-modal-content">\n <div class="bvi-modal-header">\n <div class="bvi-modal-title">' 1748 ) 1749 .concat( 1750 this._i18n.t('settings'), 1751 '</div>\n <a href="#" class="bvi-link bvi-modal-close" data-bvi="modal-close">\xD7</a>\n </div>\n <div class="bvi-modal-body">\n <div class="bvi-blocks bvi-block-center">\n <div class="bvi-block">\n <div class="bvi-block-title">' 1752 ) 1753 .concat( 1754 this._i18n.t('letterSpacing'), 1755 '</div>\n <a href="#" class="bvi-link bvi-letter-spacing-normal">' 1756 ) 1757 .concat( 1758 this._i18n.t('normal'), 1759 '</a>\n <a href="#" class="bvi-link bvi-letter-spacing-average">' 1760 ) 1761 .concat( 1762 this._i18n.t('average'), 1763 '</a>\n <a href="#" class="bvi-link bvi-letter-spacing-big">' 1764 ) 1765 .concat( 1766 this._i18n.t('big'), 1767 '</a>\n </div>\n <div class="bvi-block">\n <div class="bvi-block-title">' 1768 ) 1769 .concat( 1770 this._i18n.t('lineHeight'), 1771 '</div>\n <a href="#" class="bvi-link bvi-line-height-normal">' 1772 ) 1773 .concat( 1774 this._i18n.t('normal'), 1775 '</a>\n <a href="#" class="bvi-link bvi-line-height-average">' 1776 ) 1777 .concat( 1778 this._i18n.t('average'), 1779 '</a>\n <a href="#" class="bvi-link bvi-line-height-big">' 1780 ) 1781 .concat( 1782 this._i18n.t('big'), 1783 '</a>\n </div>\n <div class="bvi-block">\n <div class="bvi-block-title">' 1784 ) 1785 .concat( 1786 this._i18n.t('font'), 1787 '</div>\n <a href="#" class="bvi-link bvi-font-family-arial">' 1788 ) 1789 .concat( 1790 this._i18n.t('arial'), 1791 '</a>\n <a href="#" class="bvi-link bvi-font-family-times">' 1792 ) 1793 .concat( 1794 this._i18n.t('times'), 1795 '</a>\n </div>\n <div class="bvi-block">\n <div class="bvi-block-title">' 1796 ) 1797 .concat( 1798 this._i18n.t('builtElements'), 1799 '</div>\n <a href="#" class="bvi-link bvi-built-elements-on">' 1800 ) 1801 .concat( 1802 this._i18n.t('on'), 1803 '</a>\n <a href="#" class="bvi-link bvi-built-elements-off">' 1804 ) 1805 .concat( 1806 this._i18n.t('off'), 1807 '</a>\n </div>\n </div>\n <div class="bvi-blocks bvi-block-center">\n </div>\n </div>\n <div class="bvi-modal-footer">\n <a href="#" class="bvi-link bvi-reset">' 1808 ) 1809 .concat( 1810 this._i18n.t('reset'), 1811 '</a>\n </div>\n </div>\n </div>\n </div>\n </div>' 1812 ) 1813 var link = 1814 '<a href="#" class="bvi-link bvi-link-fixed-top bvi-no-styles '.concat( 1815 linkHide, 1816 '" data-bvi="panel-show">' 1817 ) + '<i class="bvi-images bvi-images-eye bvi-images-size-32 bvi-no-styles"></i></a>' 1818 window.addEventListener('scroll', scroll) 1819 document.querySelector('.bvi-body').insertAdjacentHTML('beforebegin', html) 1820 document.querySelector('.bvi-body').insertAdjacentHTML('afterbegin', link) 1821 scroll() 1822 } 1823 }, 1824 { 1825 key: '_set', 1826 value: function _set() { 1827 var _this3 = this 1828 1829 document.body.classList.add('bvi-active') 1830 wrapInner(document.body, 'div', 'bvi-body') 1831 getObject(this._config, function (key) {
1832 return _this3._setAttrDataBviBody(key, getCookie(key)) 1833 }) 1834 getArray(this._elements, function (element) { 1835 return (element.style.display = 'none') 1836 }) 1837 document.querySelectorAll('img').forEach(function (element) { 1838 if (element.classList.contains('bvi-img')) { 1839 element.classList.remove('bvi-img') 1840 } 1841 }) 1842 document.querySelectorAll('body *').forEach(function (element) { 1843 if (element.classList.contains('bvi-background-image')) { 1844 element.classList.remove('bvi-background-image') 1845 } 1846 }) 1847 } 1848 }, 1849 { 1850 key: '_remove', 1851 value: function _remove() { 1852 var bviPanel = document.querySelector('.bvi-panel') 1853 var bviBody = document.querySelector('.bvi-body') 1854 var bviLinkFixedTop = document.querySelector('.bvi-link-fixed-top') 1855 1856 if (bviPanel) { 1857 bviPanel.remove() 1858 } 1859 1860 if (bviBody) { 1861 unwrap(bviBody) 1862 } 1863 1864 if (bviLinkFixedTop) { 1865 bviLinkFixedTop.remove() 1866 } 1867 1868 document.body.classList.remove('bvi-active') 1869 getArray(this._elements, function (element) { 1870 return (element.style.display = '') 1871 }) 1872 1873 if (stringToBoolean(getCookie('reload'))) { 1874 document.location.reload() 1875 } 1876 1877 getObject(this._config, function (key) { 1878 removeCookie(key) 1879 }) 1880 1881 removeCookie('panelActive') 1882 } 1883 }, 1884 { 1885 key: '_images', 1886 value: function _images() { 1887 document.querySelectorAll('img').forEach(function (element) { 1888 if (!element.classList.contains('bvi-no-style')) { 1889 element.classList.add('bvi-img') 1890 } 1891 }) 1892 document.querySelectorAll('.bvi-body *').forEach(function (element) { 1893 var style = getComputedStyle(element) 1894 1895 if ( 1896 style.backgroundImage !== 'none' && 1897 style.background !== 'none' && 1898 !element.classList.contains('bvi-no-style') 1899 ) { 1900 element.classList.add('bvi-background-image') 1901 } 1902 }) 1903 } 1904 }, 1905 { 1906 key: '_getConfig', 1907 value: function _getConfig(config) { 1908 config = _objectSpread2(_objectSpread2({}, Default), config) 1909 var extended = {} 1910 1911 for (var keyDefault in Default) { 1912 extended[keyDefault] = config[keyDefault] 1913 } 1914 1915 checkConfig(extended, DefaultType, DefaultOptions) 1916 return extended 1917 } 1918 }, 1919 { 1920 key: '_setAttrDataBviBody', 1921 value: function _setAttrDataBviBody() { 1922 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '' 1923 var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '' 1924 document.querySelector('.bvi-body').setAttribute('data-bvi-'.concat(name), value) 1925 } 1926 } 1927 ]) 1928 1929 return Bvi 1930 })() 1931 1932 /** 1933 * -------------------------------------------------------------------------- 1934 * Button visually impaired (v1.0.0): index.umd.js 1935 * Licensed under MIT (https://github.com/veks/button-visually-impaired-javascript/blob/master/LICENSE.md) 1936 * -------------------------------------------------------------------------- 1937 */ 1938 var index_umd = { 1939 Bvi: Bvi 1940 } 1941 1942 return index_umd 1943})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.