This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isMobile(agent) { | |
| return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function escapeHtml(code) { | |
| var escapeMap = { | |
| "&": "&", | |
| "<": "<", | |
| ">": ">", | |
| '"': """, | |
| "'": "'", | |
| "`": "`" | |
| }; | |
| var escaper = function (match) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function preventDefault (event) { | |
| window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty() | |
| event.preventDefault && event.preventDefault() | |
| event.stopPropagation && event.stopPropagation() | |
| } | |
| function getParam(clientX, clientY, startX, startY) { | |
| let xOffset = clientX - startX | |
| let yOffset = clientY - startY | |
| return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getImgContainToRectConfig (outerWidth, outerHeight, imgWidth, imgHeight) => { | |
| let newWidth = outerWidth; | |
| let newHeight = outerWidth * imgHeight / imgWidth; | |
| if (newHeight > outerHeight) { | |
| newHeight = outerHeight; | |
| newWidth = outerHeight * imgWidth / imgHeight; | |
| } | |
| return { | |
| top: (outerHeight - newHeight) / 2, | |
| left: (outerWidth - newWidth) / 2, |
OlderNewer