(page, floatClick)
| 1 | export function initFloatButton(page, floatClick) { |
| 2 | const posLeft = api.settings.get('posLeft'); |
| 3 | const miniMalWidth = api.settings.get('miniMalWidth'); |
| 4 | const miniMalHeight = api.settings.get('miniMalHeight'); |
| 5 | |
| 6 | if (!j.$('#info-popup').length) { |
| 7 | api.storage.addStyle( |
| 8 | `.modal-content-kal.fullscreen{width: 100% !important;height: 100% !important; bottom: 0 !important;${posLeft}: 0 !important;}\ |
| 9 | .modal-content-kal{-webkit-transition: all 0.5s ease; -moz-transition: all 0.5s ease; -o-transition: all 0.5s ease; transition: all 0.5s ease;}\ |
| 10 | .floatbutton:hover {background-color:rgb(63,81,181) !important;}\ |
| 11 | .floatbutton:hover div {background-color:white;border-color:white;}\ |
| 12 | .floatbutton div {background-color:black;border-color:black;-webkit-transition: all 0.5s ease;-moz-transition: all 0.5s ease;-o-transition: all 0.5s ease;transition: all 0.5s ease;}\ |
| 13 | .floatbutton {\ |
| 14 | z-index: 9999;display: none; position:fixed; bottom:40px; right:40px; border-radius: 50%; font-size: 24px; height: 56px; margin: auto; min-width: 56px; width: 56px; padding: 0; overflow: hidden; background: rgba(158,158,158,.2); box-shadow: 0 1px 1.5px 0 rgba(0,0,0,.12), 0 1px 1px 0 rgba(0,0,0,.24); line-height: normal; border: none;\ |
| 15 | font-weight: 500; text-transform: uppercase; letter-spacing: 0; will-change: box-shadow; transition: box-shadow .2s cubic-bezier(.4,0,1,1),background-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1); outline: none; cursor: pointer; text-decoration: none; text-align: center; vertical-align: middle; padding: 16px !important;\ |
| 16 | }\ |
| 17 | .floatbutton.stealth {\ |
| 18 | background: rgba(158,158,158,.03);\ |
| 19 | }\ |
| 20 | .floatbutton.stealth .open-info-popup{\ |
| 21 | visibility: hidden;\ |
| 22 | }\ |
| 23 | .floatbutton.floatHide{\ |
| 24 | visibility: hidden !important;\ |
| 25 | }`, |
| 26 | ); |
| 27 | |
| 28 | // var position = 'width: 80%; height: 70%; position: absolute; top: 15%; left: 10%'; |
| 29 | let position = `max-width: 100%; max-height: 100%; min-width: 500px; min-height: 300px; width: ${miniMalWidth}; height: ${miniMalHeight}; position: absolute; bottom: 0%; ${posLeft}: 0%`; // phone |
| 30 | // @ts-ignore |
| 31 | if (j.$(window).width() < 500) { |
| 32 | position = `width: 100vw; height: 100%; position: absolute; top: 0%; ${posLeft}: 0%`; |
| 33 | } |
| 34 | let material = |
| 35 | '<div class="modal-kal" id="info-popup" style="pointer-events: none;display: none; position: fixed;z-index: 9999;left: 0;top: 0;bottom: 0;width: 100%; height: 100%; background-color: transparent; padding: 0; margin: 0; border: 0;">'; |
| 36 | material += `<div id="modal-content" class="modal-content-kal" Style="pointer-events: all; background-color: #f9f9f9; margin: 0; ${position}">`; |
| 37 | material += '</div>'; |
| 38 | material += '</div>'; |
| 39 | j.$('body').after(j.html(material)); |
| 40 | |
| 41 | let additionalClasses = ''; |
| 42 | if (api.settings.get('floatButtonStealth')) { |
| 43 | additionalClasses += 'stealth '; |
| 44 | } |
| 45 | if (api.settings.get('floatButtonHide')) { |
| 46 | additionalClasses += 'floatHide '; |
| 47 | } |
| 48 | |
| 49 | let floatbutton = `<button dir="ltr" class="open-info-popup floatbutton ${additionalClasses}" style="">`; |
| 50 | |
| 51 | if (api.settings.get('floatButtonCorrection')) { |
| 52 | floatbutton += ` |
| 53 | <i |
| 54 | class="my-float open-info-popup" |
| 55 | style="display: flex; height: 8px; transform: rotate(-45deg); margin-left: -7px; margin-right: -5px; pointer-events: none;" |
| 56 | > |
| 57 | <div |
| 58 | style=" |
| 59 | width: 1px; |
| 60 | margin-left: 2px; |
no test coverage detected