JSFiddle - React, Tailwind, and code Playground

by darcyclarke

JavaScript

(function($){

    //
    // Helpers
    //
    $.fullscreen = $.fs = {};
    
    // Vendor Prefixes
    $.fs.prefixes   = 'webkit moz o ms khtml'.split(' ');

    // Events to Bind/Unbind
    $.fs.change     = 'fullscreenchange'.split(' ');
    $.fs.request    = 'RequestFullScreen RequestFullscreen'.split(' ');
    $.fs.cancel     = 'CancelFullScreen ExitFullscreen'.split(' ');
    
    // Element we use to test against
    $.fs.Elem       = document.createElement('div');
    $.fs.Style      = $.fs.Elem.style;

    // Add CSS Properties
    $.fs.setCssAll = function(str){
        return fsStyle.cssText = prefixes.join(str + ';');
    };

    // Boolean Contains
    $.fs.contains = function(str, substr){
        return !!~('' + str).indexOf(substr);  
    };

    // Supports Event
    $.fs.isEventSupported = function(eventName) {
        var el = $.fs.Elem;
        eventName = eventName;
        var isSupported = (eventName in el);
        if (!isSupported) {
            el.setAttribute(eventName, 'return;');
            isSupported = typeof el[eventName] == 'function';
        }
        el = null;
        return isSupported;
    };
    
    // 
    // Expose Support (specifically for request)
    // 
    $.extend($.support, {
        fullscreen : (function(){
            for(i in $.fs.prefixes){
                var pfx = $.fs.prefixes[i];
                for(x in $.fs.request){
                    var evt = pfx + $.fs.request[x];
                    if($.fs.isEventSupported(evt)){
                        return true; 
                    }
                }
            }
            return false;
        })()
    });
    
    //
    // Expose Standard Pseudo Class
    //
    $.extend($.expr[':'], {
        fullscreen : function(a) {

        }
    });

    //
    // Expose Standard Event
    //
    $.event.special.fullscreenchange = {
        setup: function() {
            $(this).bind(events + ' windowopen',  $.event.special.acc.handler);
        },
       ...