![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Reference 'Swipe Up' functionality implementation based on 'Browser Ui State' intended to provide a way to expand browser to full screen state
Open in Chrome, emulate to Nexus 5X and play with different modes:
$ npm i swipe-up
Don't be afraid of caret (^) in your package.json for this dependency - semver will be used correctly for sure :hand::expressionless: :one:.:zero:.:zero:.
In case default options will fit your needs, all you need to do is instantiate SwipeUp (when DOM is ready) and call enable():
import SwipeUp from 'swipe-up'
const loadHandler = () => {
const swipeUp = new SwipeUp() //will init DOM and listeners,
swipeUp.enable() //but SwipeUp will not be displayed until you enable it explicitly
}
window.addEventListener('load', loadHandler)
Old school:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<script type="text/javascript" src="https://unpkg.com/swipe-up"></script>
<script>
window.addEventListener('load', function () {
var swipeUp = new SwipeUp()
swipeUp.enable()
})
</script>
</head>
<body>
</body>
</html>
let options = {
initialOrientation: window.innerWidth > window.innerHeight ? 'LANDSCAPE' : 'PORTRAIT',
addImportantToBodyHeight: true,
fixateRootElementsOnInit: true,
scrollWindowToTopOnShow: true,
useHtml5FullScreenWhenPossible: false,
excludedUserAgents: /\WiPad\W/i,
customCSS: '.fixedFlexBox { background-color: rgba(0, 0, 50, 0.7) }',
customCSSCleanSlate: true,
expandBodyHeightTo: '120vh',
updateTimeout: 150,
swipeUpContent: 'Swipe Up to continue <b>custom text</b>',
html5FullScreenContent: 'Touch to continue <b>custom text</b>',
}
const swipeUp = new SwipeUp(options)
//Getters:
swipeUp.browserUiState //Access to BrowserUiState instance
swipeUp.fscreen //Access to fscreen instance
swipeUp.isShown //Boolean - SwipeUp visibility status
swipeUp.isUserAgentExcluded//Boolean - Results of match for options.excludedUserAgents
swipeUp.appliedOptions //Returns options JSON-object which has been applied by Swipe Up after merging
//all sources (default, constructor, URL)
//Methods:
swipeUp.disable() //This and next one allows to control operational mode of SwipeUp, so you have
swipeUp.enable() //ability to "turn-on" and "off" SwipeUp functioning according to your needs
swipeUp.showDebugWidget() //As it sounds - you can trigger debug widget appearing via API,
swipeUp.hideDebugWidget() //but it can be also displayed via case insensitive URL param "debugInSwipeUp",
swipeUp.toggleDebugWidget()//as well as via secret touch sequence (hold finger in the bottom right corner
//on Swipe Up and quickly tripple-tap in the top left corner)
*there is another secret touch sequence which can be communicated to users to workaround possible blocking experience where Swipe Up may prevent product usage due to not yet supported browser or new mobile limitation/issue (hold finger in the bottom left corner on Swipe Up and quickly tripple-tap in the top right corner)
Polyfills:
See Matrix from Browser UI State.
See Engine from Browser UI State.
Swipe Up respects user-agent resources and throttles window resize and device orientationchange events with the help of requestAnimationFrame.
Swipe Up has to delay its calculations on above events to circumvent some silly browsers (at least Safari) which seems to fire resize in some cases slightly before the browser actually calculated final window dimensions (window.innerWidth and height) resulting into window size to be reported somewhat intermediate, and if user to press some kind of 'refresh' button (which will redisplay window size) after it - the window size will display updated to final values, meaning we are forced to use delay. Even above technique with requestAnimationFrame doesn't help to workaround this problem. All aspects of Swipe Up behavior are configurable including mentioned delay (updateTimeout).
Swipe Up applies its CSS styles by dynamically creating <style>
tag (with ID swipe-up-styles
just in case) and inserting it as first child into <head>
so you can easily customize it using either
traditional approach (with your own <style>
s which should go below Swipe Up <style>
) or via
options customCSS and customCSSCleanSlate which will result into your CSS injected into the same Swipe Up's
own <style>
tag after Swipe Up's own styles.
By default Swipe Up will try to use HTML5
Fullscreen API if user-agent will be support it,
falling back to classic "swipe up" functionality otherwise. If for some reason above API is not fitting your needs,
it can be turned-off with useHtml5FullScreenWhenPossible
option
If you need to support QQ EN, QQ CN, UC EN before 11.4.6 and/or other browsers not capable of
screen.orientation API - you may supply Swipe Up
with initialOrientation
(which you can detect with window.innerWidth > window.innerHeight check). This will allow
Swipe Up to detect states and orientation more correctly in edge cases like on-screen keyboard and split screens.
If you have business requirement to not show Swipe Up for example on all tablets - you will have to take care of this
requirement yourself because there is not reliable cross-browser way to detect if device is a tablet. Swipe Up could
help with this, but that would mean it should become dependent on Detect.js
(To be hosted on Github soon) resulting
into bigger bundle size. Use excludedUserAgents
option and supply regular expression which will list iPad and all
Android tablets which your business care of, e.g.
excludedUserAgents : /(?:\WiPad\W|\WTablet\W|\WNexus (?:7|9|10)\W)|(\WSM-T80\W)/i
which will disable Swipe Up on
iPads, Firefox on any tablet, all Nexus tablets (7, 9, 10), and Samsung Galaxy Tab S 10.5.
If you already use Detect.js
things may become lots simpler, as you can supply function instead of RegExp.
This function has to return true or false for current user-agent, and as so both libs can be combined like this:
excludedUserAgents : () => Detect.Type.is(Detect.T.Tablet)
FAQs
Reference 'Swipe Up' functionality implementation based on 'Browser Ui State' intended to provide a way to expand browser to full screen state
The npm package swipe-up receives a total of 39 weekly downloads. As such, swipe-up popularity was classified as not popular.
We found that swipe-up demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.