npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-screenfull

v1.0.0

Published

Angular bindings to the Screenfull library to allow fullscreen in your app.

Downloads

1,309

Readme

HTML5 Fullscreen API in Angular.js

Angular screenfull is a wrapper around the Screenfull library, that allows you to use the HTML5 fullscreen API, in "the Angular way".

You can see the API documentation with some demo examples.

Install

Download via npm or look for the files in the dist folder

$ npm install --save angular-screenfull

Import it to your page

<script src="node_modules/screenfull/dist/screenfull.js"></script>
<script src="node_modules/angular-screenfull/dist/angular-screenfull.min.js"></script>

You need to have both screenfull and angular-screenfull loaded in the browser in order to the directive to work. I have a an agular.js project using a custom loader, but if you want to add webpack support, PR's are welcomed.

Enable it on your app

angular.module('myModule', ['angularScreenfull']);

Use it

In its simplest form, you can do something like this

<div ngsf-fullscreen>
    <p>This is a fullscreen element</p>
    <button ngsf-toggle-fullscreen>Toggle fullscreen</button>
</div>

The ngsf-fullscreen indicates which element is going to be the fullscreen element and the ngsf-toggle-fullscreen will toggle the fullscren when clicked.

Note that you can have multiple ngsf-fullscreen elements living side by side, the other directives will use the closest parent controller.

A word in CSS

When the element that uses directive ngsf-fullscreen becomes fullscreen a class is added using the $animation service, so you can add animations to the transition.

Note that this library doesn't come with any CSS, so if you would like your element to occupy the whole screen (and I imagine that you want to), you should add something like this to your CSS.

.fullscreen {
    width: 100%;
    height: 100%;
}

Export its functionality

You can also expose the element controller trough its directive name. So for example you can achieve the same result using this

<div ngsf-fullscreen="fullscreenCtrl">
    <p>This is another fullscreen element</p>
    <button ng-click="fullscreenCtrl.toggleFullscreen()">Toggle fullscreen</button>
</div>

Show or hide

We also provide directives to show the elements based on the fullscreen status, so for example you can have this

<div ngsf-fullscreen>
    <p>This is yet another fullscreen element</p>
    <a ngsf-toggle-fullscreen show-if-fullscreen-enabled>
        <i show-if-fullscreen=false>Icon for enter fullscreen</i>
        <i show-if-fullscreen=true>Icon for exit fullscreen</i>
    </a>
</div>

The problem with F11

As stated in this bug, it appears that browser vendors don't allow a user script to tap into the F11 hotkey for security reasons. That means that we can only detect that the page is in fullscreen mode when the HTML5 fullscreen API is used.

If you can find a way to overcome this problem please let me know!