code
stringlengths
2
1.05M
(function () { var NS = 'com.benqus.test'; module('Protain Node'); test('registering test namespace: ' + NS, function () { protain.namespace(NS, function () { var args = Array.prototype.slice.call(arguments); args.unshift(this); //functionality/property var object = { getName: function () { return this.name; }, setName: function (name) { this.name = name; } }; protain .node(this, 'name', object); ok(this.nodes.name instanceof Object, 'registered functionality/property'); equal(this.nodes.name, object, 'same functionality/property'); }); }); }());
/** * Imports the config module * @module config */ import config from "../config.js"; /** * Handles the state of the config object. * * @module utilities/ConfigState */ let ConfigState = (function() { /** * Resets the config to the default state. This is called on initialize * to ensure the user's config is what matters. * * Public Accessor: AmplitudeHelpers.resetConfig() * * @access public */ function resetConfig() { config.audio = new Audio(); config.active_metadata = {}; config.active_album = ""; config.active_index = 0; config.active_playlist = null; config.playback_speed = 1.0; config.callbacks = {}; config.songs = []; config.playlists = {}; config.start_song = ""; config.starting_playlist = ""; config.starting_playlist_song = ""; config.repeat = false; config.shuffle_list = {}; config.shuffle_on = false; config.default_album_art = ""; config.default_playlist_art = ""; config.debug = false; config.volume = 0.5; config.pre_mute_volume = 0.5; config.volume_increment = 5; config.volume_decrement = 5; config.soundcloud_client = ""; config.soundcloud_use_art = false; config.soundcloud_song_count = 0; config.soundcloud_songs_ready = 0; config.continue_next = true; } /** * Sets the state of the player. */ function setPlayerState() { /* If paused and the current time is 0 the player is stopped. */ if (config.audio.paused && config.audio.currentTime == 0) { config.player_state = "stopped"; } /* If paused and the current time is greater than 0 the player is paused. */ if (config.audio.paused && config.audio.currentTime > 0) { config.player_state = "paused"; } /* If playing, the current state is playing. */ if (!config.audio.paused) { config.player_state = "playing"; } } /* Returns the public facing methods */ return { resetConfig: resetConfig, setPlayerState: setPlayerState }; })(); export default ConfigState;
/*! * reveal.js * http://lab.hakim.se/reveal-js * MIT licensed * * Copyright (C) 2015 Hakim El Hattab, http://hakim.se */ (function( root, factory ) { if( typeof define === 'function' && define.amd ) { // AMD. Register as an anonymous module. define( function() { root.Reveal = factory(); return root.Reveal; } ); } else if( typeof exports === 'object' ) { // Node. Does not work with strict CommonJS. module.exports = factory(); } else { // Browser globals. root.Reveal = factory(); } }( this, function() { 'use strict'; var Reveal; var SLIDES_SELECTOR = '.slides section', HORIZONTAL_SLIDES_SELECTOR = '.slides>section', VERTICAL_SLIDES_SELECTOR = '.slides>section.present>section', HOME_SLIDE_SELECTOR = '.slides>section:first-of-type', // Configuration defaults, can be overridden at initialization time config = { // The "normal" size of the presentation, aspect ratio will be preserved // when the presentation is scaled to fit different resolutions width: 960, height: 700, // Factor of the display size that should remain empty around the content margin: 0.1, // Bounds for smallest/largest possible scale to apply to content minScale: 0.2, maxScale: 1.5, // Display controls in the bottom right corner controls: true, // Display a presentation progress bar progress: true, // Display the page number of the current slide slideNumber: false, // Push each slide change to the browser history history: false, // Enable keyboard shortcuts for navigation keyboard: true, // Optional function that blocks keyboard events when retuning false keyboardCondition: null, // Enable the slide overview mode overview: true, // Vertical centering of slides center: true, // Enables touch navigation on devices with touch input touch: true, // Loop the presentation loop: false, // Change the presentation direction to be RTL rtl: false, // Turns fragments on and off globally fragments: true, // Flags if the presentation is running in an embedded mode, // i.e. contained within a limited portion of the screen embedded: false, // Flags if we should show a help overlay when the questionmark // key is pressed help: true, // Flags if it should be possible to pause the presentation (blackout) pause: true, // Flags if speaker notes should be visible to all viewers showNotes: false, // Number of milliseconds between automatically proceeding to the // next slide, disabled when set to 0, this value can be overwritten // by using a data-autoslide attribute on your slides autoSlide: 0, // Stop auto-sliding after user input autoSlideStoppable: true, // Enable slide navigation via mouse wheel mouseWheel: false, // Apply a 3D roll to links on hover rollingLinks: false, // Hides the address bar on mobile devices hideAddressBar: true, // Opens links in an iframe preview overlay previewLinks: false, // Exposes the reveal.js API through window.postMessage postMessage: true, // Dispatches all reveal.js events to the parent window through postMessage postMessageEvents: false, // Focuses body when page changes visiblity to ensure keyboard shortcuts work focusBodyOnPageVisibilityChange: true, // Transition style transition: 'slide', // none/fade/slide/convex/concave/zoom // Transition speed transitionSpeed: 'default', // default/fast/slow // Transition style for full page slide backgrounds backgroundTransition: 'fade', // none/fade/slide/convex/concave/zoom // Parallax background image parallaxBackgroundImage: '', // CSS syntax, e.g. "a.jpg" // Parallax background size parallaxBackgroundSize: '', // CSS syntax, e.g. "3000px 2000px" // Amount of pixels to move the parallax background per slide step parallaxBackgroundHorizontal: null, parallaxBackgroundVertical: null, // Number of slides away from the current that are visible viewDistance: 3, // Script dependencies to load dependencies: [] }, // Flags if reveal.js is loaded (has dispatched the 'ready' event) loaded = false, // Flags if the overview mode is currently active overview = false, // The horizontal and vertical index of the currently active slide indexh, indexv, // The previous and current slide HTML elements previousSlide, currentSlide, previousBackground, // Slides may hold a data-state attribute which we pick up and apply // as a class to the body. This list contains the combined state of // all current slides. state = [], // The current scale of the presentation (see width/height config) scale = 1, // CSS transform that is currently applied to the slides container, // split into two groups slidesTransform = { layout: '', overview: '' }, // Cached references to DOM elements dom = {}, // Features supported by the browser, see #checkCapabilities() features = {}, // Client is a mobile device, see #checkCapabilities() isMobileDevice, // Throttles mouse wheel navigation lastMouseWheelStep = 0, // Delays updates to the URL due to a Chrome thumbnailer bug writeURLTimeout = 0, // Flags if the interaction event listeners are bound eventsAreBound = false, // The current auto-slide duration autoSlide = 0, // Auto slide properties autoSlidePlayer, autoSlideTimeout = 0, autoSlideStartTime = -1, autoSlidePaused = false, // Holds information about the currently ongoing touch input touch = { startX: 0, startY: 0, startSpan: 0, startCount: 0, captured: false, threshold: 40 }, // Holds information about the keyboard shortcuts keyboardShortcuts = { 'N , SPACE': 'Next slide', 'P': 'Previous slide', '&#8592; , H': 'Navigate left', '&#8594; , L': 'Navigate right', '&#8593; , K': 'Navigate up', '&#8595; , J': 'Navigate down', 'Home': 'First slide', 'End': 'Last slide', 'B , .': 'Pause', 'F': 'Fullscreen', 'ESC, O': 'Slide overview' }; /** * Starts up the presentation if the client is capable. */ function initialize( options ) { checkCapabilities(); if( !features.transforms2d && !features.transforms3d ) { document.body.setAttribute( 'class', 'no-transforms' ); // Since JS won't be running any further, we load all lazy // loading elements upfront var images = toArray( document.getElementsByTagName( 'img' ) ), iframes = toArray( document.getElementsByTagName( 'iframe' ) ); var lazyLoadable = images.concat( iframes ); for( var i = 0, len = lazyLoadable.length; i < len; i++ ) { var element = lazyLoadable[i]; if( element.getAttribute( 'data-src' ) ) { element.setAttribute( 'src', element.getAttribute( 'data-src' ) ); element.removeAttribute( 'data-src' ); } } // If the browser doesn't support core features we won't be // using JavaScript to control the presentation return; } // Cache references to key DOM elements dom.wrapper = document.querySelector( '.reveal' ); dom.slides = document.querySelector( '.reveal .slides' ); // Force a layout when the whole page, incl fonts, has loaded window.addEventListener( 'load', layout, false ); var query = Reveal.getQueryHash(); // Do not accept new dependencies via query config to avoid // the potential of malicious script injection if( typeof query['dependencies'] !== 'undefined' ) delete query['dependencies']; // Copy options over to our config object extend( config, options ); extend( config, query ); // Hide the address bar in mobile browsers hideAddressBar(); // Loads the dependencies and continues to #start() once done load(); } /** * Inspect the client to see what it's capable of, this * should only happens once per runtime. */ function checkCapabilities() { features.transforms3d = 'WebkitPerspective' in document.body.style || 'MozPerspective' in document.body.style || 'msPerspective' in document.body.style || 'OPerspective' in document.body.style || 'perspective' in document.body.style; features.transforms2d = 'WebkitTransform' in document.body.style || 'MozTransform' in document.body.style || 'msTransform' in document.body.style || 'OTransform' in document.body.style || 'transform' in document.body.style; features.requestAnimationFrameMethod = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; features.requestAnimationFrame = typeof features.requestAnimationFrameMethod === 'function'; features.canvas = !!document.createElement( 'canvas' ).getContext; features.touch = !!( 'ontouchstart' in window ); // Transitions in the overview are disabled in desktop and // mobile Safari due to lag features.overviewTransitions = !/Version\/[\d\.]+.*Safari/.test( navigator.userAgent ); isMobileDevice = /(iphone|ipod|ipad|android)/gi.test( navigator.userAgent ); } /** * Loads the dependencies of reveal.js. Dependencies are * defined via the configuration option 'dependencies' * and will be loaded prior to starting/binding reveal.js. * Some dependencies may have an 'async' flag, if so they * will load after reveal.js has been started up. */ function load() { var scripts = [], scriptsAsync = [], scriptsToPreload = 0; // Called once synchronous scripts finish loading function proceed() { if( scriptsAsync.length ) { // Load asynchronous scripts head.js.apply( null, scriptsAsync ); } start(); } function loadScript( s ) { head.ready( s.src.match( /([\w\d_\-]*)\.?js$|[^\\\/]*$/i )[0], function() { // Extension may contain callback functions if( typeof s.callback === 'function' ) { s.callback.apply( this ); } if( --scriptsToPreload === 0 ) { proceed(); } }); } for( var i = 0, len = config.dependencies.length; i < len; i++ ) { var s = config.dependencies[i]; // Load if there's no condition or the condition is truthy if( !s.condition || s.condition() ) { if( s.async ) { scriptsAsync.push( s.src ); } else { scripts.push( s.src ); } loadScript( s ); } } if( scripts.length ) { scriptsToPreload = scripts.length; // Load synchronous scripts head.js.apply( null, scripts ); } else { proceed(); } } /** * Starts up reveal.js by binding input events and navigating * to the current URL deeplink if there is one. */ function start() { // Make sure we've got all the DOM elements we need setupDOM(); // Listen to messages posted to this window setupPostMessage(); // Prevent iframes from scrolling the slides out of view setupIframeScrollPrevention(); // Resets all vertical slides so that only the first is visible resetVerticalSlides(); // Updates the presentation to match the current configuration values configure(); // Read the initial hash readURL(); // Update all backgrounds updateBackground( true ); // Notify listeners that the presentation is ready but use a 1ms // timeout to ensure it's not fired synchronously after #initialize() setTimeout( function() { // Enable transitions now that we're loaded dom.slides.classList.remove( 'no-transition' ); loaded = true; dispatchEvent( 'ready', { 'indexh': indexh, 'indexv': indexv, 'currentSlide': currentSlide } ); }, 1 ); // Special setup and config is required when printing to PDF if( isPrintingPDF() ) { removeEventListeners(); // The document needs to have loaded for the PDF layout // measurements to be accurate if( document.readyState === 'complete' ) { setupPDF(); } else { window.addEventListener( 'load', setupPDF ); } } } /** * Finds and stores references to DOM elements which are * required by the presentation. If a required element is * not found, it is created. */ function setupDOM() { // Prevent transitions while we're loading dom.slides.classList.add( 'no-transition' ); // Background element dom.background = createSingletonNode( dom.wrapper, 'div', 'backgrounds', null ); // Progress bar dom.progress = createSingletonNode( dom.wrapper, 'div', 'progress', '<span></span>' ); dom.progressbar = dom.progress.querySelector( 'span' ); // Arrow controls createSingletonNode( dom.wrapper, 'aside', 'controls', '<button class="navigate-left" aria-label="previous slide"></button>' + '<button class="navigate-right" aria-label="next slide"></button>' + '<button class="navigate-up" aria-label="above slide"></button>' + '<button class="navigate-down" aria-label="below slide"></button>' ); // Slide number dom.slideNumber = createSingletonNode( dom.wrapper, 'div', 'slide-number', '' ); // Element containing notes that are visible to the audience dom.speakerNotes = createSingletonNode( dom.wrapper, 'div', 'speaker-notes', null ); dom.speakerNotes.setAttribute( 'data-prevent-swipe', '' ); // Overlay graphic which is displayed during the paused mode createSingletonNode( dom.wrapper, 'div', 'pause-overlay', null ); // Cache references to elements dom.controls = document.querySelector( '.reveal .controls' ); dom.theme = document.querySelector( '#theme' ); dom.wrapper.setAttribute( 'role', 'application' ); // There can be multiple instances of controls throughout the page dom.controlsLeft = toArray( document.querySelectorAll( '.navigate-left' ) ); dom.controlsRight = toArray( document.querySelectorAll( '.navigate-right' ) ); dom.controlsUp = toArray( document.querySelectorAll( '.navigate-up' ) ); dom.controlsDown = toArray( document.querySelectorAll( '.navigate-down' ) ); dom.controlsPrev = toArray( document.querySelectorAll( '.navigate-prev' ) ); dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) ); dom.statusDiv = createStatusDiv(); } /** * Creates a hidden div with role aria-live to announce the * current slide content. Hide the div off-screen to make it * available only to Assistive Technologies. */ function createStatusDiv() { var statusDiv = document.getElementById( 'aria-status-div' ); if( !statusDiv ) { statusDiv = document.createElement( 'div' ); statusDiv.style.position = 'absolute'; statusDiv.style.height = '1px'; statusDiv.style.width = '1px'; statusDiv.style.overflow ='hidden'; statusDiv.style.clip = 'rect( 1px, 1px, 1px, 1px )'; statusDiv.setAttribute( 'id', 'aria-status-div' ); statusDiv.setAttribute( 'aria-live', 'polite' ); statusDiv.setAttribute( 'aria-atomic','true' ); dom.wrapper.appendChild( statusDiv ); } return statusDiv; } /** * Configures the presentation for printing to a static * PDF. */ function setupPDF() { var slideSize = getComputedSlideSize( window.innerWidth, window.innerHeight ); // Dimensions of the PDF pages var pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ), pageHeight = Math.floor( slideSize.height * ( 1 + config.margin ) ); // Dimensions of slides within the pages var slideWidth = slideSize.width, slideHeight = slideSize.height; // Let the browser know what page size we want to print injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0;}' ); // Limit the size of certain elements to the dimensions of the slide injectStyleSheet( '.reveal section>img, .reveal section>video, .reveal section>iframe{max-width: '+ slideWidth +'px; max-height:'+ slideHeight +'px}' ); document.body.classList.add( 'print-pdf' ); document.body.style.width = pageWidth + 'px'; document.body.style.height = pageHeight + 'px'; // Add each slide's index as attributes on itself, we need these // indices to generate slide numbers below toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) { hslide.setAttribute( 'data-index-h', h ); if( hslide.classList.contains( 'stack' ) ) { toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) { vslide.setAttribute( 'data-index-h', h ); vslide.setAttribute( 'data-index-v', v ); } ); } } ); // Slide and slide background layout toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) { // Vertical stacks are not centred since their section // children will be if( slide.classList.contains( 'stack' ) === false ) { // Center the slide inside of the page, giving the slide some margin var left = ( pageWidth - slideWidth ) / 2, top = ( pageHeight - slideHeight ) / 2; var contentHeight = getAbsoluteHeight( slide ); var numberOfPages = Math.max( Math.ceil( contentHeight / pageHeight ), 1 ); // Center slides vertically if( numberOfPages === 1 && config.center || slide.classList.contains( 'center' ) ) { top = Math.max( ( pageHeight - contentHeight ) / 2, 0 ); } // Position the slide inside of the page slide.style.left = left + 'px'; slide.style.top = top + 'px'; slide.style.width = slideWidth + 'px'; // TODO Backgrounds need to be multiplied when the slide // stretches over multiple pages var background = slide.querySelector( '.slide-background' ); if( background ) { background.style.width = pageWidth + 'px'; background.style.height = ( pageHeight * numberOfPages ) + 'px'; background.style.top = -top + 'px'; background.style.left = -left + 'px'; } // Inject notes if `showNotes` is enabled if( config.showNotes ) { var notes = getSlideNotes( slide ); if( notes ) { var notesElement = document.createElement( 'div' ); notesElement.classList.add( 'speaker-notes' ); notesElement.classList.add( 'speaker-notes-pdf' ); notesElement.innerHTML = notes; notesElement.style.bottom = ( 40 - top ) + 'px'; slide.appendChild( notesElement ); } } // Inject slide numbers if `slideNumbers` are enabled if( config.slideNumber ) { var slideNumberH = parseInt( slide.getAttribute( 'data-index-h' ), 10 ) + 1, slideNumberV = parseInt( slide.getAttribute( 'data-index-v' ), 10 ) + 1; var numberElement = document.createElement( 'div' ); numberElement.classList.add( 'slide-number' ); numberElement.classList.add( 'slide-number-pdf' ); numberElement.innerHTML = formatSlideNumber( slideNumberH, '.', slideNumberV ); background.appendChild( numberElement ); } } } ); // Show all fragments toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' .fragment' ) ).forEach( function( fragment ) { fragment.classList.add( 'visible' ); } ); } /** * This is an unfortunate necessity. Iframes can trigger the * parent window to scroll, for example by focusing an input. * This scrolling can not be prevented by hiding overflow in * CSS so we have to resort to repeatedly checking if the * browser has decided to offset our slides :( */ function setupIframeScrollPrevention() { if( dom.slides.querySelector( 'iframe' ) ) { setInterval( function() { if( dom.wrapper.scrollTop !== 0 || dom.wrapper.scrollLeft !== 0 ) { dom.wrapper.scrollTop = 0; dom.wrapper.scrollLeft = 0; } }, 500 ); } } /** * Creates an HTML element and returns a reference to it. * If the element already exists the existing instance will * be returned. */ function createSingletonNode( container, tagname, classname, innerHTML ) { // Find all nodes matching the description var nodes = container.querySelectorAll( '.' + classname ); // Check all matches to find one which is a direct child of // the specified container for( var i = 0; i < nodes.length; i++ ) { var testNode = nodes[i]; if( testNode.parentNode === container ) { return testNode; } } // If no node was found, create it now var node = document.createElement( tagname ); node.classList.add( classname ); if( typeof innerHTML === 'string' ) { node.innerHTML = innerHTML; } container.appendChild( node ); return node; } /** * Creates the slide background elements and appends them * to the background container. One element is created per * slide no matter if the given slide has visible background. */ function createBackgrounds() { var printMode = isPrintingPDF(); // Clear prior backgrounds dom.background.innerHTML = ''; dom.background.classList.add( 'no-transition' ); // Iterate over all horizontal slides toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( slideh ) { var backgroundStack; if( printMode ) { backgroundStack = createBackground( slideh, slideh ); } else { backgroundStack = createBackground( slideh, dom.background ); } // Iterate over all vertical slides toArray( slideh.querySelectorAll( 'section' ) ).forEach( function( slidev ) { if( printMode ) { createBackground( slidev, slidev ); } else { createBackground( slidev, backgroundStack ); } backgroundStack.classList.add( 'stack' ); } ); } ); // Add parallax background if specified if( config.parallaxBackgroundImage ) { dom.background.style.backgroundImage = 'url("' + config.parallaxBackgroundImage + '")'; dom.background.style.backgroundSize = config.parallaxBackgroundSize; // Make sure the below properties are set on the element - these properties are // needed for proper transitions to be set on the element via CSS. To remove // annoying background slide-in effect when the presentation starts, apply // these properties after short time delay setTimeout( function() { dom.wrapper.classList.add( 'has-parallax-background' ); }, 1 ); } else { dom.background.style.backgroundImage = ''; dom.wrapper.classList.remove( 'has-parallax-background' ); } } /** * Creates a background for the given slide. * * @param {HTMLElement} slide * @param {HTMLElement} container The element that the background * should be appended to */ function createBackground( slide, container ) { var data = { background: slide.getAttribute( 'data-background' ), backgroundSize: slide.getAttribute( 'data-background-size' ), backgroundImage: slide.getAttribute( 'data-background-image' ), backgroundVideo: slide.getAttribute( 'data-background-video' ), backgroundIframe: slide.getAttribute( 'data-background-iframe' ), backgroundColor: slide.getAttribute( 'data-background-color' ), backgroundRepeat: slide.getAttribute( 'data-background-repeat' ), backgroundPosition: slide.getAttribute( 'data-background-position' ), backgroundTransition: slide.getAttribute( 'data-background-transition' ) }; var element = document.createElement( 'div' ); // Carry over custom classes from the slide to the background element.className = 'slide-background ' + slide.className.replace( /present|past|future/, '' ); if( data.background ) { // Auto-wrap image urls in url(...) if( /^(http|file|\/\/)/gi.test( data.background ) || /\.(svg|png|jpg|jpeg|gif|bmp)$/gi.test( data.background ) ) { slide.setAttribute( 'data-background-image', data.background ); } else { element.style.background = data.background; } } // Create a hash for this combination of background settings. // This is used to determine when two slide backgrounds are // the same. if( data.background || data.backgroundColor || data.backgroundImage || data.backgroundVideo || data.backgroundIframe ) { element.setAttribute( 'data-background-hash', data.background + data.backgroundSize + data.backgroundImage + data.backgroundVideo + data.backgroundIframe + data.backgroundColor + data.backgroundRepeat + data.backgroundPosition + data.backgroundTransition ); } // Additional and optional background properties if( data.backgroundSize ) element.style.backgroundSize = data.backgroundSize; if( data.backgroundColor ) element.style.backgroundColor = data.backgroundColor; if( data.backgroundRepeat ) element.style.backgroundRepeat = data.backgroundRepeat; if( data.backgroundPosition ) element.style.backgroundPosition = data.backgroundPosition; if( data.backgroundTransition ) element.setAttribute( 'data-background-transition', data.backgroundTransition ); container.appendChild( element ); // If backgrounds are being recreated, clear old classes slide.classList.remove( 'has-dark-background' ); slide.classList.remove( 'has-light-background' ); // If this slide has a background color, add a class that // signals if it is light or dark. If the slide has no background // color, no class will be set var computedBackgroundColor = window.getComputedStyle( element ).backgroundColor; if( computedBackgroundColor ) { var rgb = colorToRgb( computedBackgroundColor ); // Ignore fully transparent backgrounds. Some browsers return // rgba(0,0,0,0) when reading the computed background color of // an element with no background if( rgb && rgb.a !== 0 ) { if( colorBrightness( computedBackgroundColor ) < 128 ) { slide.classList.add( 'has-dark-background' ); } else { slide.classList.add( 'has-light-background' ); } } } return element; } /** * Registers a listener to postMessage events, this makes it * possible to call all reveal.js API methods from another * window. For example: * * revealWindow.postMessage( JSON.stringify({ * method: 'slide', * args: [ 2 ] * }), '*' ); */ function setupPostMessage() { if( config.postMessage ) { window.addEventListener( 'message', function ( event ) { var data = event.data; // Make sure we're dealing with JSON if( typeof data === 'string' && data.charAt( 0 ) === '{' && data.charAt( data.length - 1 ) === '}' ) { data = JSON.parse( data ); // Check if the requested method can be found if( data.method && typeof Reveal[data.method] === 'function' ) { Reveal[data.method].apply( Reveal, data.args ); } } }, false ); } } /** * Applies the configuration settings from the config * object. May be called multiple times. */ function configure( options ) { var numberOfSlides = dom.wrapper.querySelectorAll( SLIDES_SELECTOR ).length; dom.wrapper.classList.remove( config.transition ); // New config options may be passed when this method // is invoked through the API after initialization if( typeof options === 'object' ) extend( config, options ); // Force linear transition based on browser capabilities if( features.transforms3d === false ) config.transition = 'linear'; dom.wrapper.classList.add( config.transition ); dom.wrapper.setAttribute( 'data-transition-speed', config.transitionSpeed ); dom.wrapper.setAttribute( 'data-background-transition', config.backgroundTransition ); dom.controls.style.display = config.controls ? 'block' : 'none'; dom.progress.style.display = config.progress ? 'block' : 'none'; dom.slideNumber.style.display = config.slideNumber ? 'block' : 'none'; if( config.rtl ) { dom.wrapper.classList.add( 'rtl' ); } else { dom.wrapper.classList.remove( 'rtl' ); } if( config.center ) { dom.wrapper.classList.add( 'center' ); } else { dom.wrapper.classList.remove( 'center' ); } // Exit the paused mode if it was configured off if( config.pause === false ) { resume(); } if( config.showNotes ) { dom.speakerNotes.classList.add( 'visible' ); } else { dom.speakerNotes.classList.remove( 'visible' ); } if( config.mouseWheel ) { document.addEventListener( 'DOMMouseScroll', onDocumentMouseScroll, false ); // FF document.addEventListener( 'mousewheel', onDocumentMouseScroll, false ); } else { document.removeEventListener( 'DOMMouseScroll', onDocumentMouseScroll, false ); // FF document.removeEventListener( 'mousewheel', onDocumentMouseScroll, false ); } // Rolling 3D links if( config.rollingLinks ) { enableRollingLinks(); } else { disableRollingLinks(); } // Iframe link previews if( config.previewLinks ) { enablePreviewLinks(); } else { disablePreviewLinks(); enablePreviewLinks( '[data-preview-link]' ); } // Remove existing auto-slide controls if( autoSlidePlayer ) { autoSlidePlayer.destroy(); autoSlidePlayer = null; } // Generate auto-slide controls if needed if( numberOfSlides > 1 && config.autoSlide && config.autoSlideStoppable && features.canvas && features.requestAnimationFrame ) { autoSlidePlayer = new Playback( dom.wrapper, function() { return Math.min( Math.max( ( Date.now() - autoSlideStartTime ) / autoSlide, 0 ), 1 ); } ); autoSlidePlayer.on( 'click', onAutoSlidePlayerClick ); autoSlidePaused = false; } // When fragments are turned off they should be visible if( config.fragments === false ) { toArray( dom.slides.querySelectorAll( '.fragment' ) ).forEach( function( element ) { element.classList.add( 'visible' ); element.classList.remove( 'current-fragment' ); } ); } sync(); } /** * Binds all event listeners. */ function addEventListeners() { eventsAreBound = true; window.addEventListener( 'hashchange', onWindowHashChange, false ); window.addEventListener( 'resize', onWindowResize, false ); if( config.touch ) { dom.wrapper.addEventListener( 'touchstart', onTouchStart, false ); dom.wrapper.addEventListener( 'touchmove', onTouchMove, false ); dom.wrapper.addEventListener( 'touchend', onTouchEnd, false ); // Support pointer-style touch interaction as well if( window.navigator.pointerEnabled ) { // IE 11 uses un-prefixed version of pointer events dom.wrapper.addEventListener( 'pointerdown', onPointerDown, false ); dom.wrapper.addEventListener( 'pointermove', onPointerMove, false ); dom.wrapper.addEventListener( 'pointerup', onPointerUp, false ); } else if( window.navigator.msPointerEnabled ) { // IE 10 uses prefixed version of pointer events dom.wrapper.addEventListener( 'MSPointerDown', onPointerDown, false ); dom.wrapper.addEventListener( 'MSPointerMove', onPointerMove, false ); dom.wrapper.addEventListener( 'MSPointerUp', onPointerUp, false ); } } if( config.keyboard ) { document.addEventListener( 'keydown', onDocumentKeyDown, false ); document.addEventListener( 'keypress', onDocumentKeyPress, false ); } if( config.progress && dom.progress ) { dom.progress.addEventListener( 'click', onProgressClicked, false ); } if( config.focusBodyOnPageVisibilityChange ) { var visibilityChange; if( 'hidden' in document ) { visibilityChange = 'visibilitychange'; } else if( 'msHidden' in document ) { visibilityChange = 'msvisibilitychange'; } else if( 'webkitHidden' in document ) { visibilityChange = 'webkitvisibilitychange'; } if( visibilityChange ) { document.addEventListener( visibilityChange, onPageVisibilityChange, false ); } } // Listen to both touch and click events, in case the device // supports both var pointerEvents = [ 'touchstart', 'click' ]; // Only support touch for Android, fixes double navigations in // stock browser if( navigator.userAgent.match( /android/gi ) ) { pointerEvents = [ 'touchstart' ]; } pointerEvents.forEach( function( eventName ) { dom.controlsLeft.forEach( function( el ) { el.addEventListener( eventName, onNavigateLeftClicked, false ); } ); dom.controlsRight.forEach( function( el ) { el.addEventListener( eventName, onNavigateRightClicked, false ); } ); dom.controlsUp.forEach( function( el ) { el.addEventListener( eventName, onNavigateUpClicked, false ); } ); dom.controlsDown.forEach( function( el ) { el.addEventListener( eventName, onNavigateDownClicked, false ); } ); dom.controlsPrev.forEach( function( el ) { el.addEventListener( eventName, onNavigatePrevClicked, false ); } ); dom.controlsNext.forEach( function( el ) { el.addEventListener( eventName, onNavigateNextClicked, false ); } ); } ); } /** * Unbinds all event listeners. */ function removeEventListeners() { eventsAreBound = false; document.removeEventListener( 'keydown', onDocumentKeyDown, false ); document.removeEventListener( 'keypress', onDocumentKeyPress, false ); window.removeEventListener( 'hashchange', onWindowHashChange, false ); window.removeEventListener( 'resize', onWindowResize, false ); dom.wrapper.removeEventListener( 'touchstart', onTouchStart, false ); dom.wrapper.removeEventListener( 'touchmove', onTouchMove, false ); dom.wrapper.removeEventListener( 'touchend', onTouchEnd, false ); // IE11 if( window.navigator.pointerEnabled ) { dom.wrapper.removeEventListener( 'pointerdown', onPointerDown, false ); dom.wrapper.removeEventListener( 'pointermove', onPointerMove, false ); dom.wrapper.removeEventListener( 'pointerup', onPointerUp, false ); } // IE10 else if( window.navigator.msPointerEnabled ) { dom.wrapper.removeEventListener( 'MSPointerDown', onPointerDown, false ); dom.wrapper.removeEventListener( 'MSPointerMove', onPointerMove, false ); dom.wrapper.removeEventListener( 'MSPointerUp', onPointerUp, false ); } if ( config.progress && dom.progress ) { dom.progress.removeEventListener( 'click', onProgressClicked, false ); } [ 'touchstart', 'click' ].forEach( function( eventName ) { dom.controlsLeft.forEach( function( el ) { el.removeEventListener( eventName, onNavigateLeftClicked, false ); } ); dom.controlsRight.forEach( function( el ) { el.removeEventListener( eventName, onNavigateRightClicked, false ); } ); dom.controlsUp.forEach( function( el ) { el.removeEventListener( eventName, onNavigateUpClicked, false ); } ); dom.controlsDown.forEach( function( el ) { el.removeEventListener( eventName, onNavigateDownClicked, false ); } ); dom.controlsPrev.forEach( function( el ) { el.removeEventListener( eventName, onNavigatePrevClicked, false ); } ); dom.controlsNext.forEach( function( el ) { el.removeEventListener( eventName, onNavigateNextClicked, false ); } ); } ); } /** * Extend object a with the properties of object b. * If there's a conflict, object b takes precedence. */ function extend( a, b ) { for( var i in b ) { a[ i ] = b[ i ]; } } /** * Converts the target object to an array. */ function toArray( o ) { return Array.prototype.slice.call( o ); } /** * Utility for deserializing a value. */ function deserialize( value ) { if( typeof value === 'string' ) { if( value === 'null' ) return null; else if( value === 'true' ) return true; else if( value === 'false' ) return false; else if( value.match( /^\d+$/ ) ) return parseFloat( value ); } return value; } /** * Measures the distance in pixels between point a * and point b. * * @param {Object} a point with x/y properties * @param {Object} b point with x/y properties */ function distanceBetween( a, b ) { var dx = a.x - b.x, dy = a.y - b.y; return Math.sqrt( dx*dx + dy*dy ); } /** * Applies a CSS transform to the target element. */ function transformElement( element, transform ) { element.style.WebkitTransform = transform; element.style.MozTransform = transform; element.style.msTransform = transform; element.style.transform = transform; } /** * Applies CSS transforms to the slides container. The container * is transformed from two separate sources: layout and the overview * mode. */ function transformSlides( transforms ) { // Pick up new transforms from arguments if( typeof transforms.layout === 'string' ) slidesTransform.layout = transforms.layout; if( typeof transforms.overview === 'string' ) slidesTransform.overview = transforms.overview; // Apply the transforms to the slides container if( slidesTransform.layout ) { transformElement( dom.slides, slidesTransform.layout + ' ' + slidesTransform.overview ); } else { transformElement( dom.slides, slidesTransform.overview ); } } /** * Injects the given CSS styles into the DOM. */ function injectStyleSheet( value ) { var tag = document.createElement( 'style' ); tag.type = 'text/css'; if( tag.styleSheet ) { tag.styleSheet.cssText = value; } else { tag.appendChild( document.createTextNode( value ) ); } document.getElementsByTagName( 'head' )[0].appendChild( tag ); } /** * Converts various color input formats to an {r:0,g:0,b:0} object. * * @param {String} color The string representation of a color, * the following formats are supported: * - #000 * - #000000 * - rgb(0,0,0) */ function colorToRgb( color ) { var hex3 = color.match( /^#([0-9a-f]{3})$/i ); if( hex3 && hex3[1] ) { hex3 = hex3[1]; return { r: parseInt( hex3.charAt( 0 ), 16 ) * 0x11, g: parseInt( hex3.charAt( 1 ), 16 ) * 0x11, b: parseInt( hex3.charAt( 2 ), 16 ) * 0x11 }; } var hex6 = color.match( /^#([0-9a-f]{6})$/i ); if( hex6 && hex6[1] ) { hex6 = hex6[1]; return { r: parseInt( hex6.substr( 0, 2 ), 16 ), g: parseInt( hex6.substr( 2, 2 ), 16 ), b: parseInt( hex6.substr( 4, 2 ), 16 ) }; } var rgb = color.match( /^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i ); if( rgb ) { return { r: parseInt( rgb[1], 10 ), g: parseInt( rgb[2], 10 ), b: parseInt( rgb[3], 10 ) }; } var rgba = color.match( /^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\,\s*([\d]+|[\d]*.[\d]+)\s*\)$/i ); if( rgba ) { return { r: parseInt( rgba[1], 10 ), g: parseInt( rgba[2], 10 ), b: parseInt( rgba[3], 10 ), a: parseFloat( rgba[4] ) }; } return null; } /** * Calculates brightness on a scale of 0-255. * * @param color See colorStringToRgb for supported formats. */ function colorBrightness( color ) { if( typeof color === 'string' ) color = colorToRgb( color ); if( color ) { return ( color.r * 299 + color.g * 587 + color.b * 114 ) / 1000; } return null; } /** * Retrieves the height of the given element by looking * at the position and height of its immediate children. */ function getAbsoluteHeight( element ) { var height = 0; if( element ) { var absoluteChildren = 0; toArray( element.childNodes ).forEach( function( child ) { if( typeof child.offsetTop === 'number' && child.style ) { // Count # of abs children if( window.getComputedStyle( child ).position === 'absolute' ) { absoluteChildren += 1; } height = Math.max( height, child.offsetTop + child.offsetHeight ); } } ); // If there are no absolute children, use offsetHeight if( absoluteChildren === 0 ) { height = element.offsetHeight; } } return height; } /** * Returns the remaining height within the parent of the * target element. * * remaining height = [ configured parent height ] - [ current parent height ] */ function getRemainingHeight( element, height ) { height = height || 0; if( element ) { var newHeight, oldHeight = element.style.height; // Change the .stretch element height to 0 in order find the height of all // the other elements element.style.height = '0px'; newHeight = height - element.parentNode.offsetHeight; // Restore the old height, just in case element.style.height = oldHeight + 'px'; return newHeight; } return height; } /** * Checks if this instance is being used to print a PDF. */ function isPrintingPDF() { return ( /print-pdf/gi ).test( window.location.search ); } /** * Hides the address bar if we're on a mobile device. */ function hideAddressBar() { if( config.hideAddressBar && isMobileDevice ) { // Events that should trigger the address bar to hide window.addEventListener( 'load', removeAddressBar, false ); window.addEventListener( 'orientationchange', removeAddressBar, false ); } } /** * Causes the address bar to hide on mobile devices, * more vertical space ftw. */ function removeAddressBar() { setTimeout( function() { window.scrollTo( 0, 1 ); }, 10 ); } /** * Dispatches an event of the specified type from the * reveal DOM element. */ function dispatchEvent( type, args ) { var event = document.createEvent( 'HTMLEvents', 1, 2 ); event.initEvent( type, true, true ); extend( event, args ); dom.wrapper.dispatchEvent( event ); // If we're in an iframe, post each reveal.js event to the // parent window. Used by the notes plugin if( config.postMessageEvents && window.parent !== window.self ) { window.parent.postMessage( JSON.stringify({ namespace: 'reveal', eventName: type, state: getState() }), '*' ); } } /** * Wrap all links in 3D goodness. */ function enableRollingLinks() { if( features.transforms3d && !( 'msPerspective' in document.body.style ) ) { var anchors = dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' a' ); for( var i = 0, len = anchors.length; i < len; i++ ) { var anchor = anchors[i]; if( anchor.textContent && !anchor.querySelector( '*' ) && ( !anchor.className || !anchor.classList.contains( anchor, 'roll' ) ) ) { var span = document.createElement('span'); span.setAttribute('data-title', anchor.text); span.innerHTML = anchor.innerHTML; anchor.classList.add( 'roll' ); anchor.innerHTML = ''; anchor.appendChild(span); } } } } /** * Unwrap all 3D links. */ function disableRollingLinks() { var anchors = dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' a.roll' ); for( var i = 0, len = anchors.length; i < len; i++ ) { var anchor = anchors[i]; var span = anchor.querySelector( 'span' ); if( span ) { anchor.classList.remove( 'roll' ); anchor.innerHTML = span.innerHTML; } } } /** * Bind preview frame links. */ function enablePreviewLinks( selector ) { var anchors = toArray( document.querySelectorAll( selector ? selector : 'a' ) ); anchors.forEach( function( element ) { if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) { element.addEventListener( 'click', onPreviewLinkClicked, false ); } } ); } /** * Unbind preview frame links. */ function disablePreviewLinks() { var anchors = toArray( document.querySelectorAll( 'a' ) ); anchors.forEach( function( element ) { if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) { element.removeEventListener( 'click', onPreviewLinkClicked, false ); } } ); } /** * Opens a preview window for the target URL. */ function showPreview( url ) { closeOverlay(); dom.overlay = document.createElement( 'div' ); dom.overlay.classList.add( 'overlay' ); dom.overlay.classList.add( 'overlay-preview' ); dom.wrapper.appendChild( dom.overlay ); dom.overlay.innerHTML = [ '<header>', '<a class="close" href="#"><span class="icon"></span></a>', '<a class="external" href="'+ url +'" target="_blank"><span class="icon"></span></a>', '</header>', '<div class="spinner"></div>', '<div class="viewport">', '<iframe src="'+ url +'"></iframe>', '</div>' ].join(''); dom.overlay.querySelector( 'iframe' ).addEventListener( 'load', function( event ) { dom.overlay.classList.add( 'loaded' ); }, false ); dom.overlay.querySelector( '.close' ).addEventListener( 'click', function( event ) { closeOverlay(); event.preventDefault(); }, false ); dom.overlay.querySelector( '.external' ).addEventListener( 'click', function( event ) { closeOverlay(); }, false ); setTimeout( function() { dom.overlay.classList.add( 'visible' ); }, 1 ); } /** * Opens a overlay window with help material. */ function showHelp() { if( config.help ) { closeOverlay(); dom.overlay = document.createElement( 'div' ); dom.overlay.classList.add( 'overlay' ); dom.overlay.classList.add( 'overlay-help' ); dom.wrapper.appendChild( dom.overlay ); var html = '<p class="title">Keyboard Shortcuts</p><br/>'; html += '<table><th>KEY</th><th>ACTION</th>'; for( var key in keyboardShortcuts ) { html += '<tr><td>' + key + '</td><td>' + keyboardShortcuts[ key ] + '</td></tr>'; } html += '</table>'; dom.overlay.innerHTML = [ '<header>', '<a class="close" href="#"><span class="icon"></span></a>', '</header>', '<div class="viewport">', '<div class="viewport-inner">'+ html +'</div>', '</div>' ].join(''); dom.overlay.querySelector( '.close' ).addEventListener( 'click', function( event ) { closeOverlay(); event.preventDefault(); }, false ); setTimeout( function() { dom.overlay.classList.add( 'visible' ); }, 1 ); } } /** * Closes any currently open overlay. */ function closeOverlay() { if( dom.overlay ) { dom.overlay.parentNode.removeChild( dom.overlay ); dom.overlay = null; } } /** * Applies JavaScript-controlled layout rules to the * presentation. */ function layout() { if( dom.wrapper && !isPrintingPDF() ) { var size = getComputedSlideSize(); var slidePadding = 20; // TODO Dig this out of DOM // Layout the contents of the slides layoutSlideContents( config.width, config.height, slidePadding ); dom.slides.style.width = size.width + 'px'; dom.slides.style.height = size.height + 'px'; // Determine scale of content to fit within available space scale = Math.min( size.presentationWidth / size.width, size.presentationHeight / size.height ); // Respect max/min scale settings scale = Math.max( scale, config.minScale ); scale = Math.min( scale, config.maxScale ); // Don't apply any scaling styles if scale is 1 if( scale === 1 ) { dom.slides.style.zoom = ''; dom.slides.style.left = ''; dom.slides.style.top = ''; dom.slides.style.bottom = ''; dom.slides.style.right = ''; transformSlides( { layout: '' } ); } else { // Use zoom to scale up in desktop Chrome so that content // remains crisp. We don't use zoom to scale down since that // can lead to shifts in text layout/line breaks. if( scale > 1 && !isMobileDevice && /chrome/i.test( navigator.userAgent ) && typeof dom.slides.style.zoom !== 'undefined' ) { dom.slides.style.zoom = scale; dom.slides.style.left = ''; dom.slides.style.top = ''; dom.slides.style.bottom = ''; dom.slides.style.right = ''; transformSlides( { layout: '' } ); } // Apply scale transform as a fallback else { dom.slides.style.zoom = ''; dom.slides.style.left = '50%'; dom.slides.style.top = '50%'; dom.slides.style.bottom = 'auto'; dom.slides.style.right = 'auto'; transformSlides( { layout: 'translate(-50%, -50%) scale('+ scale +')' } ); } } // Select all slides, vertical and horizontal var slides = toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ); for( var i = 0, len = slides.length; i < len; i++ ) { var slide = slides[ i ]; // Don't bother updating invisible slides if( slide.style.display === 'none' ) { continue; } if( config.center || slide.classList.contains( 'center' ) ) { // Vertical stacks are not centred since their section // children will be if( slide.classList.contains( 'stack' ) ) { slide.style.top = 0; } else { slide.style.top = Math.max( ( ( size.height - getAbsoluteHeight( slide ) ) / 2 ) - slidePadding, 0 ) + 'px'; } } else { slide.style.top = ''; } } updateProgress(); updateParallax(); } } /** * Applies layout logic to the contents of all slides in * the presentation. */ function layoutSlideContents( width, height, padding ) { // Handle sizing of elements with the 'stretch' class toArray( dom.slides.querySelectorAll( 'section > .stretch' ) ).forEach( function( element ) { // Determine how much vertical space we can use var remainingHeight = getRemainingHeight( element, height ); // Consider the aspect ratio of media elements if( /(img|video)/gi.test( element.nodeName ) ) { var nw = element.naturalWidth || element.videoWidth, nh = element.naturalHeight || element.videoHeight; var es = Math.min( width / nw, remainingHeight / nh ); element.style.width = ( nw * es ) + 'px'; element.style.height = ( nh * es ) + 'px'; } else { element.style.width = width + 'px'; element.style.height = remainingHeight + 'px'; } } ); } /** * Calculates the computed pixel size of our slides. These * values are based on the width and height configuration * options. */ function getComputedSlideSize( presentationWidth, presentationHeight ) { var size = { // Slide size width: config.width, height: config.height, // Presentation size presentationWidth: presentationWidth || dom.wrapper.offsetWidth, presentationHeight: presentationHeight || dom.wrapper.offsetHeight }; // Reduce available space by margin size.presentationWidth -= ( size.presentationWidth * config.margin ); size.presentationHeight -= ( size.presentationHeight * config.margin ); // Slide width may be a percentage of available width if( typeof size.width === 'string' && /%$/.test( size.width ) ) { size.width = parseInt( size.width, 10 ) / 100 * size.presentationWidth; } // Slide height may be a percentage of available height if( typeof size.height === 'string' && /%$/.test( size.height ) ) { size.height = parseInt( size.height, 10 ) / 100 * size.presentationHeight; } return size; } /** * Stores the vertical index of a stack so that the same * vertical slide can be selected when navigating to and * from the stack. * * @param {HTMLElement} stack The vertical stack element * @param {int} v Index to memorize */ function setPreviousVerticalIndex( stack, v ) { if( typeof stack === 'object' && typeof stack.setAttribute === 'function' ) { stack.setAttribute( 'data-previous-indexv', v || 0 ); } } /** * Retrieves the vertical index which was stored using * #setPreviousVerticalIndex() or 0 if no previous index * exists. * * @param {HTMLElement} stack The vertical stack element */ function getPreviousVerticalIndex( stack ) { if( typeof stack === 'object' && typeof stack.setAttribute === 'function' && stack.classList.contains( 'stack' ) ) { // Prefer manually defined start-indexv var attributeName = stack.hasAttribute( 'data-start-indexv' ) ? 'data-start-indexv' : 'data-previous-indexv'; return parseInt( stack.getAttribute( attributeName ) || 0, 10 ); } return 0; } /** * Displays the overview of slides (quick nav) by scaling * down and arranging all slide elements. */ function activateOverview() { // Only proceed if enabled in config if( config.overview && !isOverview() ) { overview = true; dom.wrapper.classList.add( 'overview' ); dom.wrapper.classList.remove( 'overview-deactivating' ); if( features.overviewTransitions ) { setTimeout( function() { dom.wrapper.classList.add( 'overview-animated' ); }, 1 ); } // Don't auto-slide while in overview mode cancelAutoSlide(); // Move the backgrounds element into the slide container to // that the same scaling is applied dom.slides.appendChild( dom.background ); // Clicking on an overview slide navigates to it toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) { if( !slide.classList.contains( 'stack' ) ) { slide.addEventListener( 'click', onOverviewSlideClicked, true ); } } ); updateSlidesVisibility(); layoutOverview(); updateOverview(); layout(); // Notify observers of the overview showing dispatchEvent( 'overviewshown', { 'indexh': indexh, 'indexv': indexv, 'currentSlide': currentSlide } ); } } /** * Uses CSS transforms to position all slides in a grid for * display inside of the overview mode. */ function layoutOverview() { var margin = 70; var slideWidth = config.width + margin, slideHeight = config.height + margin; // Reverse in RTL mode if( config.rtl ) { slideWidth = -slideWidth; } // Layout slides toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) { hslide.setAttribute( 'data-index-h', h ); transformElement( hslide, 'translate3d(' + ( h * slideWidth ) + 'px, 0, 0)' ); if( hslide.classList.contains( 'stack' ) ) { toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) { vslide.setAttribute( 'data-index-h', h ); vslide.setAttribute( 'data-index-v', v ); transformElement( vslide, 'translate3d(0, ' + ( v * slideHeight ) + 'px, 0)' ); } ); } } ); // Layout slide backgrounds toArray( dom.background.childNodes ).forEach( function( hbackground, h ) { transformElement( hbackground, 'translate3d(' + ( h * slideWidth ) + 'px, 0, 0)' ); toArray( hbackground.querySelectorAll( '.slide-background' ) ).forEach( function( vbackground, v ) { transformElement( vbackground, 'translate3d(0, ' + ( v * slideHeight ) + 'px, 0)' ); } ); } ); } /** * Moves the overview viewport to the current slides. * Called each time the current slide changes. */ function updateOverview() { var margin = 70; var slideWidth = config.width + margin, slideHeight = config.height + margin; // Reverse in RTL mode if( config.rtl ) { slideWidth = -slideWidth; } transformSlides( { overview: [ 'translateX('+ ( -indexh * slideWidth ) +'px)', 'translateY('+ ( -indexv * slideHeight ) +'px)', 'translateZ('+ ( window.innerWidth < 400 ? -1000 : -2500 ) +'px)' ].join( ' ' ) } ); } /** * Exits the slide overview and enters the currently * active slide. */ function deactivateOverview() { // Only proceed if enabled in config if( config.overview ) { overview = false; dom.wrapper.classList.remove( 'overview' ); dom.wrapper.classList.remove( 'overview-animated' ); // Temporarily add a class so that transitions can do different things // depending on whether they are exiting/entering overview, or just // moving from slide to slide dom.wrapper.classList.add( 'overview-deactivating' ); setTimeout( function () { dom.wrapper.classList.remove( 'overview-deactivating' ); }, 1 ); // Move the background element back out dom.wrapper.appendChild( dom.background ); // Clean up changes made to slides toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) { transformElement( slide, '' ); slide.removeEventListener( 'click', onOverviewSlideClicked, true ); } ); // Clean up changes made to backgrounds toArray( dom.background.querySelectorAll( '.slide-background' ) ).forEach( function( background ) { transformElement( background, '' ); } ); transformSlides( { overview: '' } ); slide( indexh, indexv ); layout(); cueAutoSlide(); // Notify observers of the overview hiding dispatchEvent( 'overviewhidden', { 'indexh': indexh, 'indexv': indexv, 'currentSlide': currentSlide } ); } } /** * Toggles the slide overview mode on and off. * * @param {Boolean} override Optional flag which overrides the * toggle logic and forcibly sets the desired state. True means * overview is open, false means it's closed. */ function toggleOverview( override ) { if( typeof override === 'boolean' ) { override ? activateOverview() : deactivateOverview(); } else { isOverview() ? deactivateOverview() : activateOverview(); } } /** * Checks if the overview is currently active. * * @return {Boolean} true if the overview is active, * false otherwise */ function isOverview() { return overview; } /** * Checks if the current or specified slide is vertical * (nested within another slide). * * @param {HTMLElement} slide [optional] The slide to check * orientation of */ function isVerticalSlide( slide ) { // Prefer slide argument, otherwise use current slide slide = slide ? slide : currentSlide; return slide && slide.parentNode && !!slide.parentNode.nodeName.match( /section/i ); } /** * Handling the fullscreen functionality via the fullscreen API * * @see http://fullscreen.spec.whatwg.org/ * @see https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode */ function enterFullscreen() { var element = document.body; // Check which implementation is available var requestMethod = element.requestFullScreen || element.webkitRequestFullscreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullscreen; if( requestMethod ) { requestMethod.apply( element ); } } /** * Enters the paused mode which fades everything on screen to * black. */ function pause() { if( config.pause ) { var wasPaused = dom.wrapper.classList.contains( 'paused' ); cancelAutoSlide(); dom.wrapper.classList.add( 'paused' ); if( wasPaused === false ) { dispatchEvent( 'paused' ); } } } /** * Exits from the paused mode. */ function resume() { var wasPaused = dom.wrapper.classList.contains( 'paused' ); dom.wrapper.classList.remove( 'paused' ); cueAutoSlide(); if( wasPaused ) { dispatchEvent( 'resumed' ); } } /** * Toggles the paused mode on and off. */ function togglePause( override ) { if( typeof override === 'boolean' ) { override ? pause() : resume(); } else { isPaused() ? resume() : pause(); } } /** * Checks if we are currently in the paused mode. */ function isPaused() { return dom.wrapper.classList.contains( 'paused' ); } /** * Toggles the auto slide mode on and off. * * @param {Boolean} override Optional flag which sets the desired state. * True means autoplay starts, false means it stops. */ function toggleAutoSlide( override ) { if( typeof override === 'boolean' ) { override ? resumeAutoSlide() : pauseAutoSlide(); } else { autoSlidePaused ? resumeAutoSlide() : pauseAutoSlide(); } } /** * Checks if the auto slide mode is currently on. */ function isAutoSliding() { return !!( autoSlide && !autoSlidePaused ); } /** * Steps from the current point in the presentation to the * slide which matches the specified horizontal and vertical * indices. * * @param {int} h Horizontal index of the target slide * @param {int} v Vertical index of the target slide * @param {int} f Optional index of a fragment within the * target slide to activate * @param {int} o Optional origin for use in multimaster environments */ function slide( h, v, f, o ) { // Remember where we were at before previousSlide = currentSlide; // Query all horizontal slides in the deck var horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ); // If no vertical index is specified and the upcoming slide is a // stack, resume at its previous vertical index if( v === undefined && !isOverview() ) { v = getPreviousVerticalIndex( horizontalSlides[ h ] ); } // If we were on a vertical stack, remember what vertical index // it was on so we can resume at the same position when returning if( previousSlide && previousSlide.parentNode && previousSlide.parentNode.classList.contains( 'stack' ) ) { setPreviousVerticalIndex( previousSlide.parentNode, indexv ); } // Remember the state before this slide var stateBefore = state.concat(); // Reset the state array state.length = 0; var indexhBefore = indexh || 0, indexvBefore = indexv || 0; // Activate and transition to the new slide indexh = updateSlides( HORIZONTAL_SLIDES_SELECTOR, h === undefined ? indexh : h ); indexv = updateSlides( VERTICAL_SLIDES_SELECTOR, v === undefined ? indexv : v ); // Update the visibility of slides now that the indices have changed updateSlidesVisibility(); layout(); // Apply the new state stateLoop: for( var i = 0, len = state.length; i < len; i++ ) { // Check if this state existed on the previous slide. If it // did, we will avoid adding it repeatedly for( var j = 0; j < stateBefore.length; j++ ) { if( stateBefore[j] === state[i] ) { stateBefore.splice( j, 1 ); continue stateLoop; } } document.documentElement.classList.add( state[i] ); // Dispatch custom event matching the state's name dispatchEvent( state[i] ); } // Clean up the remains of the previous state while( stateBefore.length ) { document.documentElement.classList.remove( stateBefore.pop() ); } // Update the overview if it's currently active if( isOverview() ) { updateOverview(); } // Find the current horizontal slide and any possible vertical slides // within it var currentHorizontalSlide = horizontalSlides[ indexh ], currentVerticalSlides = currentHorizontalSlide.querySelectorAll( 'section' ); // Store references to the previous and current slides currentSlide = currentVerticalSlides[ indexv ] || currentHorizontalSlide; // Show fragment, if specified if( typeof f !== 'undefined' ) { navigateFragment( f ); } // Dispatch an event if the slide changed var slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore ); if( slideChanged ) { dispatchEvent( 'slidechanged', { 'indexh': indexh, 'indexv': indexv, 'previousSlide': previousSlide, 'currentSlide': currentSlide, 'origin': o } ); } else { // Ensure that the previous slide is never the same as the current previousSlide = null; } // Solves an edge case where the previous slide maintains the // 'present' class when navigating between adjacent vertical // stacks if( previousSlide ) { previousSlide.classList.remove( 'present' ); previousSlide.setAttribute( 'aria-hidden', 'true' ); // Reset all slides upon navigate to home // Issue: #285 if ( dom.wrapper.querySelector( HOME_SLIDE_SELECTOR ).classList.contains( 'present' ) ) { // Launch async task setTimeout( function () { var slides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.stack') ), i; for( i in slides ) { if( slides[i] ) { // Reset stack setPreviousVerticalIndex( slides[i], 0 ); } } }, 0 ); } } // Handle embedded content if( slideChanged || !previousSlide ) { stopEmbeddedContent( previousSlide ); startEmbeddedContent( currentSlide ); } // Announce the current slide contents, for screen readers dom.statusDiv.textContent = currentSlide.textContent; updateControls(); updateProgress(); updateBackground(); updateParallax(); updateSlideNumber(); updateNotes(); // Update the URL hash writeURL(); cueAutoSlide(); } /** * Syncs the presentation with the current DOM. Useful * when new slides or control elements are added or when * the configuration has changed. */ function sync() { // Subscribe to input removeEventListeners(); addEventListeners(); // Force a layout to make sure the current config is accounted for layout(); // Reflect the current autoSlide value autoSlide = config.autoSlide; // Start auto-sliding if it's enabled cueAutoSlide(); // Re-create the slide backgrounds createBackgrounds(); // Write the current hash to the URL writeURL(); sortAllFragments(); updateControls(); updateProgress(); updateBackground( true ); updateSlideNumber(); updateSlidesVisibility(); updateNotes(); formatEmbeddedContent(); startEmbeddedContent( currentSlide ); if( isOverview() ) { layoutOverview(); } } /** * Resets all vertical slides so that only the first * is visible. */ function resetVerticalSlides() { var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); horizontalSlides.forEach( function( horizontalSlide ) { var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ); verticalSlides.forEach( function( verticalSlide, y ) { if( y > 0 ) { verticalSlide.classList.remove( 'present' ); verticalSlide.classList.remove( 'past' ); verticalSlide.classList.add( 'future' ); verticalSlide.setAttribute( 'aria-hidden', 'true' ); } } ); } ); } /** * Sorts and formats all of fragments in the * presentation. */ function sortAllFragments() { var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); horizontalSlides.forEach( function( horizontalSlide ) { var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ); verticalSlides.forEach( function( verticalSlide, y ) { sortFragments( verticalSlide.querySelectorAll( '.fragment' ) ); } ); if( verticalSlides.length === 0 ) sortFragments( horizontalSlide.querySelectorAll( '.fragment' ) ); } ); } /** * Updates one dimension of slides by showing the slide * with the specified index. * * @param {String} selector A CSS selector that will fetch * the group of slides we are working with * @param {Number} index The index of the slide that should be * shown * * @return {Number} The index of the slide that is now shown, * might differ from the passed in index if it was out of * bounds. */ function updateSlides( selector, index ) { // Select all slides and convert the NodeList result to // an array var slides = toArray( dom.wrapper.querySelectorAll( selector ) ), slidesLength = slides.length; var printMode = isPrintingPDF(); if( slidesLength ) { // Should the index loop? if( config.loop ) { index %= slidesLength; if( index < 0 ) { index = slidesLength + index; } } // Enforce max and minimum index bounds index = Math.max( Math.min( index, slidesLength - 1 ), 0 ); for( var i = 0; i < slidesLength; i++ ) { var element = slides[i]; var reverse = config.rtl && !isVerticalSlide( element ); element.classList.remove( 'past' ); element.classList.remove( 'present' ); element.classList.remove( 'future' ); // http://www.w3.org/html/wg/drafts/html/master/editing.html#the-hidden-attribute element.setAttribute( 'hidden', '' ); element.setAttribute( 'aria-hidden', 'true' ); // If this element contains vertical slides if( element.querySelector( 'section' ) ) { element.classList.add( 'stack' ); } // If we're printing static slides, all slides are "present" if( printMode ) { element.classList.add( 'present' ); continue; } if( i < index ) { // Any element previous to index is given the 'past' class element.classList.add( reverse ? 'future' : 'past' ); if( config.fragments ) { var pastFragments = toArray( element.querySelectorAll( '.fragment' ) ); // Show all fragments on prior slides while( pastFragments.length ) { var pastFragment = pastFragments.pop(); pastFragment.classList.add( 'visible' ); pastFragment.classList.remove( 'current-fragment' ); } } } else if( i > index ) { // Any element subsequent to index is given the 'future' class element.classList.add( reverse ? 'past' : 'future' ); if( config.fragments ) { var futureFragments = toArray( element.querySelectorAll( '.fragment.visible' ) ); // No fragments in future slides should be visible ahead of time while( futureFragments.length ) { var futureFragment = futureFragments.pop(); futureFragment.classList.remove( 'visible' ); futureFragment.classList.remove( 'current-fragment' ); } } } } // Mark the current slide as present slides[index].classList.add( 'present' ); slides[index].removeAttribute( 'hidden' ); slides[index].removeAttribute( 'aria-hidden' ); // If this slide has a state associated with it, add it // onto the current state of the deck var slideState = slides[index].getAttribute( 'data-state' ); if( slideState ) { state = state.concat( slideState.split( ' ' ) ); } } else { // Since there are no slides we can't be anywhere beyond the // zeroth index index = 0; } return index; } /** * Optimization method; hide all slides that are far away * from the present slide. */ function updateSlidesVisibility() { // Select all slides and convert the NodeList result to // an array var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ), horizontalSlidesLength = horizontalSlides.length, distanceX, distanceY; if( horizontalSlidesLength && typeof indexh !== 'undefined' ) { // The number of steps away from the present slide that will // be visible var viewDistance = isOverview() ? 10 : config.viewDistance; // Limit view distance on weaker devices if( isMobileDevice ) { viewDistance = isOverview() ? 6 : 2; } // All slides need to be visible when exporting to PDF if( isPrintingPDF() ) { viewDistance = Number.MAX_VALUE; } for( var x = 0; x < horizontalSlidesLength; x++ ) { var horizontalSlide = horizontalSlides[x]; var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ), verticalSlidesLength = verticalSlides.length; // Determine how far away this slide is from the present distanceX = Math.abs( ( indexh || 0 ) - x ) || 0; // If the presentation is looped, distance should measure // 1 between the first and last slides if( config.loop ) { distanceX = Math.abs( ( ( indexh || 0 ) - x ) % ( horizontalSlidesLength - viewDistance ) ) || 0; } // Show the horizontal slide if it's within the view distance if( distanceX < viewDistance ) { showSlide( horizontalSlide ); } else { hideSlide( horizontalSlide ); } if( verticalSlidesLength ) { var oy = getPreviousVerticalIndex( horizontalSlide ); for( var y = 0; y < verticalSlidesLength; y++ ) { var verticalSlide = verticalSlides[y]; distanceY = x === ( indexh || 0 ) ? Math.abs( ( indexv || 0 ) - y ) : Math.abs( y - oy ); if( distanceX + distanceY < viewDistance ) { showSlide( verticalSlide ); } else { hideSlide( verticalSlide ); } } } } } } /** * Pick up notes from the current slide and display tham * to the viewer. * * @see `showNotes` config value */ function updateNotes() { if( config.showNotes && dom.speakerNotes && currentSlide && !isPrintingPDF() ) { dom.speakerNotes.innerHTML = getSlideNotes() || ''; } } /** * Updates the progress bar to reflect the current slide. */ function updateProgress() { // Update progress if enabled if( config.progress && dom.progressbar ) { dom.progressbar.style.width = getProgress() * dom.wrapper.offsetWidth + 'px'; } } /** * Updates the slide number div to reflect the current slide. * * The following slide number formats are available: * "h.v": horizontal . vertical slide number (default) * "h/v": horizontal / vertical slide number * "c": flattened slide number * "c/t": flattened slide number / total slides */ function updateSlideNumber() { // Update slide number if enabled if( config.slideNumber && dom.slideNumber ) { var value = []; var format = 'h.v'; // Check if a custom number format is available if( typeof config.slideNumber === 'string' ) { format = config.slideNumber; } switch( format ) { case 'c': value.push( getSlidePastCount() + 1 ); break; case 'c/t': value.push( getSlidePastCount() + 1, '/', getTotalSlides() ); break; case 'h/v': value.push( indexh + 1 ); if( isVerticalSlide() ) value.push( '/', indexv + 1 ); break; default: value.push( indexh + 1 ); if( isVerticalSlide() ) value.push( '.', indexv + 1 ); } dom.slideNumber.innerHTML = formatSlideNumber( value[0], value[1], value[2] ); } } /** * Applies HTML formatting to a slide number before it's * written to the DOM. */ function formatSlideNumber( a, delimiter, b ) { if( typeof b === 'number' && !isNaN( b ) ) { return '<span class="slide-number-a">'+ a +'</span>' + '<span class="slide-number-delimiter">'+ delimiter +'</span>' + '<span class="slide-number-b">'+ b +'</span>'; } else { return '<span class="slide-number-a">'+ a +'</span>'; } } /** * Updates the state of all control/navigation arrows. */ function updateControls() { var routes = availableRoutes(); var fragments = availableFragments(); // Remove the 'enabled' class from all directions dom.controlsLeft.concat( dom.controlsRight ) .concat( dom.controlsUp ) .concat( dom.controlsDown ) .concat( dom.controlsPrev ) .concat( dom.controlsNext ).forEach( function( node ) { node.classList.remove( 'enabled' ); node.classList.remove( 'fragmented' ); } ); // Add the 'enabled' class to the available routes if( routes.left ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.right ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.up ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.down ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'enabled' ); } ); // Prev/next buttons if( routes.left || routes.up ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.right || routes.down ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'enabled' ); } ); // Highlight fragment directions if( currentSlide ) { // Always apply fragment decorator to prev/next buttons if( fragments.prev ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); if( fragments.next ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); // Apply fragment decorators to directional buttons based on // what slide axis they are in if( isVerticalSlide( currentSlide ) ) { if( fragments.prev ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); if( fragments.next ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); } else { if( fragments.prev ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); if( fragments.next ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); } } } /** * Updates the background elements to reflect the current * slide. * * @param {Boolean} includeAll If true, the backgrounds of * all vertical slides (not just the present) will be updated. */ function updateBackground( includeAll ) { var currentBackground = null; // Reverse past/future classes when in RTL mode var horizontalPast = config.rtl ? 'future' : 'past', horizontalFuture = config.rtl ? 'past' : 'future'; // Update the classes of all backgrounds to match the // states of their slides (past/present/future) toArray( dom.background.childNodes ).forEach( function( backgroundh, h ) { backgroundh.classList.remove( 'past' ); backgroundh.classList.remove( 'present' ); backgroundh.classList.remove( 'future' ); if( h < indexh ) { backgroundh.classList.add( horizontalPast ); } else if ( h > indexh ) { backgroundh.classList.add( horizontalFuture ); } else { backgroundh.classList.add( 'present' ); // Store a reference to the current background element currentBackground = backgroundh; } if( includeAll || h === indexh ) { toArray( backgroundh.querySelectorAll( '.slide-background' ) ).forEach( function( backgroundv, v ) { backgroundv.classList.remove( 'past' ); backgroundv.classList.remove( 'present' ); backgroundv.classList.remove( 'future' ); if( v < indexv ) { backgroundv.classList.add( 'past' ); } else if ( v > indexv ) { backgroundv.classList.add( 'future' ); } else { backgroundv.classList.add( 'present' ); // Only if this is the present horizontal and vertical slide if( h === indexh ) currentBackground = backgroundv; } } ); } } ); // Stop any currently playing video background if( previousBackground ) { var previousVideo = previousBackground.querySelector( 'video' ); if( previousVideo ) previousVideo.pause(); } if( currentBackground ) { // Start video playback var currentVideo = currentBackground.querySelector( 'video' ); if( currentVideo ) { if( currentVideo.currentTime > 0 ) currentVideo.currentTime = 0; currentVideo.play(); } var backgroundImageURL = currentBackground.style.backgroundImage || ''; // Restart GIFs (doesn't work in Firefox) if( /\.gif/i.test( backgroundImageURL ) ) { currentBackground.style.backgroundImage = ''; window.getComputedStyle( currentBackground ).opacity; currentBackground.style.backgroundImage = backgroundImageURL; } // Don't transition between identical backgrounds. This // prevents unwanted flicker. var previousBackgroundHash = previousBackground ? previousBackground.getAttribute( 'data-background-hash' ) : null; var currentBackgroundHash = currentBackground.getAttribute( 'data-background-hash' ); if( currentBackgroundHash && currentBackgroundHash === previousBackgroundHash && currentBackground !== previousBackground ) { dom.background.classList.add( 'no-transition' ); } previousBackground = currentBackground; } // If there's a background brightness flag for this slide, // bubble it to the .reveal container if( currentSlide ) { [ 'has-light-background', 'has-dark-background' ].forEach( function( classToBubble ) { if( currentSlide.classList.contains( classToBubble ) ) { dom.wrapper.classList.add( classToBubble ); } else { dom.wrapper.classList.remove( classToBubble ); } } ); } // Allow the first background to apply without transition setTimeout( function() { dom.background.classList.remove( 'no-transition' ); }, 1 ); } /** * Updates the position of the parallax background based * on the current slide index. */ function updateParallax() { if( config.parallaxBackgroundImage ) { var horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ), verticalSlides = dom.wrapper.querySelectorAll( VERTICAL_SLIDES_SELECTOR ); var backgroundSize = dom.background.style.backgroundSize.split( ' ' ), backgroundWidth, backgroundHeight; if( backgroundSize.length === 1 ) { backgroundWidth = backgroundHeight = parseInt( backgroundSize[0], 10 ); } else { backgroundWidth = parseInt( backgroundSize[0], 10 ); backgroundHeight = parseInt( backgroundSize[1], 10 ); } var slideWidth = dom.background.offsetWidth, horizontalSlideCount = horizontalSlides.length, horizontalOffsetMultiplier, horizontalOffset; if( typeof config.parallaxBackgroundHorizontal === 'number' ) { horizontalOffsetMultiplier = config.parallaxBackgroundHorizontal; } else { horizontalOffsetMultiplier = ( backgroundWidth - slideWidth ) / ( horizontalSlideCount-1 ); } horizontalOffset = horizontalOffsetMultiplier * indexh * -1; var slideHeight = dom.background.offsetHeight, verticalSlideCount = verticalSlides.length, verticalOffsetMultiplier, verticalOffset; if( typeof config.parallaxBackgroundVertical === 'number' ) { verticalOffsetMultiplier = config.parallaxBackgroundVertical; } else { verticalOffsetMultiplier = ( backgroundHeight - slideHeight ) / ( verticalSlideCount-1 ); } verticalOffset = verticalSlideCount > 0 ? verticalOffsetMultiplier * indexv * 1 : 0; dom.background.style.backgroundPosition = horizontalOffset + 'px ' + -verticalOffset + 'px'; } } /** * Called when the given slide is within the configured view * distance. Shows the slide element and loads any content * that is set to load lazily (data-src). */ function showSlide( slide ) { // Show the slide element slide.style.display = 'block'; // Media elements with data-src attributes toArray( slide.querySelectorAll( 'img[data-src], video[data-src], audio[data-src]' ) ).forEach( function( element ) { element.setAttribute( 'src', element.getAttribute( 'data-src' ) ); element.removeAttribute( 'data-src' ); } ); // Media elements with <source> children toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( media ) { var sources = 0; toArray( media.querySelectorAll( 'source[data-src]' ) ).forEach( function( source ) { source.setAttribute( 'src', source.getAttribute( 'data-src' ) ); source.removeAttribute( 'data-src' ); sources += 1; } ); // If we rewrote sources for this video/audio element, we need // to manually tell it to load from its new origin if( sources > 0 ) { media.load(); } } ); // Show the corresponding background element var indices = getIndices( slide ); var background = getSlideBackground( indices.h, indices.v ); if( background ) { background.style.display = 'block'; // If the background contains media, load it if( background.hasAttribute( 'data-loaded' ) === false ) { background.setAttribute( 'data-loaded', 'true' ); var backgroundImage = slide.getAttribute( 'data-background-image' ), backgroundVideo = slide.getAttribute( 'data-background-video' ), backgroundVideoLoop = slide.hasAttribute( 'data-background-video-loop' ), backgroundIframe = slide.getAttribute( 'data-background-iframe' ); // Images if( backgroundImage ) { background.style.backgroundImage = 'url('+ backgroundImage +')'; } // Videos else if ( backgroundVideo && !isSpeakerNotes() ) { var video = document.createElement( 'video' ); if( backgroundVideoLoop ) { video.setAttribute( 'loop', '' ); } // Support comma separated lists of video sources backgroundVideo.split( ',' ).forEach( function( source ) { video.innerHTML += '<source src="'+ source +'">'; } ); background.appendChild( video ); } // Iframes else if( backgroundIframe ) { var iframe = document.createElement( 'iframe' ); iframe.setAttribute( 'src', backgroundIframe ); iframe.style.width = '100%'; iframe.style.height = '100%'; iframe.style.maxHeight = '100%'; iframe.style.maxWidth = '100%'; background.appendChild( iframe ); } } } } /** * Called when the given slide is moved outside of the * configured view distance. */ function hideSlide( slide ) { // Hide the slide element slide.style.display = 'none'; // Hide the corresponding background element var indices = getIndices( slide ); var background = getSlideBackground( indices.h, indices.v ); if( background ) { background.style.display = 'none'; } } /** * Determine what available routes there are for navigation. * * @return {Object} containing four booleans: left/right/up/down */ function availableRoutes() { var horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ), verticalSlides = dom.wrapper.querySelectorAll( VERTICAL_SLIDES_SELECTOR ); var routes = { left: indexh > 0 || config.loop, right: indexh < horizontalSlides.length - 1 || config.loop, up: indexv > 0, down: indexv < verticalSlides.length - 1 }; // reverse horizontal controls for rtl if( config.rtl ) { var left = routes.left; routes.left = routes.right; routes.right = left; } return routes; } /** * Returns an object describing the available fragment * directions. * * @return {Object} two boolean properties: prev/next */ function availableFragments() { if( currentSlide && config.fragments ) { var fragments = currentSlide.querySelectorAll( '.fragment' ); var hiddenFragments = currentSlide.querySelectorAll( '.fragment:not(.visible)' ); return { prev: fragments.length - hiddenFragments.length > 0, next: !!hiddenFragments.length }; } else { return { prev: false, next: false }; } } /** * Enforces origin-specific format rules for embedded media. */ function formatEmbeddedContent() { var _appendParamToIframeSource = function( sourceAttribute, sourceURL, param ) { toArray( dom.slides.querySelectorAll( 'iframe['+ sourceAttribute +'*="'+ sourceURL +'"]' ) ).forEach( function( el ) { var src = el.getAttribute( sourceAttribute ); if( src && src.indexOf( param ) === -1 ) { el.setAttribute( sourceAttribute, src + ( !/\?/.test( src ) ? '?' : '&' ) + param ); } }); }; // YouTube frames must include "?enablejsapi=1" _appendParamToIframeSource( 'src', 'youtube.com/embed/', 'enablejsapi=1' ); _appendParamToIframeSource( 'data-src', 'youtube.com/embed/', 'enablejsapi=1' ); // Vimeo frames must include "?api=1" _appendParamToIframeSource( 'src', 'player.vimeo.com/', 'api=1' ); _appendParamToIframeSource( 'data-src', 'player.vimeo.com/', 'api=1' ); } /** * Start playback of any embedded content inside of * the targeted slide. */ function startEmbeddedContent( slide ) { if( slide && !isSpeakerNotes() ) { // Restart GIFs toArray( slide.querySelectorAll( 'img[src$=".gif"]' ) ).forEach( function( el ) { // Setting the same unchanged source like this was confirmed // to work in Chrome, FF & Safari el.setAttribute( 'src', el.getAttribute( 'src' ) ); } ); // HTML5 media elements toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { if( el.hasAttribute( 'data-autoplay' ) && typeof el.play === 'function' ) { el.play(); } } ); // Normal iframes toArray( slide.querySelectorAll( 'iframe[src]' ) ).forEach( function( el ) { startEmbeddedIframe( { target: el } ); } ); // Lazy loading iframes toArray( slide.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) { if( el.getAttribute( 'src' ) !== el.getAttribute( 'data-src' ) ) { el.removeEventListener( 'load', startEmbeddedIframe ); // remove first to avoid dupes el.addEventListener( 'load', startEmbeddedIframe ); el.setAttribute( 'src', el.getAttribute( 'data-src' ) ); } } ); } } /** * "Starts" the content of an embedded iframe using the * postmessage API. */ function startEmbeddedIframe( event ) { var iframe = event.target; // YouTube postMessage API if( /youtube\.com\/embed\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) { iframe.contentWindow.postMessage( '{"event":"command","func":"playVideo","args":""}', '*' ); } // Vimeo postMessage API else if( /player\.vimeo\.com\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) { iframe.contentWindow.postMessage( '{"method":"play"}', '*' ); } // Generic postMessage API else { iframe.contentWindow.postMessage( 'slide:start', '*' ); } } /** * Stop playback of any embedded content inside of * the targeted slide. */ function stopEmbeddedContent( slide ) { if( slide && slide.parentNode ) { // HTML5 media elements toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { if( !el.hasAttribute( 'data-ignore' ) && typeof el.pause === 'function' ) { el.pause(); } } ); // Generic postMessage API for non-lazy loaded iframes toArray( slide.querySelectorAll( 'iframe' ) ).forEach( function( el ) { el.contentWindow.postMessage( 'slide:stop', '*' ); el.removeEventListener( 'load', startEmbeddedIframe ); }); // YouTube postMessage API toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) { if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) { el.contentWindow.postMessage( '{"event":"command","func":"pauseVideo","args":""}', '*' ); } }); // Vimeo postMessage API toArray( slide.querySelectorAll( 'iframe[src*="player.vimeo.com/"]' ) ).forEach( function( el ) { if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) { el.contentWindow.postMessage( '{"method":"pause"}', '*' ); } }); // Lazy loading iframes toArray( slide.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) { // Only removing the src doesn't actually unload the frame // in all browsers (Firefox) so we set it to blank first el.setAttribute( 'src', 'about:blank' ); el.removeAttribute( 'src' ); } ); } } /** * Returns the number of past slides. This can be used as a global * flattened index for slides. */ function getSlidePastCount() { var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); // The number of past slides var pastCount = 0; // Step through all slides and count the past ones mainLoop: for( var i = 0; i < horizontalSlides.length; i++ ) { var horizontalSlide = horizontalSlides[i]; var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ); for( var j = 0; j < verticalSlides.length; j++ ) { // Stop as soon as we arrive at the present if( verticalSlides[j].classList.contains( 'present' ) ) { break mainLoop; } pastCount++; } // Stop as soon as we arrive at the present if( horizontalSlide.classList.contains( 'present' ) ) { break; } // Don't count the wrapping section for vertical slides if( horizontalSlide.classList.contains( 'stack' ) === false ) { pastCount++; } } return pastCount; } /** * Returns a value ranging from 0-1 that represents * how far into the presentation we have navigated. */ function getProgress() { // The number of past and total slides var totalCount = getTotalSlides(); var pastCount = getSlidePastCount(); if( currentSlide ) { var allFragments = currentSlide.querySelectorAll( '.fragment' ); // If there are fragments in the current slide those should be // accounted for in the progress. if( allFragments.length > 0 ) { var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' ); // This value represents how big a portion of the slide progress // that is made up by its fragments (0-1) var fragmentWeight = 0.9; // Add fragment progress to the past slide count pastCount += ( visibleFragments.length / allFragments.length ) * fragmentWeight; } } return pastCount / ( totalCount - 1 ); } /** * Checks if this presentation is running inside of the * speaker notes window. */ function isSpeakerNotes() { return !!window.location.search.match( /receiver/gi ); } /** * Reads the current URL (hash) and navigates accordingly. */ function readURL() { var hash = window.location.hash; // Attempt to parse the hash as either an index or name var bits = hash.slice( 2 ).split( '/' ), name = hash.replace( /#|\//gi, '' ); // If the first bit is invalid and there is a name we can // assume that this is a named link if( isNaN( parseInt( bits[0], 10 ) ) && name.length ) { var element; // Ensure the named link is a valid HTML ID attribute if( /^[a-zA-Z][\w:.-]*$/.test( name ) ) { // Find the slide with the specified ID element = document.getElementById( name ); } if( element ) { // Find the position of the named slide and navigate to it var indices = Reveal.getIndices( element ); slide( indices.h, indices.v ); } // If the slide doesn't exist, navigate to the current slide else { slide( indexh || 0, indexv || 0 ); } } else { // Read the index components of the hash var h = parseInt( bits[0], 10 ) || 0, v = parseInt( bits[1], 10 ) || 0; if( h !== indexh || v !== indexv ) { slide( h, v ); } } } /** * Updates the page URL (hash) to reflect the current * state. * * @param {Number} delay The time in ms to wait before * writing the hash */ function writeURL( delay ) { if( config.history ) { // Make sure there's never more than one timeout running clearTimeout( writeURLTimeout ); // If a delay is specified, timeout this call if( typeof delay === 'number' ) { writeURLTimeout = setTimeout( writeURL, delay ); } else if( currentSlide ) { var url = '/'; // Attempt to create a named link based on the slide's ID var id = currentSlide.getAttribute( 'id' ); if( id ) { id = id.replace( /[^a-zA-Z0-9\-\_\:\.]/g, '' ); } // If the current slide has an ID, use that as a named link if( typeof id === 'string' && id.length ) { url = '/' + id; } // Otherwise use the /h/v index else { if( indexh > 0 || indexv > 0 ) url += indexh; if( indexv > 0 ) url += '/' + indexv; } window.location.hash = url; } } } /** * Retrieves the h/v location of the current, or specified, * slide. * * @param {HTMLElement} slide If specified, the returned * index will be for this slide rather than the currently * active one * * @return {Object} { h: <int>, v: <int>, f: <int> } */ function getIndices( slide ) { // By default, return the current indices var h = indexh, v = indexv, f; // If a slide is specified, return the indices of that slide if( slide ) { var isVertical = isVerticalSlide( slide ); var slideh = isVertical ? slide.parentNode : slide; // Select all horizontal slides var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); // Now that we know which the horizontal slide is, get its index h = Math.max( horizontalSlides.indexOf( slideh ), 0 ); // Assume we're not vertical v = undefined; // If this is a vertical slide, grab the vertical index if( isVertical ) { v = Math.max( toArray( slide.parentNode.querySelectorAll( 'section' ) ).indexOf( slide ), 0 ); } } if( !slide && currentSlide ) { var hasFragments = currentSlide.querySelectorAll( '.fragment' ).length > 0; if( hasFragments ) { var currentFragment = currentSlide.querySelector( '.current-fragment' ); if( currentFragment && currentFragment.hasAttribute( 'data-fragment-index' ) ) { f = parseInt( currentFragment.getAttribute( 'data-fragment-index' ), 10 ); } else { f = currentSlide.querySelectorAll( '.fragment.visible' ).length - 1; } } } return { h: h, v: v, f: f }; } /** * Retrieves the total number of slides in this presentation. */ function getTotalSlides() { return dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' ).length; } /** * Returns the slide element matching the specified index. */ function getSlide( x, y ) { var horizontalSlide = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR )[ x ]; var verticalSlides = horizontalSlide && horizontalSlide.querySelectorAll( 'section' ); if( verticalSlides && verticalSlides.length && typeof y === 'number' ) { return verticalSlides ? verticalSlides[ y ] : undefined; } return horizontalSlide; } /** * Returns the background element for the given slide. * All slides, even the ones with no background properties * defined, have a background element so as long as the * index is valid an element will be returned. */ function getSlideBackground( x, y ) { // When printing to PDF the slide backgrounds are nested // inside of the slides if( isPrintingPDF() ) { var slide = getSlide( x, y ); if( slide ) { var background = slide.querySelector( '.slide-background' ); if( background && background.parentNode === slide ) { return background; } } return undefined; } var horizontalBackground = dom.wrapper.querySelectorAll( '.backgrounds>.slide-background' )[ x ]; var verticalBackgrounds = horizontalBackground && horizontalBackground.querySelectorAll( '.slide-background' ); if( verticalBackgrounds && verticalBackgrounds.length && typeof y === 'number' ) { return verticalBackgrounds ? verticalBackgrounds[ y ] : undefined; } return horizontalBackground; } /** * Retrieves the speaker notes from a slide. Notes can be * defined in two ways: * 1. As a data-notes attribute on the slide <section> * 2. As an <aside class="notes"> inside of the slide */ function getSlideNotes( slide ) { // Default to the current slide slide = slide || currentSlide; // Notes can be specified via the data-notes attribute... if( slide.hasAttribute( 'data-notes' ) ) { return slide.getAttribute( 'data-notes' ); } // ... or using an <aside class="notes"> element var notesElement = slide.querySelector( 'aside.notes' ); if( notesElement ) { return notesElement.innerHTML; } return null; } /** * Retrieves the current state of the presentation as * an object. This state can then be restored at any * time. */ function getState() { var indices = getIndices(); return { indexh: indices.h, indexv: indices.v, indexf: indices.f, paused: isPaused(), overview: isOverview() }; } /** * Restores the presentation to the given state. * * @param {Object} state As generated by getState() */ function setState( state ) { if( typeof state === 'object' ) { slide( deserialize( state.indexh ), deserialize( state.indexv ), deserialize( state.indexf ) ); var pausedFlag = deserialize( state.paused ), overviewFlag = deserialize( state.overview ); if( typeof pausedFlag === 'boolean' && pausedFlag !== isPaused() ) { togglePause( pausedFlag ); } if( typeof overviewFlag === 'boolean' && overviewFlag !== isOverview() ) { toggleOverview( overviewFlag ); } } } /** * Return a sorted fragments list, ordered by an increasing * "data-fragment-index" attribute. * * Fragments will be revealed in the order that they are returned by * this function, so you can use the index attributes to control the * order of fragment appearance. * * To maintain a sensible default fragment order, fragments are presumed * to be passed in document order. This function adds a "fragment-index" * attribute to each node if such an attribute is not already present, * and sets that attribute to an integer value which is the position of * the fragment within the fragments list. */ function sortFragments( fragments ) { fragments = toArray( fragments ); var ordered = [], unordered = [], sorted = []; // Group ordered and unordered elements fragments.forEach( function( fragment, i ) { if( fragment.hasAttribute( 'data-fragment-index' ) ) { var index = parseInt( fragment.getAttribute( 'data-fragment-index' ), 10 ); if( !ordered[index] ) { ordered[index] = []; } ordered[index].push( fragment ); } else { unordered.push( [ fragment ] ); } } ); // Append fragments without explicit indices in their // DOM order ordered = ordered.concat( unordered ); // Manually count the index up per group to ensure there // are no gaps var index = 0; // Push all fragments in their sorted order to an array, // this flattens the groups ordered.forEach( function( group ) { group.forEach( function( fragment ) { sorted.push( fragment ); fragment.setAttribute( 'data-fragment-index', index ); } ); index ++; } ); return sorted; } /** * Navigate to the specified slide fragment. * * @param {Number} index The index of the fragment that * should be shown, -1 means all are invisible * @param {Number} offset Integer offset to apply to the * fragment index * * @return {Boolean} true if a change was made in any * fragments visibility as part of this call */ function navigateFragment( index, offset ) { if( currentSlide && config.fragments ) { var fragments = sortFragments( currentSlide.querySelectorAll( '.fragment' ) ); if( fragments.length ) { // If no index is specified, find the current if( typeof index !== 'number' ) { var lastVisibleFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop(); if( lastVisibleFragment ) { index = parseInt( lastVisibleFragment.getAttribute( 'data-fragment-index' ) || 0, 10 ); } else { index = -1; } } // If an offset is specified, apply it to the index if( typeof offset === 'number' ) { index += offset; } var fragmentsShown = [], fragmentsHidden = []; toArray( fragments ).forEach( function( element, i ) { if( element.hasAttribute( 'data-fragment-index' ) ) { i = parseInt( element.getAttribute( 'data-fragment-index' ), 10 ); } // Visible fragments if( i <= index ) { if( !element.classList.contains( 'visible' ) ) fragmentsShown.push( element ); element.classList.add( 'visible' ); element.classList.remove( 'current-fragment' ); // Announce the fragments one by one to the Screen Reader dom.statusDiv.textContent = element.textContent; if( i === index ) { element.classList.add( 'current-fragment' ); } } // Hidden fragments else { if( element.classList.contains( 'visible' ) ) fragmentsHidden.push( element ); element.classList.remove( 'visible' ); element.classList.remove( 'current-fragment' ); } } ); if( fragmentsHidden.length ) { dispatchEvent( 'fragmenthidden', { fragment: fragmentsHidden[0], fragments: fragmentsHidden } ); } if( fragmentsShown.length ) { dispatchEvent( 'fragmentshown', { fragment: fragmentsShown[0], fragments: fragmentsShown } ); } updateControls(); updateProgress(); return !!( fragmentsShown.length || fragmentsHidden.length ); } } return false; } /** * Navigate to the next slide fragment. * * @return {Boolean} true if there was a next fragment, * false otherwise */ function nextFragment() { return navigateFragment( null, 1 ); } /** * Navigate to the previous slide fragment. * * @return {Boolean} true if there was a previous fragment, * false otherwise */ function previousFragment() { return navigateFragment( null, -1 ); } /** * Cues a new automated slide if enabled in the config. */ function cueAutoSlide() { cancelAutoSlide(); if( currentSlide ) { var currentFragment = currentSlide.querySelector( '.current-fragment' ); var fragmentAutoSlide = currentFragment ? currentFragment.getAttribute( 'data-autoslide' ) : null; var parentAutoSlide = currentSlide.parentNode ? currentSlide.parentNode.getAttribute( 'data-autoslide' ) : null; var slideAutoSlide = currentSlide.getAttribute( 'data-autoslide' ); // Pick value in the following priority order: // 1. Current fragment's data-autoslide // 2. Current slide's data-autoslide // 3. Parent slide's data-autoslide // 4. Global autoSlide setting if( fragmentAutoSlide ) { autoSlide = parseInt( fragmentAutoSlide, 10 ); } else if( slideAutoSlide ) { autoSlide = parseInt( slideAutoSlide, 10 ); } else if( parentAutoSlide ) { autoSlide = parseInt( parentAutoSlide, 10 ); } else { autoSlide = config.autoSlide; } // If there are media elements with data-autoplay, // automatically set the autoSlide duration to the // length of that media. Not applicable if the slide // is divided up into fragments. if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) { toArray( currentSlide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { if( el.hasAttribute( 'data-autoplay' ) ) { if( autoSlide && el.duration * 1000 > autoSlide ) { autoSlide = ( el.duration * 1000 ) + 1000; } } } ); } // Cue the next auto-slide if: // - There is an autoSlide value // - Auto-sliding isn't paused by the user // - The presentation isn't paused // - The overview isn't active // - The presentation isn't over if( autoSlide && !autoSlidePaused && !isPaused() && !isOverview() && ( !Reveal.isLastSlide() || availableFragments().next || config.loop === true ) ) { autoSlideTimeout = setTimeout( navigateNext, autoSlide ); autoSlideStartTime = Date.now(); } if( autoSlidePlayer ) { autoSlidePlayer.setPlaying( autoSlideTimeout !== -1 ); } } } /** * Cancels any ongoing request to auto-slide. */ function cancelAutoSlide() { clearTimeout( autoSlideTimeout ); autoSlideTimeout = -1; } function pauseAutoSlide() { if( autoSlide && !autoSlidePaused ) { autoSlidePaused = true; dispatchEvent( 'autoslidepaused' ); clearTimeout( autoSlideTimeout ); if( autoSlidePlayer ) { autoSlidePlayer.setPlaying( false ); } } } function resumeAutoSlide() { if( autoSlide && autoSlidePaused ) { autoSlidePaused = false; dispatchEvent( 'autoslideresumed' ); cueAutoSlide(); } } function navigateLeft() { // Reverse for RTL if( config.rtl ) { if( ( isOverview() || nextFragment() === false ) && availableRoutes().left ) { slide( indexh + 1 ); } } // Normal navigation else if( ( isOverview() || previousFragment() === false ) && availableRoutes().left ) { slide( indexh - 1 ); } } function navigateRight() { // Reverse for RTL if( config.rtl ) { if( ( isOverview() || previousFragment() === false ) && availableRoutes().right ) { slide( indexh - 1 ); } } // Normal navigation else if( ( isOverview() || nextFragment() === false ) && availableRoutes().right ) { slide( indexh + 1 ); } } function navigateUp() { // Prioritize hiding fragments if( ( isOverview() || previousFragment() === false ) && availableRoutes().up ) { slide( indexh, indexv - 1 ); } } function navigateDown() { // Prioritize revealing fragments if( ( isOverview() || nextFragment() === false ) && availableRoutes().down ) { slide( indexh, indexv + 1 ); } } /** * Navigates backwards, prioritized in the following order: * 1) Previous fragment * 2) Previous vertical slide * 3) Previous horizontal slide */ function navigatePrev() { // Prioritize revealing fragments if( previousFragment() === false ) { if( availableRoutes().up ) { navigateUp(); } else { // Fetch the previous horizontal slide, if there is one var previousSlide; if( config.rtl ) { previousSlide = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.future' ) ).pop(); } else { previousSlide = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.past' ) ).pop(); } if( previousSlide ) { var v = ( previousSlide.querySelectorAll( 'section' ).length - 1 ) || undefined; var h = indexh - 1; slide( h, v ); } } } } /** * The reverse of #navigatePrev(). */ function navigateNext() { // Prioritize revealing fragments if( nextFragment() === false ) { if( availableRoutes().down ) { navigateDown(); } else if( config.rtl ) { navigateLeft(); } else { navigateRight(); } } // If auto-sliding is enabled we need to cue up // another timeout cueAutoSlide(); } /** * Checks if the target element prevents the triggering of * swipe navigation. */ function isSwipePrevented( target ) { while( target && typeof target.hasAttribute === 'function' ) { if( target.hasAttribute( 'data-prevent-swipe' ) ) return true; target = target.parentNode; } return false; } // --------------------------------------------------------------------// // ----------------------------- EVENTS -------------------------------// // --------------------------------------------------------------------// /** * Called by all event handlers that are based on user * input. */ function onUserInput( event ) { if( config.autoSlideStoppable ) { pauseAutoSlide(); } } /** * Handler for the document level 'keypress' event. */ function onDocumentKeyPress( event ) { // Check if the pressed key is question mark if( event.shiftKey && event.charCode === 63 ) { if( dom.overlay ) { closeOverlay(); } else { showHelp( true ); } } } /** * Handler for the document level 'keydown' event. */ function onDocumentKeyDown( event ) { // If there's a condition specified and it returns false, // ignore this event if( typeof config.keyboardCondition === 'function' && config.keyboardCondition() === false ) { return true; } // Remember if auto-sliding was paused so we can toggle it var autoSlideWasPaused = autoSlidePaused; onUserInput( event ); // Check if there's a focused element that could be using // the keyboard var activeElementIsCE = document.activeElement && document.activeElement.contentEditable !== 'inherit'; var activeElementIsInput = document.activeElement && document.activeElement.tagName && /input|textarea/i.test( document.activeElement.tagName ); // Disregard the event if there's a focused element or a // keyboard modifier key is present if( activeElementIsCE || activeElementIsInput || (event.shiftKey && event.keyCode !== 32) || event.altKey || event.ctrlKey || event.metaKey ) return; // While paused only allow resume keyboard events; 'b', '.'' var resumeKeyCodes = [66,190,191]; var key; // Custom key bindings for togglePause should be able to resume if( typeof config.keyboard === 'object' ) { for( key in config.keyboard ) { if( config.keyboard[key] === 'togglePause' ) { resumeKeyCodes.push( parseInt( key, 10 ) ); } } } if( isPaused() && resumeKeyCodes.indexOf( event.keyCode ) === -1 ) { return false; } var triggered = false; // 1. User defined key bindings if( typeof config.keyboard === 'object' ) { for( key in config.keyboard ) { // Check if this binding matches the pressed key if( parseInt( key, 10 ) === event.keyCode ) { var value = config.keyboard[ key ]; // Callback function if( typeof value === 'function' ) { value.apply( null, [ event ] ); } // String shortcuts to reveal.js API else if( typeof value === 'string' && typeof Reveal[ value ] === 'function' ) { Reveal[ value ].call(); } triggered = true; } } } // 2. System defined key bindings if( triggered === false ) { // Assume true and try to prove false triggered = true; switch( event.keyCode ) { // p, page up case 80: case 33: navigatePrev(); break; // n, page down case 78: case 34: navigateNext(); break; // h, left case 72: case 37: navigateLeft(); break; // l, right case 76: case 39: navigateRight(); break; // k, up case 75: case 38: navigateUp(); break; // j, down case 74: case 40: navigateDown(); break; // home case 36: slide( 0 ); break; // end case 35: slide( Number.MAX_VALUE ); break; // space case 32: isOverview() ? deactivateOverview() : event.shiftKey ? navigatePrev() : navigateNext(); break; // return case 13: isOverview() ? deactivateOverview() : triggered = false; break; // two-spot, semicolon, b, period, Logitech presenter tools "black screen" button case 58: case 59: case 66: case 190: case 191: togglePause(); break; // f case 70: enterFullscreen(); break; // a case 65: if ( config.autoSlideStoppable ) toggleAutoSlide( autoSlideWasPaused ); break; default: triggered = false; } } // If the input resulted in a triggered action we should prevent // the browsers default behavior if( triggered ) { event.preventDefault && event.preventDefault(); } // ESC or O key else if ( ( event.keyCode === 27 || event.keyCode === 79 ) && features.transforms3d ) { if( dom.overlay ) { closeOverlay(); } else { toggleOverview(); } event.preventDefault && event.preventDefault(); } // If auto-sliding is enabled we need to cue up // another timeout cueAutoSlide(); } /** * Handler for the 'touchstart' event, enables support for * swipe and pinch gestures. */ function onTouchStart( event ) { if( isSwipePrevented( event.target ) ) return true; touch.startX = event.touches[0].clientX; touch.startY = event.touches[0].clientY; touch.startCount = event.touches.length; // If there's two touches we need to memorize the distance // between those two points to detect pinching if( event.touches.length === 2 && config.overview ) { touch.startSpan = distanceBetween( { x: event.touches[1].clientX, y: event.touches[1].clientY }, { x: touch.startX, y: touch.startY } ); } } /** * Handler for the 'touchmove' event. */ function onTouchMove( event ) { if( isSwipePrevented( event.target ) ) return true; // Each touch should only trigger one action if( !touch.captured ) { onUserInput( event ); var currentX = event.touches[0].clientX; var currentY = event.touches[0].clientY; // If the touch started with two points and still has // two active touches; test for the pinch gesture if( event.touches.length === 2 && touch.startCount === 2 && config.overview ) { // The current distance in pixels between the two touch points var currentSpan = distanceBetween( { x: event.touches[1].clientX, y: event.touches[1].clientY }, { x: touch.startX, y: touch.startY } ); // If the span is larger than the desire amount we've got // ourselves a pinch if( Math.abs( touch.startSpan - currentSpan ) > touch.threshold ) { touch.captured = true; if( currentSpan < touch.startSpan ) { activateOverview(); } else { deactivateOverview(); } } event.preventDefault(); } // There was only one touch point, look for a swipe else if( event.touches.length === 1 && touch.startCount !== 2 ) { var deltaX = currentX - touch.startX, deltaY = currentY - touch.startY; if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { touch.captured = true; navigateLeft(); } else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { touch.captured = true; navigateRight(); } else if( deltaY > touch.threshold ) { touch.captured = true; navigateUp(); } else if( deltaY < -touch.threshold ) { touch.captured = true; navigateDown(); } // If we're embedded, only block touch events if they have // triggered an action if( config.embedded ) { if( touch.captured || isVerticalSlide( currentSlide ) ) { event.preventDefault(); } } // Not embedded? Block them all to avoid needless tossing // around of the viewport in iOS else { event.preventDefault(); } } } // There's a bug with swiping on some Android devices unless // the default action is always prevented else if( navigator.userAgent.match( /android/gi ) ) { event.preventDefault(); } } /** * Handler for the 'touchend' event. */ function onTouchEnd( event ) { touch.captured = false; } /** * Convert pointer down to touch start. */ function onPointerDown( event ) { if( event.pointerType === event.MSPOINTER_TYPE_TOUCH || event.pointerType === "touch" ) { event.touches = [{ clientX: event.clientX, clientY: event.clientY }]; onTouchStart( event ); } } /** * Convert pointer move to touch move. */ function onPointerMove( event ) { if( event.pointerType === event.MSPOINTER_TYPE_TOUCH || event.pointerType === "touch" ) { event.touches = [{ clientX: event.clientX, clientY: event.clientY }]; onTouchMove( event ); } } /** * Convert pointer up to touch end. */ function onPointerUp( event ) { if( event.pointerType === event.MSPOINTER_TYPE_TOUCH || event.pointerType === "touch" ) { event.touches = [{ clientX: event.clientX, clientY: event.clientY }]; onTouchEnd( event ); } } /** * Handles mouse wheel scrolling, throttled to avoid skipping * multiple slides. */ function onDocumentMouseScroll( event ) { if( Date.now() - lastMouseWheelStep > 600 ) { lastMouseWheelStep = Date.now(); var delta = event.detail || -event.wheelDelta; if( delta > 0 ) { navigateNext(); } else { navigatePrev(); } } } /** * Clicking on the progress bar results in a navigation to the * closest approximate horizontal slide using this equation: * * ( clickX / presentationWidth ) * numberOfSlides */ function onProgressClicked( event ) { onUserInput( event ); event.preventDefault(); var slidesTotal = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).length; var slideIndex = Math.floor( ( event.clientX / dom.wrapper.offsetWidth ) * slidesTotal ); if( config.rtl ) { slideIndex = slidesTotal - slideIndex; } slide( slideIndex ); } /** * Event handler for navigation control buttons. */ function onNavigateLeftClicked( event ) { event.preventDefault(); onUserInput(); navigateLeft(); } function onNavigateRightClicked( event ) { event.preventDefault(); onUserInput(); navigateRight(); } function onNavigateUpClicked( event ) { event.preventDefault(); onUserInput(); navigateUp(); } function onNavigateDownClicked( event ) { event.preventDefault(); onUserInput(); navigateDown(); } function onNavigatePrevClicked( event ) { event.preventDefault(); onUserInput(); navigatePrev(); } function onNavigateNextClicked( event ) { event.preventDefault(); onUserInput(); navigateNext(); } /** * Handler for the window level 'hashchange' event. */ function onWindowHashChange( event ) { readURL(); } /** * Handler for the window level 'resize' event. */ function onWindowResize( event ) { layout(); } /** * Handle for the window level 'visibilitychange' event. */ function onPageVisibilityChange( event ) { var isHidden = document.webkitHidden || document.msHidden || document.hidden; // If, after clicking a link or similar and we're coming back, // focus the document.body to ensure we can use keyboard shortcuts if( isHidden === false && document.activeElement !== document.body ) { // Not all elements support .blur() - SVGs among them. if( typeof document.activeElement.blur === 'function' ) { document.activeElement.blur(); } document.body.focus(); } } /** * Invoked when a slide is and we're in the overview. */ function onOverviewSlideClicked( event ) { // TODO There's a bug here where the event listeners are not // removed after deactivating the overview. if( eventsAreBound && isOverview() ) { event.preventDefault(); var element = event.target; while( element && !element.nodeName.match( /section/gi ) ) { element = element.parentNode; } if( element && !element.classList.contains( 'disabled' ) ) { deactivateOverview(); if( element.nodeName.match( /section/gi ) ) { var h = parseInt( element.getAttribute( 'data-index-h' ), 10 ), v = parseInt( element.getAttribute( 'data-index-v' ), 10 ); slide( h, v ); } } } } /** * Handles clicks on links that are set to preview in the * iframe overlay. */ function onPreviewLinkClicked( event ) { if( event.currentTarget && event.currentTarget.hasAttribute( 'href' ) ) { var url = event.currentTarget.getAttribute( 'href' ); if( url ) { showPreview( url ); event.preventDefault(); } } } /** * Handles click on the auto-sliding controls element. */ function onAutoSlidePlayerClick( event ) { // Replay if( Reveal.isLastSlide() && config.loop === false ) { slide( 0, 0 ); resumeAutoSlide(); } // Resume else if( autoSlidePaused ) { resumeAutoSlide(); } // Pause else { pauseAutoSlide(); } } // --------------------------------------------------------------------// // ------------------------ PLAYBACK COMPONENT ------------------------// // --------------------------------------------------------------------// /** * Constructor for the playback component, which displays * play/pause/progress controls. * * @param {HTMLElement} container The component will append * itself to this * @param {Function} progressCheck A method which will be * called frequently to get the current progress on a range * of 0-1 */ function Playback( container, progressCheck ) { // Cosmetics this.diameter = 50; this.thickness = 3; // Flags if we are currently playing this.playing = false; // Current progress on a 0-1 range this.progress = 0; // Used to loop the animation smoothly this.progressOffset = 1; this.container = container; this.progressCheck = progressCheck; this.canvas = document.createElement( 'canvas' ); this.canvas.className = 'playback'; this.canvas.width = this.diameter; this.canvas.height = this.diameter; this.context = this.canvas.getContext( '2d' ); this.container.appendChild( this.canvas ); this.render(); } Playback.prototype.setPlaying = function( value ) { var wasPlaying = this.playing; this.playing = value; // Start repainting if we weren't already if( !wasPlaying && this.playing ) { this.animate(); } else { this.render(); } }; Playback.prototype.animate = function() { var progressBefore = this.progress; this.progress = this.progressCheck(); // When we loop, offset the progress so that it eases // smoothly rather than immediately resetting if( progressBefore > 0.8 && this.progress < 0.2 ) { this.progressOffset = this.progress; } this.render(); if( this.playing ) { features.requestAnimationFrameMethod.call( window, this.animate.bind( this ) ); } }; /** * Renders the current progress and playback state. */ Playback.prototype.render = function() { var progress = this.playing ? this.progress : 0, radius = ( this.diameter / 2 ) - this.thickness, x = this.diameter / 2, y = this.diameter / 2, iconSize = 14; // Ease towards 1 this.progressOffset += ( 1 - this.progressOffset ) * 0.1; var endAngle = ( - Math.PI / 2 ) + ( progress * ( Math.PI * 2 ) ); var startAngle = ( - Math.PI / 2 ) + ( this.progressOffset * ( Math.PI * 2 ) ); this.context.save(); this.context.clearRect( 0, 0, this.diameter, this.diameter ); // Solid background color this.context.beginPath(); this.context.arc( x, y, radius + 2, 0, Math.PI * 2, false ); this.context.fillStyle = 'rgba( 0, 0, 0, 0.4 )'; this.context.fill(); // Draw progress track this.context.beginPath(); this.context.arc( x, y, radius, 0, Math.PI * 2, false ); this.context.lineWidth = this.thickness; this.context.strokeStyle = '#666'; this.context.stroke(); if( this.playing ) { // Draw progress on top of track this.context.beginPath(); this.context.arc( x, y, radius, startAngle, endAngle, false ); this.context.lineWidth = this.thickness; this.context.strokeStyle = '#fff'; this.context.stroke(); } this.context.translate( x - ( iconSize / 2 ), y - ( iconSize / 2 ) ); // Draw play/pause icons if( this.playing ) { this.context.fillStyle = '#fff'; this.context.fillRect( 0, 0, iconSize / 2 - 2, iconSize ); this.context.fillRect( iconSize / 2 + 2, 0, iconSize / 2 - 2, iconSize ); } else { this.context.beginPath(); this.context.translate( 2, 0 ); this.context.moveTo( 0, 0 ); this.context.lineTo( iconSize - 2, iconSize / 2 ); this.context.lineTo( 0, iconSize ); this.context.fillStyle = '#fff'; this.context.fill(); } this.context.restore(); }; Playback.prototype.on = function( type, listener ) { this.canvas.addEventListener( type, listener, false ); }; Playback.prototype.off = function( type, listener ) { this.canvas.removeEventListener( type, listener, false ); }; Playback.prototype.destroy = function() { this.playing = false; if( this.canvas.parentNode ) { this.container.removeChild( this.canvas ); } }; // --------------------------------------------------------------------// // ------------------------------- API --------------------------------// // --------------------------------------------------------------------// Reveal = { initialize: initialize, configure: configure, sync: sync, // Navigation methods slide: slide, left: navigateLeft, right: navigateRight, up: navigateUp, down: navigateDown, prev: navigatePrev, next: navigateNext, // Fragment methods navigateFragment: navigateFragment, prevFragment: previousFragment, nextFragment: nextFragment, // Deprecated aliases navigateTo: slide, navigateLeft: navigateLeft, navigateRight: navigateRight, navigateUp: navigateUp, navigateDown: navigateDown, navigatePrev: navigatePrev, navigateNext: navigateNext, // Forces an update in slide layout layout: layout, // Returns an object with the available routes as booleans (left/right/top/bottom) availableRoutes: availableRoutes, // Returns an object with the available fragments as booleans (prev/next) availableFragments: availableFragments, // Toggles the overview mode on/off toggleOverview: toggleOverview, // Toggles the "black screen" mode on/off togglePause: togglePause, // Toggles the auto slide mode on/off toggleAutoSlide: toggleAutoSlide, // State checks isOverview: isOverview, isPaused: isPaused, isAutoSliding: isAutoSliding, // Adds or removes all internal event listeners (such as keyboard) addEventListeners: addEventListeners, removeEventListeners: removeEventListeners, // Facility for persisting and restoring the presentation state getState: getState, setState: setState, // Presentation progress on range of 0-1 getProgress: getProgress, // Returns the indices of the current, or specified, slide getIndices: getIndices, getTotalSlides: getTotalSlides, // Returns the slide element at the specified index getSlide: getSlide, // Returns the slide background element at the specified index getSlideBackground: getSlideBackground, // Returns the speaker notes string for a slide, or null getSlideNotes: getSlideNotes, // Returns the previous slide element, may be null getPreviousSlide: function() { return previousSlide; }, // Returns the current slide element getCurrentSlide: function() { return currentSlide; }, // Returns the current scale of the presentation content getScale: function() { return scale; }, // Returns the current configuration object getConfig: function() { return config; }, // Helper method, retrieves query string as a key/value hash getQueryHash: function() { var query = {}; location.search.replace( /[A-Z0-9]+?=([\w\.%-]*)/gi, function(a) { query[ a.split( '=' ).shift() ] = a.split( '=' ).pop(); } ); // Basic deserialization for( var i in query ) { var value = query[ i ]; query[ i ] = deserialize( unescape( value ) ); } return query; }, // Returns true if we're currently on the first slide isFirstSlide: function() { return ( indexh === 0 && indexv === 0 ); }, // Returns true if we're currently on the last slide isLastSlide: function() { if( currentSlide ) { // Does this slide has next a sibling? if( currentSlide.nextElementSibling ) return false; // If it's vertical, does its parent have a next sibling? if( isVerticalSlide( currentSlide ) && currentSlide.parentNode.nextElementSibling ) return false; return true; } return false; }, // Checks if reveal.js has been loaded and is ready for use isReady: function() { return loaded; }, // Forward event binding to the reveal DOM element addEventListener: function( type, listener, useCapture ) { if( 'addEventListener' in window ) { ( dom.wrapper || document.querySelector( '.reveal' ) ).addEventListener( type, listener, useCapture ); } }, removeEventListener: function( type, listener, useCapture ) { if( 'addEventListener' in window ) { ( dom.wrapper || document.querySelector( '.reveal' ) ).removeEventListener( type, listener, useCapture ); } }, // Programatically triggers a keyboard event triggerKey: function( keyCode ) { onDocumentKeyDown( { keyCode: keyCode } ); } }; return Reveal; }));
!function(e){e.fn.timesequence=function(n){e.extend({length:60},n)}}(jQuery);
import React from 'react'; import PropTypes from 'prop-types'; import _ from 'lodash'; import createReactClass from 'create-react-class'; export default createReactClass({ displayName: 'Spinner', propTypes: { display: PropTypes.func.isRequired, children: PropTypes.node }, getDefaultProps: function() { return { display: function(props) { return true; } } }, getStyles: function() { return { container: { textAlign: 'center', marginTop: '32px', marginBottom: '32px' } } }, render: function () { var styles = this.getStyles(); var display = this.props.display(this.props); var other = _.omit(this.props, ['children', 'display']); if (display) { return ( <div style={styles.container}> Loading... </div> ); } return React.cloneElement(this.props.children, other); } });
/* Copyright (c) 2013 Henry G. Stratmann III Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ function breakpoint(name) { name = (name == undefined || name == null) ? "unnamed" : name.toString(); // This code launches our debugframe.py which communicates with our remote debugger. // You might be wondering why this is a string and why we eval() it. The reason // is simple: In order to allow our debugger access to local variables, we // need to eval() the code rather than call it as a function(). Whatever is eval()'d // will exist in the same scope as the eval() itself. return "(function() {" + "var previousResult = undefined;" + "var CONTINUE_CMD = 'cont';" + "for(;;) {" + "try {" + "var result = UIATarget.localTarget().host().performTaskWithPathArgumentsTimeout('/usr/bin/env', ['python', '/usr/local/bin/debugframe.py', \"'\"+previousResult+\"'\", '" + name + "'], 60 * 10);" + "if (result.exitCode) {" + "UIALogger.logDebug('Debugger error: ' + result.stderr);" + "return;" + "}" + "if (result.stdout == CONTINUE_CMD) {" + "return;" + "}" + "UIATarget.localTarget().pushTimeout(1);" + "var evalResult = eval(result.stdout);" + "UIATarget.localTarget().popTimeout();" + "if (evalResult) {" + "previousResult = evalResult.toString();" + "}" + "else {" + "previousResult = '(null)';" + "}" + "}" + "catch(error) {" + "previousResult = error;" + "}" + "}" + "})()"; }
// @flow import React from 'react' import { render } from 'react-dom' import { BrowserRouter } from 'react-router-dom' import WebFont from 'webfontloader' import App from './App' import registerServiceWorker from './registerServiceWorker' WebFont.load({ google: { families: ['Open Sans', 'Exo:300', 'Cookie'] } }) render( <BrowserRouter> <App /> </BrowserRouter>, document.getElementById('root') ) registerServiceWorker()
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-present Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import React from 'react'; import Layout from '../../components/Layout'; const title = 'User Console'; const isAdmin = true; export default { path: '/console', async action() { if (!isAdmin) { return { redirect: '/login' }; } const Console = await require.ensure([], require => require('./Console').default, 'admin'); return { title, chunk: 'admin', component: <Layout isLoggedIn><Console title={title} /></Layout>, }; }, };
/* eslint-env jest */ import React from 'react' import StatusBar from '../../src/components/status-bar' // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer' it('renders correctly', () => { const tree = renderer.create( <StatusBar /> ).toJSON() expect(tree).toMatchSnapshot() })
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireWildcard(require("react")); var _propTypes = _interopRequireDefault(require("prop-types")); var _dateUtils = require("@wojtekmaj/date-utils"); var _Divider = _interopRequireDefault(require("./Divider")); var _DayInput = _interopRequireDefault(require("./DateInput/DayInput")); var _MonthInput = _interopRequireDefault(require("./DateInput/MonthInput")); var _MonthSelect = _interopRequireDefault(require("./DateInput/MonthSelect")); var _YearInput = _interopRequireDefault(require("./DateInput/YearInput")); var _NativeInput = _interopRequireDefault(require("./DateInput/NativeInput")); var _dateFormatter = require("./shared/dateFormatter"); var _dates = require("./shared/dates"); var _propTypes2 = require("./shared/propTypes"); var _utils = require("./shared/utils"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var defaultMinDate = new Date(); defaultMinDate.setFullYear(1, 0, 1); defaultMinDate.setHours(0, 0, 0, 0); var defaultMaxDate = new Date(8.64e15); var allViews = ['century', 'decade', 'year', 'month']; var allValueTypes = [].concat(_toConsumableArray(allViews.slice(1)), ['day']); function toDate(value) { if (value instanceof Date) { return value; } return new Date(value); } function datesAreDifferent(date1, date2) { return date1 && !date2 || !date1 && date2 || date1 && date2 && date1.getTime() !== date2.getTime(); } /** * Returns value type that can be returned with currently applied settings. */ function getValueType(maxDetail) { return allValueTypes[allViews.indexOf(maxDetail)]; } function getValue(value, index) { if (!value) { return null; } var rawValue = Array.isArray(value) && value.length === 2 ? value[index] : value; if (!rawValue) { return null; } var valueDate = toDate(rawValue); if (isNaN(valueDate.getTime())) { throw new Error("Invalid date: ".concat(value)); } return valueDate; } function getDetailValue(_ref, index) { var value = _ref.value, minDate = _ref.minDate, maxDate = _ref.maxDate, maxDetail = _ref.maxDetail; var valuePiece = getValue(value, index); if (!valuePiece) { return null; } var valueType = getValueType(maxDetail); var detailValueFrom = [_dates.getBegin, _dates.getEnd][index](valueType, valuePiece); return (0, _utils.between)(detailValueFrom, minDate, maxDate); } var getDetailValueFrom = function getDetailValueFrom(args) { return getDetailValue(args, 0); }; var getDetailValueTo = function getDetailValueTo(args) { return getDetailValue(args, 1); }; var getDetailValueArray = function getDetailValueArray(args) { var value = args.value; if (Array.isArray(value)) { return value; } return [getDetailValueFrom, getDetailValueTo].map(function (fn) { return fn(args); }); }; function isInternalInput(element) { return element.getAttribute('data-input') === 'true'; } function findInput(element, property) { var nextElement = element; do { nextElement = nextElement[property]; } while (nextElement && !isInternalInput(nextElement)); return nextElement; } function focus(element) { if (element) { element.focus(); } } function _renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances) { var usedFunctions = []; var pattern = new RegExp(Object.keys(elementFunctions).map(function (el) { return "".concat(el, "+"); }).join('|'), 'g'); var matches = placeholder.match(pattern); return placeholder.split(pattern).reduce(function (arr, element, index) { var divider = element && /*#__PURE__*/ // eslint-disable-next-line react/no-array-index-key _react["default"].createElement(_Divider["default"], { key: "separator_".concat(index) }, element); var res = [].concat(_toConsumableArray(arr), [divider]); var currentMatch = matches && matches[index]; if (currentMatch) { var renderFunction = elementFunctions[currentMatch] || elementFunctions[Object.keys(elementFunctions).find(function (elementFunction) { return currentMatch.match(elementFunction); })]; if (!allowMultipleInstances && usedFunctions.includes(renderFunction)) { res.push(currentMatch); } else { res.push(renderFunction(currentMatch, index)); usedFunctions.push(renderFunction); } } return res; }, []); } var DateInput = /*#__PURE__*/function (_PureComponent) { _inherits(DateInput, _PureComponent); var _super = _createSuper(DateInput); function DateInput() { var _this; _classCallCheck(this, DateInput); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); _defineProperty(_assertThisInitialized(_this), "state", { year: null, month: null, day: null }); _defineProperty(_assertThisInitialized(_this), "onClick", function (event) { if (event.target === event.currentTarget) { // Wrapper was directly clicked var firstInput = event.target.children[1]; focus(firstInput); } }); _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) { switch (event.key) { case 'ArrowLeft': case 'ArrowRight': case _this.divider: { event.preventDefault(); var input = event.target; var property = event.key === 'ArrowLeft' ? 'previousElementSibling' : 'nextElementSibling'; var nextInput = findInput(input, property); focus(nextInput); break; } default: } }); _defineProperty(_assertThisInitialized(_this), "onKeyUp", function (event) { var key = event.key, input = event.target; var isNumberKey = !isNaN(parseInt(key, 10)); if (!isNumberKey) { return; } var value = input.value; var max = input.getAttribute('max'); /** * Given 1, the smallest possible number the user could type by adding another digit is 10. * 10 would be a valid value given max = 12, so we won't jump to the next input. * However, given 2, smallers possible number would be 20, and thus keeping the focus in * this field doesn't make sense. */ if (value * 10 > max || value.length >= max.length) { var property = 'nextElementSibling'; var nextInput = findInput(input, property); focus(nextInput); } }); _defineProperty(_assertThisInitialized(_this), "onChange", function (event) { var _event$target = event.target, name = _event$target.name, value = _event$target.value; _this.setState(_defineProperty({}, name, value ? parseInt(value, 10) : null), _this.onChangeExternal); }); _defineProperty(_assertThisInitialized(_this), "onChangeNative", function (event) { var onChange = _this.props.onChange; var value = event.target.value; if (!onChange) { return; } var processedValue = function () { if (!value) { return null; } var _value$split = value.split('-'), _value$split2 = _slicedToArray(_value$split, 3), yearString = _value$split2[0], monthString = _value$split2[1], dayString = _value$split2[2]; var year = parseInt(yearString, 10); var monthIndex = parseInt(monthString, 10) - 1 || 0; var day = parseInt(dayString, 10) || 1; var proposedValue = new Date(); proposedValue.setFullYear(year, monthIndex, day); proposedValue.setHours(0, 0, 0, 0); return proposedValue; }(); onChange(processedValue, false); }); _defineProperty(_assertThisInitialized(_this), "onChangeExternal", function () { var onChange = _this.props.onChange; if (!onChange) { return; } var formElements = [_this.dayInput, _this.monthInput, _this.yearInput].filter(Boolean); var values = {}; formElements.forEach(function (formElement) { values[formElement.name] = formElement.value; }); if (formElements.every(function (formElement) { return !formElement.value; })) { onChange(null, false); } else if (formElements.every(function (formElement) { return formElement.value && formElement.validity.valid; })) { var year = parseInt(values.year, 10); var monthIndex = parseInt(values.month, 10) - 1 || 0; var day = parseInt(values.day || 1, 10); var proposedValue = new Date(); proposedValue.setFullYear(year, monthIndex, day); proposedValue.setHours(0, 0, 0, 0); var processedValue = _this.getProcessedValue(proposedValue); onChange(processedValue, false); } }); _defineProperty(_assertThisInitialized(_this), "renderDay", function (currentMatch, index) { var _this$props = _this.props, autoFocus = _this$props.autoFocus, dayAriaLabel = _this$props.dayAriaLabel, dayPlaceholder = _this$props.dayPlaceholder, showLeadingZeros = _this$props.showLeadingZeros; var _this$state = _this.state, day = _this$state.day, month = _this$state.month, year = _this$state.year; if (currentMatch && currentMatch.length > 2) { throw new Error("Unsupported token: ".concat(currentMatch)); } var showLeadingZerosFromFormat = currentMatch && currentMatch.length === 2; return /*#__PURE__*/_react["default"].createElement(_DayInput["default"], _extends({ key: "day" }, _this.commonInputProps, { ariaLabel: dayAriaLabel, autoFocus: index === 0 && autoFocus, month: month, placeholder: dayPlaceholder, showLeadingZeros: showLeadingZerosFromFormat || showLeadingZeros, value: day, year: year })); }); _defineProperty(_assertThisInitialized(_this), "renderMonth", function (currentMatch, index) { var _this$props2 = _this.props, autoFocus = _this$props2.autoFocus, locale = _this$props2.locale, monthAriaLabel = _this$props2.monthAriaLabel, monthPlaceholder = _this$props2.monthPlaceholder, showLeadingZeros = _this$props2.showLeadingZeros; var _this$state2 = _this.state, month = _this$state2.month, year = _this$state2.year; if (currentMatch && currentMatch.length > 4) { throw new Error("Unsupported token: ".concat(currentMatch)); } if (currentMatch.length > 2) { return /*#__PURE__*/_react["default"].createElement(_MonthSelect["default"], _extends({ key: "month" }, _this.commonInputProps, { ariaLabel: monthAriaLabel, autoFocus: index === 0 && autoFocus, locale: locale, placeholder: monthPlaceholder, "short": currentMatch.length === 3, value: month, year: year })); } var showLeadingZerosFromFormat = currentMatch && currentMatch.length === 2; return /*#__PURE__*/_react["default"].createElement(_MonthInput["default"], _extends({ key: "month" }, _this.commonInputProps, { ariaLabel: monthAriaLabel, autoFocus: index === 0 && autoFocus, placeholder: monthPlaceholder, showLeadingZeros: showLeadingZerosFromFormat || showLeadingZeros, value: month, year: year })); }); _defineProperty(_assertThisInitialized(_this), "renderYear", function (currentMatch, index) { var _this$props3 = _this.props, autoFocus = _this$props3.autoFocus, yearAriaLabel = _this$props3.yearAriaLabel, yearPlaceholder = _this$props3.yearPlaceholder; var year = _this.state.year; return /*#__PURE__*/_react["default"].createElement(_YearInput["default"], _extends({ key: "year" }, _this.commonInputProps, { ariaLabel: yearAriaLabel, autoFocus: index === 0 && autoFocus, placeholder: yearPlaceholder, value: year, valueType: _this.valueType })); }); return _this; } _createClass(DateInput, [{ key: "getProcessedValue", /** * Gets current value in a desired format. */ value: function getProcessedValue(value) { var _this$props4 = this.props, minDate = _this$props4.minDate, maxDate = _this$props4.maxDate, maxDetail = _this$props4.maxDetail, returnValue = _this$props4.returnValue; var processFunction = function () { switch (returnValue) { case 'start': return getDetailValueFrom; case 'end': return getDetailValueTo; case 'range': return getDetailValueArray; default: throw new Error('Invalid returnValue.'); } }(); return processFunction({ value: value, minDate: minDate, maxDate: maxDate, maxDetail: maxDetail }); } }, { key: "renderCustomInputs", value: function renderCustomInputs() { var placeholder = this.placeholder; var format = this.props.format; var elementFunctions = { d: this.renderDay, M: this.renderMonth, y: this.renderYear }; var allowMultipleInstances = typeof format !== 'undefined'; return _renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances); } }, { key: "renderNativeInput", value: function renderNativeInput() { var _this$props5 = this.props, disabled = _this$props5.disabled, maxDate = _this$props5.maxDate, minDate = _this$props5.minDate, name = _this$props5.name, nativeInputAriaLabel = _this$props5.nativeInputAriaLabel, required = _this$props5.required; var value = this.state.value; return /*#__PURE__*/_react["default"].createElement(_NativeInput["default"], { key: "date", ariaLabel: nativeInputAriaLabel, disabled: disabled, maxDate: maxDate || defaultMaxDate, minDate: minDate || defaultMinDate, name: name, onChange: this.onChangeNative, required: required, value: value, valueType: this.valueType }); } }, { key: "render", value: function render() { var className = this.props.className; /* eslint-disable jsx-a11y/click-events-have-key-events */ /* eslint-disable jsx-a11y/no-static-element-interactions */ return /*#__PURE__*/_react["default"].createElement("div", { className: className, onClick: this.onClick }, this.renderNativeInput(), this.renderCustomInputs()); } }, { key: "formatDate", get: function get() { var maxDetail = this.props.maxDetail; var options = { year: 'numeric' }; var level = allViews.indexOf(maxDetail); if (level >= 2) { options.month = 'numeric'; } if (level >= 3) { options.day = 'numeric'; } return (0, _dateFormatter.getFormatter)(options); } }, { key: "divider", get: function get() { var dividers = this.placeholder.match(/[^0-9a-z]/i); return dividers ? dividers[0] : null; } }, { key: "placeholder", get: function get() { var _this$props6 = this.props, format = _this$props6.format, locale = _this$props6.locale; if (format) { return format; } var year = 2017; var monthIndex = 11; var day = 11; var date = new Date(year, monthIndex, day); var formattedDate = this.formatDate(locale, date); var datePieces = ['year', 'month', 'day']; var datePieceReplacements = ['y', 'M', 'd']; function formatDatePiece(name, dateToFormat) { return (0, _dateFormatter.getFormatter)(_defineProperty({ useGrouping: false }, name, 'numeric'))(locale, dateToFormat).match(/\d{1,}/); } var placeholder = formattedDate; datePieces.forEach(function (datePiece, index) { var formattedDatePiece = formatDatePiece(datePiece, date); var datePieceReplacement = datePieceReplacements[index]; placeholder = placeholder.replace(formattedDatePiece, datePieceReplacement); }); return placeholder; } }, { key: "commonInputProps", get: function get() { var _this2 = this; var _this$props7 = this.props, className = _this$props7.className, disabled = _this$props7.disabled, isCalendarOpen = _this$props7.isCalendarOpen, maxDate = _this$props7.maxDate, minDate = _this$props7.minDate, required = _this$props7.required; return { className: className, disabled: disabled, maxDate: maxDate || defaultMaxDate, minDate: minDate || defaultMinDate, onChange: this.onChange, onKeyDown: this.onKeyDown, onKeyUp: this.onKeyUp, // This is only for showing validity when editing required: required || isCalendarOpen, itemRef: function itemRef(ref, name) { // Save a reference to each input field _this2["".concat(name, "Input")] = ref; } }; } }, { key: "valueType", get: function get() { var maxDetail = this.props.maxDetail; return getValueType(maxDetail); } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(nextProps, prevState) { var minDate = nextProps.minDate, maxDate = nextProps.maxDate, maxDetail = nextProps.maxDetail; var nextState = {}; /** * If isCalendarOpen flag has changed, we have to update it. * It's saved in state purely for use in getDerivedStateFromProps. */ if (nextProps.isCalendarOpen !== prevState.isCalendarOpen) { nextState.isCalendarOpen = nextProps.isCalendarOpen; } /** * If the next value is different from the current one (with an exception of situation in * which values provided are limited by minDate and maxDate so that the dates are the same), * get a new one. */ var nextValue = getDetailValueFrom({ value: nextProps.value, minDate: minDate, maxDate: maxDate, maxDetail: maxDetail }); var values = [nextValue, prevState.value]; if ( // Toggling calendar visibility resets values nextState.isCalendarOpen // Flag was toggled || datesAreDifferent.apply(void 0, _toConsumableArray(values.map(function (value) { return getDetailValueFrom({ value: value, minDate: minDate, maxDate: maxDate, maxDetail: maxDetail }); }))) || datesAreDifferent.apply(void 0, _toConsumableArray(values.map(function (value) { return getDetailValueTo({ value: value, minDate: minDate, maxDate: maxDate, maxDetail: maxDetail }); })))) { if (nextValue) { nextState.year = (0, _dateUtils.getYear)(nextValue); nextState.month = (0, _dateUtils.getMonthHuman)(nextValue); nextState.day = (0, _dateUtils.getDate)(nextValue); } else { nextState.year = null; nextState.month = null; nextState.day = null; } nextState.value = nextValue; } return nextState; } }]); return DateInput; }(_react.PureComponent); exports["default"] = DateInput; DateInput.defaultProps = { maxDetail: 'month', name: 'date', returnValue: 'start' }; var isValue = _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].instanceOf(Date)]); DateInput.propTypes = { autoFocus: _propTypes["default"].bool, className: _propTypes["default"].string.isRequired, dayAriaLabel: _propTypes["default"].string, dayPlaceholder: _propTypes["default"].string, disabled: _propTypes["default"].bool, format: _propTypes["default"].string, isCalendarOpen: _propTypes["default"].bool, locale: _propTypes["default"].string, maxDate: _propTypes2.isMaxDate, maxDetail: _propTypes["default"].oneOf(allViews), minDate: _propTypes2.isMinDate, monthAriaLabel: _propTypes["default"].string, monthPlaceholder: _propTypes["default"].string, name: _propTypes["default"].string, nativeInputAriaLabel: _propTypes["default"].string, onChange: _propTypes["default"].func, required: _propTypes["default"].bool, returnValue: _propTypes["default"].oneOf(['start', 'end', 'range']), showLeadingZeros: _propTypes["default"].bool, value: _propTypes["default"].oneOfType([isValue, _propTypes["default"].arrayOf(isValue)]), yearAriaLabel: _propTypes["default"].string, yearPlaceholder: _propTypes["default"].string };
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ Ext.define('sisprod.view.AnnullableWorkRequest.WorkRequestTaskDescription', { extend: 'sisprod.view.base.BaseDataWindow', alias: 'widget.workRequestTaskDescription', require: [ 'sisprod.view.base.BaseDataWindow' ], messages: { labels: { taskDescription: 'Task Description' } }, title: 'Work Request Task Description', modal: true, width: 450, layout: 'fit', record: {}, initComponent: function(){ var me = this; me.formOptions = { // region: 'center', bodyStyle: 'padding:5px 5px 0', items: [ { xtype:'fieldset', columnWidth: 0.5, title: me.messages.labels.taskDescription, defaultType: 'textfield', defaults: {anchor: '100%'}, layout: 'anchor', items: [ { xtype: 'textareafield', anchor: '100%', name: 'description', id: 'description', allowBlank: false, readOnly: true, height: 150, value: me.record['description'] } ] } ], buttons: [ { text: me.windowMessages.closeText, handler: function() { var window = me; window.close(); } } ] }; me.callParent(arguments); } });
module.exports = Cmds.addCommand({ cmds: [';raidmode', ';start raidmode', ';enable raidmode'], requires: { guild: true, loud: false, }, desc: 'Activate raid mode', args: '', example: '', // ///////////////////////////////////////////////////////////////////////////////////////// func: (cmd, args, msgObj, speaker, channel, guild) => { if (index.raidMode[guild.id]) { Util.log('Raid mode is already active'); Util.print(channel, 'Raid mode is already active'); return; } const joinStamp = +new Date(); index.recentMembers = index.recentMembers.filter(memberData => joinStamp - memberData.joinStamp < index.newMemberTime); index.recentMembers2 = index.recentMembers2.filter(memberData => joinStamp - memberData.joinStamp < index.newMemberTime2); index.activateRaidMode(guild, channel); }, });
/** * Created by Daniel Mishcherin */ var mongoose = require('mongoose'); // data model var CrowdVoice = mongoose.model('CrowdVoice', { specURI: String, text: String }); var resources = { noConnection: 'MongoDB connection is inactive.', dbError: 'Could not get information from DB.' }; var config = { statusCodes: { OK: 200, notFound: 404, error: 500 } }; var connectionErrorHandler = function(res){ res.status(config.statusCodes.notFound).send(resources.noConnection); }; var DBErrorHandler = function(res, err){ res.status(config.statusCodes.error).send(resources.dbError); console.log('Crowd-voice: ', resources.dbError, err); }; var getAllCrowdVoiceData = function(req, res){ if (mongoose.connection.readyState === 0) { connectionErrorHandler(res); return; } CrowdVoice.find(function(err, data){ if (err) { DBErrorHandler(res, err); return; } res.jsonp(data); }); }; var getCrowdVoice = function(req, res){ if (mongoose.connection.readyState === 0) { connectionErrorHandler(res); return; } var specURI = req.query.pathToDataFile; CrowdVoice.find({specURI: specURI}, function(err, data){ if (err) { DBErrorHandler(res, err); return; } res.jsonp(data); }); }; var setCrowdVoice = function(req, res){ if (mongoose.connection.readyState === 0) { connectionErrorHandler(res); return; } var specURI = req.query.pathToDataFile; var text = req.query.text; CrowdVoice.findOneAndUpdate({specURI: specURI}, {text: text}, function(err, data) { if (err) { DBErrorHandler(res, err); return; } if(data != null) { res.jsonp(data); } else { var crowdvoice = new CrowdVoice({ specURI: req.query.specURI, text: req.query.text }); crowdvoice.save(function (err, data) { if (err) { DBErrorHandler(res, err); return; } res.jsonp(data); }); } }); }; var removeCrowdVoice = function(req, res){ if (mongoose.connection.readyState === 0) { connectionErrorHandler(res); return; } var specURI = req.query.pathToDataFile; CrowdVoice.findOneAndRemove({specURI: specURI}, function(err, data) { if (err) { DBErrorHandler(res, err); return; } res.jsonp(data); }); }; global.app.get('/getAllCrowdVoiceData', getAllCrowdVoiceData); global.app.get('/getCrowdVoice', getCrowdVoice); global.app.get('/setCrowdVoice', setCrowdVoice); global.app.get('/removeCrowdVoice', removeCrowdVoice);
import{C as ComponentBehavior}from"./component-8af4ce99.js";import"./index-7da957b6.js";class DatePickerBehaviour extends ComponentBehavior{static get params(){return{input:!0,localized:!0,component:"datepicker",provideValue:!1,props:["value","begin","end","mode","lang","host"]}}}export default DatePickerBehaviour;
/*! UIkit 3.5.2 | https://www.getuikit.com | (c) 2014 - 2020 YOOtheme | MIT License */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) : typeof define === 'function' && define.amd ? define('uikitlightbox_panel', ['uikit-util'], factory) : (global = global || self, global.UIkitLightbox_panel = factory(global.UIkit.util)); }(this, (function (uikitUtil) { 'use strict'; var Animations = { slide: { show: function(dir) { return [ {transform: translate(dir * -100)}, {transform: translate()} ]; }, percent: function(current) { return translated(current); }, translate: function(percent, dir) { return [ {transform: translate(dir * -100 * percent)}, {transform: translate(dir * 100 * (1 - percent))} ]; } } }; function translated(el) { return Math.abs(uikitUtil.css(el, 'transform').split(',')[4] / el.offsetWidth) || 0; } function translate(value, unit) { if ( value === void 0 ) value = 0; if ( unit === void 0 ) unit = '%'; value += value ? unit : ''; return uikitUtil.isIE ? ("translateX(" + value + ")") : ("translate3d(" + value + ", 0, 0)"); // currently not translate3d in IE, translate3d within translate3d does not work while transitioning } function scale3d(value) { return ("scale3d(" + value + ", " + value + ", 1)"); } var Animations$1 = uikitUtil.assign({}, Animations, { fade: { show: function() { return [ {opacity: 0}, {opacity: 1} ]; }, percent: function(current) { return 1 - uikitUtil.css(current, 'opacity'); }, translate: function(percent) { return [ {opacity: 1 - percent}, {opacity: percent} ]; } }, scale: { show: function() { return [ {opacity: 0, transform: scale3d(1 - .2)}, {opacity: 1, transform: scale3d(1)} ]; }, percent: function(current) { return 1 - uikitUtil.css(current, 'opacity'); }, translate: function(percent) { return [ {opacity: 1 - percent, transform: scale3d(1 - .2 * percent)}, {opacity: percent, transform: scale3d(1 - .2 + .2 * percent)} ]; } } }); var Container = { props: { container: Boolean }, data: { container: true }, computed: { container: function(ref) { var container = ref.container; return container === true && this.$container || container && uikitUtil.$(container); } } }; var Class = { connected: function() { !uikitUtil.hasClass(this.$el, this.$name) && uikitUtil.addClass(this.$el, this.$name); } }; var Togglable = { props: { cls: Boolean, animation: 'list', duration: Number, origin: String, transition: String }, data: { cls: false, animation: [false], duration: 200, origin: false, transition: 'linear', initProps: { overflow: '', height: '', paddingTop: '', paddingBottom: '', marginTop: '', marginBottom: '' }, hideProps: { overflow: 'hidden', height: 0, paddingTop: 0, paddingBottom: 0, marginTop: 0, marginBottom: 0 } }, computed: { hasAnimation: function(ref) { var animation = ref.animation; return !!animation[0]; }, hasTransition: function(ref) { var animation = ref.animation; return this.hasAnimation && animation[0] === true; } }, methods: { toggleElement: function(targets, show, animate) { var this$1 = this; return uikitUtil.Promise.all(uikitUtil.toNodes(targets).map(function (el) { return new uikitUtil.Promise(function (resolve) { return this$1._toggleElement(el, show, animate).then(resolve, uikitUtil.noop); } ); } )); }, isToggled: function(el) { var nodes = uikitUtil.toNodes(el || this.$el); return this.cls ? uikitUtil.hasClass(nodes, this.cls.split(' ')[0]) : !uikitUtil.hasAttr(nodes, 'hidden'); }, updateAria: function(el) { if (this.cls === false) { uikitUtil.attr(el, 'aria-hidden', !this.isToggled(el)); } }, _toggleElement: function(el, show, animate) { var this$1 = this; show = uikitUtil.isBoolean(show) ? show : uikitUtil.Animation.inProgress(el) ? uikitUtil.hasClass(el, 'uk-animation-leave') : uikitUtil.Transition.inProgress(el) ? el.style.height === '0px' : !this.isToggled(el); if (!uikitUtil.trigger(el, ("before" + (show ? 'show' : 'hide')), [this])) { return uikitUtil.Promise.reject(); } var promise = ( uikitUtil.isFunction(animate) ? animate : animate === false || !this.hasAnimation ? this._toggle : this.hasTransition ? toggleHeight(this) : toggleAnimation(this) )(el, show); uikitUtil.trigger(el, show ? 'show' : 'hide', [this]); var final = function () { uikitUtil.trigger(el, show ? 'shown' : 'hidden', [this$1]); this$1.$update(el); }; return (promise || uikitUtil.Promise.resolve()).then(final); }, _toggle: function(el, toggled) { if (!el) { return; } toggled = Boolean(toggled); var changed; if (this.cls) { changed = uikitUtil.includes(this.cls, ' ') || toggled !== uikitUtil.hasClass(el, this.cls); changed && uikitUtil.toggleClass(el, this.cls, uikitUtil.includes(this.cls, ' ') ? undefined : toggled); } else { changed = toggled === uikitUtil.hasAttr(el, 'hidden'); changed && uikitUtil.attr(el, 'hidden', !toggled ? '' : null); } uikitUtil.$$('[autofocus]', el).some(function (el) { return uikitUtil.isVisible(el) ? el.focus() || true : el.blur(); }); this.updateAria(el); if (changed) { uikitUtil.trigger(el, 'toggled', [this]); this.$update(el); } } } }; function toggleHeight(ref) { var isToggled = ref.isToggled; var duration = ref.duration; var initProps = ref.initProps; var hideProps = ref.hideProps; var transition = ref.transition; var _toggle = ref._toggle; return function (el, show) { var inProgress = uikitUtil.Transition.inProgress(el); var inner = el.hasChildNodes ? uikitUtil.toFloat(uikitUtil.css(el.firstElementChild, 'marginTop')) + uikitUtil.toFloat(uikitUtil.css(el.lastElementChild, 'marginBottom')) : 0; var currentHeight = uikitUtil.isVisible(el) ? uikitUtil.height(el) + (inProgress ? 0 : inner) : 0; uikitUtil.Transition.cancel(el); if (!isToggled(el)) { _toggle(el, true); } uikitUtil.height(el, ''); // Update child components first uikitUtil.fastdom.flush(); var endHeight = uikitUtil.height(el) + (inProgress ? 0 : inner); uikitUtil.height(el, currentHeight); return (show ? uikitUtil.Transition.start(el, uikitUtil.assign({}, initProps, {overflow: 'hidden', height: endHeight}), Math.round(duration * (1 - currentHeight / endHeight)), transition) : uikitUtil.Transition.start(el, hideProps, Math.round(duration * (currentHeight / endHeight)), transition).then(function () { return _toggle(el, false); }) ).then(function () { return uikitUtil.css(el, initProps); }); }; } function toggleAnimation(cmp) { return function (el, show) { uikitUtil.Animation.cancel(el); var animation = cmp.animation; var duration = cmp.duration; var _toggle = cmp._toggle; if (show) { _toggle(el, true); return uikitUtil.Animation.in(el, animation[0], duration, cmp.origin); } return uikitUtil.Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(function () { return _toggle(el, false); }); }; } var active = []; var Modal = { mixins: [Class, Container, Togglable], props: { selPanel: String, selClose: String, escClose: Boolean, bgClose: Boolean, stack: Boolean }, data: { cls: 'uk-open', escClose: true, bgClose: true, overlay: true, stack: false }, computed: { panel: function(ref, $el) { var selPanel = ref.selPanel; return uikitUtil.$(selPanel, $el); }, transitionElement: function() { return this.panel; }, bgClose: function(ref) { var bgClose = ref.bgClose; return bgClose && this.panel; } }, beforeDisconnect: function() { if (this.isToggled()) { this.toggleElement(this.$el, false, false); } }, events: [ { name: 'click', delegate: function() { return this.selClose; }, handler: function(e) { e.preventDefault(); this.hide(); } }, { name: 'toggle', self: true, handler: function(e) { if (e.defaultPrevented) { return; } e.preventDefault(); if (this.isToggled() === uikitUtil.includes(active, this)) { this.toggle(); } } }, { name: 'beforeshow', self: true, handler: function(e) { if (uikitUtil.includes(active, this)) { return false; } if (!this.stack && active.length) { uikitUtil.Promise.all(active.map(function (modal) { return modal.hide(); })).then(this.show); e.preventDefault(); } else { active.push(this); } } }, { name: 'show', self: true, handler: function() { var this$1 = this; if (uikitUtil.width(window) - uikitUtil.width(document) && this.overlay) { uikitUtil.css(document.body, 'overflowY', 'scroll'); } this.stack && uikitUtil.css(this.$el, 'zIndex', uikitUtil.css(this.$el, 'zIndex') + active.length); uikitUtil.addClass(document.documentElement, this.clsPage); if (this.bgClose) { uikitUtil.once(this.$el, 'hide', uikitUtil.on(document, uikitUtil.pointerDown, function (ref) { var target = ref.target; if (uikitUtil.last(active) !== this$1 || this$1.overlay && !uikitUtil.within(target, this$1.$el) || uikitUtil.within(target, this$1.panel)) { return; } uikitUtil.once(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " scroll"), function (ref) { var defaultPrevented = ref.defaultPrevented; var type = ref.type; var newTarget = ref.target; if (!defaultPrevented && type === uikitUtil.pointerUp && target === newTarget) { this$1.hide(); } }, true); }), {self: true}); } if (this.escClose) { uikitUtil.once(this.$el, 'hide', uikitUtil.on(document, 'keydown', function (e) { if (e.keyCode === 27 && uikitUtil.last(active) === this$1) { e.preventDefault(); this$1.hide(); } }), {self: true}); } } }, { name: 'hidden', self: true, handler: function() { var this$1 = this; active.splice(active.indexOf(this), 1); if (!active.length) { uikitUtil.css(document.body, 'overflowY', ''); } uikitUtil.css(this.$el, 'zIndex', ''); if (!active.some(function (modal) { return modal.clsPage === this$1.clsPage; })) { uikitUtil.removeClass(document.documentElement, this.clsPage); } } } ], methods: { toggle: function() { return this.isToggled() ? this.hide() : this.show(); }, show: function() { var this$1 = this; if (this.container && this.$el.parentNode !== this.container) { uikitUtil.append(this.container, this.$el); return new uikitUtil.Promise(function (resolve) { return requestAnimationFrame(function () { return this$1.show().then(resolve); } ); } ); } return this.toggleElement(this.$el, true, animate(this)); }, hide: function() { return this.toggleElement(this.$el, false, animate(this)); } } }; function animate(ref) { var transitionElement = ref.transitionElement; var _toggle = ref._toggle; return function (el, show) { return new uikitUtil.Promise(function (resolve, reject) { return uikitUtil.once(el, 'show hide', function () { el._reject && el._reject(); el._reject = reject; _toggle(el, show); var off = uikitUtil.once(transitionElement, 'transitionstart', function () { uikitUtil.once(transitionElement, 'transitionend transitioncancel', resolve, {self: true}); clearTimeout(timer); }, {self: true}); var timer = setTimeout(function () { off(); resolve(); }, uikitUtil.toMs(uikitUtil.css(transitionElement, 'transitionDuration'))); }); } ); }; } function Transitioner(prev, next, dir, ref) { var animation = ref.animation; var easing = ref.easing; var percent = animation.percent; var translate = animation.translate; var show = animation.show; if ( show === void 0 ) show = uikitUtil.noop; var props = show(dir); var deferred = new uikitUtil.Deferred(); return { dir: dir, show: function(duration, percent, linear) { var this$1 = this; if ( percent === void 0 ) percent = 0; var timing = linear ? 'linear' : easing; duration -= Math.round(duration * uikitUtil.clamp(percent, -1, 1)); this.translate(percent); triggerUpdate(next, 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir}); triggerUpdate(prev, 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir}); uikitUtil.Promise.all([ uikitUtil.Transition.start(next, props[1], duration, timing), uikitUtil.Transition.start(prev, props[0], duration, timing) ]).then(function () { this$1.reset(); deferred.resolve(); }, uikitUtil.noop); return deferred.promise; }, stop: function() { return uikitUtil.Transition.stop([next, prev]); }, cancel: function() { uikitUtil.Transition.cancel([next, prev]); }, reset: function() { for (var prop in props[0]) { uikitUtil.css([next, prev], prop, ''); } }, forward: function(duration, percent) { if ( percent === void 0 ) percent = this.percent(); uikitUtil.Transition.cancel([next, prev]); return this.show(duration, percent, true); }, translate: function(percent) { this.reset(); var props = translate(percent, dir); uikitUtil.css(next, props[1]); uikitUtil.css(prev, props[0]); triggerUpdate(next, 'itemtranslatein', {percent: percent, dir: dir}); triggerUpdate(prev, 'itemtranslateout', {percent: 1 - percent, dir: dir}); }, percent: function() { return percent(prev || next, next, dir); }, getDistance: function() { return prev && prev.offsetWidth; } }; } function triggerUpdate(el, type, data) { uikitUtil.trigger(el, uikitUtil.createEvent(type, false, false, data)); } var SliderAutoplay = { props: { autoplay: Boolean, autoplayInterval: Number, pauseOnHover: Boolean }, data: { autoplay: false, autoplayInterval: 7000, pauseOnHover: true }, connected: function() { this.autoplay && this.startAutoplay(); }, disconnected: function() { this.stopAutoplay(); }, update: function() { uikitUtil.attr(this.slides, 'tabindex', '-1'); }, events: [ { name: 'visibilitychange', el: uikitUtil.inBrowser && document, filter: function() { return this.autoplay; }, handler: function() { if (document.hidden) { this.stopAutoplay(); } else { this.startAutoplay(); } } } ], methods: { startAutoplay: function() { var this$1 = this; this.stopAutoplay(); this.interval = setInterval( function () { return (!this$1.draggable || !uikitUtil.$(':focus', this$1.$el)) && (!this$1.pauseOnHover || !uikitUtil.matches(this$1.$el, ':hover')) && !this$1.stack.length && this$1.show('next'); }, this.autoplayInterval ); }, stopAutoplay: function() { this.interval && clearInterval(this.interval); } } }; var SliderDrag = { props: { draggable: Boolean }, data: { draggable: true, threshold: 10 }, created: function() { var this$1 = this; ['start', 'move', 'end'].forEach(function (key) { var fn = this$1[key]; this$1[key] = function (e) { var pos = uikitUtil.getEventPos(e).x * (uikitUtil.isRtl ? -1 : 1); this$1.prevPos = pos !== this$1.pos ? this$1.pos : this$1.prevPos; this$1.pos = pos; fn(e); }; }); }, events: [ { name: uikitUtil.pointerDown, delegate: function() { return this.selSlides; }, handler: function(e) { if (!this.draggable || !uikitUtil.isTouch(e) && hasTextNodesOnly(e.target) || uikitUtil.closest(e.target, uikitUtil.selInput) || e.button > 0 || this.length < 2 ) { return; } this.start(e); } }, { // Workaround for iOS 11 bug: https://bugs.webkit.org/show_bug.cgi?id=184250 name: 'touchmove', passive: false, handler: 'move', filter: function() { return uikitUtil.pointerMove === 'touchmove'; }, delegate: function() { return this.selSlides; } }, { name: 'dragstart', handler: function(e) { e.preventDefault(); } } ], methods: { start: function() { var this$1 = this; this.drag = this.pos; if (this._transitioner) { this.percent = this._transitioner.percent(); this.drag += this._transitioner.getDistance() * this.percent * this.dir; this._transitioner.cancel(); this._transitioner.translate(this.percent); this.dragging = true; this.stack = []; } else { this.prevIndex = this.index; } // See above workaround notice var off = uikitUtil.pointerMove !== 'touchmove' ? uikitUtil.on(document, uikitUtil.pointerMove, this.move, {passive: false}) : uikitUtil.noop; this.unbindMove = function () { off(); this$1.unbindMove = null; }; uikitUtil.on(window, 'scroll', this.unbindMove); uikitUtil.on(window.visualViewport, 'resize', this.unbindMove); uikitUtil.on(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel), this.end, true); uikitUtil.css(this.list, 'userSelect', 'none'); }, move: function(e) { var this$1 = this; // See above workaround notice if (!this.unbindMove) { return; } var distance = this.pos - this.drag; if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) { return; } uikitUtil.css(this.list, 'pointerEvents', 'none'); e.cancelable && e.preventDefault(); this.dragging = true; this.dir = (distance < 0 ? 1 : -1); var ref = this; var slides = ref.slides; var ref$1 = this; var prevIndex = ref$1.prevIndex; var dis = Math.abs(distance); var nextIndex = this.getIndex(prevIndex + this.dir, prevIndex); var width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth; while (nextIndex !== prevIndex && dis > width) { this.drag -= width * this.dir; prevIndex = nextIndex; dis -= width; nextIndex = this.getIndex(prevIndex + this.dir, prevIndex); width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth; } this.percent = dis / width; var prev = slides[prevIndex]; var next = slides[nextIndex]; var changed = this.index !== nextIndex; var edge = prevIndex === nextIndex; var itemShown; [this.index, this.prevIndex].filter(function (i) { return !uikitUtil.includes([nextIndex, prevIndex], i); }).forEach(function (i) { uikitUtil.trigger(slides[i], 'itemhidden', [this$1]); if (edge) { itemShown = true; this$1.prevIndex = prevIndex; } }); if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) { uikitUtil.trigger(slides[this.index], 'itemshown', [this]); } if (changed) { this.prevIndex = prevIndex; this.index = nextIndex; !edge && uikitUtil.trigger(prev, 'beforeitemhide', [this]); uikitUtil.trigger(next, 'beforeitemshow', [this]); } this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next); if (changed) { !edge && uikitUtil.trigger(prev, 'itemhide', [this]); uikitUtil.trigger(next, 'itemshow', [this]); } }, end: function() { uikitUtil.off(window, 'scroll', this.unbindMove); uikitUtil.off(window.visualViewport, 'resize', this.unbindMove); this.unbindMove && this.unbindMove(); uikitUtil.off(document, uikitUtil.pointerUp, this.end, true); if (this.dragging) { this.dragging = null; if (this.index === this.prevIndex) { this.percent = 1 - this.percent; this.dir *= -1; this._show(false, this.index, true); this._transitioner = null; } else { var dirChange = (uikitUtil.isRtl ? this.dir * (uikitUtil.isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos; this.index = dirChange ? this.index : this.prevIndex; if (dirChange) { this.percent = 1 - this.percent; } this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true); } } uikitUtil.css(this.list, {userSelect: '', pointerEvents: ''}); this.drag = this.percent = null; } } }; function hasTextNodesOnly(el) { return !el.children.length && el.childNodes.length; } var SliderNav = { data: { selNav: false }, computed: { nav: function(ref, $el) { var selNav = ref.selNav; return uikitUtil.$(selNav, $el); }, selNavItem: function(ref) { var attrItem = ref.attrItem; return ("[" + attrItem + "],[data-" + attrItem + "]"); }, navItems: function(_, $el) { return uikitUtil.$$(this.selNavItem, $el); } }, update: { write: function() { var this$1 = this; if (this.nav && this.length !== this.nav.children.length) { uikitUtil.html(this.nav, this.slides.map(function (_, i) { return ("<li " + (this$1.attrItem) + "=\"" + i + "\"><a href></a></li>"); }).join('')); } uikitUtil.toggleClass(uikitUtil.$$(this.selNavItem, this.$el).concat(this.nav), 'uk-hidden', !this.maxIndex); this.updateNav(); }, events: ['resize'] }, events: [ { name: 'click', delegate: function() { return this.selNavItem; }, handler: function(e) { e.preventDefault(); this.show(uikitUtil.data(e.current, this.attrItem)); } }, { name: 'itemshow', handler: 'updateNav' } ], methods: { updateNav: function() { var this$1 = this; var i = this.getValidIndex(); this.navItems.forEach(function (el) { var cmd = uikitUtil.data(el, this$1.attrItem); uikitUtil.toggleClass(el, this$1.clsActive, uikitUtil.toNumber(cmd) === i); uikitUtil.toggleClass(el, 'uk-invisible', this$1.finite && (cmd === 'previous' && i === 0 || cmd === 'next' && i >= this$1.maxIndex)); }); } } }; var Slider = { mixins: [SliderAutoplay, SliderDrag, SliderNav], props: { clsActivated: Boolean, easing: String, index: Number, finite: Boolean, velocity: Number, selSlides: String }, data: function () { return ({ easing: 'ease', finite: false, velocity: 1, index: 0, prevIndex: -1, stack: [], percent: 0, clsActive: 'uk-active', clsActivated: false, Transitioner: false, transitionOptions: {} }); }, connected: function() { this.prevIndex = -1; this.index = this.getValidIndex(this.index); this.stack = []; }, disconnected: function() { uikitUtil.removeClass(this.slides, this.clsActive); }, computed: { duration: function(ref, $el) { var velocity = ref.velocity; return speedUp($el.offsetWidth / velocity); }, list: function(ref, $el) { var selList = ref.selList; return uikitUtil.$(selList, $el); }, maxIndex: function() { return this.length - 1; }, selSlides: function(ref) { var selList = ref.selList; var selSlides = ref.selSlides; return (selList + " " + (selSlides || '> *')); }, slides: { get: function() { return uikitUtil.$$(this.selSlides, this.$el); }, watch: function() { this.$reset(); } }, length: function() { return this.slides.length; } }, events: { itemshown: function() { this.$update(this.list); } }, methods: { show: function(index, force) { var this$1 = this; if ( force === void 0 ) force = false; if (this.dragging || !this.length) { return; } var ref = this; var stack = ref.stack; var queueIndex = force ? 0 : stack.length; var reset = function () { stack.splice(queueIndex, 1); if (stack.length) { this$1.show(stack.shift(), true); } }; stack[force ? 'unshift' : 'push'](index); if (!force && stack.length > 1) { if (stack.length === 2) { this._transitioner.forward(Math.min(this.duration, 200)); } return; } var prevIndex = this.getIndex(this.index); var prev = uikitUtil.hasClass(this.slides, this.clsActive) && this.slides[prevIndex]; var nextIndex = this.getIndex(index, this.index); var next = this.slides[nextIndex]; if (prev === next) { reset(); return; } this.dir = getDirection(index, prevIndex); this.prevIndex = prevIndex; this.index = nextIndex; if (prev && !uikitUtil.trigger(prev, 'beforeitemhide', [this]) || !uikitUtil.trigger(next, 'beforeitemshow', [this, prev]) ) { this.index = this.prevIndex; reset(); return; } var promise = this._show(prev, next, force).then(function () { prev && uikitUtil.trigger(prev, 'itemhidden', [this$1]); uikitUtil.trigger(next, 'itemshown', [this$1]); return new uikitUtil.Promise(function (resolve) { uikitUtil.fastdom.write(function () { stack.shift(); if (stack.length) { this$1.show(stack.shift(), true); } else { this$1._transitioner = null; } resolve(); }); }); }); prev && uikitUtil.trigger(prev, 'itemhide', [this]); uikitUtil.trigger(next, 'itemshow', [this]); return promise; }, getIndex: function(index, prev) { if ( index === void 0 ) index = this.index; if ( prev === void 0 ) prev = this.index; return uikitUtil.clamp(uikitUtil.getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex); }, getValidIndex: function(index, prevIndex) { if ( index === void 0 ) index = this.index; if ( prevIndex === void 0 ) prevIndex = this.prevIndex; return this.getIndex(index, prevIndex); }, _show: function(prev, next, force) { this._transitioner = this._getTransitioner( prev, next, this.dir, uikitUtil.assign({ easing: force ? next.offsetWidth < 600 ? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */ : 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */ : this.easing }, this.transitionOptions) ); if (!force && !prev) { this._translate(1); return uikitUtil.Promise.resolve(); } var ref = this.stack; var length = ref.length; return this._transitioner[length > 1 ? 'forward' : 'show'](length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration, this.percent); }, _getDistance: function(prev, next) { return this._getTransitioner(prev, prev !== next && next).getDistance(); }, _translate: function(percent, prev, next) { if ( prev === void 0 ) prev = this.prevIndex; if ( next === void 0 ) next = this.index; var transitioner = this._getTransitioner(prev !== next ? prev : false, next); transitioner.translate(percent); return transitioner; }, _getTransitioner: function(prev, next, dir, options) { if ( prev === void 0 ) prev = this.prevIndex; if ( next === void 0 ) next = this.index; if ( dir === void 0 ) dir = this.dir || 1; if ( options === void 0 ) options = this.transitionOptions; return new this.Transitioner( uikitUtil.isNumber(prev) ? this.slides[prev] : prev, uikitUtil.isNumber(next) ? this.slides[next] : next, dir * (uikitUtil.isRtl ? -1 : 1), options ); } } }; function getDirection(index, prevIndex) { return index === 'next' ? 1 : index === 'previous' ? -1 : index < prevIndex ? -1 : 1; } function speedUp(x) { return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200) } var Slideshow = { mixins: [Slider], props: { animation: String }, data: { animation: 'slide', clsActivated: 'uk-transition-active', Animations: Animations, Transitioner: Transitioner }, computed: { animation: function(ref) { var animation = ref.animation; var Animations = ref.Animations; return uikitUtil.assign(Animations[animation] || Animations.slide, {name: animation}); }, transitionOptions: function() { return {animation: this.animation}; } }, events: { 'itemshow itemhide itemshown itemhidden': function(ref) { var target = ref.target; this.$update(target); }, beforeitemshow: function(ref) { var target = ref.target; uikitUtil.addClass(target, this.clsActive); }, itemshown: function(ref) { var target = ref.target; uikitUtil.addClass(target, this.clsActivated); }, itemhidden: function(ref) { var target = ref.target; uikitUtil.removeClass(target, this.clsActive, this.clsActivated); } } }; var Component = { mixins: [Container, Modal, Togglable, Slideshow], functional: true, props: { delayControls: Number, preload: Number, videoAutoplay: Boolean, template: String }, data: function () { return ({ preload: 1, videoAutoplay: false, delayControls: 3000, items: [], cls: 'uk-open', clsPage: 'uk-lightbox-page', selList: '.uk-lightbox-items', attrItem: 'uk-lightbox-item', selClose: '.uk-close-large', selCaption: '.uk-lightbox-caption', pauseOnHover: false, velocity: 2, Animations: Animations$1, template: "<div class=\"uk-lightbox uk-overflow-hidden\"> <ul class=\"uk-lightbox-items\"></ul> <div class=\"uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque\"> <button class=\"uk-lightbox-toolbar-icon uk-close-large\" type=\"button\" uk-close></button> </div> <a class=\"uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade\" href uk-slidenav-previous uk-lightbox-item=\"previous\"></a> <a class=\"uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade\" href uk-slidenav-next uk-lightbox-item=\"next\"></a> <div class=\"uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque\"></div> </div>" }); }, created: function() { var $el = uikitUtil.$(this.template); var list = uikitUtil.$(this.selList, $el); this.items.forEach(function () { return uikitUtil.append(list, '<li>'); }); this.$mount(uikitUtil.append(this.container, $el)); }, computed: { caption: function(ref, $el) { var selCaption = ref.selCaption; return uikitUtil.$('.uk-lightbox-caption', $el); } }, events: [ { name: (uikitUtil.pointerMove + " " + uikitUtil.pointerDown + " keydown"), handler: 'showControls' }, { name: 'click', self: true, delegate: function() { return this.selSlides; }, handler: function(e) { if (e.defaultPrevented) { return; } this.hide(); } }, { name: 'shown', self: true, handler: function() { this.showControls(); } }, { name: 'hide', self: true, handler: function() { this.hideControls(); uikitUtil.removeClass(this.slides, this.clsActive); uikitUtil.Transition.stop(this.slides); } }, { name: 'hidden', self: true, handler: function() { this.$destroy(true); } }, { name: 'keyup', el: uikitUtil.inBrowser && document, handler: function(e) { if (!this.isToggled(this.$el) || !this.draggable) { return; } switch (e.keyCode) { case 37: this.show('previous'); break; case 39: this.show('next'); break; } } }, { name: 'beforeitemshow', handler: function(e) { if (this.isToggled()) { return; } this.draggable = false; e.preventDefault(); this.toggleElement(this.$el, true, false); this.animation = Animations$1['scale']; uikitUtil.removeClass(e.target, this.clsActive); this.stack.splice(1, 0, this.index); } }, { name: 'itemshow', handler: function() { uikitUtil.html(this.caption, this.getItem().caption || ''); for (var j = -this.preload; j <= this.preload; j++) { this.loadItem(this.index + j); } } }, { name: 'itemshown', handler: function() { this.draggable = this.$props.draggable; } }, { name: 'itemload', handler: function(_, item) { var this$1 = this; var src = item.source; var type = item.type; var alt = item.alt; if ( alt === void 0 ) alt = ''; var poster = item.poster; var attrs = item.attrs; if ( attrs === void 0 ) attrs = {}; this.setItem(item, '<span uk-spinner></span>'); if (!src) { return; } var matches; var iframeAttrs = { frameborder: '0', allow: 'autoplay', allowfullscreen: '', style: 'max-width: 100%; box-sizing: border-box;', 'uk-responsive': '', 'uk-video': ("" + (this.videoAutoplay)) }; // Image if (type === 'image' || src.match(/\.(jpe?g|png|gif|svg|webp)($|\?)/i)) { uikitUtil.getImage(src, attrs.srcset, attrs.size).then( function (ref) { var width = ref.width; var height = ref.height; return this$1.setItem(item, createEl('img', uikitUtil.assign({src: src, width: width, height: height, alt: alt}, attrs))); }, function () { return this$1.setError(item); } ); // Video } else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) { var video = createEl('video', uikitUtil.assign({ src: src, poster: poster, controls: '', playsinline: '', 'uk-video': ("" + (this.videoAutoplay)) }, attrs)); uikitUtil.on(video, 'loadedmetadata', function () { uikitUtil.attr(video, {width: video.videoWidth, height: video.videoHeight}); this$1.setItem(item, video); }); uikitUtil.on(video, 'error', function () { return this$1.setError(item); }); // Iframe } else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) { this.setItem(item, createEl('iframe', uikitUtil.assign({ src: src, frameborder: '0', allowfullscreen: '', class: 'uk-lightbox-iframe' }, attrs))); // YouTube } else if ((matches = src.match(/\/\/(?:.*?youtube(-nocookie)?\..*?[?&]v=|youtu\.be\/)([\w-]{11})[&?]?(.*)?/))) { this.setItem(item, createEl('iframe', uikitUtil.assign({ src: ("https://www.youtube" + (matches[1] || '') + ".com/embed/" + (matches[2]) + (matches[3] ? ("?" + (matches[3])) : '')), width: 1920, height: 1080 }, iframeAttrs, attrs))); // Vimeo } else if ((matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/))) { uikitUtil.ajax(("https://vimeo.com/api/oembed.json?maxwidth=1920&url=" + (encodeURI(src))), { responseType: 'json', withCredentials: false }).then( function (ref) { var ref_response = ref.response; var height = ref_response.height; var width = ref_response.width; return this$1.setItem(item, createEl('iframe', uikitUtil.assign({ src: ("https://player.vimeo.com/video/" + (matches[1]) + (matches[2] ? ("?" + (matches[2])) : '')), width: width, height: height }, iframeAttrs, attrs))); }, function () { return this$1.setError(item); } ); } } } ], methods: { loadItem: function(index) { if ( index === void 0 ) index = this.index; var item = this.getItem(index); if (!this.getSlide(item).childElementCount) { uikitUtil.trigger(this.$el, 'itemload', [item]); } }, getItem: function(index) { if ( index === void 0 ) index = this.index; return this.items[uikitUtil.getIndex(index, this.slides)]; }, setItem: function(item, content) { uikitUtil.trigger(this.$el, 'itemloaded', [this, uikitUtil.html(this.getSlide(item), content) ]); }, getSlide: function(item) { return this.slides[this.items.indexOf(item)]; }, setError: function(item) { this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>'); }, showControls: function() { clearTimeout(this.controlsTimer); this.controlsTimer = setTimeout(this.hideControls, this.delayControls); uikitUtil.addClass(this.$el, 'uk-active', 'uk-transition-active'); }, hideControls: function() { uikitUtil.removeClass(this.$el, 'uk-active', 'uk-transition-active'); } } }; function createEl(tag, attrs) { var el = uikitUtil.fragment(("<" + tag + ">")); uikitUtil.attr(el, attrs); return el; } if (typeof window !== 'undefined' && window.UIkit) { window.UIkit.component('lightboxPanel', Component); } return Component; })));
'use strict'; module.exports = { extends: 'octane', rules: { 'no-positive-tabindex': false } };
/** @license React v0.0.0-experimental-27659559e * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict';var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60117,r=60129,u=60131,v=60132; if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;b=w("react.element");c=w("react.portal");d=w("react.fragment");e=w("react.strict_mode");f=w("react.profiler");g=w("react.provider");h=w("react.context");k=w("react.forward_ref");l=w("react.suspense");m=w("react.suspense_list");n=w("react.memo");p=w("react.lazy");q=w("react.fundamental");r=w("react.debug_trace_mode");u=w("react.legacy_hidden");v=w("react.cache")}var x=0;"function"===typeof Symbol&&(x=Symbol.for("react.module.reference")); function y(a){if("object"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H; exports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n}; exports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l}; exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===r||a===e||a===l||a===m||a===u||a===v||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===q||a.$$typeof===x||void 0!==a.getModuleId)?!0:!1};exports.typeOf=y;
/** * @license Highcharts JS v8.2.0 (2020-08-20) * * (c) 2009-2019 Torstein Honsi * * License: www.highcharts.com/license */ 'use strict'; (function (factory) { if (typeof module === 'object' && module.exports) { factory['default'] = factory; module.exports = factory; } else if (typeof define === 'function' && define.amd) { define('highcharts/themes/grid', ['highcharts'], function (Highcharts) { factory(Highcharts); factory.Highcharts = Highcharts; return factory; }); } else { factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined); } }(function (Highcharts) { var _modules = Highcharts ? Highcharts._modules : {}; function _registerModule(obj, path, args, fn) { if (!obj.hasOwnProperty(path)) { obj[path] = fn.apply(null, args); } } _registerModule(_modules, 'Extensions/Themes/Grid.js', [_modules['Core/Globals.js'], _modules['Core/Utilities.js']], function (Highcharts, U) { /* * * * (c) 2010-2020 Torstein Honsi * * License: www.highcharts.com/license * * Grid theme for Highcharts JS * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var setOptions = U.setOptions; Highcharts.theme = { colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'], chart: { backgroundColor: { linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 }, stops: [ [0, 'rgb(255, 255, 255)'], [1, 'rgb(240, 240, 255)'] ] }, borderWidth: 2, plotBackgroundColor: 'rgba(255, 255, 255, .9)', plotShadow: true, plotBorderWidth: 1 }, title: { style: { color: '#000', font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' } }, subtitle: { style: { color: '#666666', font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' } }, xAxis: { gridLineWidth: 1, lineColor: '#000', tickColor: '#000', labels: { style: { color: '#000', font: '11px Trebuchet MS, Verdana, sans-serif' } }, title: { style: { color: '#333', fontWeight: 'bold', fontSize: '12px', fontFamily: 'Trebuchet MS, Verdana, sans-serif' } } }, yAxis: { minorTickInterval: 'auto', lineColor: '#000', lineWidth: 1, tickWidth: 1, tickColor: '#000', labels: { style: { color: '#000', font: '11px Trebuchet MS, Verdana, sans-serif' } }, title: { style: { color: '#333', fontWeight: 'bold', fontSize: '12px', fontFamily: 'Trebuchet MS, Verdana, sans-serif' } } }, legend: { itemStyle: { font: '9pt Trebuchet MS, Verdana, sans-serif', color: 'black' }, itemHoverStyle: { color: '#039' }, itemHiddenStyle: { color: 'gray' } }, labels: { style: { color: '#99b' } }, navigation: { buttonOptions: { theme: { stroke: '#CCCCCC' } } } }; // Apply the theme setOptions(Highcharts.theme); }); _registerModule(_modules, 'masters/themes/grid.src.js', [], function () { }); }));
/*! UIkit 3.8.0 | https://www.getuikit.com | (c) 2014 - 2021 YOOtheme | MIT License */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) : typeof define === 'function' && define.amd ? define('uikittooltip', ['uikit-util'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UIkitTooltip = factory(global.UIkit.util)); })(this, (function (uikitUtil) { 'use strict'; var Container = { props: { container: Boolean }, data: { container: true }, computed: { container: function(ref) { var container = ref.container; return container === true && this.$container || container && uikitUtil.$(container); } } }; var Togglable = { props: { cls: Boolean, animation: 'list', duration: Number, origin: String, transition: String }, data: { cls: false, animation: [false], duration: 200, origin: false, transition: 'linear', clsEnter: 'uk-togglabe-enter', clsLeave: 'uk-togglabe-leave', initProps: { overflow: '', height: '', paddingTop: '', paddingBottom: '', marginTop: '', marginBottom: '' }, hideProps: { overflow: 'hidden', height: 0, paddingTop: 0, paddingBottom: 0, marginTop: 0, marginBottom: 0 } }, computed: { hasAnimation: function(ref) { var animation = ref.animation; return !!animation[0]; }, hasTransition: function(ref) { var animation = ref.animation; return this.hasAnimation && animation[0] === true; } }, methods: { toggleElement: function(targets, toggle, animate) { var this$1$1 = this; return new uikitUtil.Promise(function (resolve) { return uikitUtil.Promise.all(uikitUtil.toNodes(targets).map(function (el) { var show = uikitUtil.isBoolean(toggle) ? toggle : !this$1$1.isToggled(el); if (!uikitUtil.trigger(el, ("before" + (show ? 'show' : 'hide')), [this$1$1])) { return uikitUtil.Promise.reject(); } var promise = ( uikitUtil.isFunction(animate) ? animate : animate === false || !this$1$1.hasAnimation ? this$1$1._toggle : this$1$1.hasTransition ? toggleHeight(this$1$1) : toggleAnimation(this$1$1) )(el, show); var cls = show ? this$1$1.clsEnter : this$1$1.clsLeave; uikitUtil.addClass(el, cls); uikitUtil.trigger(el, show ? 'show' : 'hide', [this$1$1]); var done = function () { uikitUtil.removeClass(el, cls); uikitUtil.trigger(el, show ? 'shown' : 'hidden', [this$1$1]); this$1$1.$update(el); }; return promise ? promise.then(done, function () { uikitUtil.removeClass(el, cls); return uikitUtil.Promise.reject(); }) : done(); })).then(resolve, uikitUtil.noop); } ); }, isToggled: function(el) { var assign; if ( el === void 0 ) el = this.$el; (assign = uikitUtil.toNodes(el), el = assign[0]); return uikitUtil.hasClass(el, this.clsEnter) ? true : uikitUtil.hasClass(el, this.clsLeave) ? false : this.cls ? uikitUtil.hasClass(el, this.cls.split(' ')[0]) : uikitUtil.isVisible(el); }, _toggle: function(el, toggled) { if (!el) { return; } toggled = Boolean(toggled); var changed; if (this.cls) { changed = uikitUtil.includes(this.cls, ' ') || toggled !== uikitUtil.hasClass(el, this.cls); changed && uikitUtil.toggleClass(el, this.cls, uikitUtil.includes(this.cls, ' ') ? undefined : toggled); } else { changed = toggled === el.hidden; changed && (el.hidden = !toggled); } uikitUtil.$$('[autofocus]', el).some(function (el) { return uikitUtil.isVisible(el) ? el.focus() || true : el.blur(); }); if (changed) { uikitUtil.trigger(el, 'toggled', [toggled, this]); this.$update(el); } } } }; function toggleHeight(ref) { var isToggled = ref.isToggled; var duration = ref.duration; var initProps = ref.initProps; var hideProps = ref.hideProps; var transition = ref.transition; var _toggle = ref._toggle; return function (el, show) { var inProgress = uikitUtil.Transition.inProgress(el); var inner = el.hasChildNodes ? uikitUtil.toFloat(uikitUtil.css(el.firstElementChild, 'marginTop')) + uikitUtil.toFloat(uikitUtil.css(el.lastElementChild, 'marginBottom')) : 0; var currentHeight = uikitUtil.isVisible(el) ? uikitUtil.height(el) + (inProgress ? 0 : inner) : 0; uikitUtil.Transition.cancel(el); if (!isToggled(el)) { _toggle(el, true); } uikitUtil.height(el, ''); // Update child components first uikitUtil.fastdom.flush(); var endHeight = uikitUtil.height(el) + (inProgress ? 0 : inner); uikitUtil.height(el, currentHeight); return (show ? uikitUtil.Transition.start(el, uikitUtil.assign({}, initProps, {overflow: 'hidden', height: endHeight}), Math.round(duration * (1 - currentHeight / endHeight)), transition) : uikitUtil.Transition.start(el, hideProps, Math.round(duration * (currentHeight / endHeight)), transition).then(function () { return _toggle(el, false); }) ).then(function () { return uikitUtil.css(el, initProps); }); }; } function toggleAnimation(cmp) { return function (el, show) { uikitUtil.Animation.cancel(el); var animation = cmp.animation; var duration = cmp.duration; var _toggle = cmp._toggle; if (show) { _toggle(el, true); return uikitUtil.Animation.in(el, animation[0], duration, cmp.origin); } return uikitUtil.Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(function () { return _toggle(el, false); }); }; } var Position = { props: { pos: String, offset: null, flip: Boolean, clsPos: String }, data: { pos: ("bottom-" + (!uikitUtil.isRtl ? 'left' : 'right')), flip: true, offset: false, clsPos: '' }, computed: { pos: function(ref) { var pos = ref.pos; return (pos + (!uikitUtil.includes(pos, '-') ? '-center' : '')).split('-'); }, dir: function() { return this.pos[0]; }, align: function() { return this.pos[1]; } }, methods: { positionAt: function(element, target, boundary) { uikitUtil.removeClasses(element, ((this.clsPos) + "-(top|bottom|left|right)(-[a-z]+)?")); var ref = this; var offset = ref.offset; var axis = this.getAxis(); if (!uikitUtil.isNumeric(offset)) { var node = uikitUtil.$(offset); offset = node ? uikitUtil.offset(node)[axis === 'x' ? 'left' : 'top'] - uikitUtil.offset(target)[axis === 'x' ? 'right' : 'bottom'] : 0; } var ref$1 = uikitUtil.positionAt( element, target, axis === 'x' ? ((uikitUtil.flipPosition(this.dir)) + " " + (this.align)) : ((this.align) + " " + (uikitUtil.flipPosition(this.dir))), axis === 'x' ? ((this.dir) + " " + (this.align)) : ((this.align) + " " + (this.dir)), axis === 'x' ? ("" + (this.dir === 'left' ? -offset : offset)) : (" " + (this.dir === 'top' ? -offset : offset)), null, this.flip, boundary ).target; var x = ref$1.x; var y = ref$1.y; this.dir = axis === 'x' ? x : y; this.align = axis === 'x' ? y : x; uikitUtil.toggleClass(element, ((this.clsPos) + "-" + (this.dir) + "-" + (this.align)), this.offset === false); }, getAxis: function() { return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x'; } } }; var obj; var Component = { mixins: [Container, Togglable, Position], args: 'title', props: { delay: Number, title: String }, data: { pos: 'top', title: '', delay: 0, animation: ['uk-animation-scale-up'], duration: 100, cls: 'uk-active', clsPos: 'uk-tooltip' }, beforeConnect: function() { this._hasTitle = uikitUtil.hasAttr(this.$el, 'title'); uikitUtil.attr(this.$el, 'title', ''); this.updateAria(false); makeFocusable(this.$el); }, disconnected: function() { this.hide(); uikitUtil.attr(this.$el, 'title', this._hasTitle ? this.title : null); }, methods: { show: function() { var this$1$1 = this; if (this.isToggled(this.tooltip || null) || !this.title) { return; } this._unbind = uikitUtil.once(document, ("show keydown " + uikitUtil.pointerDown), this.hide, false, function (e) { return e.type === uikitUtil.pointerDown && !uikitUtil.within(e.target, this$1$1.$el) || e.type === 'keydown' && e.keyCode === 27 || e.type === 'show' && e.detail[0] !== this$1$1 && e.detail[0].$name === this$1$1.$name; } ); clearTimeout(this.showTimer); this.showTimer = setTimeout(this._show, this.delay); }, hide: function() { var this$1$1 = this; if (uikitUtil.matches(this.$el, 'input:focus')) { return; } clearTimeout(this.showTimer); if (!this.isToggled(this.tooltip || null)) { return; } this.toggleElement(this.tooltip, false, false).then(function () { this$1$1.tooltip = uikitUtil.remove(this$1$1.tooltip); this$1$1._unbind(); }); }, _show: function() { var this$1$1 = this; this.tooltip = uikitUtil.append(this.container, ("<div class=\"" + (this.clsPos) + "\"> <div class=\"" + (this.clsPos) + "-inner\">" + (this.title) + "</div> </div>") ); uikitUtil.on(this.tooltip, 'toggled', function (e, toggled) { this$1$1.updateAria(toggled); if (!toggled) { return; } this$1$1.positionAt(this$1$1.tooltip, this$1$1.$el); this$1$1.origin = this$1$1.getAxis() === 'y' ? ((uikitUtil.flipPosition(this$1$1.dir)) + "-" + (this$1$1.align)) : ((this$1$1.align) + "-" + (uikitUtil.flipPosition(this$1$1.dir))); }); this.toggleElement(this.tooltip, true); }, updateAria: function(toggled) { uikitUtil.attr(this.$el, 'aria-expanded', toggled); } }, events: ( obj = { focus: 'show', blur: 'hide' }, obj[(uikitUtil.pointerEnter + " " + uikitUtil.pointerLeave)] = function (e) { if (!uikitUtil.isTouch(e)) { this[e.type === uikitUtil.pointerEnter ? 'show' : 'hide'](); } }, obj[uikitUtil.pointerDown] = function (e) { if (uikitUtil.isTouch(e)) { this.show(); } }, obj ) }; function makeFocusable(el) { if (!uikitUtil.isFocusable(el)) { uikitUtil.attr(el, 'tabindex', '0'); } } if (typeof window !== 'undefined' && window.UIkit) { window.UIkit.component('tooltip', Component); } return Component; }));
/* * SystemJS 6.10.1 */ (function () { function errMsg(errCode, msg) { return (msg || "") + " (SystemJS Error#" + errCode + " " + "https://git.io/JvFET#" + errCode + ")"; } var hasSymbol = typeof Symbol !== 'undefined'; var hasSelf = typeof self !== 'undefined'; var hasDocument = typeof document !== 'undefined'; var envGlobal = hasSelf ? self : global; var baseUrl; if (hasDocument) { var baseEl = document.querySelector('base[href]'); if (baseEl) baseUrl = baseEl.href; } if (!baseUrl && typeof location !== 'undefined') { baseUrl = location.href.split('#')[0].split('?')[0]; var lastSepIndex = baseUrl.lastIndexOf('/'); if (lastSepIndex !== -1) baseUrl = baseUrl.slice(0, lastSepIndex + 1); } var backslashRegEx = /\\/g; function resolveIfNotPlainOrUrl (relUrl, parentUrl) { if (relUrl.indexOf('\\') !== -1) relUrl = relUrl.replace(backslashRegEx, '/'); // protocol-relative if (relUrl[0] === '/' && relUrl[1] === '/') { return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl; } // relative-url else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) || relUrl.length === 1 && (relUrl += '/')) || relUrl[0] === '/') { var parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1); // Disabled, but these cases will give inconsistent results for deep backtracking //if (parentUrl[parentProtocol.length] !== '/') // throw Error('Cannot resolve'); // read pathname from parent URL // pathname taken to be part after leading "/" var pathname; if (parentUrl[parentProtocol.length + 1] === '/') { // resolving to a :// so we need to read out the auth and host if (parentProtocol !== 'file:') { pathname = parentUrl.slice(parentProtocol.length + 2); pathname = pathname.slice(pathname.indexOf('/') + 1); } else { pathname = parentUrl.slice(8); } } else { // resolving to :/ so pathname is the /... part pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/')); } if (relUrl[0] === '/') return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl; // join together and split for removal of .. and . segments // looping the string instead of anything fancy for perf reasons // '../../../../../z' resolved to 'x/y' is just 'z' var segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl; var output = []; var segmentIndex = -1; for (var i = 0; i < segmented.length; i++) { // busy reading a segment - only terminate on '/' if (segmentIndex !== -1) { if (segmented[i] === '/') { output.push(segmented.slice(segmentIndex, i + 1)); segmentIndex = -1; } } // new segment - check if it is relative else if (segmented[i] === '.') { // ../ segment if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) { output.pop(); i += 2; } // ./ segment else if (segmented[i + 1] === '/' || i + 1 === segmented.length) { i += 1; } else { // the start of a new segment as below segmentIndex = i; } } // it is the start of a new segment else { segmentIndex = i; } } // finish reading out the last segment if (segmentIndex !== -1) output.push(segmented.slice(segmentIndex)); return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join(''); } } /* * Import maps implementation * * To make lookups fast we pre-resolve the entire import map * and then match based on backtracked hash lookups * */ function resolveUrl (relUrl, parentUrl) { return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl)); } function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap, parentUrl) { for (var p in packages) { var resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p; var rhs = packages[p]; // package fallbacks not currently supported if (typeof rhs !== 'string') continue; var mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(rhs, baseUrl) || rhs, parentUrl); if (!mapped) { targetWarning('W1', p, rhs, 'bare specifier did not resolve'); } else outPackages[resolvedLhs] = mapped; } } function resolveAndComposeImportMap (json, baseUrl, outMap) { if (json.imports) resolveAndComposePackages(json.imports, outMap.imports, baseUrl, outMap, null); var u; for (u in json.scopes || {}) { var resolvedScope = resolveUrl(u, baseUrl); resolveAndComposePackages(json.scopes[u], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, outMap, resolvedScope); } for (u in json.depcache || {}) outMap.depcache[resolveUrl(u, baseUrl)] = json.depcache[u]; for (u in json.integrity || {}) outMap.integrity[resolveUrl(u, baseUrl)] = json.integrity[u]; } function getMatch (path, matchObj) { if (matchObj[path]) return path; var sepIndex = path.length; do { var segment = path.slice(0, sepIndex + 1); if (segment in matchObj) return segment; } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1) } function applyPackages (id, packages) { var pkgName = getMatch(id, packages); if (pkgName) { var pkg = packages[pkgName]; if (pkg === null) return; if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/') { targetWarning('W2', pkgName, pkg, "should have a trailing '/'"); } else return pkg + id.slice(pkgName.length); } } function targetWarning (code, match, target, msg) { console.warn(errMsg(code, "Package target " + msg + ", resolving target '" + target + "' for " + match)); } function resolveImportMap (importMap, resolvedOrPlain, parentUrl) { var scopes = importMap.scopes; var scopeUrl = parentUrl && getMatch(parentUrl, scopes); while (scopeUrl) { var packageResolution = applyPackages(resolvedOrPlain, scopes[scopeUrl]); if (packageResolution) return packageResolution; scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), scopes); } return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain; } /* * SystemJS Core * * Provides * - System.import * - System.register support for * live bindings, function hoisting through circular references, * reexports, dynamic import, import.meta.url, top-level await * - System.getRegister to get the registration * - Symbol.toStringTag support in Module objects * - Hookable System.createContext to customize import.meta * - System.onload(err, id, deps) handler for tracing / hot-reloading * * Core comes with no System.prototype.resolve or * System.prototype.instantiate implementations */ var toStringTag = hasSymbol && Symbol.toStringTag; var REGISTRY = hasSymbol ? Symbol() : '@'; function SystemJS () { this[REGISTRY] = {}; } var systemJSPrototype = SystemJS.prototype; systemJSPrototype.import = function (id, parentUrl) { var loader = this; return Promise.resolve(loader.prepareImport()) .then(function() { return loader.resolve(id, parentUrl); }) .then(function (id) { var load = getOrCreateLoad(loader, id); return load.C || topLevelLoad(loader, load); }); }; // Hookable createContext function -> allowing eg custom import meta systemJSPrototype.createContext = function (parentId) { var loader = this; return { url: parentId, resolve: function (id, parentUrl) { return Promise.resolve(loader.resolve(id, parentUrl || parentId)); } }; }; // onLoad(err, id, deps) provided for tracing / hot-reloading systemJSPrototype.onload = function () {}; function loadToId (load) { return load.id; } function triggerOnload (loader, load, err, isErrSource) { loader.onload(err, load.id, load.d && load.d.map(loadToId), !!isErrSource); if (err) throw err; } var lastRegister; systemJSPrototype.register = function (deps, declare) { lastRegister = [deps, declare]; }; /* * getRegister provides the last anonymous System.register call */ systemJSPrototype.getRegister = function () { var _lastRegister = lastRegister; lastRegister = undefined; return _lastRegister; }; function getOrCreateLoad (loader, id, firstParentUrl) { var load = loader[REGISTRY][id]; if (load) return load; var importerSetters = []; var ns = Object.create(null); if (toStringTag) Object.defineProperty(ns, toStringTag, { value: 'Module' }); var instantiatePromise = Promise.resolve() .then(function () { return loader.instantiate(id, firstParentUrl); }) .then(function (registration) { if (!registration) throw Error(errMsg(2, 'Module ' + id + ' did not instantiate')); function _export (name, value) { // note if we have hoisted exports (including reexports) load.h = true; var changed = false; if (typeof name === 'string') { if (!(name in ns) || ns[name] !== value) { ns[name] = value; changed = true; } } else { for (var p in name) { var value = name[p]; if (!(p in ns) || ns[p] !== value) { ns[p] = value; changed = true; } } if (name && name.__esModule) { ns.__esModule = name.__esModule; } } if (changed) for (var i = 0; i < importerSetters.length; i++) { var setter = importerSetters[i]; if (setter) setter(ns); } return value; } var declared = registration[1](_export, registration[1].length === 2 ? { import: function (importId) { return loader.import(importId, id); }, meta: loader.createContext(id) } : undefined); load.e = declared.execute || function () {}; return [registration[0], declared.setters || []]; }, function (err) { load.e = null; load.er = err; triggerOnload(loader, load, err, true); throw err; }); var linkPromise = instantiatePromise .then(function (instantiation) { return Promise.all(instantiation[0].map(function (dep, i) { var setter = instantiation[1][i]; return Promise.resolve(loader.resolve(dep, id)) .then(function (depId) { var depLoad = getOrCreateLoad(loader, depId, id); // depLoad.I may be undefined for already-evaluated return Promise.resolve(depLoad.I) .then(function () { if (setter) { depLoad.i.push(setter); // only run early setters when there are hoisted exports of that module // the timing works here as pending hoisted export calls will trigger through importerSetters if (depLoad.h || !depLoad.I) setter(depLoad.n); } return depLoad; }); }); })) .then(function (depLoads) { load.d = depLoads; }); }); // Capital letter = a promise function return load = loader[REGISTRY][id] = { id: id, // importerSetters, the setters functions registered to this dependency // we retain this to add more later i: importerSetters, // module namespace object n: ns, // instantiate I: instantiatePromise, // link L: linkPromise, // whether it has hoisted exports h: false, // On instantiate completion we have populated: // dependency load records d: undefined, // execution function e: undefined, // On execution we have populated: // the execution error if any er: undefined, // in the case of TLA, the execution promise E: undefined, // On execution, L, I, E cleared // Promise for top-level completion C: undefined, // parent instantiator / executor p: undefined }; } function instantiateAll (loader, load, parent, loaded) { if (!loaded[load.id]) { loaded[load.id] = true; // load.L may be undefined for already-instantiated return Promise.resolve(load.L) .then(function () { if (!load.p || load.p.e === null) load.p = parent; return Promise.all(load.d.map(function (dep) { return instantiateAll(loader, dep, parent, loaded); })); }) .catch(function (err) { if (load.er) throw err; load.e = null; triggerOnload(loader, load, err, false); throw err; }); } } function topLevelLoad (loader, load) { return load.C = instantiateAll(loader, load, load, {}) .then(function () { return postOrderExec(loader, load, {}); }) .then(function () { return load.n; }); } // the closest we can get to call(undefined) var nullContext = Object.freeze(Object.create(null)); // returns a promise if and only if a top-level await subgraph // throws on sync errors function postOrderExec (loader, load, seen) { if (seen[load.id]) return; seen[load.id] = true; if (!load.e) { if (load.er) throw load.er; if (load.E) return load.E; return; } // deps execute first, unless circular var depLoadPromises; load.d.forEach(function (depLoad) { try { var depLoadPromise = postOrderExec(loader, depLoad, seen); if (depLoadPromise) (depLoadPromises = depLoadPromises || []).push(depLoadPromise); } catch (err) { load.e = null; load.er = err; triggerOnload(loader, load, err, false); throw err; } }); if (depLoadPromises) return Promise.all(depLoadPromises).then(doExec); return doExec(); function doExec () { try { var execPromise = load.e.call(nullContext); if (execPromise) { execPromise = execPromise.then(function () { load.C = load.n; load.E = null; // indicates completion if (!false) triggerOnload(loader, load, null, true); }, function (err) { load.er = err; load.E = null; if (!false) triggerOnload(loader, load, err, true); throw err; }); return load.E = execPromise; } // (should be a promise, but a minify optimization to leave out Promise.resolve) load.C = load.n; load.L = load.I = undefined; } catch (err) { load.er = err; throw err; } finally { load.e = null; triggerOnload(loader, load, load.er, true); } } } envGlobal.System = new SystemJS(); /* * SystemJS browser attachments for script and import map processing */ var importMapPromise = Promise.resolve(); var importMap = { imports: {}, scopes: {}, depcache: {}, integrity: {} }; // Scripts are processed immediately, on the first System.import, and on DOMReady. // Import map scripts are processed only once (by being marked) and in order for each phase. // This is to avoid using DOM mutation observers in core, although that would be an alternative. var processFirst = hasDocument; systemJSPrototype.prepareImport = function (doProcessScripts) { if (processFirst || doProcessScripts) { processScripts(); processFirst = false; } return importMapPromise; }; if (hasDocument) { processScripts(); window.addEventListener('DOMContentLoaded', processScripts); } function processScripts () { [].forEach.call(document.querySelectorAll('script'), function (script) { if (script.sp) // sp marker = systemjs processed return; // TODO: deprecate systemjs-module in next major now that we have auto import if (script.type === 'systemjs-module') { script.sp = true; if (!script.src) return; System.import(script.src.slice(0, 7) === 'import:' ? script.src.slice(7) : resolveUrl(script.src, baseUrl)).catch(function (e) { // if there is a script load error, dispatch an "error" event // on the script tag. if (e.message.indexOf('https://git.io/JvFET#3') > -1) { var event = document.createEvent('Event'); event.initEvent('error', false, false); script.dispatchEvent(event); } return Promise.reject(e); }); } else if (script.type === 'systemjs-importmap') { script.sp = true; var fetchPromise = script.src ? fetch(script.src, { integrity: script.integrity }).then(function (res) { if (!res.ok) throw Error( 'Invalid status code: ' + res.status); return res.text(); }).catch(function (err) { err.message = errMsg('W4', 'Error fetching systemjs-import map ' + script.src) + '\n' + err.message; console.warn(err); if (typeof script.onerror === 'function') { script.onerror(); } return '{}'; }) : script.innerHTML; importMapPromise = importMapPromise.then(function () { return fetchPromise; }).then(function (text) { extendImportMap(importMap, text, script.src || baseUrl); }); } }); } function extendImportMap (importMap, newMapText, newMapUrl) { var newMap = {}; try { newMap = JSON.parse(newMapText); } catch (err) { console.warn(Error(( errMsg('W5', "systemjs-importmap contains invalid JSON") + '\n\n' + newMapText + '\n' ))); } resolveAndComposeImportMap(newMap, newMapUrl, importMap); } /* * Script instantiation loading */ if (hasDocument) { window.addEventListener('error', function (evt) { lastWindowErrorUrl = evt.filename; lastWindowError = evt.error; }); var baseOrigin = location.origin; } systemJSPrototype.createScript = function (url) { var script = document.createElement('script'); script.async = true; // Only add cross origin for actual cross origin // this is because Safari triggers for all // - https://bugs.webkit.org/show_bug.cgi?id=171566 if (url.indexOf(baseOrigin + '/')) script.crossOrigin = 'anonymous'; var integrity = importMap.integrity[url]; if (integrity) script.integrity = integrity; script.src = url; return script; }; // Auto imports -> script tags can be inlined directly for load phase var lastAutoImportUrl, lastAutoImportDeps, lastAutoImportTimeout; var autoImportCandidates = {}; var systemRegister = systemJSPrototype.register; systemJSPrototype.register = function (deps, declare) { if (hasDocument && document.readyState === 'loading' && typeof deps !== 'string') { var scripts = document.querySelectorAll('script[src]'); var lastScript = scripts[scripts.length - 1]; if (lastScript) { lastAutoImportUrl = lastScript.src; lastAutoImportDeps = deps; // if this is already a System load, then the instantiate has already begun // so this re-import has no consequence var loader = this; lastAutoImportTimeout = setTimeout(function () { autoImportCandidates[lastScript.src] = [deps, declare]; loader.import(lastScript.src); }); } } else { lastAutoImportDeps = undefined; } return systemRegister.call(this, deps, declare); }; var lastWindowErrorUrl, lastWindowError; systemJSPrototype.instantiate = function (url, firstParentUrl) { var autoImportRegistration = autoImportCandidates[url]; if (autoImportRegistration) { delete autoImportCandidates[url]; return autoImportRegistration; } var loader = this; return new Promise(function (resolve, reject) { var script = systemJSPrototype.createScript(url); script.addEventListener('error', function () { reject(Error(errMsg(3, 'Error loading ' + url + (firstParentUrl ? ' from ' + firstParentUrl : '')))); }); script.addEventListener('load', function () { document.head.removeChild(script); // Note that if an error occurs that isn't caught by this if statement, // that getRegister will return null and a "did not instantiate" error will be thrown. if (lastWindowErrorUrl === url) { reject(lastWindowError); } else { var register = loader.getRegister(); // Clear any auto import registration for dynamic import scripts during load if (register && register[0] === lastAutoImportDeps) clearTimeout(lastAutoImportTimeout); resolve(register); } }); document.head.appendChild(script); }); }; /* * Fetch loader, sets up shouldFetch and fetch hooks */ systemJSPrototype.shouldFetch = function () { return false; }; if (typeof fetch !== 'undefined') systemJSPrototype.fetch = fetch; var instantiate = systemJSPrototype.instantiate; var jsContentTypeRegEx = /^(text|application)\/(x-)?javascript(;|$)/; systemJSPrototype.instantiate = function (url, parent) { var loader = this; if (!this.shouldFetch(url)) return instantiate.apply(this, arguments); return this.fetch(url, { credentials: 'same-origin', integrity: importMap.integrity[url] }) .then(function (res) { if (!res.ok) throw Error(errMsg(7, res.status + ' ' + res.statusText + ', loading ' + url + (parent ? ' from ' + parent : ''))); var contentType = res.headers.get('content-type'); if (!contentType || !jsContentTypeRegEx.test(contentType)) throw Error(errMsg(4, 'Unknown Content-Type "' + contentType + '", loading ' + url + (parent ? ' from ' + parent : ''))); return res.text().then(function (source) { if (source.indexOf('//# sourceURL=') < 0) source += '\n//# sourceURL=' + url; (0, eval)(source); return loader.getRegister(); }); }); }; systemJSPrototype.resolve = function (id, parentUrl) { parentUrl = parentUrl || !true || baseUrl; return resolveImportMap(( importMap), resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl); }; function throwUnresolved (id, parentUrl) { throw Error(errMsg(8, "Unable to resolve bare specifier '" + id + (parentUrl ? "' from " + parentUrl : "'"))); } var systemInstantiate = systemJSPrototype.instantiate; systemJSPrototype.instantiate = function (url, firstParentUrl) { var preloads = ( importMap).depcache[url]; if (preloads) { for (var i = 0; i < preloads.length; i++) getOrCreateLoad(this, this.resolve(preloads[i], url), url); } return systemInstantiate.call(this, url, firstParentUrl); }; /* * Supports loading System.register in workers */ if (hasSelf && typeof importScripts === 'function') systemJSPrototype.instantiate = function (url) { var loader = this; return Promise.resolve().then(function () { importScripts(url); return loader.getRegister(); }); }; /* * SystemJS global script loading support * Extra for the s.js build only * (Included by default in system.js build) */ (function (global) { var systemJSPrototype = global.System.constructor.prototype; // safari unpredictably lists some new globals first or second in object order var firstGlobalProp, secondGlobalProp, lastGlobalProp; function getGlobalProp (useFirstGlobalProp) { var cnt = 0; var foundLastProp, result; for (var p in global) { // do not check frames cause it could be removed during import if (shouldSkipProperty(p)) continue; if (cnt === 0 && p !== firstGlobalProp || cnt === 1 && p !== secondGlobalProp) return p; if (foundLastProp) { lastGlobalProp = p; result = useFirstGlobalProp && result || p; } else { foundLastProp = p === lastGlobalProp; } cnt++; } return result; } function noteGlobalProps () { // alternatively Object.keys(global).pop() // but this may be faster (pending benchmarks) firstGlobalProp = secondGlobalProp = undefined; for (var p in global) { // do not check frames cause it could be removed during import if (shouldSkipProperty(p)) continue; if (!firstGlobalProp) firstGlobalProp = p; else if (!secondGlobalProp) secondGlobalProp = p; lastGlobalProp = p; } return lastGlobalProp; } var impt = systemJSPrototype.import; systemJSPrototype.import = function (id, parentUrl) { noteGlobalProps(); return impt.call(this, id, parentUrl); }; var emptyInstantiation = [[], function () { return {} }]; var getRegister = systemJSPrototype.getRegister; systemJSPrototype.getRegister = function () { var lastRegister = getRegister.call(this); if (lastRegister) return lastRegister; // no registration -> attempt a global detection as difference from snapshot // when multiple globals, we take the global value to be the last defined new global object property // for performance, this will not support multi-version / global collisions as previous SystemJS versions did // note in Edge, deleting and re-adding a global does not change its ordering var globalProp = getGlobalProp(this.firstGlobalProp); if (!globalProp) return emptyInstantiation; var globalExport; try { globalExport = global[globalProp]; } catch (e) { return emptyInstantiation; } return [[], function (_export) { return { execute: function () { _export(globalExport); _export({ default: globalExport, __useDefault: true }); } }; }]; }; var isIE11 = typeof navigator !== 'undefined' && navigator.userAgent.indexOf('Trident') !== -1; function shouldSkipProperty(p) { return !global.hasOwnProperty(p) || !isNaN(p) && p < global.length || isIE11 && global[p] && typeof window !== 'undefined' && global[p].parent === window; } })(typeof self !== 'undefined' ? self : global); /* * Loads JSON, CSS, Wasm module types based on file extension * filters and content type verifications */ (function(global) { var systemJSPrototype = global.System.constructor.prototype; var moduleTypesRegEx = /^[^#?]+\.(css|html|json|wasm)([?#].*)?$/; systemJSPrototype.shouldFetch = function (url) { return moduleTypesRegEx.test(url); }; var jsonContentType = /^application\/json(;|$)/; var cssContentType = /^text\/css(;|$)/; var wasmContentType = /^application\/wasm(;|$)/; var fetch = systemJSPrototype.fetch; systemJSPrototype.fetch = function (url, options) { return fetch(url, options) .then(function (res) { if (!res.ok) return res; var contentType = res.headers.get('content-type'); if (jsonContentType.test(contentType)) return res.json() .then(function (json) { return new Response(new Blob([ 'System.register([],function(e){return{execute:function(){e("default",' + JSON.stringify(json) + ')}}})' ], { type: 'application/javascript' })); }); if (cssContentType.test(contentType)) return res.text() .then(function (source) { source = source.replace(/url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g, function (match, quotes, relUrl1, relUrl2) { return 'url(' + quotes + resolveUrl(relUrl1 || relUrl2, url) + quotes + ')'; }); return new Response(new Blob([ 'System.register([],function(e){return{execute:function(){var s=new CSSStyleSheet();s.replaceSync(' + JSON.stringify(source) + ');e("default",s)}}})' ], { type: 'application/javascript' })); }); if (wasmContentType.test(contentType)) return (WebAssembly.compileStreaming ? WebAssembly.compileStreaming(res) : res.arrayBuffer().then(WebAssembly.compile)) .then(function (module) { if (!global.System.wasmModules) global.System.wasmModules = Object.create(null); global.System.wasmModules[url] = module; // we can only set imports if supported (eg early Safari doesnt support) var deps = []; var setterSources = []; if (WebAssembly.Module.imports) WebAssembly.Module.imports(module).forEach(function (impt) { var key = JSON.stringify(impt.module); if (deps.indexOf(key) === -1) { deps.push(key); setterSources.push('function(m){i[' + key + ']=m}'); } }); return new Response(new Blob([ 'System.register([' + deps.join(',') + '],function(e){var i={};return{setters:[' + setterSources.join(',') + '],execute:function(){return WebAssembly.instantiate(System.wasmModules[' + JSON.stringify(url) + '],i).then(function(m){e(m.exports)})}}})' ], { type: 'application/javascript' })); }); return res; }); }; })(typeof self !== 'undefined' ? self : global); var toStringTag$1 = typeof Symbol !== 'undefined' && Symbol.toStringTag; systemJSPrototype.get = function (id) { var load = this[REGISTRY][id]; if (load && load.e === null && !load.E) { if (load.er) return null; return load.n; } }; systemJSPrototype.set = function (id, module) { { try { // No page-relative URLs allowed new URL(id); } catch (err) { console.warn(Error(errMsg('W3', '"' + id + '" is not a valid URL to set in the module registry'))); } } var ns; if (toStringTag$1 && module[toStringTag$1] === 'Module') { ns = module; } else { ns = Object.assign(Object.create(null), module); if (toStringTag$1) Object.defineProperty(ns, toStringTag$1, { value: 'Module' }); } var done = Promise.resolve(ns); var load = this[REGISTRY][id] || (this[REGISTRY][id] = { id: id, i: [], h: false, d: [], e: null, er: undefined, E: undefined }); if (load.e || load.E) return false; Object.assign(load, { n: ns, I: undefined, L: undefined, C: done }); return ns; }; systemJSPrototype.has = function (id) { var load = this[REGISTRY][id]; return !!load; }; // Delete function provided for hot-reloading use cases systemJSPrototype.delete = function (id) { var registry = this[REGISTRY]; var load = registry[id]; // in future we can support load.E case by failing load first // but that will require TLA callbacks to be implemented if (!load || (load.p && load.p.e !== null) || load.E) return false; var importerSetters = load.i; // remove from importerSetters // (release for gc) if (load.d) load.d.forEach(function (depLoad) { var importerIndex = depLoad.i.indexOf(load); if (importerIndex !== -1) depLoad.i.splice(importerIndex, 1); }); delete registry[id]; return function () { var load = registry[id]; if (!load || !importerSetters || load.e !== null || load.E) return false; // add back the old setters importerSetters.forEach(function (setter) { load.i.push(setter); setter(load.n); }); importerSetters = null; }; }; var iterator = typeof Symbol !== 'undefined' && Symbol.iterator; systemJSPrototype.entries = function () { var loader = this, keys = Object.keys(loader[REGISTRY]); var index = 0, ns, key; var result = { next: function () { while ( (key = keys[index++]) !== undefined && (ns = loader.get(key)) === undefined ); return { done: key === undefined, value: key !== undefined && [key, ns] }; } }; result[iterator] = function() { return this }; return result; }; }());
/*! * froala_editor v3.2.3 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2020 Froala Labs */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('froala-editor')) : typeof define === 'function' && define.amd ? define(['froala-editor'], factory) : (factory(global.FroalaEditor)); }(this, (function (FE) { 'use strict'; FE = FE && FE.hasOwnProperty('default') ? FE['default'] : FE; /** * Ukrainian */ FE.LANGUAGE['uk'] = { translation: { // Place holder 'Type something': "\u041D\u0430\u043F\u0438\u0448\u0456\u0442\u044C \u0431\u0443\u0434\u044C-\u0449\u043E", // Basic formatting 'Bold': "\u0416\u0438\u0440\u043D\u0438\u0439", 'Italic': "\u041A\u0443\u0440\u0441\u0438\u0432", 'Underline': "\u041F\u0456\u0434\u043A\u0440\u0435\u0441\u043B\u0435\u043D\u0438\u0439", 'Strikethrough': "\u0417\u0430\u043A\u0440\u0435\u0441\u043B\u0435\u043D\u0438\u0439", // Main buttons 'Insert': "\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438", 'Delete': "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438", 'Cancel': "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438", 'OK': 'OK', 'Back': "\u043D\u0430\u0437\u0430\u0434", 'Remove': "\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438", 'More': "\u0431\u0456\u043B\u044C\u0448\u0435", 'Update': "\u043E\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u044F", 'Style': "\u0441\u0442\u0438\u043B\u044C", // Font 'Font Family': "\u0428\u0440\u0438\u0444\u0442", 'Font Size': "\u0420\u043E\u0437\u043C\u0456\u0440 \u0448\u0440\u0438\u0444\u0442\u0443", // Colors 'Colors': "\u043A\u043E\u043B\u044C\u043E\u0440\u0438", 'Background': "\u0424\u043E\u043D", 'Text': "\u0422\u0435\u043A\u0441\u0442", 'HEX Color': 'Шістнадцятковий колір', // Paragraphs 'Paragraph Format': "\u0424\u043E\u0440\u043C\u0430\u0442", 'Normal': "\u041D\u043E\u0440\u043C\u0430\u043B\u044C\u043D\u0438\u0439", 'Code': "\u041A\u043E\u0434", 'Heading 1': "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 1", 'Heading 2': "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 2", 'Heading 3': "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 3", 'Heading 4': "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 4", // Style 'Paragraph Style': "\u043F\u0443\u043D\u043A\u0442 \u0441\u0442\u0438\u043B\u044C", 'Inline Style': "\u0432\u0431\u0443\u0434\u043E\u0432\u0430\u043D\u0438\u0439 \u0441\u0442\u0438\u043B\u044C", // Alignment 'Align': "\u0412\u0438\u0440\u0456\u0432\u043D\u044E\u0432\u0430\u043D\u043D\u044F", 'Align Left': "\u041F\u043E \u043B\u0456\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E", 'Align Center': "\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443", 'Align Right': "\u041F\u043E \u043F\u0440\u0430\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E", 'Align Justify': "\u041F\u043E \u0448\u0438\u0440\u0438\u043D\u0456", 'None': "\u043D\u0456", // Lists 'Ordered List': "\u041D\u0443\u043C\u0435\u0440\u043E\u0432\u0430\u043D\u0438\u0439 \u0441\u043F\u0438\u0441\u043E\u043A", 'Unordered List': "\u041C\u0430\u0440\u043A\u043E\u0432\u0430\u043D\u0438\u0439 \u0441\u043F\u0438\u0441\u043E\u043A", // Indent 'Decrease Indent': "\u0417\u043C\u0435\u043D\u0448\u0438\u0442\u0438 \u0432\u0456\u0434\u0441\u0442\u0443\u043F", 'Increase Indent': "\u0417\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438 \u0432\u0456\u0434\u0441\u0442\u0443\u043F", // Links 'Insert Link': "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F", 'Open in new tab': "\u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u0432 \u043D\u043E\u0432\u0456\u0439 \u0432\u043A\u043B\u0430\u0434\u0446\u0456", 'Open Link': "\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F", 'Edit Link': "\u0440\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F", 'Unlink': "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F", 'Choose Link': "\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F", // Images 'Insert Image': "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F", 'Upload Image': "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438 \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F", 'By URL': "\u0437\u0430 URL", 'Browse': "\u043F\u0435\u0440\u0435\u0433\u043B\u044F\u0434\u0430\u0442\u0438", 'Drop image': "\u041F\u0435\u0440\u0435\u043C\u0456\u0441\u0442\u0456\u0442\u044C \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F \u0441\u044E\u0434\u0438", 'or click': "\u0430\u0431\u043E \u043D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C", 'Manage Images': "\u041A\u0435\u0440\u0443\u0432\u0430\u043D\u043D\u044F \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F\u043C\u0438", 'Loading': "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F", 'Deleting': "\u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043D\u044F", 'Tags': "\u043A\u043B\u044E\u0447\u043E\u0432\u0456 \u0441\u043B\u043E\u0432\u0430", 'Are you sure? Image will be deleted.': "\u0412\u0438 \u0432\u043F\u0435\u0432\u043D\u0435\u043D\u0456? \u0417\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F \u0431\u0443\u0434\u0435 \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E.", 'Replace': "\u0437\u0430\u043C\u0456\u043D\u044E\u0432\u0430\u0442\u0438", 'Uploading': "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F", 'Loading image': "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u044C", 'Display': "\u0434\u0438\u0441\u043F\u043B\u0435\u0439", 'Inline': "\u0412 \u043B\u0456\u043D\u0456\u044E", 'Break Text': "\u043F\u0435\u0440\u0435\u0440\u0432\u0430 \u0442\u0435\u043A\u0441\u0442", 'Alternative Text': "\u0430\u043B\u044C\u0442\u0435\u0440\u043D\u0430\u0442\u0438\u0432\u043D\u0438\u0439 \u0442\u0435\u043A\u0441\u0442", 'Change Size': "\u0437\u043C\u0456\u043D\u0438\u0442\u0438 \u0440\u043E\u0437\u043C\u0456\u0440", 'Width': "\u0428\u0438\u0440\u0438\u043D\u0430", 'Height': "\u0412\u0438\u0441\u043E\u0442\u0430", 'Something went wrong. Please try again.': "\u0429\u043E\u0441\u044C \u043F\u0456\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A. \u0411\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430 \u0441\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0449\u0435 \u0440\u0430\u0437.", 'Image Caption': 'Заголовок зображення', 'Advanced Edit': 'Розширений редагування', // Video 'Insert Video': "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0432\u0456\u0434\u0435\u043E", 'Embedded Code': "\u0432\u0431\u0443\u0434\u043E\u0432\u0430\u043D\u0438\u0439 \u043A\u043E\u0434", 'Paste in a video URL': 'Вставте в відео-URL', 'Drop video': 'Перетягніть відео', 'Your browser does not support HTML5 video.': 'Ваш браузер не підтримує відео html5.', 'Upload Video': 'Завантажити відео', // Tables 'Insert Table': "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0442\u0430\u0431\u043B\u0438\u0446\u044E", 'Table Header': "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u0442\u0430\u0431\u043B\u0438\u0446\u0456", 'Remove Table': "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0442\u0430\u0431\u043B\u0438\u0446\u0456", 'Table Style': "\u0421\u0442\u0438\u043B\u044C \u0442\u0430\u0431\u043B\u0438\u0446\u0456", 'Horizontal Align': "\u0413\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u0435 \u0432\u0438\u0440\u0456\u0432\u043D\u044E\u0432\u0430\u043D\u043D\u044F", 'Row': "\u0420\u044F\u0434\u043E\u043A", 'Insert row above': "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u043F\u043E\u0440\u043E\u0436\u043D\u0456\u0439 \u0440\u044F\u0434\u043E\u043A \u0437\u0432\u0435\u0440\u0445\u0443", 'Insert row below': "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u043F\u043E\u0440\u043E\u0436\u043D\u0456\u0439 \u0440\u044F\u0434\u043E\u043A \u0437\u043D\u0438\u0437\u0443", 'Delete row': "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0440\u044F\u0434\u043E\u043A", 'Column': "\u0421\u0442\u043E\u0432\u043F\u0435\u0446\u044C", 'Insert column before': "\u0414\u043E\u0434\u0430\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C \u043B\u0456\u0432\u043E\u0440\u0443\u0447", 'Insert column after': "\u0414\u043E\u0434\u0430\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C \u043F\u0440\u0430\u0432\u043E\u0440\u0443\u0447", 'Delete column': "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C", 'Cell': "\u041A\u043E\u043C\u0456\u0440\u043A\u0430", 'Merge cells': "\u041E\u0431'\u0454\u0434\u043D\u0430\u0442\u0438 \u043A\u043E\u043C\u0456\u0440\u043A\u0438", 'Horizontal split': "\u0420\u043E\u0437\u0434\u0456\u043B\u0438\u0442\u0438 \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u043E", 'Vertical split': "\u0420\u043E\u0437\u0434\u0456\u043B\u0438\u0442\u0438 \u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E", 'Cell Background': "\u0441\u0442\u0456\u043B\u044C\u043D\u0438\u043A\u043E\u0432\u0438\u0439 \u0444\u043E\u043D", 'Vertical Align': "\u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u0430 \u0432\u0438\u0440\u0456\u0432\u043D\u044E\u0432\u0430\u043D\u043D\u044F", 'Top': "\u0422\u043E\u043F", 'Middle': "\u0441\u0435\u0440\u0435\u0434\u043D\u0456\u0439", 'Bottom': "\u0434\u043D\u043E", 'Align Top': "\u0417\u0456\u0441\u0442\u0430\u0432\u0442\u0435 \u0432\u0435\u0440\u0445\u043D\u044E", 'Align Middle': "\u0432\u0438\u0440\u0456\u0432\u043D\u044F\u0442\u0438 \u043F\u043E \u0441\u0435\u0440\u0435\u0434\u0438\u043D\u0456", 'Align Bottom': "\u0417\u0456\u0441\u0442\u0430\u0432\u0442\u0435 \u043D\u0438\u0436\u043D\u044E", 'Cell Style': "\u0441\u0442\u0438\u043B\u044C \u043A\u043E\u043C\u0456\u0440\u043A\u0438", // Files 'Upload File': "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438 \u0444\u0430\u0439\u043B", 'Drop file': "\u041F\u0435\u0440\u0435\u043C\u0456\u0441\u0442\u0456\u0442\u044C \u0444\u0430\u0439\u043B \u0441\u044E\u0434\u0438", // Emoticons 'Emoticons': "\u0441\u043C\u0430\u0439\u043B\u0438", 'Grinning face': "\u043F\u043E\u0441\u043C\u0456\u0445\u043D\u0443\u0432\u0448\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430", 'Grinning face with smiling eyes': "\u041F\u043E\u0441\u043C\u0456\u0445\u043D\u0443\u0432\u0448\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430 \u0437 \u0443\u0441\u043C\u0456\u0445\u043D\u0435\u043D\u0438\u043C\u0438 \u043E\u0447\u0438\u043C\u0430", 'Face with tears of joy': "\u041E\u0431\u043B\u0438\u0447\u0447\u044F \u0437\u0456 \u0441\u043B\u044C\u043E\u0437\u0430\u043C\u0438 \u0440\u0430\u0434\u043E\u0441\u0442\u0456", 'Smiling face with open mouth': "\u0423\u0441\u043C\u0456\u0445\u043D\u0435\u043D\u0435 \u043E\u0431\u043B\u0438\u0447\u0447\u044F \u0437 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u043C \u0440\u043E\u0442\u043E\u043C", 'Smiling face with open mouth and smiling eyes': "\u041F\u043E\u0441\u043C\u0456\u0445\u0430\u044E\u0447\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430 \u0437 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u043C \u0440\u043E\u0442\u043E\u043C \u0456 ", 'Smiling face with open mouth and cold sweat': "\u041F\u043E\u0441\u043C\u0456\u0445\u0430\u044E\u0447\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430 \u0437 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u043C \u0440\u043E\u0442\u043E\u043C \u0456 ", 'Smiling face with open mouth and tightly-closed eyes': "\u041F\u043E\u0441\u043C\u0456\u0445\u0430\u044E\u0447\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430 \u0437 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u043C \u0440\u043E\u0442\u043E\u043C \u0456 \u0449\u0456\u043B\u044C\u043D\u043E \u0437\u0430\u043A\u0440\u0438\u0442\u0438\u043C\u0438 \u043E\u0447\u0438\u043C\u0430", 'Smiling face with halo': "\u041F\u043E\u0441\u043C\u0456\u0445\u0430\u044E\u0447\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430 \u0433\u0430\u043B\u043E", 'Smiling face with horns': "\u041F\u043E\u0441\u043C\u0456\u0445\u0430\u044E\u0447\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430 \u0437 \u0440\u043E\u0433\u0430\u043C\u0438", 'Winking face': "\u043F\u0456\u0434\u043C\u043E\u0440\u0433\u0443\u044E\u0447\u0438 \u043E\u0441\u043E\u0431\u0430", 'Smiling face with smiling eyes': "\u041F\u043E\u0441\u043C\u0456\u0445\u0430\u044E\u0447\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430 \u0437 \u0443\u0441\u043C\u0456\u0445\u043D\u0435\u043D\u0438\u043C\u0438 \u043E\u0447\u0438\u043C\u0430", 'Face savoring delicious food': "\u041E\u0441\u043E\u0431\u0430 \u0441\u043C\u0430\u043A\u0443\u044E\u0447\u0438 \u0441\u043C\u0430\u0447\u043D\u0443 \u0457\u0436\u0443", 'Relieved face': "\u0437\u0432\u0456\u043B\u044C\u043D\u0435\u043D\u043E \u043E\u0441\u043E\u0431\u0430", 'Smiling face with heart-shaped eyes': "\u041F\u043E\u0441\u043C\u0456\u0445\u0430\u044E\u0447\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430 \u0443 \u0444\u043E\u0440\u043C\u0456 \u0441\u0435\u0440\u0446\u044F \u043E\u0447\u0438\u043C\u0430", 'Smiling face with sunglasses': "Smiling face with sunglasses", 'Smirking face': "\u043F\u043E\u0441\u043C\u0456\u0445\u043D\u0443\u0432\u0448\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430", 'Neutral face': "\u0437\u0432\u0438\u0447\u0430\u0439\u043D\u0438\u0439 \u043E\u0441\u043E\u0431\u0430", 'Expressionless face': "\u043D\u0435\u0432\u0438\u0440\u0430\u0437\u043D\u0456 \u043E\u0431\u043B\u0438\u0447\u0447\u044F", 'Unamused face': "Unamused \u043E\u0441\u043E\u0431\u0430", 'Face with cold sweat': "\u041E\u0441\u043E\u0431\u0430 \u0437 \u0445\u043E\u043B\u043E\u0434\u043D\u043E\u0433\u043E \u043F\u043E\u0442\u0443", 'Pensive face': "\u0437\u0430\u043C\u0438\u0441\u043B\u0435\u043D\u0438\u0439 \u043E\u0441\u043E\u0431\u0430", 'Confused face': "\u043F\u043B\u0443\u0442\u0430\u0442\u0438 \u043E\u0441\u043E\u0431\u0430", 'Confounded face': "\u043D\u0435\u0445\u0430\u0439 \u043F\u043E\u0441\u043E\u0440\u043E\u043C\u043B\u044F\u0442\u044C\u0441\u044F \u043E\u0441\u043E\u0431\u0430", 'Kissing face': "\u043F\u043E\u0446\u0456\u043B\u0443\u043D\u043A\u0438 \u043E\u0441\u043E\u0431\u0430", 'Face throwing a kiss': "\u041E\u0441\u043E\u0431\u0430 \u043A\u0438\u0434\u0430\u043B\u0438 \u043F\u043E\u0446\u0456\u043B\u0443\u043D\u043E\u043A", 'Kissing face with smiling eyes': "\u041F\u043E\u0446\u0456\u043B\u0443\u043D\u043A\u0438 \u043E\u0441\u043E\u0431\u0430 \u0437 \u0443\u0441\u043C\u0456\u0445\u043D\u0435\u043D\u0438\u043C\u0438 \u043E\u0447\u0438\u043C\u0430", 'Kissing face with closed eyes': "\u041F\u043E\u0446\u0456\u043B\u0443\u043D\u043A\u0438 \u043E\u0431\u043B\u0438\u0447\u0447\u044F \u0437 \u0437\u0430\u043F\u043B\u044E\u0449\u0435\u043D\u0438\u043C\u0438 \u043E\u0447\u0438\u043C\u0430", 'Face with stuck out tongue': "\u041E\u0431\u043B\u0438\u0447\u0447\u044F \u0437 \u0441\u0442\u0438\u0440\u0447\u0430\u043B\u0438 \u044F\u0437\u0438\u043A", 'Face with stuck out tongue and winking eye': "\u041E\u0431\u043B\u0438\u0447\u0447\u044F \u0437 \u0441\u0442\u0438\u0440\u0447\u0430\u043B\u0438 \u044F\u0437\u0438\u043A\u0430 \u0456 \u0410\u043D\u0456\u043C\u043E\u0432\u0430\u043D\u0435 \u043E\u0447\u0435\u0439", 'Face with stuck out tongue and tightly-closed eyes': "\u041E\u0431\u043B\u0438\u0447\u0447\u044F \u0437 \u0441\u0442\u0438\u0440\u0447\u0430\u043B\u0438 \u044F\u0437\u0438\u043A\u0430 \u0456 \u0449\u0456\u043B\u044C\u043D\u043E \u0437\u0430\u043A\u0440\u0438\u0442\u0456 \u043E\u0447\u0456", 'Disappointed face': "\u0440\u043E\u0437\u0447\u0430\u0440\u043E\u0432\u0430\u043D\u0438\u0439 \u043E\u0441\u043E\u0431\u0430", 'Worried face': "\u0441\u0442\u0443\u0440\u0431\u043E\u0432\u0430\u043D\u0438\u0439 \u043E\u0441\u043E\u0431\u0430", 'Angry face': "\u0437\u043B\u0438\u0439 \u043E\u0441\u043E\u0431\u0430", 'Pouting face': "\u043F\u0443\u0445\u043A\u0456 \u043E\u0441\u043E\u0431\u0430", 'Crying face': "\u043F\u043B\u0430\u0447 \u043E\u0441\u043E\u0431\u0430", 'Persevering face': "\u043D\u0430\u043F\u043E\u043B\u0435\u0433\u043B\u0438\u0432\u0430 \u043E\u0441\u043E\u0431\u0430", 'Face with look of triumph': "\u041E\u0441\u043E\u0431\u0430 \u0437 \u0432\u0438\u0434\u043E\u043C \u0442\u0440\u0456\u0443\u043C\u0444\u0443", 'Disappointed but relieved face': "\u0420\u043E\u0437\u0447\u0430\u0440\u043E\u0432\u0430\u043D\u0438\u0439, \u0430\u043B\u0435 \u0437\u0432\u0456\u043B\u044C\u043D\u0435\u043D\u0438\u0439 \u043E\u0441\u043E\u0431\u0430", 'Frowning face with open mouth': "\u041D\u0430\u0441\u0443\u043F\u0438\u0432\u0448\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430 \u0437 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u043C \u0440\u043E\u0442\u043E\u043C", 'Anguished face': "\u0431\u043E\u043B\u0456\u0441\u043D\u0438\u0439 \u043E\u0441\u043E\u0431\u0430", 'Fearful face': "\u043F\u043E\u0431\u043E\u044E\u044E\u0447\u0438\u0441\u044C \u043E\u0441\u043E\u0431\u0430", 'Weary face': "\u0432\u0442\u043E\u043C\u043B\u0435\u043D\u0438\u0439 \u043E\u0441\u043E\u0431\u0430", 'Sleepy face': 'сонне обличчя', 'Tired face': "\u0432\u0442\u043E\u043C\u0438\u043B\u0438\u0441\u044F \u043E\u0441\u043E\u0431\u0430", 'Grimacing face': "\u0433\u0440\u0438\u043C\u0430\u0441\u0443\u044E\u0447\u0438 \u043E\u0441\u043E\u0431\u0430", 'Loudly crying face': "Loudly crying face", 'Face with open mouth': "\u041E\u0441\u043E\u0431\u0430 \u0437 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u043C \u0440\u043E\u0442\u043E\u043C", 'Hushed face': "\u0437\u0430\u0442\u0438\u0445 \u043E\u0441\u043E\u0431\u0430", 'Face with open mouth and cold sweat': "\u041E\u0441\u043E\u0431\u0430 \u0437 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u043C \u0440\u043E\u0442\u043E\u043C \u0456 \u0445\u043E\u043B\u043E\u0434\u043D\u0438\u0439 \u043F\u0456\u0442", 'Face screaming in fear': "\u041E\u0441\u043E\u0431\u0430 \u043A\u0440\u0438\u0447\u0430\u0442\u0438 \u0432 \u0441\u0442\u0440\u0430\u0445\u0443", 'Astonished face': "\u0437\u0434\u0438\u0432\u043E\u0432\u0430\u043D\u0438\u0439 \u043E\u0441\u043E\u0431\u0430", 'Flushed face': "\u043F\u0440\u0438\u043F\u043B\u0438\u0432 \u043A\u0440\u043E\u0432\u0456 \u0434\u043E \u043E\u0431\u043B\u0438\u0447\u0447\u044F", 'Sleeping face': "\u0421\u043F\u043B\u044F\u0447\u0430 \u043E\u0441\u043E\u0431\u0430", 'Dizzy face': "\u0414\u0456\u0437\u0437\u0456 \u043E\u0441\u043E\u0431\u0430", 'Face without mouth': "\u041E\u0441\u043E\u0431\u0430 \u0431\u0435\u0437 \u0440\u043E\u0442\u0430", 'Face with medical mask': "\u041E\u0441\u043E\u0431\u0430 \u0437 \u043C\u0435\u0434\u0438\u0447\u043D\u043E\u044E \u043C\u0430\u0441\u043A\u043E\u044E", // Line breaker 'Break': "\u0437\u043B\u043E\u043C\u0438\u0442\u0438", // Math 'Subscript': "\u043F\u0456\u0434\u0440\u044F\u0434\u043A\u043E\u0432\u0438\u0439", 'Superscript': "\u043D\u0430\u0434\u0440\u044F\u0434\u043A\u043E\u0432\u0438\u0439 \u0441\u0438\u043C\u0432\u043E\u043B", // Full screen 'Fullscreen': "\u043F\u043E\u0432\u043D\u043E\u0435\u043A\u0440\u0430\u043D\u043D\u0438\u0439 \u0440\u0435\u0436\u0438\u043C", // Horizontal line 'Insert Horizontal Line': "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0433\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u0443 \u043B\u0456\u043D\u0456\u044E", // Clear formatting 'Clear Formatting': "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u0438 \u0444\u043E\u0440\u043C\u0430\u0442\u0443\u0432\u0430\u043D\u043D\u044F", // Save 'Save': "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438", // Undo, redo 'Undo': "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438", 'Redo': "\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438", // Select all 'Select All': "\u0412\u0438\u0431\u0440\u0430\u0442\u0438 \u0432\u0441\u0435", // Code view 'Code View': "\u041F\u0435\u0440\u0435\u0433\u043B\u044F\u0434 \u043A\u043E\u0434\u0443", // Quote 'Quote': "\u0426\u0438\u0442\u0430\u0442\u0430", 'Increase': "\u0417\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438", 'Decrease': "\u0437\u043D\u0438\u0436\u0435\u043D\u043D\u044F", // Quick Insert 'Quick Insert': "\u0428\u0432\u0438\u0434\u043A\u0438\u0439 \u0432\u0441\u0442\u0430\u0432\u043A\u0430", // Spcial Characters 'Special Characters': 'Спеціальні символи', 'Latin': 'Латинський', 'Greek': 'Грецький', 'Cyrillic': 'Кирилиця', 'Punctuation': 'Пунктуація', 'Currency': 'Валюта', 'Arrows': 'Стріли', 'Math': 'Математика', 'Misc': 'Різне', // Print. 'Print': 'Друкувати', // Spell Checker. 'Spell Checker': 'Перевірка орфографії', // Help 'Help': 'Допомогти', 'Shortcuts': 'Ярлики', 'Inline Editor': 'Вбудований редактор', 'Show the editor': 'Показати редактору', 'Common actions': 'Спільні дії', 'Copy': 'Скопіювати', 'Cut': 'Вирізати', 'Paste': 'Вставити', 'Basic Formatting': 'Основне форматування', 'Increase quote level': 'Збільшити рівень цитування', 'Decrease quote level': 'Знизити рівень цитування', 'Image / Video': 'Зображення / відео', 'Resize larger': 'Змінити розмір більше', 'Resize smaller': 'Змінити розмір менше', 'Table': 'Стіл', 'Select table cell': 'Виберіть комірку таблиці', 'Extend selection one cell': 'Продовжити виділення однієї комірки', 'Extend selection one row': 'Продовжити виділення одного рядка', 'Navigation': 'Навігація', 'Focus popup / toolbar': 'Фокус спливаюче / панель інструментів', 'Return focus to previous position': 'Поверніть фокус на попередню позицію', // Embed.ly 'Embed URL': 'Вставити URL-адресу', 'Paste in a URL to embed': 'Вставте в url, щоб вставити', // Word Paste. 'The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?': 'Вставлений вміст надходить з документу Microsoft Word. ви хочете зберегти формат чи очистити його?', 'Keep': 'Тримати', 'Clean': 'Чистий', 'Word Paste Detected': 'Слово паста виявлено', // Character Counter 'Characters': 'Символи', // More Buttons 'More Text': 'більше тексту', 'More Paragraph': 'більше Параграф', 'More Rich': 'більше Багатий', 'More Misc': 'більше Різне' }, direction: 'ltr' }; }))); //# sourceMappingURL=uk.js.map
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); require('./turn-order-0846b669.js'); require('immer'); require('./reducer-172d838d.js'); var ai = require('./ai-df0d3376.js'); exports.Bot = ai.Bot; exports.MCTSBot = ai.MCTSBot; exports.RandomBot = ai.RandomBot; exports.Simulate = ai.Simulate; exports.Step = ai.Step;
/*! * DevExtreme (dx.messages.tr.js) * Version: 20.2.6 (build 21098-1745) * Build date: Thu Apr 08 2021 * * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; ! function(root, factory) { if ("function" === typeof define && define.amd) { define(function(require) { factory(require("devextreme/localization")) }) } else { if ("object" === typeof module && module.exports) { factory(require("devextreme/localization")) } else { factory(DevExpress.localization) } } }(this, function(localization) { localization.loadMessages({ tr: { Yes: "Evet", No: "Hay\u0131r", Cancel: "\u0130ptal", Clear: "Temizle", Done: "Tamam", Loading: "Y\xfckleniyor...", Select: "Se\xe7...", Search: "Ara", Back: "Geri", OK: "Tamam", "dxCollectionWidget-noDataText": "G\xf6sterilecek bilgi yok", "validation-required": "Zorunlu", "validation-required-formatted": "{0} gerekli", "validation-numeric": "De\u011fer bir say\u0131 olmal\u0131", "validation-numeric-formatted": "{0} bir say\u0131 olmal\u0131", "validation-range": "De\u011fer aral\u0131k d\u0131\u015f\u0131nda", "validation-range-formatted": "{0} aral\u0131k d\u0131\u015f\u0131nda", "validation-stringLength": "De\u011ferin uzunlu\u011fu do\u011fru de\u011fil", "validation-stringLength-formatted": "{0} uzunlu\u011fu do\u011fru de\u011fil", "validation-custom": "De\u011fer ge\xe7ersiz", "validation-custom-formatted": "{0} ge\xe7ersiz", "validation-compare": "De\u011ferler e\u015fle\u015fmiyor", "validation-compare-formatted": "{0} e\u015fle\u015fmiyor", "validation-pattern": "De\u011fer kal\u0131pla e\u015fle\u015fmiyor", "validation-pattern-formatted": "{0} kal\u0131pla e\u015fle\u015fmiyor", "validation-email": "E-posta ge\xe7ersiz", "validation-email-formatted": "{0} ge\xe7ersiz", "validation-mask": "De\u011fer ge\xe7ersiz", "dxLookup-searchPlaceholder": "Minimum karakter say\u0131s\u0131: {0}", "dxList-pullingDownText": "Yenilemek i\xe7in a\u015fa\u011f\u0131ya \xe7ekin...", "dxList-pulledDownText": "Yenilemek i\xe7in b\u0131rak\u0131n...", "dxList-refreshingText": "Yenileniyor...", "dxList-pageLoadingText": "Y\xfckleniyor...", "dxList-nextButtonText": "Daha", "dxList-selectAll": "T\xfcm\xfcn\xfc Se\xe7", "dxListEditDecorator-delete": "Sil", "dxListEditDecorator-more": "Daha", "dxScrollView-pullingDownText": "Yenilemek i\xe7in a\u015fa\u011f\u0131ya \xe7ekin...", "dxScrollView-pulledDownText": "Yenilemek i\xe7in b\u0131rak\u0131n...", "dxScrollView-refreshingText": "Yenileniyor...", "dxScrollView-reachBottomText": "Y\xfckleniyor...", "dxDateBox-simulatedDataPickerTitleTime": "Saat se\xe7", "dxDateBox-simulatedDataPickerTitleDate": "Tarih se\xe7", "dxDateBox-simulatedDataPickerTitleDateTime": "Tarih ve saati se\xe7in", "dxDateBox-validation-datetime": "De\u011fer bir tarih veya saat olmal\u0131d\u0131r", "dxFileUploader-selectFile": "Dosya se\xe7", "dxFileUploader-dropFile": "veya Dosyay\u0131 buraya b\u0131rak\u0131n", "dxFileUploader-bytes": "bytes", "dxFileUploader-kb": "kb", "dxFileUploader-Mb": "Mb", "dxFileUploader-Gb": "Gb", "dxFileUploader-upload": "Y\xfckleme", "dxFileUploader-uploaded": "Y\xfcklenen", "dxFileUploader-readyToUpload": "Y\xfcklemeye haz\u0131r", "dxFileUploader-uploadAbortedMessage": "TODO", "dxFileUploader-uploadFailedMessage": "Y\xfckleme ba\u015far\u0131s\u0131z", "dxFileUploader-invalidFileExtension": "Dosya t\xfcr\xfcne izin verilmiyor", "dxFileUploader-invalidMaxFileSize": "Dosya \xe7ok b\xfcy\xfck", "dxFileUploader-invalidMinFileSize": "Dosya \xe7ok k\xfc\xe7\xfck", "dxRangeSlider-ariaFrom": "\u0130tibaren", "dxRangeSlider-ariaTill": "Kadar", "dxSwitch-switchedOnText": "A\xe7\u0131k", "dxSwitch-switchedOffText": "Kapal\u0131", "dxForm-optionalMark": "iste\u011fe ba\u011fl\u0131", "dxForm-requiredMessage": "{0} gerekli", "dxNumberBox-invalidValueMessage": "De\u011fer bir say\u0131 olmal\u0131", "dxNumberBox-noDataText": "Veri yok", "dxDataGrid-columnChooserTitle": "S\xfctun Se\xe7ici", "dxDataGrid-columnChooserEmptyText": "S\xfctunu gizlemek i\xe7in buraya s\xfcr\xfckleyin", "dxDataGrid-groupContinuesMessage": "Bir sonraki sayfada devam ediyor", "dxDataGrid-groupContinuedMessage": "\xd6nceki sayfadan devam", "dxDataGrid-groupHeaderText": "Bu S\xfctuna G\xf6re Grupla", "dxDataGrid-ungroupHeaderText": "Grubu Kald\u0131r", "dxDataGrid-ungroupAllText": "T\xfcm Gruplar\u0131 Kald\u0131r", "dxDataGrid-editingEditRow": "D\xfczenle", "dxDataGrid-editingSaveRowChanges": "Kaydet", "dxDataGrid-editingCancelRowChanges": "\u0130ptal", "dxDataGrid-editingDeleteRow": "Sil", "dxDataGrid-editingUndeleteRow": "Silme", "dxDataGrid-editingConfirmDeleteMessage": "Bu kayd\u0131 silmek istedi\u011finize emin misiniz?", "dxDataGrid-validationCancelChanges": "De\u011fi\u015fiklikleri iptal et", "dxDataGrid-groupPanelEmptyText": "Bu s\xfctuna g\xf6re gruplamak i\xe7in bir s\xfctun ba\u015fl\u0131\u011f\u0131n\u0131 buraya s\xfcr\xfckleyin", "dxDataGrid-noDataText": "Veri yok", "dxDataGrid-searchPanelPlaceholder": "Arama...", "dxDataGrid-filterRowShowAllText": "(T\xfcm\xfc)", "dxDataGrid-filterRowResetOperationText": "S\u0131f\u0131rla", "dxDataGrid-filterRowOperationEquals": "E\u015fittir", "dxDataGrid-filterRowOperationNotEquals": "E\u015fit de\u011fil", "dxDataGrid-filterRowOperationLess": "Daha k\xfc\xe7\xfck", "dxDataGrid-filterRowOperationLessOrEquals": "Daha k\xfc\xe7\xfck veya e\u015fit", "dxDataGrid-filterRowOperationGreater": "Daha b\xfcy\xfck", "dxDataGrid-filterRowOperationGreaterOrEquals": "Daha b\xfcy\xfck veya e\u015fit", "dxDataGrid-filterRowOperationStartsWith": "\u0130le ba\u015flar", "dxDataGrid-filterRowOperationContains": "\u0130\xe7eren", "dxDataGrid-filterRowOperationNotContains": "\u0130\xe7ermeyen", "dxDataGrid-filterRowOperationEndsWith": "\u0130le biten", "dxDataGrid-filterRowOperationBetween": "Aras\u0131nda", "dxDataGrid-filterRowOperationBetweenStartText": "Ba\u015fla", "dxDataGrid-filterRowOperationBetweenEndText": "Biti\u015f", "dxDataGrid-applyFilterText": "Filtre uygula", "dxDataGrid-trueText": "evet", "dxDataGrid-falseText": "hay\u0131r", "dxDataGrid-sortingAscendingText": "Artan S\u0131ralama", "dxDataGrid-sortingDescendingText": "Azalan S\u0131ralama", "dxDataGrid-sortingClearText": "S\u0131ralamay\u0131 Temizle", "dxDataGrid-editingSaveAllChanges": "De\u011fi\u015fiklikleri Kaydet", "dxDataGrid-editingCancelAllChanges": "De\u011fi\u015fiklikleri iptal et", "dxDataGrid-editingAddRow": "Sat\u0131r ekle", "dxDataGrid-summaryMin": "Min: {0}", "dxDataGrid-summaryMinOtherColumn": "{1} min: {0}", "dxDataGrid-summaryMax": "Max: {0}", "dxDataGrid-summaryMaxOtherColumn": "{1} max: {0}", "dxDataGrid-summaryAvg": "Ort: {0}", "dxDataGrid-summaryAvgOtherColumn": "{1} ortalamas\u0131: {0}", "dxDataGrid-summarySum": "Top: {0}", "dxDataGrid-summarySumOtherColumn": "{1} toplam\u0131: {0}", "dxDataGrid-summaryCount": "Toplam: {0}", "dxDataGrid-columnFixingFix": "Sabitle", "dxDataGrid-columnFixingUnfix": "\xc7\xf6z", "dxDataGrid-columnFixingLeftPosition": "Sola", "dxDataGrid-columnFixingRightPosition": "Sa\u011fa", "dxDataGrid-exportTo": "D\u0131\u015fa aktar", "dxDataGrid-exportToExcel": "Excel dosyas\u0131na aktar", "dxDataGrid-exporting": "D\u0131\u015fa Aktar...", "dxDataGrid-excelFormat": "Excel dosyas\u0131", "dxDataGrid-selectedRows": "Se\xe7ili sat\u0131rlar", "dxDataGrid-exportSelectedRows": "Se\xe7ili sat\u0131rlar\u0131 aktar", "dxDataGrid-exportAll": "T\xfcm verileri d\u0131\u015fa aktar", "dxDataGrid-headerFilterEmptyValue": "(Blanks)", "dxDataGrid-headerFilterOK": "Tamam", "dxDataGrid-headerFilterCancel": "\u0130ptal", "dxDataGrid-ariaColumn": "S\xfctun", "dxDataGrid-ariaValue": "Veri", "dxDataGrid-ariaFilterCell": "Filtre h\xfccresi", "dxDataGrid-ariaCollapse": "Daralt", "dxDataGrid-ariaExpand": "Geni\u015flet", "dxDataGrid-ariaDataGrid": "Tablo", "dxDataGrid-ariaSearchInGrid": "Tabloda ara", "dxDataGrid-ariaSelectAll": "Hepsini se\xe7", "dxDataGrid-ariaSelectRow": "Sat\u0131r\u0131 se\xe7", "dxDataGrid-filterBuilderPopupTitle": "Filtre Olu\u015fturucu", "dxDataGrid-filterPanelCreateFilter": "Filtre Olu\u015ftur", "dxDataGrid-filterPanelClearFilter": "Temizle", "dxDataGrid-filterPanelFilterEnabledHint": "Filtreyi etkinle\u015ftir", "dxTreeList-ariaTreeList": "A\u011fa\xe7 listesi", "dxTreeList-editingAddRowToNode": "Ekle", "dxPager-infoText": "Sayfa {0} / {1} ({2} veri)", "dxPager-pagesCountText": "aras\u0131nda", "dxPager-pageSizesAllText": "T\xfcm\xfc", "dxPivotGrid-grandTotal": "Genel Toplam", "dxPivotGrid-total": "{0} Toplam", "dxPivotGrid-fieldChooserTitle": "Alan Se\xe7ici", "dxPivotGrid-showFieldChooser": "Alan Se\xe7iciyi G\xf6ster", "dxPivotGrid-expandAll": "T\xfcm\xfcn\xfc Geni\u015flet", "dxPivotGrid-collapseAll": "T\xfcm\xfcn\xfc Daralt", "dxPivotGrid-sortColumnBySummary": '"{0}" Bu S\xfctuna G\xf6re S\u0131rala', "dxPivotGrid-sortRowBySummary": '"{0}" Bu Sat\u0131ra G\xf6re S\u0131rala', "dxPivotGrid-removeAllSorting": "T\xfcm S\u0131ralamalar\u0131 Kald\u0131r", "dxPivotGrid-dataNotAvailable": "N/A", "dxPivotGrid-rowFields": "Sat\u0131r Alanlar\u0131", "dxPivotGrid-columnFields": "S\xfctun Alanlar\u0131", "dxPivotGrid-dataFields": "Veri Alanlar\u0131", "dxPivotGrid-filterFields": "Filtre Alanlar\u0131", "dxPivotGrid-allFields": "T\xfcm Alanlar", "dxPivotGrid-columnFieldArea": "S\xfctun Alanlar\u0131n\u0131 Buraya B\u0131rak", "dxPivotGrid-dataFieldArea": "Veri Alanlar\u0131n\u0131 Buraya B\u0131rak", "dxPivotGrid-rowFieldArea": "Sat\u0131r Alanlar\u0131n\u0131 Buraya B\u0131rak", "dxPivotGrid-filterFieldArea": "Filtre Alanlar\u0131n\u0131 Buraya B\u0131rak", "dxScheduler-editorLabelTitle": "Konu", "dxScheduler-editorLabelStartDate": "Ba\u015flang\u0131\xe7 Tarihi", "dxScheduler-editorLabelEndDate": "Biti\u015f Tarihi", "dxScheduler-editorLabelDescription": "A\xe7\u0131klama", "dxScheduler-editorLabelRecurrence": "Tekrar", "dxScheduler-openAppointment": "Randevu A\xe7", "dxScheduler-recurrenceNever": "Asla", "dxScheduler-recurrenceMinutely": "Minutely", "dxScheduler-recurrenceHourly": "Hourly", "dxScheduler-recurrenceDaily": "G\xfcnl\xfck", "dxScheduler-recurrenceWeekly": "Haftal\u0131k", "dxScheduler-recurrenceMonthly": "Ayl\u0131k", "dxScheduler-recurrenceYearly": "Y\u0131ll\u0131k", "dxScheduler-recurrenceRepeatEvery": "Her tekrarla", "dxScheduler-recurrenceRepeatOn": "Tekrarla", "dxScheduler-recurrenceEnd": "Tekrar\u0131 bitir", "dxScheduler-recurrenceAfter": "Sonra", "dxScheduler-recurrenceOn": "\u0130le", "dxScheduler-recurrenceRepeatMinutely": "minute(s)", "dxScheduler-recurrenceRepeatHourly": "hour(s)", "dxScheduler-recurrenceRepeatDaily": "g\xfcnler", "dxScheduler-recurrenceRepeatWeekly": "haftalar", "dxScheduler-recurrenceRepeatMonthly": "aylar", "dxScheduler-recurrenceRepeatYearly": "y\u0131llar", "dxScheduler-switcherDay": "G\xfcn", "dxScheduler-switcherWeek": "Hafta", "dxScheduler-switcherWorkWeek": "\xc7al\u0131\u015fma Haftas\u0131", "dxScheduler-switcherMonth": "Ay", "dxScheduler-switcherAgenda": "Ajanda", "dxScheduler-switcherTimelineDay": "Zaman \xc7izelgesi G\xfcn\xfc", "dxScheduler-switcherTimelineWeek": "Zaman \xc7izelgesi Haftas\u0131", "dxScheduler-switcherTimelineWorkWeek": "Zaman \xc7izelgesi \xc7al\u0131\u015fma Haftas\u0131", "dxScheduler-switcherTimelineMonth": "TZaman \xc7izelgesi \xc7al\u0131\u015fma Ay\u0131", "dxScheduler-recurrenceRepeatOnDate": "tarihinde", "dxScheduler-recurrenceRepeatCount": "olaylar", "dxScheduler-allDay": "T\xfcm g\xfcn", "dxScheduler-confirmRecurrenceEditMessage": "Yaln\u0131zca bu randevuyu veya t\xfcm diziyi d\xfczenlemek ister misiniz?", "dxScheduler-confirmRecurrenceDeleteMessage": "Yaln\u0131zca bu randevuyu veya t\xfcm diziyi silmek istiyor musunuz?", "dxScheduler-confirmRecurrenceEditSeries": "Serileri d\xfczenle", "dxScheduler-confirmRecurrenceDeleteSeries": "Serileri sil", "dxScheduler-confirmRecurrenceEditOccurrence": "Randevuyu d\xfczenle", "dxScheduler-confirmRecurrenceDeleteOccurrence": "Randevuyu sil", "dxScheduler-noTimezoneTitle": "Saat dilimi yok", "dxScheduler-moreAppointments": "{0} daha", "dxCalendar-todayButtonText": "Bug\xfcn", "dxCalendar-ariaWidgetName": "Takvim", "dxColorView-ariaRed": "K\u0131rm\u0131z\u0131", "dxColorView-ariaGreen": "Ye\u015fil", "dxColorView-ariaBlue": "Mavi", "dxColorView-ariaAlpha": "\u015eeffafl\u0131k", "dxColorView-ariaHex": "Renk kodu", "dxTagBox-selected": "{0} se\xe7ili", "dxTagBox-allSelected": "T\xfcm\xfc se\xe7ildi ({0})", "dxTagBox-moreSelected": "{0} daha", "vizExport-printingButtonText": "Yazd\u0131r", "vizExport-titleMenuText": "D\u0131\u015fa Aktar/Yazd\u0131r", "vizExport-exportButtonText": "{0} dosya", "dxFilterBuilder-and": "Ve", "dxFilterBuilder-or": "Veya", "dxFilterBuilder-notAnd": "De\u011fil Ve", "dxFilterBuilder-notOr": "De\u011fil Veya", "dxFilterBuilder-addCondition": "Ko\u015ful Ekle", "dxFilterBuilder-addGroup": "Grup Ekle", "dxFilterBuilder-enterValueText": "<de\u011fer gir>", "dxFilterBuilder-filterOperationEquals": "E\u015fit", "dxFilterBuilder-filterOperationNotEquals": "E\u015fit de\u011fil", "dxFilterBuilder-filterOperationLess": "Daha k\xfc\xe7\xfck", "dxFilterBuilder-filterOperationLessOrEquals": "Daha k\xfc\xe7\xfck veya e\u015fit", "dxFilterBuilder-filterOperationGreater": "Daha b\xfcy\xfck", "dxFilterBuilder-filterOperationGreaterOrEquals": "Daha b\xfcy\xfck veya e\u015fit", "dxFilterBuilder-filterOperationStartsWith": "\u0130le ba\u015flar", "dxFilterBuilder-filterOperationContains": "\u0130\xe7erir", "dxFilterBuilder-filterOperationNotContains": "\u0130\xe7ermez", "dxFilterBuilder-filterOperationEndsWith": "\u0130le biter", "dxFilterBuilder-filterOperationIsBlank": "Bo\u015f", "dxFilterBuilder-filterOperationIsNotBlank": "Bo\u015f de\u011fil", "dxFilterBuilder-filterOperationBetween": "Aras\u0131nda", "dxFilterBuilder-filterOperationAnyOf": "Herhangi biri", "dxFilterBuilder-filterOperationNoneOf": "Hi\xe7biri", "dxHtmlEditor-dialogColorCaption": "Yaz\u0131 Tipi Rengini De\u011fi\u015ftir", "dxHtmlEditor-dialogBackgroundCaption": "Arka Plan Rengini De\u011fi\u015ftir", "dxHtmlEditor-dialogLinkCaption": "Link Ekle", "dxHtmlEditor-dialogLinkUrlField": "URL", "dxHtmlEditor-dialogLinkTextField": "Metin", "dxHtmlEditor-dialogLinkTargetField": "Linki yeni pencerede a\xe7", "dxHtmlEditor-dialogImageCaption": "Resim Ekle", "dxHtmlEditor-dialogImageUrlField": "URL", "dxHtmlEditor-dialogImageAltField": "Alternatif metin", "dxHtmlEditor-dialogImageWidthField": "Geni\u015flik (px)", "dxHtmlEditor-dialogImageHeightField": "Y\xfckseklik (px)", "dxHtmlEditor-dialogInsertTableRowsField": "!TODO", "dxHtmlEditor-dialogInsertTableColumnsField": "!TODO", "dxHtmlEditor-dialogInsertTableCaption": "!TODO", "dxHtmlEditor-heading": "Ba\u015fl\u0131k", "dxHtmlEditor-normalText": "Normal metin", "dxFileManager-errorNoAccess": "Eri\u015fim reddedildi. \u0130\u015flem tamamlanam\u0131yor.", "dxFileManager-errorDirectoryExistsFormat": "Klas\xf6r '{0}' zaten var.", "dxFileManager-errorFileExistsFormat": "Dosya '{0}' zaten var.", "dxFileManager-errorFileNotFoundFormat": "Dosya '{0}' bulunamad\u0131", "dxFileManager-errorDefault": "Belirtilmemi\u015f hata.", "dxFileManager-newDirectoryName": "TODO", "dxFileManager-rootDirectoryName": "TODO", "dxFileManager-errorDirectoryNotFoundFormat": "TODO", "dxFileManager-errorWrongFileExtension": "TODO", "dxFileManager-errorMaxFileSizeExceeded": "TODO", "dxFileManager-errorInvalidSymbols": "TODO", "dxFileManager-errorDirectoryOpenFailed": "TODO", "dxDiagram-categoryGeneral": "TODO", "dxDiagram-categoryFlowchart": "TODO", "dxDiagram-categoryOrgChart": "TODO", "dxDiagram-categoryContainers": "TODO", "dxDiagram-categoryCustom": "TODO", "dxDiagram-commandExportToSvg": "TODO", "dxDiagram-commandExportToPng": "TODO", "dxDiagram-commandExportToJpg": "TODO", "dxDiagram-commandUndo": "TODO", "dxDiagram-commandRedo": "TODO", "dxDiagram-commandFontName": "TODO", "dxDiagram-commandFontSize": "TODO", "dxDiagram-commandBold": "TODO", "dxDiagram-commandItalic": "TODO", "dxDiagram-commandUnderline": "TODO", "dxDiagram-commandTextColor": "TODO", "dxDiagram-commandLineColor": "TODO", "dxDiagram-commandFillColor": "TODO", "dxDiagram-commandAlignLeft": "TODO", "dxDiagram-commandAlignCenter": "TODO", "dxDiagram-commandAlignRight": "TODO", "dxDiagram-commandConnectorLineType": "TODO", "dxDiagram-commandConnectorLineStraight": "TODO", "dxDiagram-commandConnectorLineOrthogonal": "TODO", "dxDiagram-commandConnectorLineStart": "TODO", "dxDiagram-commandConnectorLineEnd": "TODO", "dxDiagram-commandConnectorLineNone": "TODO", "dxDiagram-commandConnectorLineArrow": "TODO", "dxDiagram-commandFullscreen": "TODO", "dxDiagram-commandUnits": "TODO", "dxDiagram-commandPageSize": "TODO", "dxDiagram-commandPageOrientation": "TODO", "dxDiagram-commandPageOrientationLandscape": "TODO", "dxDiagram-commandPageOrientationPortrait": "TODO", "dxDiagram-commandPageColor": "TODO", "dxDiagram-commandShowGrid": "TODO", "dxDiagram-commandSnapToGrid": "TODO", "dxDiagram-commandGridSize": "TODO", "dxDiagram-commandZoomLevel": "TODO", "dxDiagram-commandAutoZoom": "TODO", "dxDiagram-commandFitToContent": "TODO", "dxDiagram-commandFitToWidth": "TODO", "dxDiagram-commandAutoZoomByContent": "TODO", "dxDiagram-commandAutoZoomByWidth": "TODO", "dxDiagram-commandSimpleView": "TODO", "dxDiagram-commandCut": "TODO", "dxDiagram-commandCopy": "TODO", "dxDiagram-commandPaste": "TODO", "dxDiagram-commandSelectAll": "TODO", "dxDiagram-commandDelete": "TODO", "dxDiagram-commandBringToFront": "TODO", "dxDiagram-commandSendToBack": "TODO", "dxDiagram-commandLock": "TODO", "dxDiagram-commandUnlock": "TODO", "dxDiagram-commandInsertShapeImage": "TODO", "dxDiagram-commandEditShapeImage": "TODO", "dxDiagram-commandDeleteShapeImage": "TODO", "dxDiagram-commandLayoutLeftToRight": "TODO", "dxDiagram-commandLayoutRightToLeft": "TODO", "dxDiagram-commandLayoutTopToBottom": "TODO", "dxDiagram-commandLayoutBottomToTop": "TODO", "dxDiagram-unitIn": "TODO", "dxDiagram-unitCm": "TODO", "dxDiagram-unitPx": "TODO", "dxDiagram-dialogButtonOK": "TODO", "dxDiagram-dialogButtonCancel": "TODO", "dxDiagram-dialogInsertShapeImageTitle": "TODO", "dxDiagram-dialogEditShapeImageTitle": "TODO", "dxDiagram-dialogEditShapeImageSelectButton": "TODO", "dxDiagram-dialogEditShapeImageLabelText": "TODO", "dxDiagram-uiExport": "TODO", "dxDiagram-uiProperties": "TODO", "dxDiagram-uiSettings": "TODO", "dxDiagram-uiShowToolbox": "TODO", "dxDiagram-uiSearch": "TODO", "dxDiagram-uiStyle": "TODO", "dxDiagram-uiLayout": "TODO", "dxDiagram-uiLayoutTree": "TODO", "dxDiagram-uiLayoutLayered": "TODO", "dxDiagram-uiDiagram": "TODO", "dxDiagram-uiText": "TODO", "dxDiagram-uiObject": "TODO", "dxDiagram-uiConnector": "TODO", "dxDiagram-uiPage": "TODO", "dxDiagram-shapeText": "TODO", "dxDiagram-shapeRectangle": "TODO", "dxDiagram-shapeEllipse": "TODO", "dxDiagram-shapeCross": "TODO", "dxDiagram-shapeTriangle": "TODO", "dxDiagram-shapeDiamond": "TODO", "dxDiagram-shapeHeart": "TODO", "dxDiagram-shapePentagon": "TODO", "dxDiagram-shapeHexagon": "TODO", "dxDiagram-shapeOctagon": "TODO", "dxDiagram-shapeStar": "TODO", "dxDiagram-shapeArrowLeft": "TODO", "dxDiagram-shapeArrowUp": "TODO", "dxDiagram-shapeArrowRight": "TODO", "dxDiagram-shapeArrowDown": "TODO", "dxDiagram-shapeArrowUpDown": "TODO", "dxDiagram-shapeArrowLeftRight": "TODO", "dxDiagram-shapeProcess": "TODO", "dxDiagram-shapeDecision": "TODO", "dxDiagram-shapeTerminator": "TODO", "dxDiagram-shapePredefinedProcess": "TODO", "dxDiagram-shapeDocument": "TODO", "dxDiagram-shapeMultipleDocuments": "TODO", "dxDiagram-shapeManualInput": "TODO", "dxDiagram-shapePreparation": "TODO", "dxDiagram-shapeData": "TODO", "dxDiagram-shapeDatabase": "TODO", "dxDiagram-shapeHardDisk": "TODO", "dxDiagram-shapeInternalStorage": "TODO", "dxDiagram-shapePaperTape": "TODO", "dxDiagram-shapeManualOperation": "TODO", "dxDiagram-shapeDelay": "TODO", "dxDiagram-shapeStoredData": "TODO", "dxDiagram-shapeDisplay": "TODO", "dxDiagram-shapeMerge": "TODO", "dxDiagram-shapeConnector": "TODO", "dxDiagram-shapeOr": "TODO", "dxDiagram-shapeSummingJunction": "TODO", "dxDiagram-shapeContainerDefaultText": "TODO", "dxDiagram-shapeVerticalContainer": "TODO", "dxDiagram-shapeHorizontalContainer": "TODO", "dxDiagram-shapeCardDefaultText": "TODO", "dxDiagram-shapeCardWithImageOnLeft": "TODO", "dxDiagram-shapeCardWithImageOnTop": "TODO", "dxDiagram-shapeCardWithImageOnRight": "TODO", "dxGantt-dialogTitle": "TODO", "dxGantt-dialogStartTitle": "TODO", "dxGantt-dialogEndTitle": "TODO", "dxGantt-dialogProgressTitle": "TODO", "dxGantt-dialogResourcesTitle": "TODO", "dxGantt-dialogResourceManagerTitle": "TODO", "dxGantt-dialogTaskDetailsTitle": "TODO", "dxGantt-dialogEditResourceListHint": "TODO", "dxGantt-dialogEditNoResources": "TODO", "dxGantt-dialogButtonAdd": "TODO", "dxGantt-contextMenuNewTask": "TODO", "dxGantt-contextMenuNewSubtask": "TODO", "dxGantt-contextMenuDeleteTask": "TODO", "dxGantt-contextMenuDeleteDependency": "TODO", "dxGantt-dialogTaskDeleteConfirmation": "TODO", "dxGantt-dialogDependencyDeleteConfirmation": "TODO", "dxGantt-dialogResourcesDeleteConfirmation": "TODO", "dxGantt-dialogConstraintCriticalViolationMessage": "TODO", "dxGantt-dialogConstraintViolationMessage": "TODO", "dxGantt-dialogCancelOperationMessage": "TODO", "dxGantt-dialogDeleteDependencyMessage": "TODO", "dxGantt-dialogMoveTaskAndKeepDependencyMessage": "TODO", "dxGantt-undo": "TODO", "dxGantt-redo": "TODO", "dxGantt-expandAll": "TODO", "dxGantt-collapseAll": "TODO", "dxGantt-addNewTask": "TODO", "dxGantt-deleteSelectedTask": "TODO", "dxGantt-zoomIn": "TODO", "dxGantt-zoomOut": "TODO", "dxGantt-fullScreen": "TODO" } }) });
'use strict'; var test = require('tape'); var fs = require('fs'); var path = require('path'); var geojsonvt = require('../src/index'); var square = [{ geometry: [[[-64, 4160], [-64, -64], [4160, -64], [4160, 4160], [-64, 4160]]], type: 3, tags: {name: 'Pennsylvania', density: 284.3} }]; test('getTile: us-states.json', function (t) { var log = console.log; console.log = function () {}; var index = geojsonvt(getJSON('us-states.json'), {debug: 2}); console.log = log; t.same(index.getTile(7, 37, 48).features, getJSON('us-states-z7-37-48.json'), 'z7-37-48'); t.same(index.getTile(9, 148, 192).features, square, 'z9-148-192 (clipped square)'); t.same(index.getTile(11, 592, 768).features, square, 'z11-592-768 (clipped square)'); t.equal(index.getTile(11, 800, 400), null, 'non-existing tile'); t.equal(index.getTile(-5, 123.25, 400.25), null, 'invalid tile'); t.equal(index.total, 29); t.end(); }); function getJSON(name) { return JSON.parse(fs.readFileSync(path.join(__dirname, '/fixtures/' + name))); }
var path = require('path'), problem = require('../problem'); function testIt(tape, result, value, done) { tape.deepEqual( result, {value: value, done: done}, 'iterator.next().value == {value: ' + value + ', done: ' + done + '}' ); } module.exports = { title: 'Passing Args To Yield', problem: problem(__dirname, function (args, t) { var solution = require(path.resolve(args[0])), tester = testIt.bind(null, t), iterator, result; t.equal(typeof solution, 'function', 'you exported a generator'); iterator = solution(); tester(iterator.next(), 1, false); tester(iterator.next(), 2, false); tester(iterator.next(2), 3 * 2, false); tester(iterator.next(5), 4 * 5, false); tester(iterator.next(3), 5 * 3, false); t.end(); }) }
import propertyTest from '../../helpers/propertyTest' propertyTest('RDATE', { transformableValue: new Date('1991-03-07 09:00:00'), transformedValue: '19910307T090000' })
/** * Created by imod on 5/8/15. */ 'use strict'; // TODO: This won't work too well if we have multiple server instances. // TODO: Add a configuration option to indicate if this is the main server instance, or... // TODO: Create a second server only app / node server that just the timers. var RUNNING_BUILD_QUERY_MS = 20000, CURRENT_BUILD_STATUS_QUERY_MS = 5000; Controllers.Timer = (function () { var buildQueryHandle = false, currentBuildServerTimerHandles = []; function StartRunningBuildsTimer(serverId) { if (!process.env.IS_MIRROR) { console.log('Starting running build timer for server: ' + serverId); var id = Meteor.setInterval(function () { Controllers.Timer.onRunningBuildQueryInterval(serverId); }, CURRENT_BUILD_STATUS_QUERY_MS); currentBuildServerTimerHandles.push({serverId: serverId, timerId: id}); } } function StopRunningBuildsTimer(serverId) { console.log('Stopping running build timer for server: ' + serverId); var serverTimerHandle = _.find(currentBuildServerTimerHandles, function (s) { return s.serverId === serverId; }); Meteor.clearInterval(serverTimerHandle.timerId); currentBuildServerTimerHandles = _.reject(currentBuildServerTimerHandles, function (s) { return s.serverId === serverTimerHandle.serverId; }); } function CheckRunningBuildsTimer(serverId, hasActiveBuilds) { var serverTimerHandle = _.find(currentBuildServerTimerHandles, function (s) { return s.serverId === serverId; }); if (hasActiveBuilds && !serverTimerHandle) { Controllers.Timer.onStartRunningBuildsTimer(serverId); } else if(!hasActiveBuilds && serverTimerHandle) { Controllers.Timer.onStopRunningBuildsTimer(serverId); } } /** * This will be called every CURRENT_BUILD_STATUS_QUERY_MS to update the status * of the running builds. * * @param serverId * @constructor */ function RunningBuildQueryInterval(serverId) { console.log('Running build timer for server: ' + serverId); var server = Controllers.Servers.getServer(serverId); server.updateRunningBuilds(CheckRunningBuildsTimer); } function PollInterval() { var servers = Controllers.Servers.getServers(); servers.forEach(function (server) { server.queryRunningBuilds(CheckRunningBuildsTimer); }); } function Startup() { if (buildQueryHandle !== false) { Meteor.clearTimeout(buildQueryHandle); buildQueryHandle = false; } if (!process.env.IS_MIRROR) { buildQueryHandle = Meteor.setInterval(PollInterval, RUNNING_BUILD_QUERY_MS); } } return { onStartUp: Startup, onStartRunningBuildsTimer: StartRunningBuildsTimer, onStopRunningBuildsTimer: StopRunningBuildsTimer, onRunningBuildQueryInterval: RunningBuildQueryInterval, onCheckRunningBuildsTimer: CheckRunningBuildsTimer, onPollInterval: PollInterval }; })();
(function () { 'use strict'; angular .module('professions') .run(menuConfig); menuConfig.$inject = ['Menus']; function menuConfig(Menus) { // Add the dropdown list item Menus.addSubMenuItem('topbar', 'admin', { title: 'Manage Classes', state: 'professions.list' }); } })();
var stopList = [ "A.M.S.HOSPITAL", "A.V.CONSTRUCTION", "AAYURVEDA ASHRAMAM", "ADAMBAKKAM P.S", "ADI DRAVIDAR HOSTEL", "ADYAR GATE", "AGARAM", "AGARAM THEN", "AIRFORCE STATION", "ALAGESA NAGAR", "ALAMADHI", "ALAMADHI OLD", "ALAPAKKAM", "ALWAR THIRUNAGAR", "AMBATHUR ESTATE", "AMBEDKAR NAGAR", "AMMAN KULAM", "ANAKAPUTHUR", "ANANDA NAGAR", "ANDARKUPPAM", "ANDERSONPET", "ANGALAMMAN KOIL", "ANJATHAMMAN KOIL", "ANJUGAM SCHOOL", "ANNA NAGAR", "ANNA NAGAR CIRCLE", "ANNA NAGAR EAST", "ANNA NAGAR WEST", "ANNA POORNA HOTEL/DAMS RD", "ANNA ROAD P.O./DAMS ROAD", "ANNA SQUARE", "ANNA UNIVERSITY", "ANNAMBEDU", "ARANI", "ARASANKAZHANI", "ARIYALUR", "ARUMBAKKAM", "ASHOK LAYLAND", "ASHOK LEYLAND MARK.DIV", "AVADI", "AVADI CIRCLE", "AVADI MOSQUE", "AVVAI HOME", "AYANAMBAKKAM", "AYANAVARAM B.S", "AYAPAKKAM", "AYYAPPA NAGAR", "BALAJI NAGAR (BHARATH ENG", "BESANT NAGAR", "BHARATHI NAGAR(PERIYAR PA", "BOROSIL COMPANY", "BRINDAVAN COLONY", "BROADWAY", "BUILDERS INDUSTRY", "BURIAL GROUND", "BURMAH SHELL PETROL BUNK", "BUS BAY-17TH KM", "BUTT ROAD", "C.I.T.COLONY", "C.M.B.T", "C.R.P.F", "CAMP ROAD", "CEMENTRY (MANDAVELI", "CENTRAL", "CHEMBARAMBAKKAM", "CHEPAUK", "CHETTIMEDU", "CHIDAMBARAM STORES", "CHINMAYA NAGAR", "CHITHALAPAKKAM", "CHITLAPAKKAM", "CHITLAPAKKAM B.S", "CHITTUKADU", "CHOLA MANDAL", "CHOOLAI MILL", "CHOOLAI P.O", "CHURCH", "CIPET", "CLIVE BATTERY", "CONCORDE", "CONVENT", "CORBORUNDUM UNIVERSAL", "CORPN. PLAY GROUND", "CORPORATION SCHOOL/OFFICE", "CYCLE SHOP", "D.M.S", "D.P.I", "DASAMAHAN", "DASAPRAKASH", "DASARATHAPURAM", "DEFENCE COLONY", "DEFENCE QUARTERS", "DHARMAPRAKASH/PETROL BUNK", "DOVETON", "DRY CATTLLE FORM", "DUNLOP", "ECHANKUZHI", "EGMORE", "EGMORE NORTH R.S", "EKKATTUTHANGAL", "ELLAIAMMAN KOIL", "ENG.COLLEGE", "ENNORE", "ERNAVOOR GATE", "F.C.I OLD", "FIVE LAMPS", "FORD", "FORE SHORE ESTATE", "G.K.M.COLONY", "GANESH PURAM", "GEMINI P.H", "GOVARDANAGIRI", "GOVT. GIRLS H.SC", "GRAND LINE", "GUDUVANCHERY", "GUINDY R.S", "GUINDY TVK ESTATE", "GURUNANAK COLLEGE", "H.V.F.MAIN GATE", "HASTHINAPURAM", "HIGH COURT", "HINDY VIDYALAYA", "HOTEL ARUN", "I.C.F", "I.C.I", "I.O.C", "I.R.T. RD.JN", "ICF ANNEXE", "INDIRA NAGAR WATER TANK", "INJAMBAKKAM", "IRULAPALAYAM", "IRULAPALAYAM RD JN", "IRUMBULIYUR", "JAFFARKHAN PET", "JAMALAYA", "JAYENDIRA NAGAR", "JN OF III AND 1ST AVE", "JN. OF R.GARDEN & PEVR H", "JN.OF MAMBAKKAM & O.BAKKA", "JN.OF MANALI RD.CHINNA KO", "JN.OF RACE COURSE RD", "JN.OF.ARTERIAL RD WITH 40", "JN.OF.PALAVANTHANGAL &GST", "JN.OF.VLY-TBM RD&MVKM-K.K", "Jn.OF P.T.R Rd/KAMARAJ Rd", "KAKKAN BRIDGE", "KALLIKUPPAM", "KAMABAR ARANGAM", "KAMARAJAPURAM", "KANATHUR", "KANDANCHAVADI", "KANDIGAI", "KANNAGI NAGAR S.C.BOARD", "KANNAN THEATER", "KANNIAMMAN NAGAR", "KARANAI", "KARANODAI", "KARAPAKKAM", "KARASANGAL", "KARAYANCAHVADI", "KATTUR ROAD JN", "KAVANGARAI", "KAVARAIPALAYAM", "KAVIARASU KANNADASAN NAGA", "KEERAPAKKAM", "KELAMBAKKAM", "KELLEYS", "KILKATTALAI", "KILPAUK GARDEN", "KODUNGAIYUR O.T", "KODUNGAIYUR(PARVATHI NAGA", "KOILPATHAGAI RD.JN", "KOLAPAKKAM", "KOLAPPANCHERY", "KOLATHUR", "KOLATHUR/NEHRU RD JN", "KOLLAICHERI", "KONDAKKARAI", "KORATTUR", "KORUKKUPET", "KORUKKUPET R.S", "KOSAPALAYAM", "KOSAPUR RD. JN", "KOSAVAMPETTAI", "KOTHARI", "KOTTIVAKKAM", "KOTTUR NSK STATUE", "KOTTURPURAM", "KOTYAMEDU", "KOVALAM", "KOVILAMCHERRY VILLAGE", "KOYAMBEDU P.S", "KOYAMBEDU ROHINI THEATER", "KOYAMBEDU SCHOOL", "KUMARAN KUNDRAM", "KUMARAN NAGAR", "KUMUNANCHAVADI", "KUNDRATHUR B.S", "KUNDRATHUR MURUGAN TEMPLE", "KUTHAMBAKKAM", "LADY MCTM SCHOOL/MILLERS", "LUCAS TVS", "LUZ", "M.K.B.NAGAR", "M.K.B.NAGAR EAST", "M.M.C", "M.M.D.A.COLONY", "M.M.D.A.COLONY RD.JN", "MADAMBAKKAM KOIL", "MADHAVARAM", "MADHAVARAM MILLK COLONY", "MADHAVARAM POST BOX", "MADIPAKKAM B.S", "MADIPAKKAM RD. JN", "MADURAPAKKAM RD.JN", "MADURAVOYAL", "MAHALAKSHMI NAGAR", "MAHARANI", "MAHENDRA CITY(CHETTY PUNN", "MALLIGAI NAGAR AVE", "MALROSAPURAM", "MAMBAKKAM RDJN./VENKATAMA", "MAMBAKKAM TEMPLE", "MANALAI SEEKADU", "MANALI", "MANALI NEW TOWN", "MANALI RD JN", "MANAPAKKAM P.U.O", "MANAPAKKAM VILLAGE", "MANDAVELI", "MANGADU", "MANIMANGALAM", "MANIMANGALAM RD. JN", "MANIMANGALAM VILLAGE", "MARAIMALAI NAGAR", "MARAIMALAI NAGAR I.E", "MATERNITY HOSPITAL", "MATHUR M.M.D.A", "MATHUR RD. JN", "MEDAVAKKAM COLONY", "MEDAVAKKAM JN", "MELKOTTIYUR", "MELPAKKAM", "MENAMBEDU", "MEPPADU HOSPITAL", "MEPPUR", "MILLERS ROAD", "MINJUR", "MINJUR B.D.O", "MINJUR NEW TERMINUS", "MOGAIPAIR ROAD JN", "MOGALIVAKKAM / MARI AMMN", "MOOLAKADAI", "MOOTAKARAN CHAVADI", "MOOVARASANPET", "MOULIVAKKAM", "MUDICHUR VILLAGE", "MULLAI NAGAR", "MURUGAN KOIL / GIRUGAMBAK", "MUTHUMARIAMMAN KOIL", "MYLAPORE", "N.G.O.COLONY", "NADUVANKARAI", "NAGALKENI", "NALLUR", "NALLUR PUDU NAGAR", "NANDAMBAKKAM VILLAGE", "NANGANALLUR", "NAPALAYAM", "NARAYANAPURAM", "NATHAMUNI TALKIES", "NAVALUR", "NEDUGUNDRAM", "NEELANKARAI", "NEMAM", "NEMILICHERI", "NERKUNDRAM", "NOOTHANCHERI", "NOOTHANCHERI CROSS RD", "NUCLEUS COMPANY", "OKKIYAM THORAIPAKKAM SEC", "ORAGADAM", "ORAGADAM O.T", "OTTIAMBAKKAM", "P.OR & SONS", "P1.POLICE STATION", "PADAPPAI", "PADAVATTAMMAN SCHOOL", "PADIYANALLUR", "PADURMEDU", "PAKKAM", "PALAKKA COMPANY", "PALAVAKKAM", "PALAVASTHIC CHEMICALS", "PALLAVAN NAGAR", "PALLAVARAM", "PAMMADU KULAM RD.JN", "PAMMAL", "PAMMAL SANKAR NAGAR", "PANAIYUR", "PANJETTI", "PARIVAKKAM", "PARRYS", "PARUTHIPATTU RD. JN", "PATTABIRAM", "PATTAMANDIRI", "PATTUR", "PAVENTHER SALAI", "PAZAVANTHANGAL ROAD JN", "PAZHANTHANDALAM", "PERAMBUR B.S", "PERAMBUR MARKET", "PERAMBUR R.S", "PERIYA KOTTAMEDU", "PERIYAPALAYAM", "PERIYAPALAYAM RD JN", "PERIYAPANICHERI", "PERIYAR BRIDGE", "PERIYAR NAGAR", "PERUMALPATTU", "PERUMBAKKAM LIMIT", "PICTURE POST", "POLYTECHNIC", "PONDY BAZAAR", "PONMAR", "PONNIAMMAN KOIL RD. JN", "POOCHIATHIBEDU", "POOMBUHAR", "POONAMALLEE", "POONTHANDALAM", "PORUR", "POZHICHALUR", "PRITHIYANGARA DEVI TEMPLE", "PTC QUARTER / ESWARANTEMP", "PUDUPAKKAM", "PUDUR", "PUDUR HIGH SCHOOL", "PULIPAKKAM", "PUSHPA NAGAR", "PUSHPAGIRI RD. JN", "PUTHUCHATHIRAM", "PUZHITHIVAKKAM B.S", "Q.M ARTS (MEN", "Q.M.ARTS COLLEGE", "Q.M.C", "RAMAPURAM", "RAMAPURAM (L.N.P KOIL", "RAMASAMY NAGAR", "RED HILLS", "REGAL", "ROYAPURAM P.S", "S.H.B", "S.I.V.E.T", "S.R.P. COLONY", "SADANANDAPURAM", "SAIDAPET", "SAIDAPET WEST", "SANTHOME P.O", "SARMA NAGAR", "SATHANKUPPAM", "SATHIYAMOORTHY NAGAR", "SAYANI/AYNAVARAM", "SCREW FACTORY", "SECRETARIAT", "SECRETARIAT COLONY", "SEMILIVARAM", "SENNEERKUPPAM", "SENTHIL NAGAR", "SHANTHI/DAMS RD", "SHIVASHANMUGAPURAM", "SHOLAVARAM", "SIDCO", "SIDCO NAGAR", "SIKKARAYAPURAM", "SIRUCHERI", "SIRUKALATHUR", "SOMANGALAM", "SOMANGALAM RD /AMARAMBEDU", "SOMANGALAM RD JN/N.V.R.D", "SONALUR / PUDUR", "SRI RAM ENGG.COLLEGE", "SRI SANKARA HEALTH CENTRE", "SRINIVASA NAGAR", "SRINIVASA THEATER", "SRP TOOLS", "ST THOMAS MOUNT PO", "ST THOMAS MOUNT R.S", "STERLING RD./METROLOG. DE", "SUN THEATER", "SUNDARASOZHAPURAM", "SUNNAMBU KOLATHUR", "SURAPEDU", "T.B.INSTITUTE", "T.B.SANATORIUM", "T.N.C.F", "T.NAGAR", "T.V.K.NAGAR", "T.V.S", "T.V.T RLY GATE", "TAMARAIPAKKAM", "TAMARIND TREE", "TAMBARAM", "TAMBARAM EAST", "TAMBARAM TOWN LIMIT", "TARAMANI", "TAYLORS ROAD", "TEACHERS COLONY", "TELEGRAPH OFFICE", "THAILAPURAM", "THALAMBUR", "THAMBUCHETTY ST", "THANDALAM RD JN", "THANDARAI", "THANGAL", "THAZHANKUPPAM", "THEAGARAYA COLLEGE", "THEYAMPAKKAM", "THILLAI GANGA NAGR IIND M", "THIRUMANGALAM", "THIRUMUDIVAKKAM", "THIRUNEERMALAI", "THIRUNINDRAVOOR", "THIRUNINDRAVOOR RLY.STN", "THIRUSOOLAM NATIONAL AIRP", "THIRUVANMIYUR", "THIRUVERKADU", "THIRUVETRIYUR B.S", "THIRUVOTRIYUR TEMPLE", "THORAPPAKKAM P.T.C COLONY", "THORAPPAKKAM TEA SHOP", "THRUVOTRIYUR TEMPLE", "TOLLGATE", "TONDAIAYRPET", "TRIPLICANE", "TRUSTPURAM", "U.S.I.S", "UTHAMAR GANDHISALAI (CORP", "UTHANDI VILLAGE", "V. NAGAR", "V.HOUSE", "V.HOUSE P.S", "V.M.STREET", "VAANAGARAM", "VADAPALANI B.S", "VADAPALANI JN", "VADAPERUMBAKKAM", "VADHATTUR JN", "VALASARAVAKKAM", "VALLIYUR SCHOOL", "VALLUVARKOTTAM", "VANDALOOR ZOO", "VANUVAMBEDU", "VARADARAJA PURAM", "VARADHARAJA THEATER", "VAZHUTHALAMBEDU RD. JN", "VEENUS", "VEERABADRA NAGAR", "VEERAPURAM", "VEERAPURAM RD JN", "VELACHERY", "VELACHERY HOSPITAL", "VELANGADUPAKKAM", "VELAPPANCHAVADI", "VELLAIKAL", "VELLALA STREET", "VELLAVEDU", "VENGAL CROSS ROAD", "VENGAMBAKKAM RD JN", "VENGATAPURAM", "VEPPAMPATTU R.S", "VETERINARY HOSPITAL", "VETERINARY HOSPITAL/PRDCT", "VICHOOR", "VIDYODAYA", "VILINJAMBAKKAM AMMAN KOIL", "VILLIVAKKAM", "VINAYAGAPURAM", "VINAYAGAR KOIL", "VIRUGAMBAKKAM", "VYASARPADI", "WATER TANK", "WEELS INDIA RD.JN", "WESLEY H.S", "WOMEN'S POLYTECHNIC", "Y.M.I.A" ];
'use strict'; function Paginator (page, perPage) { this.currentPage = page || 1; this.perPage = perPage || 4; this.lastPage = 0; this.data = []; return this; } Paginator.prototype.setCount = function (count) { this.count = Number(count); return this; }; Paginator.prototype.getLastPage = function () { this.lastPage = Math.ceil((this.count / this.perPage - 1) + 1); return this.lastPage; }; Paginator.prototype.setData = function (data) { this.data = data; return this; }; Paginator.prototype.getPaginator = function () { this.getLastPage(); if(!this.pages) { this.getPages(); } return this; }; Paginator.prototype.getCurrentPage = function () { return this.currentPage; }; Paginator.prototype.getLimit = function () { return this.perPage; }; Paginator.prototype.getPages = function () { this.pages = []; var i; for(i=1; i<this.lastPage + 1; i++) { this.pages.push(i); } return this.pages; }; Paginator.prototype.getOffset = function () { return (this.currentPage - 1) * this.perPage; }; module.exports = Paginator;
{ "translatorID": "b1c90b99-2e1a-4374-a03b-92e45f1afc55", "label": "Radio Free Europe / Radio Liberty", "creator": "Avram Lyon", "target": "^https?://(www\\.rferl\\.org/|www\\.azatliq\\.org/|www\\.azattyq\\.org/|rus\\.azattyq\\.org/|da\\.azadiradio\\.org/|pa\\.azadiradio\\.org/|www\\.azattyk\\.org/|www\\.ozodi\\.org/|www\\.ozodlik\\.org/|www\\.evropaelire\\.org/|www\\.slobodnaevropa\\.org/|www\\.makdenes\\.org/|www\\.iraqhurr\\.org/|www\\.radiofarda\\.com/|www\\.azatutyun\\.am/|www\\.azadliq\\.org/|www\\.svaboda\\.org/|www\\.svoboda\\.org/|www\\.tavisupleba\\.org/|www\\.azathabar\\.com/|www\\.svobodanews\\.ru/|www\\.europalibera\\.org/|www\\.radiosvoboda\\.org/)", "minVersion": "2.1.9", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsbv", "lastUpdated": "2014-04-04 10:15:37" } /* ***** BEGIN LICENSE BLOCK ***** Radio Liberty Translator Copyright © 2009-2011 Avram Lyon, [email protected] This file is part of Zotero. Zotero is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Zotero is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Zotero. If not, see <http://www.gnu.org/licenses/>. ***** END LICENSE BLOCK ***** */ /* This translator works on articles posted on the websites of Radio Free Europe / Radio Liberty. It imports the basic metadata the site provides, from normal article pages and from search result pages. The translator tries to work on all of the languages of RFE/RL; they should all work. Editions: English: http://www.rferl.org/ Tatar/Bashkir: http://www.azatliq.org/ Kazakh: http://www.azattyq.org/ (Kazakh) http://rus.azattyq.org/ (Russian) Afghan: http://da.azadiradio.org/ (Dari) http://pa.azadiradio.org/ (Pashto) Kirghiz: http://www.azattyk.org/ Tajik: http://www.ozodi.org/ Uzbek: http://www.ozodlik.org/ Albanian: http://www.evropaelire.org/ Bosnian/Montenegrin/Serbian: http://www.slobodnaevropa.org/ Macedonian: http://www.makdenes.org/ Iraqi Arabic: http://www.iraqhurr.org/ Farsi: http://www.radiofarda.com/ Armenian: http://www.azatutyun.am/ Azerbaijani: http://www.azadliq.org/ Belarus: http://www.svaboda.org/ Georgian: http://www.tavisupleba.org/ Turkmen: http://www.azathabar.com/ Russian: http://www.svobodanews.ru/ and svoboda.org Moldovan: http://www.europalibera.org/ (Romanian) Ukrainian: http://www.radiosvoboda.org/ This translator does not yet attempt to work with the video files that Radio Liberty hosts and produces; work with them must be left for a future revision. It does try to save linked audio files for stories-- still nothing for video content. Another future improvement would be the facility to import from the front page and subject pages. This is not yet possible. Some of the services use non-standard ways of marking authorship, for example, the Pashto edition places the author at the bottom of the article, but there is no clear way to scrape that information and the translator does not load it. */ var item; function detectWeb(doc, url){ if (url.match(/\/content\/|\/archive\/news|\/archive\/ru_news_zone/)) { // The translator uses this type because RFE/RL generally has a place of publication // and a Section; both are specific to newspaperArticle. return "newspaperArticle"; } else if (url.match(/\/search\/\?k=.+/)){ return "multiple"; } } function doWeb(doc, url){ var articles = new Array(); if (detectWeb(doc, url) == "multiple") { var results = doc.evaluate('//div[@class="searchResultItem"]', doc, null, XPathResult.ANY_TYPE, null); var items = new Array(); var result; while(result = results.iterateNext()) { var link = doc.evaluate('./a[@class="resultLink"]', result, null, XPathResult.ANY_TYPE, null).iterateNext(); var title = link.textContent; var url = link.href; items[url] = title; } Zotero.selectItems(items, function (items) { if (!items) { return true; } for (var i in items) { articles.push(i); } Zotero.Utilities.processDocuments(articles, scrape); }); } else { scrape(doc, url); } function scrape(doc, url){ item = new Zotero.Item("newspaperArticle"); item.title = Zotero.Utilities.trimInternal( doc.evaluate('//h1', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent ); var author = doc.evaluate('//div[@id="article"]//div[@class="author"]', doc, null, XPathResult.ANY_TYPE, null); if ((author = author.iterateNext()) !== null) { author = author.textContent; // Sometimes we have "By Author" if(author.substr(0, 3).toLowerCase() == "by ") { author = author.substr(3); } var cleaned = Zotero.Utilities.cleanAuthor(author, "author"); // If we have only one name, set the author to one-name mode if (cleaned.firstName == "") { cleaned["fieldMode"] = true; } else { // We can check for all lower-case and capitalize if necessary // All-uppercase is handled by cleanAuthor cleaned.firstName = (cleaned.firstName == cleaned.firstName.toLowerCase()) ? Zotero.Utilities.capitalizeTitle(cleaned.firstName, true) : cleaned.firstName; cleaned.lastName = (cleaned.lastName == cleaned.lastName.toLowerCase()) ? Zotero.Utilities.capitalizeTitle(cleaned.lastName, true) : cleaned.lastName; } item.creators.push(cleaned); } // The section should _always_ be present item.section = ZU.xpathText(doc, '//div[@id="article" or contains(@class, "middle_content")]/h2'); // This exposes a limitation of Zotero's date handling; the Afghan services // use the Hijri calendar, and mixed sorting looks funny-- I'd like to be able // to mark such dates to be handled appropriately var date = doc.evaluate('//div[@id="article"]//p[@class="article_date"]', doc, null, XPathResult.ANY_TYPE, null); if ((date = date.iterateNext()) !== null) { // sometimes not present item.date = Zotero.Utilities.trimInternal(date.textContent); } // We can also try to derive the location-- if the byline can be parsed // Here, we assume that the byline uses all-caps for the location // TODO Use more general all-caps character class, since this excludes special // characters that may occur in city names. // This all-caps class is borrowed from utilities.js and augmented by // the basic Cyrillic capital letters. var textnode = doc.evaluate('//div[@id="article"]//div[@class="zoomMe"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext(); if (textnode) { var text = textnode.textContent; hits = text.match(/([A-ZА-Я \u0400-\u042f]+) \((.*)\) --/); if (!hits) { hits = text.match(/([A-ZА-Я \u0400-\u042f]+) --/); } if (hits) { var place = Zotero.Utilities.capitalizeTitle(hits[1], true); item.place = place; // We add the wire service as an author; it would be nice to have a field for it item.creators.push({lastName : hits[2], creatorType:"author", fieldMode:true}); } } item.url = url; item.publicationTitle = doc.evaluate('//h2[@id="header_logo_anchor" or @id="header_logo"]//span', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent.trim(); // Language map: var map = { "www.rferl.org" : "English", "www.azatliq.org" : "Tatar/Bashkir", "www.azattyq.org" : "Kazakh", "rus.azattyq.org" : "Russian", "da.azadiradio.org" : "Dari", "pa.azadiradio.org" : "Pashto", "www.azattyk.org" : "Kirghiz", "www.ozodi.org" : "Tajik", "www.ozodlik.org" : "Uzbek", "www.evropaelire.org" : "Albanian", "www.slobodnaevropa.org" : "Bosnian/Montenegrin/Serbian", "www.makdenes.org" : "Macedonian", "www.iraqhurr.org" : "Iraqi Arabic", "www.radiofarda.com" : "Farsi", "www.azatutyun.am" : "Armenian", "www.azadliq.org" : "Azerbaijani", "www.svaboda.org" : "Belarussian", "www.tavisupleba.org" : "Georgian", "www.azathabar.com" : "Turkmen", "www.svobodanews.ru" : "Russian", "www.svoboda.org" : "Russian", "www.europalibera.org" : "Romanian", "www.radiosvoboda.org" : "Ukrainian" } domain = doc.location.href.match(/https?:\/\/([^/]+)/); item.language = map[domain[1]]; /* The printable version doesn't save nicely, unfortunately. // Make printable URL for better saving var printurl = url.replace(/(.*)\/.*\/(.*\.html)/,"$1/articleprintview/$2"); item.attachments.push({url:printurl, title:"RFE/RL Snapshot", mimeType:"text/html"}); */ item.attachments.push({url:url, title: (item.publicationTitle + " Snapshot"), mimeType:"text/html"}); var listenLink = doc.evaluate('//li[@class="listenlink"]/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext(); if (listenLink) { Zotero.Utilities.doGet(listenLink.href, addAudio, null); } else item.complete(); } } function addAudio(text) { // http://realaudio.rferl.org/TB/2011/03/29/20110329-183936-TB-clip.mp3 var audio = text.match(/https?:\/\/(realaudio|audioarchive)\.rferl\.org[^"]*\.mp3/); if (audio) item.attachments.push({url:audio[0], mimeType:"application/octet-stream", title:"RFE/RL Audio"}) item.complete(); } /** BEGIN TEST CASES **/ var testCases = [ { "type": "web", "url": "http://www.azatliq.org/content/article/24281041.html", "items": [ { "itemType": "newspaperArticle", "creators": [ { "firstName": "Гүзәл", "lastName": "Мәхмүтова", "creatorType": "author" } ], "notes": [], "tags": [], "seeAlso": [], "attachments": [ { "url": false, "title": " Азатлык Радиосы Snapshot", "mimeType": "text/html" }, { "url": false, "mimeType": "application/octet-stream", "title": "RFE/RL Audio" } ], "title": "Татар яшьләре татарлыкны сакларга тырыша", "section": "татарстан", "date": "29.07.2011", "url": "http://www.azatliq.org/content/article/24281041.html", "publicationTitle": "Азатлык Радиосы", "language": "Tatar/Bashkir", "libraryCatalog": "Radio Free Europe / Radio Liberty" } ] }, { "type": "web", "url": "http://www.svoboda.org/content/news/24382010.html", "items": [ { "itemType": "newspaperArticle", "creators": [], "notes": [], "tags": [], "seeAlso": [], "attachments": [ { "title": "Радио Свобода Snapshot", "mimeType": "text/html" } ], "title": "Партия \"Яблоко\" перевела свою предвыборную программу на 18 языков", "section": "Новости", "date": "Опубликовано 05.11.2011 06:49", "url": "http://www.svoboda.org/content/news/24382010.html", "publicationTitle": "Радио Свобода", "language": "Russian", "libraryCatalog": "Radio Free Europe / Radio Liberty", "accessDate": "CURRENT_TIMESTAMP" } ] } ] /** END TEST CASES **/
var searchData= [ ['up_5f',['up_',['../class_rational_type.html#ab200b64618693ea1a166755f8d8bec63',1,'RationalType']]] ];
/* ----------- JOBS ------------ */ export const REQUEST_ALL_JOBS = 'REQUEST_ALL_JOBS' export const REQUEST_FILTERED_JOBS = 'REQUEST_FILTERED_JOBS' export const RECEIVE_FILTERED_JOBS = 'RECEIVE_FILTERED_JOBS' export const RECEIVE_ALL_JOBS = 'RECEIVE_ALL_JOBS' export const PAGINATE_JOBS = 'PAGINATE_JOBS' export const RECEIVE_JOB = 'RECEIVE_JOB' export const REQUEST_JOB = 'REQUEST_JOB' export const CREATE_JOBS = 'CREATE_JOBS' export const UPDATE_JOB = 'UPDATE_JOB' export const CLOSE_JOB = 'CLOSE_JOB' /* ----- APP LOCATION UPDATE ----- */ export const RECEIVE_DASH_LOCATION = 'RECEIVE_DASH_LOCATION' export const RECEIVE_NEXT_ROUTE = 'RECEIVE_NEXT_ROUTE' /* ----------- SKILLS ------------ */ export const RECEIVE_SELECTED_SKILLS = 'RECEIVE_SELECTED_SKILLS' export const REQUEST_ALL_SKILLS = 'REQUEST_ALL_SKILLS' export const CREATE_SKILLS = 'CREATE_SKILLS' export const RECEIVE_SKILLS = 'RECEIVE_SKILLS' /* ------ USERS & PROJECTS ------- */ export const AUTHENTICATED = 'AUTHENTICATED' export const AUTHENTICATING = 'AUTHENTICATING' export const REQUEST_USER = 'REQUEST_USER' export const RECEIVE_USER = 'RECEIVE_USER' export const CREATE_USER = 'CREATE_USER' export const UPDATE_USER = 'UPDATE_USER' export const DELETE_USER = 'DELETE_USER' export const APPLY_TO_JOB = 'APPLY_TO_JOB' export const APPLIED_TO_JOB = 'APPLIED_TO_JOB' export const SAVE_JOB = 'SAVE_JOB' export const UNSAVE_JOB = 'UNSAVE_JOB' export const REQUEST_ALL_USERS = 'REQUEST_ALL_USERS' export const REQUEST_FILTERED_USERS = 'REQUEST_FILTERED_USERS' export const RECEIVE_FILTERED_USERS = 'RECEIVE_FILTERED_USERS' export const RECEIVE_ALL_USERS = 'RECEIVE_ALL_USERS' export const PAGINATE_USERS = 'PAGINATE_USERS' export const BEGIN_UPLOADING = 'BEGIN_UPLOADING' export const DONE_UPLOADING = 'DONE_UPLOADING' export const REQUEST_PROJECT = 'REQUEST_PROJECT' export const RECEIVE_PROJECT = 'RECEIVE_PROJECT' export const CREATE_PROJECT = 'CREATE_PROJECT' export const UPDATE_PROJECT = 'UPDATE_PROJECT' export const DELETE_PROJECT = 'DELETE_PROJECT' /* ----------- ALERTS ------------ */ export const RECEIVE_ALERT = 'RECEIVE_ALERT' export const DISMISS_ALERT = 'DISMISS_ALERT'
module.exports = { printWidth: 120, trailingComma: 'all', singleQuote: true, };
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { ScrollView } from 'react-native'; import AppStyle from '../../../theme/styles'; import TodoListHelper from '../../../utils/TodoListHelper'; import TodoListItem from '../../../components/discover/todo-list/view/TodoListItem'; import DoneListTitle from '../../../components/discover/todo-list/view/DoneListTitle'; let notChangeList; let changeList; let changeState; let changeBasic; class TodoList extends Component { static componentName = 'TodoList'; static propTypes = { data: PropTypes.shape( PropTypes.string.isRequired, PropTypes.string.isRequired, PropTypes.arrayOf( PropTypes.shape( PropTypes.string, ), ).isRequired, ).isRequired, }; static defaultProps = { data: {}, }; constructor(props) { super(props); this.state = { data: this.props.data, test: false, }; this.getNotChangeList = val => ( this.state.data.basic .filter(todo => todo.title !== val.title)); this.getChangeList = val => ( this.state.data.basic .filter(todo => todo.title === val.title) .map((value) => { changeState = value; changeState.state = !changeState.state; return changeState; })); this.change = (val) => { notChangeList = this.getNotChangeList(val); changeList = this.getChangeList(val); changeBasic = { basic: notChangeList.concat(changeList) }; TodoListHelper.changeTodoState( TodoListHelper.key(this.props.data), changeBasic, result => ( this.setState({ data: result }))); }; } componentDidMount() { TodoListHelper.init( TodoListHelper.key(this.props.data), this.props.data, result => ( this.setState({ data: result }))); } getTodoList() { return this.state.data.basic .filter(val => !val.state) .map( (val, index) => ( <TodoListItem title={val.title} click={() => { this.change(val); }} key={val.id.concat(index)} />)); } getDoneList() { return this.state.data.basic .filter(val => val.state) .map( (val, index) => ( <TodoListItem checked title={val.title} click={() => { this.change(val); }} key={val.id.concat(index)} />)); } render() { if (this.state.data !== null) { const todo = this.getTodoList(); const done = this.getDoneList(); return ( <ScrollView style={[AppStyle.detailBasisStyle, { backgroundColor: null }]}> {todo} { (done.length !== 0) ? <DoneListTitle /> : null } {done} </ScrollView>); } return null; } } export default TodoList;
(function(window){ var WORKER_PATH = 'recorderWorker.js'; var Recorder = function(source, cfg){ var config = cfg || {}; var bufferLen = config.bufferLen || 4096; this.context = source.context; this.node = this.context.createScriptProcessor(bufferLen, 2, 2); var worker = new Worker(config.workerPath || WORKER_PATH); worker.postMessage({ command: 'init', config: { sampleRate: this.context.sampleRate } }); var recording = false, currCallback; this.node.onaudioprocess = function(e){ if (!recording) return; worker.postMessage({ command: 'record', buffer: [ e.inputBuffer.getChannelData(0), e.inputBuffer.getChannelData(1) ] }); } this.configure = function(cfg){ for (var prop in cfg){ if (cfg.hasOwnProperty(prop)){ config[prop] = cfg[prop]; } } } this.record = function(){ recording = true; } this.stop = function(){ recording = false; } this.clear = function(){ worker.postMessage({ command: 'clear' }); } this.getBuffer = function(cb) { currCallback = cb || config.callback; worker.postMessage({ command: 'getBuffer' }) } this.exportWAV = function(cb, type){ currCallback = cb || config.callback; type = type || config.type || 'audio/wav'; if (!currCallback) throw new Error('Callback not set'); worker.postMessage({ command: 'exportWAV', type: type }); } worker.onmessage = function(e){ var blob = e.data; currCallback(blob); } source.connect(this.node); this.node.connect(this.context.destination); //this should not be necessary }; Recorder.forceDownload = function(blob, filename){ var url = (window.URL || window.webkitURL).createObjectURL(blob); var link = window.document.createElement('a'); link.href = url; link.download = filename || 'output.wav'; var click = document.createEvent("Event"); click.initEvent("click", true, true); link.dispatchEvent(click); } window.Recorder = Recorder; })(window);
module.exports = ( function () { "use strict"; var numGainNodes = 4; var audioContext = new AudioContext(); var gainNodes = []; for (var i = 0; i < numGainNodes; i++) { var gainNode = audioContext.createGain(); gainNode.connect(audioContext.destination); gainNode.gain.value = 1; gainNodes.push(gainNode); } var iGainNode = 0; function getNextGainNode() { var node = gainNodes[iGainNode]; iGainNode = (iGainNode + 1) % numGainNodes; return node; } var playBuffer = function (buffer, vol) { var source = audioContext.createBufferSource(); var gainNode = getNextGainNode(); gainNode.gain.value = vol; source.connect(gainNode); source.buffer = buffer; source.start(0); }; var loadBuffer = function (url, onLoad) { var request = new XMLHttpRequest(); request.responseType = 'arraybuffer'; request.open('GET', url); request.onload = function () { audioContext.decodeAudioData(this.response, onLoad); }; request.send(); }; return { audioContext: audioContext, getNextGainNode: getNextGainNode, playBuffer: playBuffer, loadBuffer: loadBuffer }; } )();
angular.module('map.service', []) .factory('MapServices', function($q) { var makeMap = function(mapCanvas) { var deferred = $q.defer(); var map = new google.maps.Map(mapCanvas, { zoom: 15, center: {lat: 34.0210487, lng: -118.4922354}, scrollwheel: false }); deferred.resolve(map); return deferred.promise; // return map; }; var geocoder = new google.maps.Geocoder(); var infowindow = new google.maps.InfoWindow(); var getGeoCode = function(address){ var deferred2 = $q.defer(); var geocodeOptions = { address: address }; geocoder.geocode(geocodeOptions, function(results, status) { if ( status !== google.maps.GeocoderStatus.OK ) { console.log("Geocoder failed!!! ", status); //deferred.reject('Geocoder failed due to: ' + status); } deferred2.resolve(results[0].geometry.location); }); return deferred2.promise; // need to call lat() and lng() }; var renderMarker = function(transaction, map, bounds){ var date = transaction.spent_date || ""; var contentString = '<div id="content" style="font-family: sans-serif">'+ '<div id="bodyContent">'+ '<p style="color: black"><strong>' + transaction.name + '</strong></p>'+ '<p style="color: black; width: 200px">' + transaction.location.slice(0, -15) + '</p>'+ '<p style="color: black">$' + transaction.amount + '</p>'+ '<p style="color: black">' + date + '</p>'+ '</div>'+ '</div>'; var icons = { "Food & Drink": "assets/google/forkknife.png", // "assets/google/purple-dot.png", "Entertainment": "assets/google/arts.png", "Education": "assets/google/graduation.png", "Travel": "assets/google/plane.png", "Rent": "assets/google/homegardenbusiness.png", "Household": "assets/google/grocerystore.png", "Transport": "assets/google/cargreen.png", "Payments": "assets/google/dollar.png", "Shopping": "assets/google/cart.png", "Healthcare": "assets/google/redcross.png", "Tax": "assets/google/dollar.png", "Miscellaneous": "assets/google/miscpin.png" }; var marker = new google.maps.Marker({ position: transaction.latlng, map: map, title: transaction.name, icon: icons[transaction.category] }); marker.addListener('click', function() { infowindow.setContent(contentString); infowindow.open(map, marker); }); var ll = new google.maps.LatLng(transaction.latlng); bounds.extend(ll); }; var setBounds = function(map, bounds){ map.fitBounds(bounds); }; return { makeMap: makeMap, getGeoCode: getGeoCode, renderMarker: renderMarker, setBounds: setBounds }; });
YUI.add('log-extension', function (Y) { Y.LogExtension = function () { this.log = function (msg, type) { if (window.appConfig.isDebug) { if (typeof msg === 'object') { Y.log(msg); } else { type = type || 'info'; Y.log(msg, type, this.name); } } }; }; });
/* * MouseShake.js * Version 1.0 * Author: David Godzsak * [email protected] * * Copyright (c) 2015 * Licensed under the MIT license. * */ (function(){ //Setup //object timestamp with coordinates Stamp=function(x,y,time){ this.x=x; this.y=y; this.time=time; }; //constants and global vars var stuff={ //units moves:[], //set of Stamps deg:0, //degrees tick:new Date().getTime(), //time x:0, //coordinate x y:0, //coorddinate y refresh:80, //milisecs shakeDeg:500, //degrees lifeTime:500, //milisecs l:false //mousemove indicator }; //shake event var mouseshake = new Event('mouseshake',{ 'detail' : 'mouseshake fired', 'bubbles': true, 'cancelable': true }); //get gamma in triangles using law of cosines function gamma(st,nd,rd){ //pythagoras var a=Math.sqrt(Math.pow(st.x-nd.x,2)+Math.pow(st.y-nd.y,2)); var b=Math.sqrt(Math.pow(nd.x-rd.x,2)+Math.pow(nd.y-rd.y,2)); var c=Math.sqrt(Math.pow(rd.x-st.x,2)+Math.pow(rd.y-st.y,2)); var gam; if((a*b)==0){ gam=0; }else{ //law of cosines gam=180-Math.acos((Math.pow(a,2)+Math.pow(b,2)-Math.pow(c,2))/(2*a*b))*180/Math.PI; }; return gam; }; //update mouse position document.addEventListener('mousemove',function(e){ //new position stuff.x=e.pageX; stuff.y=e.pageY; stuff.l=true; }); //detects shake event detect=setInterval(function(){ //add new Stamps if(stuff.l){ //set up Stamp var now=new Date().getTime(); var a=new Stamp(stuff.x,stuff.y,now); //add Stamp to set stuff.moves.push(a); stuff.l=false; //mousemove indicator off }; //delete old Stamps -----------------might need some improvement. for(var i=0;i<stuff.moves.length;++i){ if(now-stuff.moves[i].time>stuff.lifeTime){ stuff.moves.splice(i, 1); }; }; //reset degrees so we can add them again stuff.deg=0; //add up gammas (deg=sum(gamma)) if(stuff.moves.length>2){ for(var i=2;i<stuff.moves.length;++i){ stuff.deg+=gamma(stuff.moves[i],stuff.moves[i-1],stuff.moves[i-2]); }; }; //if degree exceeds shakeDeg shake event happens if(stuff.deg>stuff.shakeDeg){ //fire document.dispatchEvent(mouseshake); //reset everything when shake happens stuff.deg=0; stuff.moves=[]; }; },stuff.refresh); })();
var searchData= [ ['jump_5fto_5findex',['jump_to_index',['../namespace_exact_abstract.html#a66f81afa75f4987d4f04a081b294312b',1,'ExactAbstract']]] ];
(function(){ var get = Ember.get, set = Ember.set; var oValidator; module("Validator mixins", { setup: function() { oValidator = Ember.Validation.map(function(){ this.property('name').required().length(5,6); this.property('age').required(); }) }, teardown: function() { oValidator = null; } }); test('ValidatorSupport', function() { var o = Ember.Object.extend(Ember.Validation.ValidatorSupport, { validator: oValidator, name:"test", age:"" }).create(); var result1 = o.validate(true); strictEqual(get(result1, 'hasError'), true, "object callback"); o.name = "tester"; o.age = "20"; var result2 = o.validate(true); strictEqual(get(result2, 'hasError'), false, "object callback"); }); /** * Should support specifying a base class without explicitly declaring a validator property * * Example: * App.Form = Em.Object.extend(Ember.Validation.ValidatorSupport); * App.Form.create(); */ test('ValidatorSupport initializes without explicitly declaring validator property', function() { expect(1); var o = Ember.Object.extend(Ember.Validation.ValidatorSupport).create(); ok(o); }); test('ValidatorSupport callbacks', function() { expect(5); var o = Ember.Object.extend(Ember.Validation.ValidatorSupport, { validator: oValidator, name:"test", age:"" }).create(); o.subscribeValidation("", this, function(result){ strictEqual(get(result, 'hasError'), true, "object callback"); }); o.subscribeValidation("name", this, function(result){ strictEqual(get(result, 'hasError'), true, "name callback"); }); var func = function(result){ strictEqual(get(result, 'hasError'), true, "age callback"); }; o.subscribeValidation("age", this, func); o.validate(); o.unsubscribeValidation("age", this, func); o.validate(true); }); })();
loadOnce("../BaseSettingElement"); loadOnce("../$SettingElementTypesHandler"); loadOnce("/GUIelements/inputs/ShortcutInputElement"); loadOnce("/$Utils"); window.ShortcutSettingElementClass = class ShortcutSettingElementClass extends BaseSettingElementClass{ __initHtml(){ super.__initHtml(); var t = this; this.shortcutElement = new ShortcutInputElement(this.setting.value, function(){ t.updateSize(); }, function(value){ return true; //is value valid, might add a method for checking clashing shortcuts in the future }); this.$(".value").append(this.shortcutElement); } __valueChange(newValue, oldValue){ this.shortcutElement.setValue(newValue); } static matchesSetting(setting){ //code to determine if the setting element matches the setting return setting.value instanceof Shortcut; } } $SettingElementTypesHandler.registerElementClass(window.ShortcutSettingElementClass);
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var alias_1 = require("./alias"); exports.AliasConverter = alias_1.AliasConverter; var array_1 = require("./array"); exports.ArrayConverter = array_1.ArrayConverter; var binding_array_1 = require("./binding-array"); exports.BindingArrayConverter = binding_array_1.BindingArrayConverter; var binding_object_1 = require("./binding-object"); exports.BindingObjectConverter = binding_object_1.BindingObjectConverter; var enum_1 = require("./enum"); exports.EnumConverter = enum_1.EnumConverter; var intrinsic_1 = require("./intrinsic"); exports.IntrinsicConverter = intrinsic_1.IntrinsicConverter; var string_literal_1 = require("./string-literal"); exports.StringLiteralConverter = string_literal_1.StringLiteralConverter; var reference_1 = require("./reference"); exports.ReferenceConverter = reference_1.ReferenceConverter; var this_1 = require("./this"); exports.ThisConverter = this_1.ThisConverter; var tuple_1 = require("./tuple"); exports.TupleConverter = tuple_1.TupleConverter; var type_parameter_1 = require("./type-parameter"); exports.TypeParameterConverter = type_parameter_1.TypeParameterConverter; var union_1 = require("./union"); exports.UnionConverter = union_1.UnionConverter; var unknown_1 = require("./unknown"); exports.UnknownConverter = unknown_1.UnknownConverter; //# sourceMappingURL=index.js.map
function Point(x, y) { // :: Int -> Int -> Int -> Point if (x instanceof Array) { this.init(x[0], x[1]) } else { this.init(x, y) } this.init = function (x, y) { this.x = Math.round(x) || 0 this.y = Math.round(y) || 0 } } Point.prototype.rotate2d = function (n, xbit, ybit) { // : Int -> Int -> Int -> Point var rotate = rotate2d(n, this.x, this.y, xbit, ybit) this.x = rotate[0], this.y = rotate[1] } function convert2dPointToDistance (p, height) { // :: Int -> Int -> Int -> Int if (p instanceof Array) p = new Point(p) var xbit, ybit, level, d = 0 var forHeight = p.x > p.y ? p.x : p.y // needs some tests to make sure height is compatible // What keeps the user from putting 54 down as the height while (forHeight >= height) { height *=2 } // For each Hilbert level, we want to add an amount to // `d` based on which region we are in for (level = height / 2; level > 0; level = Math.floor(level / 2)) { // Determine what region we're in xbit = (p.x & level) > 0 ybit = (p.y & level) > 0 // increase distance based on region d += level * level * ((3 * xbit) ^ ybit) // rotate so that we'll be in sync with the next // region. p.rotate2d(level, xbit, ybit) } return d } function convertDistanceTo2dPoint (distance, height) { // :: Int -> Int -> [Int, Int] distance = Math.floor(distance) var xbit, ybit, level, p = new Point(0, 0) if (height <= Math.sqrt(distance)) { height = 2 while (height <= Math.sqrt(distance)) { height *=2 } } for (level = 1; level < height; level *= 2) { xbit = 1 & (distance / 2) ybit = 1 & (distance ^ xbit) p.rotate2d(level, xbit, ybit) p.x += level * xbit p.y += level * ybit distance = Math.floor(distance / 4) } return [p.x, p.y] } function rotate2d (n, x, y, xbit, ybit) { // :: Int -> Int -> Int -> Int -> Int -> [Int, Int] if (ybit == 0 ) { if (xbit == 1) { x = n - 1 - x y = n - 1 - y } var temp = x x = y y = temp } return [x, y] }
import { accessor as get } from './accessors' import dates from './dates' export function startsBefore(date, min) { return dates.lt(dates.merge(min, date), min, 'minutes') } export function positionFromDate(date, min, total) { if (startsBefore(date, min)) return 0 let diff = dates.diff(min, dates.merge(min, date), 'minutes') return Math.min(diff, total) } /** * Events will be sorted primarily according to earliest start time. * If two events start at the same time, the one with the longest duration will * be placed first. */ let sort = (events, { startAccessor, endAccessor }) => events.sort((a, b) => { let startA = +get(a, startAccessor) let startB = +get(b, startAccessor) if (startA === startB) { return +get(b, endAccessor) - +get(a, endAccessor) } return startA - startB }) let getSlot = (event, accessor, min, totalMin) => event && positionFromDate( get(event, accessor), min, totalMin ) /** * Two events are considered siblings if the difference between their * start time is less than 1 hour. */ let isSibling = (idx1, idx2, { events, startAccessor, min, totalMin }) => { let event1 = events[idx1] let event2 = events[idx2] if (!event1 || !event2) return false let start1 = getSlot(event1, startAccessor, min, totalMin) let start2 = getSlot(event2, startAccessor, min, totalMin) return (Math.abs(start1 - start2) < 60) } /** * An event is considered a child of another event if its start time is * more than 1 hour later than the other event's start time, * but before its end time. */ let isChild = (parentIdx, childIdx, { events, startAccessor, endAccessor, min, totalMin }) => { if (isSibling( parentIdx, childIdx, { events, startAccessor, endAccessor, min, totalMin } )) return false let parentEnd = getSlot(events[parentIdx], endAccessor, min, totalMin) let childStart = getSlot(events[childIdx], startAccessor, min, totalMin) return parentEnd > childStart } /** * Given an event index, siblings directly following it will be found and * returned as an array of indexes. */ let getSiblings = (idx, { events, startAccessor, endAccessor, min, totalMin }) => { let nextIdx = idx let siblings = [] while (isSibling( idx, ++nextIdx, { events, startAccessor, endAccessor, min, totalMin }) ) { siblings.push(nextIdx) } return siblings } /** * Given an event index, and a start search position, all child events to that * event will be found and placed into groups of siblings. * The return value is an array of child group arrays, as well as the largest * size of the child groups. */ let getChildGroups = (idx, nextIdx, { events, startAccessor, endAccessor, min, totalMin }) => { let groups = [] let nbrOfColumns = 0 while (isChild( idx, nextIdx, { events, startAccessor, endAccessor, min, totalMin } )) { let childGroup = [nextIdx] let siblingIdx = nextIdx while (isSibling( nextIdx, ++siblingIdx, { events, startAccessor, endAccessor, min, totalMin } )) { childGroup.push(siblingIdx) } nbrOfColumns = Math.max(nbrOfColumns, childGroup.length) groups.push(childGroup) nextIdx = siblingIdx } return { childGroups: groups, nbrOfChildColumns: nbrOfColumns } } /** * Returns height and top offset, both in percentage, for an event at * the specified index. */ let getYStyles = (idx, { events, startAccessor, endAccessor, min, totalMin, step }) => { let event = events[idx] let start = getSlot(event, startAccessor, min, totalMin) let end = Math.max(getSlot(event, endAccessor, min, totalMin), start + step) let top = start / totalMin * 100 let bottom = end / totalMin * 100 return { top, height: bottom - top } } /** * Takes an array of unsorted events, and returns a sorted array * containing the same events, but with an additional style property. * These styles will position the events similarly to Google Calendar. * * The algorithm will start by sorting the array, and then iterating over it. * Starting at the first event, each of its siblings and children, placed in * groups of siblings, will be found. Both are needed in order to calculate the * width of the first event. When the width is known, its siblings will be * given the same width, but with an incremental x-offset. * * Each group of children will be looking to move as far away from its original * parent as possible. A move can be made to one of the parent's siblings, if * that sibling is also a parent to the child group. This will make room for * more events. * * When a child group knows its parent, it looks at the space occupied by that * parent, and calculates the remaning available space and divides that among * each other. * * All widths and x-offsets are calculated without taking overlapping into * account. Overlapping is added in the end according to the OVERLAP_MULTIPLIER. * If that is set to 0, the events won't overlap or grow. * * When one of these rounds are finished, all events connected have been * traversed, so the cursor will be moved past all of them. */ export default function getStyledEvents ({ events: unsortedEvents, startAccessor, endAccessor, min, totalMin, step }) { let OVERLAP_MULTIPLIER = 0.3 let events = sort(unsortedEvents, { startAccessor, endAccessor }) let helperArgs = { events, startAccessor, endAccessor, min, totalMin, step } let styledEvents = [] let idx = 0 // One iteration will cover all connected events. while (idx < events.length) { let siblings = getSiblings(idx, helperArgs) let { childGroups, nbrOfChildColumns } = getChildGroups( idx, idx + siblings.length + 1, helperArgs ) let nbrOfColumns = Math.max(nbrOfChildColumns, siblings.length) + 1; // Set styles to top level events. [idx, ...siblings].forEach((eventIdx, siblingIdx) => { let width = 100 / nbrOfColumns let xAdjustment = width * (nbrOfColumns > 1 ? OVERLAP_MULTIPLIER : 0) let { top, height } = getYStyles(eventIdx, helperArgs) styledEvents[eventIdx] = { event: events[eventIdx], style: { top, height, width: width + xAdjustment, xOffset: (width * siblingIdx) - xAdjustment } } }) childGroups.forEach(group => { let parentIdx = idx let siblingIdx = 0 // Move child group to sibling if possible, since this will makes // room for more events. while (isChild(siblings[siblingIdx], group[0], helperArgs)) { parentIdx = siblings[siblingIdx] siblingIdx++ } // Set styles to child events. group.forEach((eventIdx, i) => { let { style: parentStyle } = styledEvents[parentIdx] let spaceOccupiedByParent = parentStyle.width + parentStyle.xOffset let columns = Math.min(group.length, nbrOfColumns) let width = (100 - spaceOccupiedByParent) / columns let xAdjustment = spaceOccupiedByParent * OVERLAP_MULTIPLIER let { top, height } = getYStyles(eventIdx, helperArgs) styledEvents[eventIdx] = { event: events[eventIdx], style: { top, height, width: width + xAdjustment, xOffset: spaceOccupiedByParent + (width * i) - xAdjustment } } }) }) // Move past all events we just went through idx += 1 + siblings.length + childGroups.reduce( (total, group) => total + group.length, 0 ) } return styledEvents }
import Frontmatter from '../frontmatter'; jest.mock("../../valueObjects/AssetProxy.js"); const FrontmatterFormatter = new Frontmatter(); describe('Frontmatter', () => { it('should parse YAML with --- delimiters', () => { expect( FrontmatterFormatter.fromFile('---\ntitle: YAML\ndescription: Something longer\n---\nContent') ).toEqual( { title: 'YAML', description: 'Something longer', body: 'Content', } ); }); it('should parse YAML with ---yaml delimiters', () => { expect( FrontmatterFormatter.fromFile('---yaml\ntitle: YAML\ndescription: Something longer\n---\nContent') ).toEqual( { title: 'YAML', description: 'Something longer', body: 'Content', } ); }); it('should overwrite any body param in the front matter', () => { expect( FrontmatterFormatter.fromFile('---\ntitle: The Title\nbody: Something longer\n---\nContent') ).toEqual( { title: 'The Title', body: 'Content', } ); }); it('should parse TOML with +++ delimiters', () => { expect( FrontmatterFormatter.fromFile('+++\ntitle = "TOML"\ndescription = "Front matter"\n+++\nContent') ).toEqual( { title: 'TOML', description: 'Front matter', body: 'Content', } ); }); it('should parse TOML with ---toml delimiters', () => { expect( FrontmatterFormatter.fromFile('---toml\ntitle = "TOML"\ndescription = "Something longer"\n---\nContent') ).toEqual( { title: 'TOML', description: 'Something longer', body: 'Content', } ); }); it('should parse JSON with { } delimiters', () => { expect( FrontmatterFormatter.fromFile('{\n"title": "The Title",\n"description": "Something longer"\n}\nContent') ).toEqual( { title: 'The Title', description: 'Something longer', body: 'Content', } ); }); it('should parse JSON with ---json delimiters', () => { expect( FrontmatterFormatter.fromFile('---json\n{\n"title": "The Title",\n"description": "Something longer"\n}\n---\nContent') ).toEqual( { title: 'The Title', description: 'Something longer', body: 'Content', } ); }); it('should stringify YAML with --- delimiters', () => { expect( FrontmatterFormatter.toFile({ body: 'Some content\nOn another line', tags: ['front matter', 'yaml'], title: 'YAML' }) ).toEqual( [ '---', 'tags:', ' - front matter', ' - yaml', 'title: YAML', '---', 'Some content', 'On another line\n', ].join('\n') ); }); });
/** * Created by twiforce on 30.12.13. */ if (settings.snowfall) { (function(){for(var b=0,c=["webkit","moz"],a=0;a<c.length&&!window.requestAnimationFrame;++a)window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[c[a]+"CancelAnimationFrame"]||window[c[a]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a,c){var e=(new Date).getTime(),g=Math.max(0,16-(e-b)),f=window.setTimeout(function(){a(e+g)},g);b=e+g;return f});window.cancelAnimationFrame||(window.cancelAnimationFrame= function(a){clearTimeout(a)})})(); (function(b){b.snowfall=function(c,a){function x(k,d,f,g,h){this.id=h;this.x=k;this.y=d;this.size=f;this.speed=g;this.step=0;this.stepSize=e(1,10)/100;a.collection&&(this.target=r[e(0,r.length-1)]);k=null;a.image?(k=b(document.createElement("img")),k[0].src=a.image):(k=b(document.createElement("div")),k.css({background:a.flakeColor}));k.attr({"class":"snowfall-flakes",id:"flake-"+this.id}).css({width:this.size,height:this.size,position:"absolute",top:this.y,left:this.x,fontSize:0,zIndex:a.flakeIndex}); b(c).get(0).tagName===b(document).get(0).tagName?(b("body").append(k),c=b("body")):b(c).append(k);this.element=document.getElementById("flake-"+this.id);this.update=function(){this.y+=this.speed;this.y>p-(this.size+6)&&this.reset();this.element.style.top=this.y+"px";this.element.style.left=this.x+"px";this.step+=this.stepSize;this.x=!1===s?this.x+Math.cos(this.step):this.x+(s+Math.cos(this.step));if(a.collection&&this.x>this.target.x&&this.x<this.target.width+this.target.x&&this.y>this.target.y&& this.y<this.target.height+this.target.y){var b=this.target.element.getContext("2d"),c=this.x-this.target.x,d=this.y-this.target.y,e=this.target.colData;if(void 0!==e[parseInt(c)][parseInt(d+this.speed+this.size)]||d+this.speed+this.size>this.target.height)if(d+this.speed+this.size>this.target.height){for(;d+this.speed+this.size>this.target.height&&0<this.speed;)this.speed*=0.5;b.fillStyle="#fff";void 0==e[parseInt(c)][parseInt(d+this.speed+this.size)]?(e[parseInt(c)][parseInt(d+this.speed+this.size)]= 1,b.fillRect(c,d+this.speed+this.size,this.size,this.size)):(e[parseInt(c)][parseInt(d+this.speed)]=1,b.fillRect(c,d+this.speed,this.size,this.size));this.reset()}else this.speed=1,this.stepSize=0,parseInt(c)+1<this.target.width&&void 0==e[parseInt(c)+1][parseInt(d)+1]?this.x++:0<parseInt(c)-1&&void 0==e[parseInt(c)-1][parseInt(d)+1]?this.x--:(b.fillStyle="#fff",b.fillRect(c,d,this.size,this.size),e[parseInt(c)][parseInt(d)]=1,this.reset())}(this.x>q-l||this.x<l)&&this.reset()};this.reset=function(){this.y= 0;this.x=e(l,q-l);this.stepSize=e(1,10)/100;this.size=e(100*a.minSize,100*a.maxSize)/100;this.speed=e(a.minSpeed,a.maxSpeed)}}function u(){for(d=0;d<g.length;d+=1)g[d].update();v=requestAnimationFrame(function(){u()})}a=b.extend({flakeCount:35,flakeColor:"#ffffff",flakeIndex:999999,minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:40,deviceorientation:!1},a);var e=function(a,b){return Math.round(a+Math.random()*(b-a))};b(c).data("snowfall",this);var g=[], f=0,d=0,p=b(c).height(),q=b(c).width(),l=0,v=0;if(!1!==a.collection)if(f=document.createElement("canvas"),f.getContext&&f.getContext("2d"))for(var r=[],f=b(a.collection),n=a.collectionHeight,d=0;d<f.length;d++){var h=f[d].getBoundingClientRect(),m=document.createElement("canvas"),w=[];if(0<h.top-n){document.body.appendChild(m);m.style.position="absolute";m.height=n;m.width=h.width;m.style.left=h.left+"px";m.style.top=h.top-n+"px";for(var t=0;t<h.width;t++)w[t]=[];r.push({element:m,x:h.left,y:h.top- n,width:h.width,height:n,colData:w})}}else a.collection=!1;b(c).get(0).tagName===b(document).get(0).tagName&&(l=25);b(window).bind("resize",function(){p=b(c)[0].clientHeight;q=b(c)[0].offsetWidth;console.log(p)});for(d=0;d<a.flakeCount;d+=1)f=g.length,g.push(new x(e(l,q-l),e(0,p),e(100*a.minSize,100*a.maxSize)/100,e(a.minSpeed,a.maxSpeed),f));a.round&&b(".snowfall-flakes").css({"-moz-border-radius":a.maxSize,"-webkit-border-radius":a.maxSize,"border-radius":a.maxSize});a.shadow&&b(".snowfall-flakes").css({"-moz-box-shadow":"1px 1px 1px #555", "-webkit-box-shadow":"1px 1px 1px #555","box-shadow":"1px 1px 1px #555"});var s=!1;a.deviceorientation&&b(window).bind("deviceorientation",function(a){s=0.1*a.originalEvent.gamma});u();this.clear=function(){b(c).children(".snowfall-flakes").remove();g=[];cancelAnimationFrame(v)}};b.fn.snowfall=function(c){if("object"==typeof c||void 0==c)return this.each(function(a){new b.snowfall(this,c)});if("string"==typeof c)return this.each(function(a){(a=b(this).data("snowfall"))&&a.clear()})}})(jQuery); $(document).ready(function(){ $(document).snowfall({flakeCount : 400, maxSpeed : 5, maxSize : 5, round: true}); }); }
'use strict' import path from 'path'; import webpack from 'webpack'; import config from '../config'; import HtmlPlugin from 'html-webpack-plugin'; import NyanProgressPlugin from 'nyan-progress-webpack-plugin'; export default { entry: [path.resolve(__dirname, '../src/scripts/main')], resolve: { root: path.resolve(__dirname, '..'), modulesDirectories: ['node_modules'], extensions: ['', '.js', '.jsx', '.json'] }, output: { path: path.resolve(__dirname, '../build'), filename: 'bundle.js' }, module: { preLoaders: [ { test: /\.jsx?$/, include: [path.resolve(__dirname, '../src/scripts')], loader: 'eslint' } ], loaders: [ { test: /\.svg$/, loaders: ['file'] }, { test: /\.(jpe?g|png|gif)$/i, loaders: ['url?limit=25000'] }, { test: /\.woff$/, include: [path.resolve(__dirname, '../src/fonts')], loaders: ['url?limit=25000'] } ], noParse: /\.min\.js/ }, plugins: [ new webpack.DefinePlugin({ 'settings': { 'apiRoot': JSON.stringify(config.apiRoot), }, 'process.env': { 'NODE_ENV': JSON.stringify(config.ENVIRONMENT) } }), new webpack.optimize.OccurenceOrderPlugin(true), new HtmlPlugin({ title: config.appName, template: path.resolve(__dirname, '../src/templates/main.html') }), new NyanProgressPlugin() ], target: 'web', debug: config.DEVELOPMENT, cache: config.DEVELOPMENT, devtool: config.DEVELOPMENT ? config.devtool : false, stats: { children: false, colors: true, reasons: config.DEVELOPMENT }, postcss: function() { return [ require('cssnext')(config.cssnext), require('postcss-nested'), require('postcss-bem-linter')(config.bemLinter), require('postcss-reporter') ]; }, eslint: { configFile: path.resolve(__dirname, '../.eslintrc'), failOnError: false, failOnWarning: false } };
'use strict'; var lineChart = require('./writables/line-chart-writable') var go = module.exports = function (el, opts) { return lineChart(el, opts, true); }
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M13 8v8h-3V8h3m0-3h-3C8.34 5 7 6.34 7 8v8c0 1.66 1.34 3 3 3h3c1.66 0 3-1.34 3-3V8c0-1.66-1.34-3-3-3zM2.5 8H3v9.5c0 .83.67 1.5 1.5 1.5S6 18.33 6 17.5V7c0-1.1-.9-2-2-2H2.5C1.67 5 1 5.67 1 6.5S1.67 8 2.5 8zm16 3c-.83 0-1.5.68-1.5 1.5v2c0 .82.67 1.5 1.5 1.5H21v1h-3c-.55 0-1 .45-1 1s.45 1 1 1h3.5c.83 0 1.5-.67 1.5-1.5v-2c0-.83-.67-1.5-1.5-1.5H19v-1h3c.55 0 1-.45 1-1s-.45-1-1-1h-3.5z" }), 'Timer10SelectRounded'); exports.default = _default;
'use strict'; angular.module('copayApp.controllers').controller('exportController', function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, fingerprintService, configService, storageService, profileService, platformInfo, notification, go, gettext, gettextCatalog) { var prevState; var isWP = platformInfo.isWP; var isAndroid = platformInfo.isAndroid; var fc = profileService.focusedClient; $scope.isEncrypted = fc.isPrivKeyEncrypted(); $scope.isCordova = platformInfo.isCordova; $scope.isSafari = platformInfo.isSafari; $scope.error = null; $scope.init = function(state) { $scope.supported = true; $scope.exportQR = false; $scope.noSignEnabled = false; $scope.showAdvanced = false; prevState = state || 'walletHome'; fingerprintService.check(fc, function(err) { if (err) { go.path(prevState); return; } handleEncryptedWallet(fc, function(err) { if (err) { go.path(prevState); return; } $scope.exportWalletInfo = encodeWalletInfo(); $timeout(function() { $scope.$apply(); }, 1); }); }); }; /* EXPORT WITHOUT PRIVATE KEY - PENDING $scope.noSignEnabledChange = function() { $scope.exportWalletInfo = encodeWalletInfo(); $timeout(function() { $scope.$apply(); }, 1); }; */ $scope.$on('$destroy', function() { walletService.lock(fc); }); function handleEncryptedWallet(client, cb) { if (!walletService.isEncrypted(client)) { $scope.credentialsEncrypted = false; return cb(); } $rootScope.$emit('Local/NeedsPassword', false, function(err, password) { if (err) return cb(err); return cb(walletService.unlock(client, password)); }); }; function encodeWalletInfo() { var c = fc.credentials; var derivationPath = fc.credentials.getBaseAddressDerivationPath(); var encodingType = { mnemonic: 1, xpriv: 2, xpub: 3 }; var info; $scope.supported = (c.derivationStrategy == 'BIP44' && c.canSign()); if ($scope.supported) { if (c.mnemonic) { info = { type: encodingType.mnemonic, data: c.mnemonic, } } else { info = { type: encodingType.xpriv, data: c.xPrivKey } } } else { /* EXPORT WITHOUT PRIVATE KEY - PENDING info = { type: encodingType.xpub, data: c.xPubKey } */ return null; } var code = info.type + '|' + info.data + '|' + c.network.toLowerCase() + '|' + derivationPath + '|' + (c.mnemonicHasPassphrase); return code; }; $scope.downloadWalletBackup = function() { $scope.getAddressbook(function(err, localAddressBook) { if (err) { $scope.error = true; return; } var opts = { noSign: $scope.noSignEnabled, addressBook: localAddressBook }; backupService.walletDownload($scope.password, opts, function(err) { if (err) { $scope.error = true; return; } notification.success(gettext('Success'), gettext('Encrypted export file saved')); go.walletHome(); }); }); }; $scope.getAddressbook = function(cb) { storageService.getAddressbook(fc.credentials.network, function(err, addressBook) { if (err) return cb(err); var localAddressBook = []; try { localAddressBook = JSON.parse(addressBook); } catch (ex) { $log.warn(ex); } return cb(null, localAddressBook); }); }; $scope.getBackup = function(cb) { $scope.getAddressbook(function(err, localAddressBook) { if (err) { $scope.error = true; return cb(null); } var opts = { noSign: $scope.noSignEnabled, addressBook: localAddressBook }; var ew = backupService.walletExport($scope.password, opts); if (!ew) { $scope.error = true; } else { $scope.error = false; } return cb(ew); }); }; $scope.viewWalletBackup = function() { $timeout(function() { $scope.getBackup(function(backup) { var ew = backup; if (!ew) return; $scope.backupWalletPlainText = ew; }); }, 100); }; $scope.copyWalletBackup = function() { $scope.getBackup(function(backup) { var ew = backup; if (!ew) return; window.cordova.plugins.clipboard.copy(ew); window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard')); }); }; $scope.sendWalletBackup = function() { var fc = profileService.focusedClient; window.plugins.toast.showShortCenter(gettextCatalog.getString('Preparing backup...')); var name = (fc.credentials.walletName || fc.credentials.walletId); if (fc.alias) { name = fc.alias + ' [' + name + ']'; } $scope.getBackup(function(backup) { var ew = backup; if (!ew) return; if ($scope.noSignEnabled) name = name + '(No Private Key)'; var subject = 'Copay Wallet Backup: ' + name; var body = 'Here is the encrypted backup of the wallet ' + name + ': \n\n' + ew + '\n\n To import this backup, copy all text between {...}, including the symbols {}'; window.plugins.socialsharing.shareViaEmail( body, subject, null, // TO: must be null or an array null, // CC: must be null or an array null, // BCC: must be null or an array null, // FILES: can be null, a string, or an array function() {}, function() {} ); }); }; });
console.log("Hoshiumi");
import { default as convertor } from 'color'; import { default as colors } from '../../src/colors'; function convertColors() { return Object.keys(colors) .map((key) => { return { name: key, color: convertor(colors[key].value), }; }); } function extractGrays(colorArr) { return colorArr .filter((value) => { return value.color.hue() === 0; }) .sort((prev, next) => { const prevLight = prev.color.clone().lightness(); const nextLight = next.color.clone().lightness(); return prevLight - nextLight; }); } function extractNormals(colorArr) { return colorArr .filter((value) => { return value.color.hue() !== 0; }) .sort((prev, next) => { const prevHue = prev.color.clone().hue(); const nextHue = next.color.clone().hue(); return prevHue - nextHue; }); } const convertedColors = convertColors(); export const grayColors = extractGrays(convertedColors); export const normalColors = extractNormals(convertedColors);
Template.body.onRendered(function() { var tmpl = this; var hash = window.location.hash; if (hash.charAt(0) === '#') { FlowRouter.go('/' + hash.slice(1)); } var main = tmpl.main = tmpl.find('#main'); var anchors = tmpl.anchors = tmpl.findAll('#content [id]'); var progressBar = tmpl.progressBar = tmpl.find('#progress'); tmpl.rendered = true; tmpl.setProgress = function(progress) { progressBar.style.width = progress + '%'; }; tmpl.getProgressFromPosition = function() { var curr = main.scrollTop; var max = main.scrollHeight - main.clientHeight; return curr / max * 100; }; $(window).on('resize', _.throttle(function(e) { tmpl.setProgress(tmpl.getProgressFromPosition()); }, 1000 / 5)); }); Template.body.events({ 'scroll #main': _.throttle(function(e, tmpl) { if (tmpl.rendered) { var scrollProgress = tmpl.getProgressFromPosition(); tmpl.setProgress(scrollProgress); } }, 1000 / 5), 'click #toggle-menu': function(e, tmpl) { var layout = tmpl.find('#layout'); layout.classList.add('open'); }, 'click #sidebar': function(e) { e.stopPropagation(); }, 'click #overlay': function(e, tmpl) { var layout = tmpl.find('#layout'); layout.classList.remove('open'); }, 'click #sidebar a': function(e, tmpl) { var section = this; var layout = tmpl.find('#layout'); layout.classList.remove('open'); tmpl.main.scrollTop = 0; tmpl.setProgress(0); FlowRouter.go('/' + section.slug); } });
var express = require("express"); var path = require("path"); var favicon = require("serve-favicon"); var logger = require("morgan"); var cookieParser = require("cookie-parser"); var bodyParser = require("body-parser"); var indexRoute = require("./routes/index"); var usersRoute = require("./routes/users"); var app = express(); // view engine setup app.set("views", path.join(__dirname, "views")); app.set("view engine", "ejs"); // uncomment after placing your favicon in /public //app.use(favicon(path.join(__dirname, "public", "favicon.ico"))); app.use(logger("dev")); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); app.use(express.static(path.join(__dirname, "public"))); app.use("/", indexRoute); app.use("/users", usersRoute); // catch 404 and forward to error handler app.use(function(req, res, next) { var err = new Error("Not Found"); err.status = 404; next(err); }); // error handlers // development error handler // will print stacktrace if (app.get("env") === "development") { app.use(function(err, req, res, next) { res.status(err.status || 500); res.render("error", { message: err.message, error: err }); }); } // production error handler // no stacktraces leaked to user app.use(function(err, req, res, next) { res.status(err.status || 500); res.render("error", { message: err.message, error: {} }); }); module.exports = app;
module.exports = { 'POST /auth/signup': { controller: "AuthLocalController", action: "signup" }, 'POST /auth/login': { controller: "AuthLocalController", action: "login" }, // JWT token blacklist 'POST /auth/blacklists/tokens': { controller: "AuthLocalController", action: "blacklistToken" }, //QQ authentication 'GET /auth/qq/callback': { controller: "AuthQQController", action: "login" }, //weibo authentication 'GET /auth/weibo/callback': { controller: "AuthWeiboController", action: "login" }, }
/* * @flow */ import {suite, test} from 'flow-dev-tools/src/test/Tester'; export default suite(({addFile, addFiles, addCode}) => [ test('Functions with unions: https://github.com/facebook/flow/issues/1948', [ addFile('issue-1948.js').noNewErrors(), ]), ]);
/** * base.js * This file contains all global functions provided by js.io. */ exports.log = jsio.__env.log; exports.GLOBAL = jsio.__env.global; /** * Various polyfill methods to ensure js.io implementations provide * a baseline of JavaScript functionality. Feature compatibility (localStorage, * etc.) should be provided elsewhere. */ // Array.isArray // Not available before ECMAScript 5. // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray if (!Array.isArray) { Array.isArray = function (arg) { return Object.prototype.toString.call(arg) === '[object Array]'; } }; // Function.prototype.bind // Not available before ECMAScript 5. // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind if (!Function.prototype.bind) { Function.prototype.bind = function (oThis) { if (typeof this !== "function") { // closest thing possible to the ECMAScript 5 internal IsCallable function throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function () {}, fBound = function () { return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } /** * DEPRECATED. Old js.io polyfills. */ var SLICE = Array.prototype.slice; /* Use native isArray if available */ if (typeof Array.isArray === 'function') { exports.isArray = Array.isArray; } else { exports.isArray = function (obj) { return Object.prototype.toString.call(obj) === '[object Array]'; } } exports.bind = function(context, method /*, VARGS*/) { if(arguments.length > 2) { var args = SLICE.call(arguments, 2); return typeof method == 'string' ? function __bound() { if (context[method]) { return context[method].apply(context, args.concat(SLICE.call(arguments, 0))); } else { throw logger.error('No method:', method, 'for context', context); } } : function __bound() { return method.apply(context, args.concat(SLICE.call(arguments, 0))); } } else { return typeof method == 'string' ? function __bound() { if (context[method]) { return context[method].apply(context, arguments); } else { throw logger.error('No method:', method, 'for context', context); } } : function __bound() { return method.apply(context, arguments); } } } /** * Class constructor. */ exports.Class = function(name, parent, proto) { return exports.__class__(function() { return this.init && this.init.apply(this, arguments); }, name, parent, proto); } exports.__class__ = function (cls, name, parent, proto) { var clsProto = function () {}; var logger; if (typeof name != 'string') { proto = parent; parent = name; name = null; } if (name) { logger = exports.logging.get(name); } if (!parent) { throw new Error('parent or prototype not provided'); } if (!proto) { proto = parent; parent = null; } if (parent) { if (exports.isArray(parent)) { // multiple inheritance, use at your own risk =) clsProto.prototype = {}; for(var i = 0, p; p = parent[i]; ++i) { if (p == Error && ErrorParentClass) { p = ErrorParentClass; } for (var item in p.prototype) { if (!(item in clsProto.prototype)) { clsProto.prototype[item] = p.prototype[item]; } } } parent = parent[0]; } else { if (parent == Error && ErrorParentClass) { parent = ErrorParentClass; } clsProto.prototype = parent.prototype; } } var supr = parent ? function(context, method, args) { var f = parent.prototype[method]; if (!f) { throw new Error('method ' + method + ' does not exist'); } return f.apply(context, args || []); } : null; var p = cls.prototype = new clsProto(); p.constructor = cls; p.__parentClass__ = parent; if (name) { p.__class__ = name; } proto.call(p, logger || supr, logger && supr); return cls; } var ErrorParentClass = exports.__class__(function ErrorCls() { var err = Error.prototype.constructor.apply(this, arguments); for (var prop in err) { if (err.hasOwnProperty(prop)) { this[prop] = err[prop]; } } }, function() {}); /** * Merge two objects together. */ exports.Class.defaults = exports.merge = function(base, extra) { base = base || {}; for (var i = 1, len = arguments.length; i < len; ++i) { var copyFrom = arguments[i]; for (var key in copyFrom) { if (copyFrom.hasOwnProperty(key) && !base.hasOwnProperty(key)) { base[key] = copyFrom[key]; } } } return base; } /** * Create a timer delay. */ exports.delay = function(orig, timeout) { var _timer = null; var ctx, args; var f = function() { orig.apply(ctx, args); } return function() { ctx = this; args = arguments; if (_timer) { clearTimeout(_timer); } _timer = setTimeout(f, timeout || 0); } } /** * Log constructor and default "logger". */ exports.logging = (function() { // logging namespace, this is what is exported var logging = { DEBUG: 1, LOG: 2, INFO: 3, WARN: 4, ERROR: 5, NONE: 10 }; var _loggers = {}; // all loggers var _production = false; var _prefix = ''; logging.setPrefix = function(prefix) { _prefix = prefix + ' '; } logging.setProduction = function(prod) { _production = !!prod; for (var key in _loggers) { _loggers[key].setProduction(_production); } } logging.get = function(name) { var logger = name in _loggers ? _loggers[name] : (_loggers[name] = new Logger(name)); logger.setProduction(_production); return logger; } logging.set = function(name, logger) { _loggers[name] = logger; } logging.getAll = function() { return _loggers; } logging.__create = function(pkg, ctx) { ctx.logger = logging.get(pkg); } var Logger = exports.__class__( function Logger(name, level) { this._name = name; this._isProduction = _production; this.setLevel(level || logging.LOG); }, function () { this.setProduction = function (isProduction) { this._isProduction = isProduction; isProduction && this.setLevel(logging.NONE); } this.setLevel = function(level) { this._level = level; if (this._isProduction) { level = logging.NONE; } this.DEBUG = level <= logging.DEBUG; this.LOG = level <= logging.LOG; this.INFO = level <= logging.INFO; this.WARN = level <= logging.WARN; this.ERROR = level <= logging.ERROR; } function makeLogger(type) { var level = logging[type]; return function() { if (!this._isProduction && level >= this._level) { var prefix = type + ' ' + _prefix + this._name; var listener = this._listener || exports.log; return listener && listener.apply(this._listener, [prefix].concat(SLICE.call(arguments))); } return arguments[0]; } } this.setListener = function(listener) { this._listener = listener; } this.debug = makeLogger("DEBUG"); this.log = makeLogger("LOG"); this.info = makeLogger("INFO"); this.warn = makeLogger("WARN"); this.error = makeLogger("ERROR"); }); return logging; })(); var logger = exports.logging.get('jsiocore');
define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.conf = { comments: { lineComment: '#' }, brackets: [ ['{', '}'], ['[', ']'], ['(', ')'] ], autoClosingPairs: [ { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, ], surroundingPairs: [ { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, ], folding: { offSide: true } }; exports.language = { tokenPostfix: '.yaml', brackets: [ { token: 'delimiter.bracket', open: '{', close: '}' }, { token: 'delimiter.square', open: '[', close: ']' } ], keywords: ['true', 'True', 'TRUE', 'false', 'False', 'FALSE', 'null', 'Null', 'Null', '~'], numberInteger: /(?:0|[+-]?[0-9]+)/, numberFloat: /(?:0|[+-]?[0-9]+)(?:\.[0-9]+)?(?:e[-+][1-9][0-9]*)?/, numberOctal: /0o[0-7]+/, numberHex: /0x[0-9a-fA-F]+/, numberInfinity: /[+-]?\.(?:inf|Inf|INF)/, numberNaN: /\.(?:nan|Nan|NAN)/, numberDate: /\d{4}-\d\d-\d\d([Tt ]\d\d:\d\d:\d\d(\.\d+)?(( ?[+-]\d\d?(:\d\d)?)|Z)?)?/, escapes: /\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/, tokenizer: { root: [ { include: '@whitespace' }, { include: '@comment' }, // Directive [/%[^ ]+.*$/, 'meta.directive'], // Document Markers [/---/, 'operators.directivesEnd'], [/\.{3}/, 'operators.documentEnd'], // Block Structure Indicators [/[-?:](?= )/, 'operators'], { include: '@anchor' }, { include: '@tagHandle' }, { include: '@flowCollections' }, { include: '@blockStyle' }, // Numbers [/@numberInteger(?![ \t]*\S+)/, 'number'], [/@numberFloat(?![ \t]*\S+)/, 'number.float'], [/@numberOctal(?![ \t]*\S+)/, 'number.octal'], [/@numberHex(?![ \t]*\S+)/, 'number.hex'], [/@numberInfinity(?![ \t]*\S+)/, 'number.infinity'], [/@numberNaN(?![ \t]*\S+)/, 'number.nan'], [/@numberDate(?![ \t]*\S+)/, 'number.date'], // Key:Value pair [/(".*?"|'.*?'|.*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']], { include: '@flowScalars' }, // String nodes [/.+$/, { cases: { '@keywords': 'keyword', '@default': 'string' } }] ], // Flow Collection: Flow Mapping object: [ { include: '@whitespace' }, { include: '@comment' }, // Flow Mapping termination [/\}/, '@brackets', '@pop'], // Flow Mapping delimiter [/,/, 'delimiter.comma'], // Flow Mapping Key:Value delimiter [/:(?= )/, 'operators'], // Flow Mapping Key:Value key [/(?:".*?"|'.*?'|[^,\{\[]+?)(?=: )/, 'type'], // Start Flow Style { include: '@flowCollections' }, { include: '@flowScalars' }, // Scalar Data types { include: '@tagHandle' }, { include: '@anchor' }, { include: '@flowNumber' }, // Other value (keyword or string) [/[^\},]+/, { cases: { '@keywords': 'keyword', '@default': 'string' } }] ], // Flow Collection: Flow Sequence array: [ { include: '@whitespace' }, { include: '@comment' }, // Flow Sequence termination [/\]/, '@brackets', '@pop'], // Flow Sequence delimiter [/,/, 'delimiter.comma'], // Start Flow Style { include: '@flowCollections' }, { include: '@flowScalars' }, // Scalar Data types { include: '@tagHandle' }, { include: '@anchor' }, { include: '@flowNumber' }, // Other value (keyword or string) [/[^\],]+/, { cases: { '@keywords': 'keyword', '@default': 'string' } }] ], // First line of a Block Style multiString: [ [/^( +).+$/, 'string', '@multiStringContinued.$1'] ], // Further lines of a Block Style // Workaround for indentation detection multiStringContinued: [ [/^( *).+$/, { cases: { '$1==$S2': 'string', '@default': { token: '@rematch', next: '@popall' } } }] ], whitespace: [ [/[ \t\r\n]+/, 'white'] ], // Only line comments comment: [ [/#.*$/, 'comment'] ], // Start Flow Collections flowCollections: [ [/\[/, '@brackets', '@array'], [/\{/, '@brackets', '@object'] ], // Start Flow Scalars (quoted strings) flowScalars: [ [/"([^"\\]|\\.)*$/, 'string.invalid'], [/'([^'\\]|\\.)*$/, 'string.invalid'], [/'[^']*'/, 'string'], [/"/, 'string', '@doubleQuotedString'] ], doubleQuotedString: [ [/[^\\"]+/, 'string'], [/@escapes/, 'string.escape'], [/\\./, 'string.escape.invalid'], [/"/, 'string', '@pop'] ], // Start Block Scalar blockStyle: [ [/[>|][0-9]*[+-]?$/, 'operators', '@multiString'] ], // Numbers in Flow Collections (terminate with ,]}) flowNumber: [ [/@numberInteger(?=[ \t]*[,\]\}])/, 'number'], [/@numberFloat(?=[ \t]*[,\]\}])/, 'number.float'], [/@numberOctal(?=[ \t]*[,\]\}])/, 'number.octal'], [/@numberHex(?=[ \t]*[,\]\}])/, 'number.hex'], [/@numberInfinity(?=[ \t]*[,\]\}])/, 'number.infinity'], [/@numberNaN(?=[ \t]*[,\]\}])/, 'number.nan'], [/@numberDate(?=[ \t]*[,\]\}])/, 'number.date'] ], tagHandle: [ [/\![^ ]*/, 'tag'] ], anchor: [ [/[&*][^ ]+/, 'namespace'] ] } }; });
import { getCredentials, api, request, credentials } from '../../data/api-data.js'; import { imgURL } from '../../data/interactions'; const customEmojiName = `my-custom-emoji-${ Date.now() }`; let createdCustomEmoji; describe('[EmojiCustom]', function() { this.retries(0); before((done) => getCredentials(done)); // DEPRECATED // Will be removed after v1.12.0 describe('[/emoji-custom]', () => { it('should return emojis', (done) => { request.get(api('emoji-custom')) .set(credentials) .expect(200) .expect((res) => { expect(res.body).to.have.property('emojis').and.to.be.a('array'); }) .end(done); }); it('should return emojis when use "query" query parameter', (done) => { request.get(api('emoji-custom?query={"_updatedAt": {"$gt": { "$date": "2018-11-27T13:52:01Z" } }}')) .set(credentials) .expect(200) .expect((res) => { expect(res.body).to.have.property('emojis').and.to.be.a('array'); }) .end(done); }); }); describe('[/emoji-custom.create]', () => { it('should create new custom emoji', (done) => { request.post(api('emoji-custom.create')) .set(credentials) .attach('emoji', imgURL) .field({ name: customEmojiName, aliases: `${ customEmojiName }-alias`, }) .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); }) .end(done); }); it('should create new custom emoji without optional parameter "aliases"', (done) => { request.post(api('emoji-custom.create')) .set(credentials) .attach('emoji', imgURL) .field({ name: `${ customEmojiName }-without-aliases`, }) .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); }) .end(done); }); it('should throw an error when the filename is wrong', (done) => { request.post(api('emoji-custom.create')) .set(credentials) .attach('emojiwrong', imgURL) .field({ _id: 'invalid-id', name: 'my-custom-emoji-without-aliases', }) .expect('Content-Type', 'application/json') .expect(400) .expect((res) => { expect(res.body).to.have.property('success', false); expect(res.body.errorType).to.be.equal('invalid-field'); }) .end(done); }); }); describe('[/emoji-custom.update]', () => { before((done) => { request.get(api('emoji-custom')) .set(credentials) .expect(200) .expect((res) => { expect(res.body).to.have.property('emojis').and.to.be.a('array'); createdCustomEmoji = res.body.emojis.find((emoji) => emoji.name === customEmojiName); }) .end(done); }); it('successfully:', () => { it('should update the custom emoji without a file', (done) => { request.post(api('emoji-custom.update')) .set(credentials) .field({ _id: createdCustomEmoji._id, name: customEmojiName, aliases: 'alias-my-custom-emoji', }) .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); }) .end(done); }); it('should update the custom emoji without optional parameter "aliases"', (done) => { request.post(api('emoji-custom.update')) .set(credentials) .field({ _id: createdCustomEmoji._id, name: customEmojiName, }) .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); }) .end(done); }); it('should update the custom emoji with all parameters and with a file', (done) => { request.post(api('emoji-custom.update')) .set(credentials) .attach('emoji', imgURL) .field({ _id: createdCustomEmoji._id, name: customEmojiName, }) .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); }) .end(done); }); }); it('should throw error when:', () => { it('the fields does not include "_id"', (done) => { request.post(api('emoji-custom.update')) .set(credentials) .attach('emoji', imgURL) .field({ name: 'my-custom-emoji-without-aliases', }) .expect('Content-Type', 'application/json') .expect(400) .expect((res) => { expect(res.body).to.have.property('success', false); expect(res.body.errorType).to.be.equal('The required "_id" query param is missing.'); }) .end(done); }); it('the custom emoji does not exists', (done) => { request.post(api('emoji-custom.update')) .set(credentials) .attach('emoji', imgURL) .field({ _id: 'invalid-id', name: 'my-custom-emoji-without-aliases', }) .expect('Content-Type', 'application/json') .expect(400) .expect((res) => { expect(res.body).to.have.property('success', false); expect(res.body.errorType).to.be.equal('Emoji not found.'); }) .end(done); }); it('the filename is wrong', (done) => { request.post(api('emoji-custom.update')) .set(credentials) .attach('emojiwrong', imgURL) .field({ _id: 'invalid-id', name: 'my-custom-emoji-without-aliases', }) .expect('Content-Type', 'application/json') .expect(400) .expect((res) => { expect(res.body).to.have.property('success', false); expect(res.body.errorType).to.be.equal('invalid-field'); }) .end(done); }); }); }); describe('[/emoji-custom.list]', () => { it('should return emojis', (done) => { request.get(api('emoji-custom.list')) .set(credentials) .expect(200) .expect((res) => { expect(res.body).to.have.property('emojis').and.to.be.a('object'); expect(res.body.emojis).to.have.property('update').and.to.be.a('array').and.to.not.have.lengthOf(0); expect(res.body.emojis).to.have.property('remove').and.to.be.a('array').and.to.have.lengthOf(0); }) .end(done); }); it('should return emojis when use "query" query parameter', (done) => { request.get(api(`emoji-custom.list?query={"_updatedAt": {"$gt": { "$date": "${ new Date().toISOString() }" } } }`)) .set(credentials) .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); expect(res.body).to.have.property('emojis').and.to.be.a('object'); expect(res.body.emojis).to.have.property('update').and.to.be.a('array').and.to.have.lengthOf(0); expect(res.body.emojis).to.have.property('remove').and.to.be.a('array').and.to.have.lengthOf(0); }) .end(done); }); it('should return emojis when use "updateSince" query parameter', (done) => { request.get(api(`emoji-custom.list?updatedSince=${ new Date().toISOString() }`)) .set(credentials) .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); expect(res.body).to.have.property('emojis').and.to.be.a('object'); expect(res.body.emojis).to.have.property('update').and.to.be.a('array').and.to.have.lengthOf(0); expect(res.body.emojis).to.have.property('remove').and.to.be.a('array').and.to.have.lengthOf(0); }) .end(done); }); it('should return emojis when use both, "updateSince" and "query" query parameter', (done) => { request.get(api(`emoji-custom.list?query={"_updatedAt": {"$gt": { "$date": "${ new Date().toISOString() }" } }}&updatedSince=${ new Date().toISOString() }`)) .set(credentials) .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); expect(res.body).to.have.property('emojis').and.to.be.a('object'); expect(res.body.emojis).to.have.property('update').and.to.be.a('array').and.to.have.lengthOf(0); expect(res.body.emojis).to.have.property('remove').and.to.be.a('array').and.to.have.lengthOf(0); }) .end(done); }); it('should return an error when the "updateSince" query parameter is a invalid date', (done) => { request.get(api('emoji-custom.list?updatedSince=invalid-date')) .set(credentials) .expect(400) .expect((res) => { expect(res.body).to.have.property('success', false); expect(res.body.errorType).to.be.equal('error-roomId-param-invalid'); }) .end(done); }); }); describe('[/emoji-custom.delete]', () => { it('should throw an error when trying delete custom emoji without the required param "emojid"', (done) => { request.post(api('emoji-custom.delete')) .set(credentials) .send({}) .expect('Content-Type', 'application/json') .expect(400) .expect((res) => { expect(res.body).to.have.property('success', false); expect(res.body.error).to.be.equal('The "emojiId" params is required!'); }) .end(done); }); it('should throw an error when trying delete custom emoji that does not exists', (done) => { request.post(api('emoji-custom.delete')) .set(credentials) .send({ emojiId: 'invalid-id', }) .expect('Content-Type', 'application/json') .expect(400) .expect((res) => { expect(res.body).to.have.property('success', false); expect(res.body.errorType).to.be.equal('Custom_Emoji_Error_Invalid_Emoji'); }) .end(done); }); it('should delete the custom emoji created before successfully', (done) => { request.post(api('emoji-custom.delete')) .set(credentials) .send({ emojiId: createdCustomEmoji._id, }) .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { expect(res.body).to.have.property('success', true); }) .end(done); }); }); });
import hook from 'css-modules-require-hook' import sass from 'node-sass' hook({ extensions: ['.css', '.scss'], preprocessCss: (css) => { const result = sass.renderSync({ data: css }) return result.css } })
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M18 9.98 6 22h16V5.97l-4 4.01zM20 20h-2v-7.22l2-2V20zM5.22 7.22 3.93 5.93c3.9-3.91 10.24-3.91 14.15 0l-1.29 1.29c-3.19-3.19-8.38-3.19-11.57 0zm7.71 3.85L11 13l-1.93-1.93c1.07-1.06 2.79-1.06 3.86 0zm1.29-1.28c-1.78-1.77-4.66-1.77-6.43 0L6.5 8.5c2.48-2.48 6.52-2.48 9 0l-1.28 1.29z" }), 'CellWifi'); exports.default = _default;
module.exports = () => { throw new Error('Method is not supported'); };
/** * Copyright <%= year %> Telerik AD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ (function(f, define){ define([], f); })(function(){ (function( window, undefined ) { var kendo = window.kendo || (window.kendo = { cultures: {} }); kendo.cultures["es-EC"] = { name: "es-EC", numberFormat: { pattern: ["-n"], decimals: 2, ",": ".", ".": ",", groupSize: [3], percent: { pattern: ["-n %","n %"], decimals: 2, ",": ".", ".": ",", groupSize: [3], symbol: "%" }, currency: { pattern: ["($ n)","$ n"], decimals: 2, ",": ".", ".": ",", groupSize: [3], symbol: "$" } }, calendars: { standard: { days: { names: ["domingo","lunes","martes","miércoles","jueves","viernes","sábado"], namesAbbr: ["dom","lun","mar","mié","jue","vie","sáb"], namesShort: ["do","lu","ma","mi","ju","vi","sá"] }, months: { names: ["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""], namesAbbr: ["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic",""] }, AM: [""], PM: [""], patterns: { d: "dd/MM/yyyy", D: "dddd, dd' de 'MMMM' de 'yyyy", F: "dddd, dd' de 'MMMM' de 'yyyy H:mm:ss", g: "dd/MM/yyyy H:mm", G: "dd/MM/yyyy H:mm:ss", m: "dd MMMM", M: "dd MMMM", s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss", t: "H:mm", T: "H:mm:ss", u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'", y: "MMMM' de 'yyyy", Y: "MMMM' de 'yyyy" }, "/": "/", ":": ":", firstDay: 0 } } } })(this); return window.kendo; }, typeof define == 'function' && define.amd ? define : function(_, f){ f(); });
/* Function name: findTitle(url); Inputs: A URL Returns: The contents of the <title>...</title> tag at that URL. Prints: Nothing require "open-uri" ** Note #1 ** Since these specific tools aren't available in JavaScript, this particular exercise doesn't directly translate. I will see if there is a way to do similar things and up date this accordingly. ** Note #2 ** open-uri allows us to download the contents of any URL using the "open" method contents = open('https://www.google.com/').read The "contents" variable now contains a string of all the HTML living at https://www.google.com. open-uri comes with Ruby, so you DO NOT need to install anything extra. */ function findTitle(url) { //In three "easy" steps: // 1. Use "open" to download the contents of URL // 2. Use one of the methods described below to extract the // contents of the title tag. // 3. Return the contents of the title tag. } /* Some sanity checks! console.log(findTitle("https://www.google.com")); => "Google" console.log(findTitle("https://www.yahoo.com")); => "Yahoo" console.log(findTitle("https://www.facebook.com")); => "Welcome to Facebook - Log In, Sign Up or Learn More" ** Note #3 ** Once you have the HTML, there are a few ways to extract the contents of the title tag. 1. Use a library that can parse HTML. We recommend "nokogiri". To use nokogiri, first install it; npm install nokogiri and require it in your JavaScript code require 'nokogiri' Nokogiri can be difficult to install, so if this doesn't work let us know! See http://nokogiri.org/tutorials/parsing_an_html_xml_document.html for examples. If Nokogiri is installed, getting the title of a web page is as simple as Nokogiri::HTML(open(url)).title 2. Use regular expressions Regular expressions (or "regex") are a mini-language to specify search patterns inside a larger piece of text. They are very powerful, but the syntax is intimidating until you get used to it. Start here: http://code.tutsplus.com/tutorials/you-dont-know-anything-about-regular-expressions-a-complete-guide--net-7869 3. Iterate through the string one character at a time. You can do this using String each_char, like so contents.each_char do |char| logic goes here end This is tedious but instructive. */
version https://git-lfs.github.com/spec/v1 oid sha256:8ceebd3407fc2ae5cae4d0f8ef2bb59c8931fc43223387f5afe4a5581862709a size 422284
import powerSpectrum from './powerSpectrum'; let melToFreq = function(melValue){ let freqValue = 700*(Math.exp(melValue/1125)-1); return freqValue; }; let freqToMel = function(freqValue){ let melValue = 1125*Math.log(1+(freqValue/700)); return melValue; }; export default function(args){ if(typeof args.ampSpectrum !== "object"){ throw new TypeError(); } //used tutorial from http://practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/ let powSpec = powerSpectrum(args); let numFilters = 26; //26 filters is standard let melValues = new Float32Array(numFilters+2); //the +2 is the upper and lower limits let melValuesInFreq = new Float32Array(numFilters+2); //Generate limits in Hz - from 0 to the nyquist. let lowerLimitFreq = 0; let upperLimitFreq = args.sampleRate/2; //Convert the limits to Mel let lowerLimitMel = freqToMel(lowerLimitFreq); let upperLimitMel = freqToMel(upperLimitFreq); //Find the range let range = upperLimitMel-lowerLimitMel; //Find the range as part of the linear interpolation let valueToAdd = range/(numFilters+1); let fftBinsOfFreq = Array(numFilters+2); for (let i = 0; i < melValues.length; i++) { //Initialising the mel frequencies - they are just a linear interpolation between the lower and upper limits. melValues[i] = i*valueToAdd; //Convert back to Hz melValuesInFreq[i] = melToFreq(melValues[i]); //Find the corresponding bins fftBinsOfFreq[i] = Math.floor((args.bufferSize+1)*melValuesInFreq[i]/args.sampleRate); } let filterBank = Array(numFilters); for (let j = 0; j < filterBank.length; j++) { //creating a two dimensional array of size numFiltes * (args.buffersize/2)+1 and pre-populating the arrays with 0s. filterBank[j] = Array.apply(null, new Array((args.bufferSize/2)+1)).map(Number.prototype.valueOf,0); //creating the lower and upper slopes for each bin for (let i = fftBinsOfFreq[j]; i < fftBinsOfFreq[j+1]; i++) { filterBank[j][i] = (i - fftBinsOfFreq[j])/(fftBinsOfFreq[j+1]-fftBinsOfFreq[j]); } for (let i = fftBinsOfFreq[j+1]; i < fftBinsOfFreq[j+2]; i++) { filterBank[j][i] = (fftBinsOfFreq[j+2]-i)/(fftBinsOfFreq[j+2]-fftBinsOfFreq[j+1]); } } let loggedMelBands = new Float32Array(numFilters); for (let i = 0; i < loggedMelBands.length; i++) { loggedMelBands[i] = 0; for (let j = 0; j < (args.bufferSize/2); j++) { //point multiplication between power spectrum and filterbanks. filterBank[i][j] = filterBank[i][j]*powSpec[j]; //summing up all of the coefficients into one array loggedMelBands[i] += filterBank[i][j]; } //log each coefficient loggedMelBands[i] = Math.log(loggedMelBands[i]); } //dct let k = Math.PI/numFilters; let w1 = 1.0/Math.sqrt(numFilters); let w2 = Math.sqrt(2.0/numFilters); let numCoeffs = 13; let dctMatrix = new Float32Array(numCoeffs*numFilters); for(let i = 0; i < numCoeffs; i++){ for (let j = 0; j < numFilters; j++) { let idx = i + (j*numCoeffs); if(i === 0){ dctMatrix[idx] = w1 * Math.cos(k * (i+1) * (j+0.5)); } else{ dctMatrix[idx] = w2 * Math.cos(k * (i+1) * (j+0.5)); } } } let mfccs = new Float32Array(numCoeffs); for (let k = 0; k < numCoeffs; k++) { let v = 0; for (let n = 0; n < numFilters; n++) { let idx = k + (n*numCoeffs); v += (dctMatrix[idx] * loggedMelBands[n]); } mfccs[k] = v/numCoeffs; } return mfccs; }
'use strict'; var $ = require('mano-legacy'); require('mano-legacy/on-env-update'); require('mano-legacy/dbjs-form-fill'); require('mano-legacy/element#/toggle'); require('mano-legacy/dbjs-observe-mock'); var getContext = function (formEntity, sKeyPath) { var i, context, arrayFromName, sKey; context = formEntity; sKey = sKeyPath; if (sKeyPath.indexOf('/') !== -1) { arrayFromName = sKeyPath.split('/'); sKey = arrayFromName[arrayFromName.length - 1]; for (i = 0; i < arrayFromName.length - 1; i++) { context = context[arrayFromName[i]] || { master: formEntity.master, key: arrayFromName[i], owner: context || formEntity.master }; } } return { sKey: sKey, object: context }; }; $.formSectionStateHelper = function fsHelper(formId, entityId, constraints, legacyEntityProto) { var Entity = function () {}, form = $(formId); if (!form) { setTimeout(function () { fsHelper(formId, entityId, constraints, legacyEntityProto); }, 0); return; } if (legacyEntityProto) { Entity.prototype = legacyEntityProto; } $.onEnvUpdate(formId, function () { var result, i, context, domElem, entities = {}, formEntityId, formEntity; for (i = 0; i < constraints.length; i++) { domElem = $(constraints[i].id); if (!domElem) { continue; } formEntityId = constraints[i].sKey.split('/', 1)[0]; formEntity = entities[formEntityId]; if (!formEntity) { formEntity = entities[formEntityId] = new Entity(); formEntity.__id__ = formEntityId; $.dbjsFormFill(formEntity, form, $.formSectionsObjectsMap); } context = getContext(formEntity, constraints[i].sKey.slice(formEntityId.length + 1)); result = constraints[i].constraint.call(context.object, $.dbjsObserveMock); domElem.toggle(result); if (!result) { delete context.object[context.sKey]; } else { $.dbjsFormFill(formEntity, form, $.formSectionsObjectsMap); } } }); };
var page = require('webpage').create(), system = require('system'), address, output, size; if (system.args.length < 3 || system.args.length > 5) { console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]'); console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'); console.log(' image (png/jpg output) examples: "1920px" entire page, window width 1920px'); console.log(' "800px*600px" window, clipped to 800x600'); phantom.exit(1); } else { address = system.args[1]; output = system.args[2]; page.viewportSize = { width: 512, height: 512 }; if (system.args.length > 3 && system.args[2].substr(-4) === ".pdf") { size = system.args[3].split('*'); page.paperSize = size.length === 2 ? { width: size[0], height: size[1], margin: '0px' } : { format: system.args[3], orientation: 'portrait', margin: '1cm' }; } else if (system.args.length > 3 && system.args[3].substr(-2) === "px") { size = system.args[3].split('*'); if (size.length === 2) { pageWidth = parseInt(size[0], 10); pageHeight = parseInt(size[1], 10); page.viewportSize = { width: pageWidth, height: pageHeight }; page.clipRect = { top: 0, left: 0, width: pageWidth, height: pageHeight }; } else { console.log("size:", system.args[3]); pageWidth = parseInt(system.args[3], 10); pageHeight = parseInt(pageWidth * 3/4, 10); // it's as good an assumption as any console.log ("pageHeight:",pageHeight); page.viewportSize = { width: pageWidth, height: pageHeight }; } } if (system.args.length > 4) { page.zoomFactor = system.args[4]; } page.open(address, function (status) { if (status !== 'success') { console.log('Unable to load the address!'); phantom.exit(1); } else { window.setTimeout(function () { page.render(output); phantom.exit(); }, 200); } }); }
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8zm-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91z" }), 'RestartAltSharp'); exports.default = _default;
'use strict'; const eslint = require('gulp-eslint'); module.exports = (gulp, config) => { gulp.task('eslint', () => gulp .src(config.paths.scripts.concat(config.paths.configs)) .pipe(eslint()) .pipe(eslint.format()) ); };
// --------------------------------------------------------------------------------- // Patterns for methods" parameters // --------------------------------------------------------------------------------- STATE_PAT = { changePwd: Match.Optional(String), enrollAccount: Match.Optional(String), forgotPwd: Match.Optional(String), resetPwd: Match.Optional(String), signIn: Match.Optional(String), signUp: Match.Optional(String), verifyEmail: Match.Optional(String), resendVerificationEmail: Match.Optional(String), }; ERRORS_PAT = { accountsCreationDisabled: Match.Optional(String), cannotRemoveService: Match.Optional(String), captchaVerification: Match.Optional(String), loginForbidden: Match.Optional(String), mustBeLoggedIn: Match.Optional(String), pwdMismatch: Match.Optional(String), validationErrors: Match.Optional(String), verifyEmailFirst: Match.Optional(String), }; INFO_PAT = { emailSent: Match.Optional(String), emailVerified: Match.Optional(String), pwdChanged: Match.Optional(String), pwdReset: Match.Optional(String), pwdSet: Match.Optional(String), signUpVerifyEmail: Match.Optional(String), verificationEmailSent: Match.Optional(String), }; INPUT_ICONS_PAT = { hasError: Match.Optional(String), hasSuccess: Match.Optional(String), isValidating: Match.Optional(String), }; ObjWithStringValues = Match.Where(function (x) { check(x, Object); _.each(_.values(x), function(value){ check(value, String); }); return true; }); TEXTS_PAT = { button: Match.Optional(STATE_PAT), errors: Match.Optional(ERRORS_PAT), info: Match.Optional(INFO_PAT), inputIcons: Match.Optional(INPUT_ICONS_PAT), maxAllowedLength: Match.Optional(String), minRequiredLength: Match.Optional(String), navSignIn: Match.Optional(String), navSignOut: Match.Optional(String), optionalField: Match.Optional(String), pwdLink_link: Match.Optional(String), pwdLink_pre: Match.Optional(String), pwdLink_suff: Match.Optional(String), requiredField: Match.Optional(String), resendVerificationEmailLink_pre: Match.Optional(String), resendVerificationEmailLink_link: Match.Optional(String), resendVerificationEmailLink_suff: Match.Optional(String), sep: Match.Optional(String), signInLink_link: Match.Optional(String), signInLink_pre: Match.Optional(String), signInLink_suff: Match.Optional(String), signUpLink_link: Match.Optional(String), signUpLink_pre: Match.Optional(String), signUpLink_suff: Match.Optional(String), socialAdd: Match.Optional(String), socialConfigure: Match.Optional(String), socialIcons: Match.Optional(ObjWithStringValues), socialRemove: Match.Optional(String), socialSignIn: Match.Optional(String), socialSignUp: Match.Optional(String), socialWith: Match.Optional(String), termsAnd: Match.Optional(String), termsPreamble: Match.Optional(String), termsPrivacy: Match.Optional(String), termsTerms: Match.Optional(String), title: Match.Optional(STATE_PAT), }; // Configuration pattern to be checked with check CONFIG_PAT = { // Behaviour confirmPassword: Match.Optional(Boolean), defaultState: Match.Optional(String), enablePasswordChange: Match.Optional(Boolean), enforceEmailVerification: Match.Optional(Boolean), forbidClientAccountCreation: Match.Optional(Boolean), lowercaseUsername: Match.Optional(Boolean), overrideLoginErrors: Match.Optional(Boolean), sendVerificationEmail: Match.Optional(Boolean), socialLoginStyle: Match.Optional(Match.OneOf("popup", "redirect")), // Appearance defaultLayout: Match.Optional(String), defaultLayoutRegions: Match.Optional(Object), defaultContentRegion: Match.Optional(String), hideSignInLink: Match.Optional(Boolean), hideSignUpLink: Match.Optional(Boolean), showAddRemoveServices: Match.Optional(Boolean), showForgotPasswordLink: Match.Optional(Boolean), showResendVerificationEmailLink: Match.Optional(Boolean), showLabels: Match.Optional(Boolean), showPlaceholders: Match.Optional(Boolean), // Client-side Validation continuousValidation: Match.Optional(Boolean), negativeFeedback: Match.Optional(Boolean), negativeValidation: Match.Optional(Boolean), positiveFeedback: Match.Optional(Boolean), positiveValidation: Match.Optional(Boolean), showValidating: Match.Optional(Boolean), // Privacy Policy and Terms of Use privacyUrl: Match.Optional(String), termsUrl: Match.Optional(String), // Redirects homeRoutePath: Match.Optional(String), redirectTimeout: Match.Optional(Number), // Hooks onLogoutHook: Match.Optional(Function), onSubmitHook: Match.Optional(Function), preSignUpHook: Match.Optional(Function), texts: Match.Optional(TEXTS_PAT), //reCaptcha config reCaptcha: Match.Optional({ data_type: Match.Optional(Match.OneOf("audio", "image")), secretKey: Match.Optional(String), siteKey: Match.Optional(String), theme: Match.Optional(Match.OneOf("dark", "light")), }), showReCaptcha: Match.Optional(Boolean), }; FIELD_SUB_PAT = { "default": Match.Optional(String), changePwd: Match.Optional(String), enrollAccount: Match.Optional(String), forgotPwd: Match.Optional(String), resetPwd: Match.Optional(String), signIn: Match.Optional(String), signUp: Match.Optional(String), }; // Field pattern FIELD_PAT = { _id: String, type: String, required: Match.Optional(Boolean), displayName: Match.Optional(Match.OneOf(String, Match.Where(_.isFunction), FIELD_SUB_PAT)), placeholder: Match.Optional(Match.OneOf(String, FIELD_SUB_PAT)), select: Match.Optional([{text: String, value: Match.Any}]), minLength: Match.Optional(Match.Integer), maxLength: Match.Optional(Match.Integer), re: Match.Optional(RegExp), func: Match.Optional(Match.Where(_.isFunction)), errStr: Match.Optional(String), // Client-side Validation continuousValidation: Match.Optional(Boolean), negativeFeedback: Match.Optional(Boolean), negativeValidation: Match.Optional(Boolean), positiveValidation: Match.Optional(Boolean), positiveFeedback: Match.Optional(Boolean), // Transforms trim: Match.Optional(Boolean), lowercase: Match.Optional(Boolean), uppercase: Match.Optional(Boolean), transform: Match.Optional(Match.Where(_.isFunction)), // Custom options options: Match.Optional(Object), template: Match.Optional(String), }; // Route configuration pattern to be checked with check var ROUTE_PAT = { name: Match.Optional(String), path: Match.Optional(String), template: Match.Optional(String), layoutTemplate: Match.Optional(String), renderLayout: Match.Optional(Object), contentRange: Match.Optional(String), redirect: Match.Optional(Match.OneOf(String, Match.Where(_.isFunction))), }; // ----------------------------------------------------------------------------- // AccountsTemplates object // ----------------------------------------------------------------------------- // ------------------- // Client/Server stuff // ------------------- // Constructor AT = function() { }; /* Each field object is represented by the following properties: _id: String (required) // A unique field"s id / name type: String (required) // Displayed input type required: Boolean (optional) // Specifies Whether to fail or not when field is left empty displayName: String (optional) // The field"s name to be displayed as a label above the input element placeholder: String (optional) // The placeholder text to be displayed inside the input element minLength: Integer (optional) // Possibly specifies the minimum allowed length maxLength: Integer (optional) // Possibly specifies the maximum allowed length re: RegExp (optional) // Regular expression for validation func: Function (optional) // Custom function for validation errStr: String (optional) // Error message to be displayed in case re validation fails */ /* Routes configuration can be done by calling AccountsTemplates.configureRoute with the route name and the following options in a separate object. E.g. AccountsTemplates.configureRoute("gingIn", option); name: String (optional). A unique route"s name to be passed to iron-router path: String (optional). A unique route"s path to be passed to iron-router template: String (optional). The name of the template to be rendered layoutTemplate: String (optional). The name of the layout to be used redirect: String (optional). The name of the route (or its path) where to redirect after form submit */ // Allowed routes along with theirs default configuration values AT.prototype.ROUTE_DEFAULT = { changePwd: { name: "atChangePwd", path: "/change-password"}, enrollAccount: { name: "atEnrollAccount", path: "/enroll-account"}, ensureSignedIn: { name: "atEnsureSignedIn", path: null}, forgotPwd: { name: "atForgotPwd", path: "/forgot-password"}, resetPwd: { name: "atResetPwd", path: "/reset-password"}, signIn: { name: "atSignIn", path: "/sign-in"}, signUp: { name: "atSignUp", path: "/sign-up"}, verifyEmail: { name: "atVerifyEmail", path: "/verify-email"}, resendVerificationEmail: { name: "atResendVerificationEmail", path: "/send-again"}, }; // Allowed input types AT.prototype.INPUT_TYPES = [ "checkbox", "email", "hidden", "password", "radio", "select", "tel", "text", "url", ]; // Current configuration values AT.prototype.options = { // Appearance //defaultLayout: undefined, defaultLayoutRegions: {}, showAddRemoveServices: false, showForgotPasswordLink: false, showResendVerificationEmailLink: false, showLabels: true, showPlaceholders: true, // Behaviour confirmPassword: true, defaultState: "signIn", enablePasswordChange: false, forbidClientAccountCreation: false, lowercaseUsername: false, overrideLoginErrors: true, sendVerificationEmail: false, socialLoginStyle: "popup", // Client-side Validation //continuousValidation: false, //negativeFeedback: false, //negativeValidation: false, //positiveValidation: false, //positiveFeedback: false, //showValidating: false, // Privacy Policy and Terms of Use privacyUrl: undefined, termsUrl: undefined, // Redirects homeRoutePath: "/", redirectTimeout: 2000, // 2 seconds // Hooks onSubmitHook: undefined, }; AT.prototype.texts = { button: { changePwd: "updateYourPassword", //enrollAccount: "createAccount", enrollAccount: "signUp", forgotPwd: "emailResetLink", resetPwd: "setPassword", signIn: "signIn", signUp: "signUp", resendVerificationEmail: "Send email again", }, errors: { accountsCreationDisabled: "Client side accounts creation is disabled!!!", cannotRemoveService: "Cannot remove the only active service!", captchaVerification: "Captcha verification failed!", loginForbidden: "error.accounts.Login forbidden", mustBeLoggedIn: "error.accounts.Must be logged in", pwdMismatch: "error.pwdsDontMatch", validationErrors: "Validation Errors", verifyEmailFirst: "Please verify your email first. Check the email and follow the link!", }, navSignIn: 'signIn', navSignOut: 'signOut', info: { emailSent: "info.emailSent", emailVerified: "info.emailVerified", pwdChanged: "info.passwordChanged", pwdReset: "info.passwordReset", pwdSet: "Password Set", signUpVerifyEmail: "Successful Registration! Please check your email and follow the instructions.", verificationEmailSent: "A new email has been sent to you. If the email doesn't show up in your inbox, be sure to check your spam folder.", }, inputIcons: { isValidating: "fa fa-spinner fa-spin", hasSuccess: "fa fa-check", hasError: "fa fa-times", }, maxAllowedLength: "Maximum allowed length", minRequiredLength: "Minimum required length", optionalField: "optional", pwdLink_pre: "", pwdLink_link: "forgotPassword", pwdLink_suff: "", requiredField: "Required Field", resendVerificationEmailLink_pre: "Verification email lost?", resendVerificationEmailLink_link: "Send again", resendVerificationEmailLink_suff: "", sep: "OR", signInLink_pre: "ifYouAlreadyHaveAnAccount", signInLink_link: "signin", signInLink_suff: "", signUpLink_pre: "dontHaveAnAccount", signUpLink_link: "signUp", signUpLink_suff: "", socialAdd: "add", socialConfigure: "configure", socialIcons: { "meteor-developer": "fa fa-rocket" }, socialRemove: "remove", socialSignIn: "signIn", socialSignUp: "signUp", socialWith: "with", termsPreamble: "clickAgree", termsPrivacy: "privacyPolicy", termsAnd: "and", termsTerms: "terms", title: { changePwd: "changePassword", enrollAccount: "createAccount", forgotPwd: "resetYourPassword", resetPwd: "resetYourPassword", signIn: "signIn", signUp: "createAccount", verifyEmail: "", resendVerificationEmail: "Send the verification email again", }, }; AT.prototype.SPECIAL_FIELDS = [ "password_again", "username_and_email", ]; // SignIn / SignUp fields AT.prototype._fields = [ new Field({ _id: "email", type: "email", required: true, lowercase: true, trim: true, func: function(email){ return !_.contains(email, '@'); }, errStr: 'Invalid email', }), new Field({ _id: "password", type: "password", required: true, minLength: 6, displayName: { "default": "password", changePwd: "newPassword", resetPwd: "newPassword", }, placeholder: { "default": "password", changePwd: "newPassword", resetPwd: "newPassword", }, }), ]; // Configured routes AT.prototype.routes = {}; AT.prototype._initialized = false; // Input type validation AT.prototype._isValidInputType = function(value) { return _.indexOf(this.INPUT_TYPES, value) !== -1; }; AT.prototype.addField = function(field) { // Fields can be added only before initialization if (this._initialized) throw new Error("AccountsTemplates.addField should strictly be called before AccountsTemplates.init!"); field = _.pick(field, _.keys(FIELD_PAT)); check(field, FIELD_PAT); // Checks there"s currently no field called field._id if (_.indexOf(_.pluck(this._fields, "_id"), field._id) !== -1) throw new Error("A field called " + field._id + " already exists!"); // Validates field.type if (!this._isValidInputType(field.type)) throw new Error("field.type is not valid!"); // Checks field.minLength is strictly positive if (typeof field.minLength !== "undefined" && field.minLength <= 0) throw new Error("field.minLength should be greater than zero!"); // Checks field.maxLength is strictly positive if (typeof field.maxLength !== "undefined" && field.maxLength <= 0) throw new Error("field.maxLength should be greater than zero!"); // Checks field.maxLength is greater than field.minLength if (typeof field.minLength !== "undefined" && typeof field.minLength !== "undefined" && field.maxLength < field.minLength) throw new Error("field.maxLength should be greater than field.maxLength!"); if (!(Meteor.isServer && _.contains(this.SPECIAL_FIELDS, field._id))) this._fields.push(new Field(field)); return this._fields; }; AT.prototype.addFields = function(fields) { var ok; try { // don"t bother with `typeof` - just access `length` and `catch` ok = fields.length > 0 && "0" in Object(fields); } catch (e) { throw new Error("field argument should be an array of valid field objects!"); } if (ok) { _.map(fields, function(field){ this.addField(field); }, this); } else throw new Error("field argument should be an array of valid field objects!"); return this._fields; }; AT.prototype.configure = function(config) { // Configuration options can be set only before initialization if (this._initialized) throw new Error("Configuration options must be set before AccountsTemplates.init!"); // Updates the current configuration check(config, CONFIG_PAT); var options = _.omit(config, "texts", "reCaptcha"); this.options = _.defaults(options, this.options); // Possibly sets up reCaptcha options var reCaptcha = config.reCaptcha; if (reCaptcha) { // Updates the current button object this.options.reCaptcha = _.defaults(reCaptcha, this.options.reCaptcha || {}); } // Possibly sets up texts... if (config.texts){ var texts = config.texts; var simpleTexts = _.omit(texts, "button", "errors", "info", "inputIcons", "socialIcons", "title"); this.texts = _.defaults(simpleTexts, this.texts); if (texts.button) { // Updates the current button object this.texts.button = _.defaults(texts.button, this.texts.button); } if (texts.errors) { // Updates the current errors object this.texts.errors = _.defaults(texts.errors, this.texts.errors); } if (texts.info) { // Updates the current info object this.texts.info = _.defaults(texts.info, this.texts.info); } if (texts.inputIcons) { // Updates the current inputIcons object this.texts.inputIcons = _.defaults(texts.inputIcons, this.texts.inputIcons); } if (texts.socialIcons) { // Updates the current socialIcons object this.texts.socialIcons = _.defaults(texts.socialIcons, this.texts.socialIcons); } if (texts.title) { // Updates the current title object this.texts.title = _.defaults(texts.title, this.texts.title); } } }; AT.prototype.configureRoute = function(route, options) { check(route, String); check(options, Match.OneOf(undefined, Match.ObjectIncluding(ROUTE_PAT))); options = _.clone(options); // Route Configuration can be done only before initialization if (this._initialized) throw new Error("Route Configuration can be done only before AccountsTemplates.init!"); // Only allowed routes can be configured if (!(route in this.ROUTE_DEFAULT)) throw new Error("Unknown Route!"); // Possibly adds a initial / to the provided path if (options && options.path && options.path[0] !== "/") options.path = "/" + options.path; // Updates the current configuration options = _.defaults(options || {}, this.ROUTE_DEFAULT[route]); this.routes[route] = options; // Sets up configured routes this.setupRoute(route, options); }; AT.prototype.hasField = function(fieldId) { return !!this.getField(fieldId); }; AT.prototype.getField = function(fieldId) { var field = _.filter(this._fields, function(field){ return field._id == fieldId; }); return (field.length === 1) ? field[0] : undefined; }; AT.prototype.getFields = function() { return this._fields; }; AT.prototype.getFieldIds = function() { return _.pluck(this._fields, "_id"); }; AT.prototype.getRouteName = function(route) { if (route in this.routes) return this.routes[route].name; return null; }; AT.prototype.getRoutePath = function(route) { if (route in this.routes) return this.routes[route].path; return "#"; }; AT.prototype.oauthServices = function(){ // Extracts names of available services var names; if (Meteor.isServer) names = (Accounts.oauth && Accounts.oauth.serviceNames()) || []; else names = (Accounts.oauth && Accounts.loginServicesConfigured() && Accounts.oauth.serviceNames()) || []; // Extracts names of configured services var configuredServices = []; if (Accounts.loginServiceConfiguration) configuredServices = _.pluck(Accounts.loginServiceConfiguration.find().fetch(), "service"); // Builds a list of objects containing service name as _id and its configuration status var services = _.map(names, function(name){ return { _id : name, configured: _.contains(configuredServices, name), }; }); // Checks whether there is a UI to configure services... // XXX: this only works with the accounts-ui package var showUnconfigured = typeof Accounts._loginButtonsSession !== "undefined"; // Filters out unconfigured services in case they"re not to be displayed if (!showUnconfigured){ services = _.filter(services, function(service){ return service.configured; }); } // Sorts services by name services = _.sortBy(services, function(service){ return service._id; }); return services; }; AT.prototype.removeField = function(fieldId) { // Fields can be removed only before initialization if (this._initialized) throw new Error("AccountsTemplates.removeField should strictly be called before AccountsTemplates.init!"); // Tries to look up the field with given _id var index = _.indexOf(_.pluck(this._fields, "_id"), fieldId); if (index !== -1) return this._fields.splice(index, 1)[0]; else if (!(Meteor.isServer && _.contains(this.SPECIAL_FIELDS, fieldId))) throw new Error("A field called " + fieldId + " does not exist!"); }; AT.prototype.setupRoute = function(route, options) { check(route, String); check(options, Match.OneOf(undefined, Match.ObjectIncluding(ROUTE_PAT))); options = _.clone(options); // Determines the default layout to be used in case no specific one is specified for single routes var defaultLayout = AccountsTemplates.options.defaultLayout; var defaultLayoutRegions = AccountsTemplates.options.defaultLayoutRegions; var defaultContentRegion = AccountsTemplates.options.defaultContentRegion; if (route === "ensureSignedIn") return; if (route === "changePwd" && !AccountsTemplates.options.enablePasswordChange) throw new Error("changePwd route configured but enablePasswordChange set to false!"); if (route === "forgotPwd" && !AccountsTemplates.options.showForgotPasswordLink) throw new Error("forgotPwd route configured but showForgotPasswordLink set to false!"); if (route === "signUp" && AccountsTemplates.options.forbidClientAccountCreation) throw new Error("signUp route configured but forbidClientAccountCreation set to true!"); // Possibly prints a warning in case the MAIL_URL environment variable was not set //if (Meteor.isServer && route === "forgotPwd" && (!process.env.MAIL_URL || ! Package["email"])){ // console.warn("[AccountsTemplates] WARNING: showForgotPasswordLink set to true, but MAIL_URL is not configured!"); //} var name = options.name; // Default provided... var path = options.path; // Default provided... var template = options.template || "fullPageAtForm"; var layoutTemplate = options.layoutTemplate || defaultLayout; var layoutRegions = options.layoutRegions || defaultLayoutRegions; var contentRegion = options.contentRegion || defaultContentRegion; // Possibly adds token parameter if (_.contains(["enrollAccount", "resetPwd", "verifyEmail"], route)){ path += "/:paramToken"; if (route === "verifyEmail") FlowRouter.route(path, { name: route, triggersEnter: [function() { AccountsTemplates.setState(route); AccountsTemplates.setDisabled(true); }], action: function(params) { layoutRegions[contentRegion] = template; FlowLayout.render(layoutTemplate, layoutRegions); var token = params.paramToken; Accounts.verifyEmail(token, function(error){ AccountsTemplates.setDisabled(false); AccountsTemplates.submitCallback(error, route, function(){ AccountsTemplates.state.form.set("result", AccountsTemplates.texts.info.emailVerified); }); }); } }); else FlowRouter.route(path, { name: route, triggersEnter:[function() { AccountsTemplates.setState(route); }], action: function(params) { layoutRegions[contentRegion] = template; FlowLayout.render(layoutTemplate, layoutRegions); } }); } else FlowRouter.route(path, { name: route, triggersEnter: [function() { var redirect = false; if (route === 'changePwd') { if (!Meteor.loggingIn() && !Meteor.userId()) { redirect = true; } } else if (Meteor.userId()) { redirect = true; } if (redirect) { AccountsTemplates.postSubmitRedirect(route); } else { AccountsTemplates.setState(route); } }], action: function() { layoutRegions[contentRegion] = template; FlowLayout.render(layoutTemplate, layoutRegions); } }); };
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S12.9_A1_T4; * @section: 12.9; * @assertion: Appearing of "return" without a function body leads to syntax error; * @description: Checking if execution of "return" with no function fails; * @negative; */ ////////////////////////////////////////////////////////////////////////////// //CHECK#1 return; // //////////////////////////////////////////////////////////////////////////////
var path = require('path') var utils = require('./utils') var config = require('../config') var vueLoaderConfig = require('./vue-loader.conf') function resolve(dir) { return path.join(__dirname, '..', dir) } module.exports = { entry: { app: './src/main.js' }, output: { path: config.build.assetsRoot, filename: '[name].js', publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath }, resolve: { extensions: ['.js', '.vue', '.json'], modules: [ resolve('src'), resolve('node_modules') ], alias: { 'vue$': 'vue/dist/vue.common.js', 'src': resolve('src'), 'assets': resolve('src/assets'), 'components': resolve('src/components') } }, module: { rules: [{ test: /\.vue$/, loader: 'vue-loader', options: vueLoaderConfig }, { test: /\.js$/, loader: 'babel-loader', include: [resolve('src'), resolve('test')] }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, loader: 'url-loader', query: { limit: 10000, name: utils.assetsPath('img/[name].[hash:7].[ext]') } }, { test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url-loader', query: { limit: 10000, name: utils.assetsPath('fonts/[name].[hash:7].[ext]') } }, { test: /\.(css|less)$/, loader: "style-loader!css-loader!postcss-loader!less-loader" } ] } }
/** * Main App Controller for the Angular Material Starter App * @param ProductDataService * @param $mdSidenav * @constructor */ import angular from "angular"; function AppController(ProductDataService, contract, $mdSidenav, $scope) { var self = this self.selected = null self.users = [ ] self.selectUser = selectUser self.toggleList = toggleUsersList // Load all registered users ProductDataService .loadAllObjects() .then(function(users) { self.users = [].concat(users) self.selected = users[0] }) // ********************************* // Internal methods // ********************************* /** * Hide or Show the 'left' sideNav area */ function toggleUsersList() { $mdSidenav('left').toggle() } /** * Select the current avatars * @param menuId */ function selectUser(user) { self.selected = angular.isNumber(user) ? $scope.users[user] : user contract.getInfo(self.selected.serial).then(function(info) { self.selected.isWarrantyValid = info.isWarrantyValid self.selected.warrantyEndDate = info.warrantyEndDate self.selected.customerId = info.customer self.selected.price = info.product[6] }) } } export default [ 'ProductDataService', 'EthereumService', '$mdSidenav', '$scope', AppController ]
'use strict'; var path = require('path'); /** * Path conversion utilities */ module.exports = { unix: function unix(str) { var input = path.normalize(str); input = input.replace(/\\/g, '\/'); var parts = input.split(':'); var drive = parts.shift(); var isLetter = drive.length === 1 && drive.match(/[a-z]/i); var result = isLetter ? drive + parts.join(':') : input; return result; } };
var grunt = require('grunt'), expect = require('expect.js'); describe('grunt-mdfiver', function() { it("Grunt be okay", function() { }); });
/* * L.TileLayer is used for standard xyz-numbered tile layers. */ L.Google = L.Class.extend({ includes: L.Mixin.Events, options: { minZoom: 0, maxZoom: 18, tileSize: 256, subdomains: 'abc', errorTileUrl: '', attribution: '', opacity: 1, continuousWorld: false, noWrap: false, }, // Possible types: SATELLITE, ROADMAP, HYBRID initialize: function(type, options) { L.Util.setOptions(this, options); this._type = google.maps.MapTypeId[type || 'SATELLITE']; }, onAdd: function(map, insertAtTheBottom) { this._map = map; this._insertAtTheBottom = insertAtTheBottom; // create a container div for tiles this._initContainer(); this._initMapObject(); // set up events map.on('viewreset', this._resetCallback, this); this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this); map.on('move', this._update, this); //map.on('moveend', this._update, this); this._reset(); this._update(); }, onRemove: function(map) { this._map._container.removeChild(this._container); //this._container = null; this._map.off('viewreset', this._resetCallback, this); this._map.off('move', this._update, this); //this._map.off('moveend', this._update, this); }, getAttribution: function() { return this.options.attribution; }, setOpacity: function(opacity) { this.options.opacity = opacity; if (opacity < 1) { L.DomUtil.setOpacity(this._container, opacity); } }, _initContainer: function() { var tilePane = this._map._container first = tilePane.firstChild; if (!this._container) { this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left'); this._container.id = "_GMapContainer"; } if (true) { tilePane.insertBefore(this._container, first); this.setOpacity(this.options.opacity); var size = this._map.getSize(); this._container.style.width = size.x + 'px'; this._container.style.height = size.y + 'px'; } }, _initMapObject: function() { this._google_center = new google.maps.LatLng(0, 0); var map = new google.maps.Map(this._container, { center: this._google_center, zoom: 0, mapTypeId: this._type, disableDefaultUI: true, keyboardShortcuts: false, draggable: false, disableDoubleClickZoom: true, scrollwheel: false, streetViewControl: false }); var _this = this; this._reposition = google.maps.event.addListenerOnce(map, "center_changed", function() { _this.onReposition(); }); map.backgroundColor = '#ff0000'; this._google = map; }, _resetCallback: function(e) { this._reset(e.hard); }, _reset: function(clearOldContainer) { this._initContainer(); }, _update: function() { this._resize(); var bounds = this._map.getBounds(); var ne = bounds.getNorthEast(); var sw = bounds.getSouthWest(); var google_bounds = new google.maps.LatLngBounds( new google.maps.LatLng(sw.lat, sw.lng), new google.maps.LatLng(ne.lat, ne.lng) ); var center = this._map.getCenter(); var _center = new google.maps.LatLng(center.lat, center.lng); this._google.setCenter(_center); this._google.setZoom(this._map.getZoom()); //this._google.fitBounds(google_bounds); }, _resize: function() { var size = this._map.getSize(); if (this._container.style.width == size.x && this._container.style.height == size.y) return; this._container.style.width = size.x + 'px'; this._container.style.height = size.y + 'px'; google.maps.event.trigger(this._google, "resize"); }, onReposition: function() { //google.maps.event.trigger(this._google, "resize"); } });
'use strict'; require('harmony-reflect'); require('es6-shim'); function oMap(obj){ obj = obj || {}; const map = new Map(); Object.keys(obj).forEach(function(key) { map.set(key, obj[key]); }); const handlers = { get: function(target,name){ if(name in target){ return target[name]; } return target.get(name); }, set: function (target,name,value){ return target.set(name,value); }, has: function(target,value){ return target.has(value); }, hasOwn: function(target,value){ return target.has(value); }, deleteProperty: function(target,value){ return target.delete(value); }, keys: function(target){ const k = target.keys(); const out = []; try{ while(true){ out.push(k.next().toString()); } }finally{ return out; } }, enumerate: function(target){ return target.iterator(); } }; return new Proxy(map,handlers); } module.exports = oMap;
zipdata({"7660023":[37,"仲多度郡まんのう町","吉野"],"7660201":[37,"仲多度郡まんのう町","造田"],"7660026":[37,"仲多度郡まんのう町","岸上"],"7660004":[37,"仲多度郡琴平町","榎井"],"7660204":[37,"仲多度郡まんのう町","勝浦"],"7660016":[37,"仲多度郡まんのう町","炭所東"],"7660017":[37,"仲多度郡まんのう町","炭所西"],"7660015":[37,"仲多度郡まんのう町","長尾"],"7660024":[37,"仲多度郡まんのう町","神野"],"7660027":[37,"仲多度郡まんのう町","五條"],"7660025":[37,"仲多度郡まんのう町","真野"],"7660203":[37,"仲多度郡まんのう町","川東"],"7660007":[37,"仲多度郡琴平町","下櫛梨"],"7660006":[37,"仲多度郡琴平町","上櫛梨"],"7660202":[37,"仲多度郡まんのう町","中通"],"7660013":[37,"仲多度郡まんのう町","東高篠"],"7660002":[37,"仲多度郡琴平町","琴平町"],"7660003":[37,"仲多度郡琴平町","五條"],"7660012":[37,"仲多度郡まんのう町","西高篠"],"7668502":[37,"仲多度郡琴平町","榎井","817-10"],"7660005":[37,"仲多度郡琴平町","苗田"],"7660014":[37,"仲多度郡まんのう町","羽間"],"7660022":[37,"仲多度郡まんのう町","吉野下"],"7660021":[37,"仲多度郡まんのう町","四條"],"7660001":[37,"仲多度郡琴平町","琴平町"],"7660011":[37,"仲多度郡まんのう町","公文"],"7668501":[37,"仲多度郡琴平町","","892-1"],"7660000":[37,"仲多度郡琴平町",""]} );
{ "name": "fit.js", "url": "https://github.com/soulwire/fit.js.git" }
'use strict'; const fs = require('fs'); describe('The assets copied from the src/static directory...', () => { it('Should include a favicon file', done => { fs.stat('build/favicon.ico', err => { if (err) throw err; done(); }); }); it('Should include ALL images in /img', done => { function getBuiltImages (source) { fs.readdir('build/img', (err, built) => { if (err) throw err; built.should.eql(source); done(); }); } fs.readdir('src/static/img', (err, source) => { if (err) throw err; getBuiltImages(source); }); }); });
const { expect } = require('chai'), Users = require('../server/db/users'); describe('Users model', () => { const user = new Users({ githubId: 3333333, login: 'octocat', name: 'monalisa octocat', email: '[email protected]', avatar_url: 'https://github.com/images/error/octocat_happy.gif', url: 'https://api.github.com/users/octocat', html_url: 'https://github.com/octocat', location: 'San Francisco', public_repos: 2, public_gists: 4, accessToken: 'randomAccessToken', totalFiddles: 2, }); it('saves appropriate fields', (done) => { user.save().then((savedUser) => { expect(savedUser.githubId).to.equal(3333333); expect(savedUser.login).to.equal('octocat'); expect(savedUser.name).to.equal('monalisa octocat'); expect(savedUser.email).to.equal('[email protected]'); expect(savedUser.avatar_url).to.equal('https://github.com/images/error/octocat_happy.gif'); expect(savedUser.url).to.equal('https://api.github.com/users/octocat'); expect(savedUser.html_url).to.equal('https://github.com/octocat'); expect(savedUser.location).to.equal('San Francisco'); expect(savedUser.public_repos).to.equal(2); expect(savedUser.public_gists).to.equal(4); expect(savedUser.accessToken).to.equal('randomAccessToken'); expect(savedUser.totalFiddles).to.equal(2); done(); }).then(null, done); }); it('findOrCreate updates accessTokens', (done) => { const profile = { id: user.githubId }; Users.findOrCreate(profile, 'newToken').then((savedUser) => { expect(savedUser.login).to.equal('octocat'); expect(savedUser.accessToken).to.equal('newToken'); done(); }).then(null, done); }); });
/* mustache.js — Logic-less templates in JavaScript See http://mustache.github.com/ for more info. */ var Mustache = function () { var _toString = Object.prototype.toString; Array.isArray = Array.isArray || function (obj) { return _toString.call(obj) == "[object Array]"; } var _trim = String.prototype.trim, trim; if (_trim) { trim = function (text) { return text == null ? "" : _trim.call(text); } } else { var trimLeft, trimRight; // IE doesn't match non-breaking spaces with \s. if ((/\S/).test("\xA0")) { trimLeft = /^[\s\xA0]+/; trimRight = /[\s\xA0]+$/; } else { trimLeft = /^\s+/; trimRight = /\s+$/; } trim = function (text) { return text == null ? "" : text.toString().replace(trimLeft, "").replace(trimRight, ""); } } var escapeMap = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': '&quot;', "'": '&#39;' }; function escapeHTML(string) { return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) { return escapeMap[s] || s; }); } var regexCache = {}; var Renderer = function () {}; Renderer.prototype = { otag: "{{", ctag: "}}", pragmas: {}, buffer: [], pragmas_implemented: { "IMPLICIT-ITERATOR": true }, context: {}, render: function (template, context, partials, in_recursion) { // reset buffer & set context if (!in_recursion) { this.context = context; this.buffer = []; // TODO: make this non-lazy } // fail fast if (!this.includes("", template)) { if (in_recursion) { return template; } else { this.send(template); return; } } // get the pragmas together template = this.render_pragmas(template); // render the template var html = this.render_section(template, context, partials); // render_section did not find any sections, we still need to render the tags if (html === false) { html = this.render_tags(template, context, partials, in_recursion); } if (in_recursion) { return html; } else { this.sendLines(html); } }, /* Sends parsed lines */ send: function (line) { if (line !== "") { this.buffer.push(line); } }, sendLines: function (text) { if (text) { var lines = text.split("\n"); for (var i = 0; i < lines.length; i++) { this.send(lines[i]); } } }, /* Looks for %PRAGMAS */ render_pragmas: function (template) { // no pragmas if (!this.includes("%", template)) { return template; } var that = this; var regex = this.getCachedRegex("render_pragmas", function (otag, ctag) { return new RegExp(otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" + ctag, "g"); }); return template.replace(regex, function (match, pragma, options) { if (!that.pragmas_implemented[pragma]) { throw({message: "This implementation of mustache doesn't understand the '" + pragma + "' pragma"}); } that.pragmas[pragma] = {}; if (options) { var opts = options.split("="); that.pragmas[pragma][opts[0]] = opts[1]; } return ""; // ignore unknown pragmas silently }); }, /* Tries to find a partial in the curent scope and render it */ render_partial: function (name, context, partials) { name = trim(name); if (!partials || partials[name] === undefined) { throw({message: "unknown_partial '" + name + "'"}); } if (!context || typeof context[name] != "object") { return this.render(partials[name], context, partials, true); } return this.render(partials[name], context[name], partials, true); }, /* Renders inverted (^) and normal (#) sections */ render_section: function (template, context, partials) { if (!this.includes("#", template) && !this.includes("^", template)) { // did not render anything, there were no sections return false; } var that = this; var regex = this.getCachedRegex("render_section", function (otag, ctag) { // This regex matches _the first_ section ({{#foo}}{{/foo}}), and captures the remainder return new RegExp( "^([\\s\\S]*?)" + // all the crap at the beginning that is not {{*}} ($1) otag + // {{ "(\\^|\\#)\\s*(.+)\\s*" + // #foo (# == $2, foo == $3) ctag + // }} "\n*([\\s\\S]*?)" + // between the tag ($2). leading newlines are dropped otag + // {{ "\\/\\s*\\3\\s*" + // /foo (backreference to the opening tag). ctag + // }} "\\s*([\\s\\S]*)$", // everything else in the string ($4). leading whitespace is dropped. "g"); }); // for each {{#foo}}{{/foo}} section do... return template.replace(regex, function (match, before, type, name, content, after) { // before contains only tags, no sections var renderedBefore = before ? that.render_tags(before, context, partials, true) : "", // after may contain both sections and tags, so use full rendering function renderedAfter = after ? that.render(after, context, partials, true) : "", // will be computed below renderedContent, value = that.find(name, context); if (type === "^") { // inverted section if (!value || Array.isArray(value) && value.length === 0) { // false or empty list, render it renderedContent = that.render(content, context, partials, true); } else { renderedContent = ""; } } else if (type === "#") { // normal section if (Array.isArray(value)) { // Enumerable, Let's loop! renderedContent = that.map(value, function (row) { return that.render(content, that.create_context(row), partials, true); }).join(""); } else if (that.is_object(value)) { // Object, Use it as subcontext! renderedContent = that.render(content, that.create_context(value), partials, true); } else if (typeof value == "function") { // higher order section renderedContent = value.call(context, content, function (text) { return that.render(text, context, partials, true); }); } else if (value) { // boolean section renderedContent = that.render(content, context, partials, true); } else { renderedContent = ""; } } return renderedBefore + renderedContent + renderedAfter; }); }, /* Replace {{foo}} and friends with values from our view */ render_tags: function (template, context, partials, in_recursion) { // tit for tat var that = this; var new_regex = function () { return that.getCachedRegex("render_tags", function (otag, ctag) { return new RegExp(otag + "(=|!|>|&|\\{|%)?([^#\\^]+?)\\1?" + ctag + "+", "g"); }); }; var regex = new_regex(); var tag_replace_callback = function (match, operator, name) { switch(operator) { case "!": // ignore comments return ""; case "=": // set new delimiters, rebuild the replace regexp that.set_delimiters(name); regex = new_regex(); return ""; case ">": // render partial return that.render_partial(name, context, partials); case "{": // the triple mustache is unescaped case "&": // & operator is an alternative unescape method return that.find(name, context); default: // escape the value return escapeHTML(that.find(name, context)); } }; var lines = template.split("\n"); for(var i = 0; i < lines.length; i++) { lines[i] = lines[i].replace(regex, tag_replace_callback, this); if (!in_recursion) { this.send(lines[i]); } } if (in_recursion) { return lines.join("\n"); } }, set_delimiters: function (delimiters) { var dels = delimiters.split(" "); this.otag = this.escape_regex(dels[0]); this.ctag = this.escape_regex(dels[1]); }, escape_regex: function (text) { // thank you Simon Willison if (!arguments.callee.sRE) { var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\' ]; arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' ); } return text.replace(arguments.callee.sRE, '\\$1'); }, /* find `name` in current `context`. That is find me a value from the view object */ find: function (name, context) { name = trim(name); // Checks whether a value is thruthy or false or 0 function is_kinda_truthy(bool) { return bool === false || bool === 0 || bool; } var value; // check for dot notation eg. foo.bar if (name.match(/([a-z_]+)\./ig)) { var childValue = this.walk_context(name, context); if (is_kinda_truthy(childValue)) { value = childValue; } } else { if (is_kinda_truthy(context[name])) { value = context[name]; } else if (is_kinda_truthy(this.context[name])) { value = this.context[name]; } } if (typeof value == "function") { return value.apply(context); } if (value !== undefined) { return value; } // silently ignore unkown variables return ""; }, walk_context: function (name, context) { var path = name.split('.'); // if the var doesn't exist in current context, check the top level context var value_context = (context[path[0]] != undefined) ? context : this.context; var value = value_context[path.shift()]; while (value != undefined && path.length > 0) { value_context = value; value = value[path.shift()]; } // if the value is a function, call it, binding the correct context if (typeof value == "function") { return value.apply(value_context); } return value; }, // Utility methods /* includes tag */ includes: function (needle, haystack) { return haystack.indexOf(this.otag + needle) != -1; }, // by @langalex, support for arrays of strings create_context: function (_context) { if (this.is_object(_context)) { return _context; } else { var iterator = "."; if (this.pragmas["IMPLICIT-ITERATOR"]) { iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator; } var ctx = {}; ctx[iterator] = _context; return ctx; } }, is_object: function (a) { return a && typeof a == "object"; }, /* Why, why, why? Because IE. Cry, cry cry. */ map: function (array, fn) { if (typeof array.map == "function") { return array.map(fn); } else { var r = []; var l = array.length; for(var i = 0; i < l; i++) { r.push(fn(array[i])); } return r; } }, getCachedRegex: function (name, generator) { var byOtag = regexCache[this.otag]; if (!byOtag) { byOtag = regexCache[this.otag] = {}; } var byCtag = byOtag[this.ctag]; if (!byCtag) { byCtag = byOtag[this.ctag] = {}; } var regex = byCtag[name]; if (!regex) { regex = byCtag[name] = generator(this.otag, this.ctag); } return regex; } }; return({ name: "mustache.js", version: "0.4.0-dev", /* Turns a template and view into HTML */ to_html: function (template, view, partials, send_fun) { var renderer = new Renderer(); if (send_fun) { renderer.send = send_fun; } renderer.render(template, view || {}, partials); if (!send_fun) { return renderer.buffer.join("\n"); } } }); }();
/** * Copy to clipboard functionality for code snippet examples */ import Clipboard from 'clipboard'; const clipboard = new Clipboard('.pl-js-code-copy-btn'); clipboard.on('success', function (e) { const copyButton = document.querySelectorAll('.pl-js-code-copy-btn'); for (let i = 0; i < copyButton.length; i++) { copyButton[i].querySelector('.pl-c-code-copy-btn__icon-text').innerText = 'Copy'; } e.trigger.classList.add('is-copied'); e.trigger.querySelector('.pl-c-code-copy-btn__icon-text').textContent = 'Copied'; setTimeout(() => { e.trigger.classList.remove('is-copied'); e.trigger.querySelector('.pl-c-code-copy-btn__icon-text').textContent = 'Copy'; e.clearSelection(); e.trigger.blur(); }, 2000); });
let nanoajax = require('nanoajax'); let Store = require('./Store'); class Regions extends Store { getRegions() { return this.__getData('regions'); } getConnections() { return this.__getData('regions/connections'); } } export default new Regions();
var path = require('path'); var chai = require('chai'); chai.use(require('chai-fs')); chai.should(); const ROOT_DIR = path.join(process.cwd()); describe('As a dev', function() { describe('When testing cartridge directory structure', function() { var pathToTest; it('then _cartridge folder should exist', function() { pathToTest = path.join(ROOT_DIR, '_cartridge'); pathToTest.should.be.a.directory(); }) it('then _config folder should exist', function() { pathToTest = path.join(ROOT_DIR, '_config'); pathToTest.should.be.a.directory(); }) it('then _source folder should exist', function() { pathToTest = path.join(ROOT_DIR, '_source'); pathToTest.should.be.a.directory(); }) }); });
/*! noUiSlider - 7.0.10 - 2014-12-27 14:50:46 */ /*jslint browser: true */ /*jslint white: true */ // ----------------------------------------------------------------------------- // LP Change // // This module has been manually wrapped in define to correctly handle the // jquery dependency. // // Shim wouldn't work in this case as it depends on a module in a different file. // ----------------------------------------------------------------------------- define([ "jquery" ], function($){ 'use strict'; // Removes duplicates from an array. function unique(array) { return $.grep(array, function(el, index) { return index === $.inArray(el, array); }); } // Round a value to the closest 'to'. function closest ( value, to ) { return Math.round(value / to) * to; } // Checks whether a value is numerical. function isNumeric ( a ) { return typeof a === 'number' && !isNaN( a ) && isFinite( a ); } // Rounds a number to 7 supported decimals. function accurateNumber( number ) { var p = Math.pow(10, 7); return Number((Math.round(number*p)/p).toFixed(7)); } // Sets a class and removes it after [duration] ms. function addClassFor ( element, className, duration ) { element.addClass(className); setTimeout(function(){ element.removeClass(className); }, duration); } // Limits a value to 0 - 100 function limit ( a ) { return Math.max(Math.min(a, 100), 0); } // Wraps a variable as an array, if it isn't one yet. function asArray ( a ) { return $.isArray(a) ? a : [a]; } // Counts decimals function countDecimals ( numStr ) { var pieces = numStr.split("."); return pieces.length > 1 ? pieces[1].length : 0; } var // Cache the document selector; /** @const */ doc = $(document), // Make a backup of the original jQuery/Zepto .val() method. /** @const */ $val = $.fn.val, // Namespace for binding and unbinding slider events; /** @const */ namespace = '.nui', // Determine the events to bind. IE11 implements pointerEvents without // a prefix, which breaks compatibility with the IE10 implementation. /** @const */ actions = window.navigator.pointerEnabled ? { start: 'pointerdown', move: 'pointermove', end: 'pointerup' } : window.navigator.msPointerEnabled ? { start: 'MSPointerDown', move: 'MSPointerMove', end: 'MSPointerUp' } : { start: 'mousedown touchstart', move: 'mousemove touchmove', end: 'mouseup touchend' }, // Re-usable list of classes; /** @const */ Classes = [ /* 0 */ 'noUi-target' /* 1 */ ,'noUi-base' /* 2 */ ,'noUi-origin' /* 3 */ ,'noUi-handle' /* 4 */ ,'noUi-horizontal' /* 5 */ ,'noUi-vertical' /* 6 */ ,'noUi-background' /* 7 */ ,'noUi-connect' /* 8 */ ,'noUi-ltr' /* 9 */ ,'noUi-rtl' /* 10 */ ,'noUi-dragable' /* 11 */ ,'' /* 12 */ ,'noUi-state-drag' /* 13 */ ,'' /* 14 */ ,'noUi-state-tap' /* 15 */ ,'noUi-active' /* 16 */ ,'' /* 17 */ ,'noUi-stacking' ]; // Value calculation // Determine the size of a sub-range in relation to a full range. function subRangeRatio ( pa, pb ) { return (100 / (pb - pa)); } // (percentage) How many percent is this value of this range? function fromPercentage ( range, value ) { return (value * 100) / ( range[1] - range[0] ); } // (percentage) Where is this value on this range? function toPercentage ( range, value ) { return fromPercentage( range, range[0] < 0 ? value + Math.abs(range[0]) : value - range[0] ); } // (value) How much is this percentage on this range? function isPercentage ( range, value ) { return ((value * ( range[1] - range[0] )) / 100) + range[0]; } // Range conversion function getJ ( value, arr ) { var j = 1; while ( value >= arr[j] ){ j += 1; } return j; } // (percentage) Input a value, find where, on a scale of 0-100, it applies. function toStepping ( xVal, xPct, value ) { if ( value >= xVal.slice(-1)[0] ){ return 100; } var j = getJ( value, xVal ), va, vb, pa, pb; va = xVal[j-1]; vb = xVal[j]; pa = xPct[j-1]; pb = xPct[j]; return pa + (toPercentage([va, vb], value) / subRangeRatio (pa, pb)); } // (value) Input a percentage, find where it is on the specified range. function fromStepping ( xVal, xPct, value ) { // There is no range group that fits 100 if ( value >= 100 ){ return xVal.slice(-1)[0]; } var j = getJ( value, xPct ), va, vb, pa, pb; va = xVal[j-1]; vb = xVal[j]; pa = xPct[j-1]; pb = xPct[j]; return isPercentage([va, vb], (value - pa) * subRangeRatio (pa, pb)); } // (percentage) Get the step that applies at a certain value. function getStep ( xPct, xSteps, snap, value ) { if ( value === 100 ) { return value; } var j = getJ( value, xPct ), a, b; // If 'snap' is set, steps are used as fixed points on the slider. if ( snap ) { a = xPct[j-1]; b = xPct[j]; // Find the closest position, a or b. if ((value - a) > ((b-a)/2)){ return b; } return a; } if ( !xSteps[j-1] ){ return value; } return xPct[j-1] + closest( value - xPct[j-1], xSteps[j-1] ); } // Entry parsing function handleEntryPoint ( index, value, that ) { var percentage; // Wrap numerical input in an array. if ( typeof value === "number" ) { value = [value]; } // Reject any invalid input, by testing whether value is an array. if ( Object.prototype.toString.call( value ) !== '[object Array]' ){ throw new Error("noUiSlider: 'range' contains invalid value."); } // Covert min/max syntax to 0 and 100. if ( index === 'min' ) { percentage = 0; } else if ( index === 'max' ) { percentage = 100; } else { percentage = parseFloat( index ); } // Check for correct input. if ( !isNumeric( percentage ) || !isNumeric( value[0] ) ) { throw new Error("noUiSlider: 'range' value isn't numeric."); } // Store values. that.xPct.push( percentage ); that.xVal.push( value[0] ); // NaN will evaluate to false too, but to keep // logging clear, set step explicitly. Make sure // not to override the 'step' setting with false. if ( !percentage ) { if ( !isNaN( value[1] ) ) { that.xSteps[0] = value[1]; } } else { that.xSteps.push( isNaN(value[1]) ? false : value[1] ); } } function handleStepPoint ( i, n, that ) { // Ignore 'false' stepping. if ( !n ) { return true; } // Factor to range ratio that.xSteps[i] = fromPercentage([ that.xVal[i] ,that.xVal[i+1] ], n) / subRangeRatio ( that.xPct[i], that.xPct[i+1] ); } // Interface // The interface to Spectrum handles all direction-based // conversions, so the above values are unaware. function Spectrum ( entry, snap, direction, singleStep ) { this.xPct = []; this.xVal = []; this.xSteps = [ singleStep || false ]; this.xNumSteps = [ false ]; this.snap = snap; this.direction = direction; var index, ordered = [ /* [0, 'min'], [1, '50%'], [2, 'max'] */ ]; // Map the object keys to an array. for ( index in entry ) { if ( entry.hasOwnProperty(index) ) { ordered.push([entry[index], index]); } } // Sort all entries by value (numeric sort). ordered.sort(function(a, b) { return a[0] - b[0]; }); // Convert all entries to subranges. for ( index = 0; index < ordered.length; index++ ) { handleEntryPoint(ordered[index][1], ordered[index][0], this); } // Store the actual step values. // xSteps is sorted in the same order as xPct and xVal. this.xNumSteps = this.xSteps.slice(0); // Convert all numeric steps to the percentage of the subrange they represent. for ( index = 0; index < this.xNumSteps.length; index++ ) { handleStepPoint(index, this.xNumSteps[index], this); } } Spectrum.prototype.getMargin = function ( value ) { return this.xPct.length === 2 ? fromPercentage(this.xVal, value) : false; }; Spectrum.prototype.toStepping = function ( value ) { value = toStepping( this.xVal, this.xPct, value ); // Invert the value if this is a right-to-left slider. if ( this.direction ) { value = 100 - value; } return value; }; Spectrum.prototype.fromStepping = function ( value ) { // Invert the value if this is a right-to-left slider. if ( this.direction ) { value = 100 - value; } return accurateNumber(fromStepping( this.xVal, this.xPct, value )); }; Spectrum.prototype.getStep = function ( value ) { // Find the proper step for rtl sliders by search in inverse direction. // Fixes issue #262. if ( this.direction ) { value = 100 - value; } value = getStep(this.xPct, this.xSteps, this.snap, value ); if ( this.direction ) { value = 100 - value; } return value; }; Spectrum.prototype.getApplicableStep = function ( value ) { // If the value is 100%, return the negative step twice. var j = getJ(value, this.xPct), offset = value === 100 ? 2 : 1; return [this.xNumSteps[j-2], this.xVal[j-offset], this.xNumSteps[j-offset]]; }; // Outside testing Spectrum.prototype.convert = function ( value ) { return this.getStep(this.toStepping(value)); }; /* Every input option is tested and parsed. This'll prevent endless validation in internal methods. These tests are structured with an item for every option available. An option can be marked as required by setting the 'r' flag. The testing function is provided with three arguments: - The provided value for the option; - A reference to the options object; - The name for the option; The testing function returns false when an error is detected, or true when everything is OK. It can also modify the option object, to make sure all values can be correctly looped elsewhere. */ /** @const */ var defaultFormatter = { 'to': function( value ){ return value.toFixed(2); }, 'from': Number }; function testStep ( parsed, entry ) { if ( !isNumeric( entry ) ) { throw new Error("noUiSlider: 'step' is not numeric."); } // The step option can still be used to set stepping // for linear sliders. Overwritten if set in 'range'. parsed.singleStep = entry; } function testRange ( parsed, entry ) { // Filter incorrect input. if ( typeof entry !== 'object' || $.isArray(entry) ) { throw new Error("noUiSlider: 'range' is not an object."); } // Catch missing start or end. if ( entry.min === undefined || entry.max === undefined ) { throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'."); } parsed.spectrum = new Spectrum(entry, parsed.snap, parsed.dir, parsed.singleStep); } function testStart ( parsed, entry ) { entry = asArray(entry); // Validate input. Values aren't tested, as the public .val method // will always provide a valid location. if ( !$.isArray( entry ) || !entry.length || entry.length > 2 ) { throw new Error("noUiSlider: 'start' option is incorrect."); } // Store the number of handles. parsed.handles = entry.length; // When the slider is initialized, the .val method will // be called with the start options. parsed.start = entry; } function testSnap ( parsed, entry ) { // Enforce 100% stepping within subranges. parsed.snap = entry; if ( typeof entry !== 'boolean' ){ throw new Error("noUiSlider: 'snap' option must be a boolean."); } } function testAnimate ( parsed, entry ) { // Enforce 100% stepping within subranges. parsed.animate = entry; if ( typeof entry !== 'boolean' ){ throw new Error("noUiSlider: 'animate' option must be a boolean."); } } function testConnect ( parsed, entry ) { if ( entry === 'lower' && parsed.handles === 1 ) { parsed.connect = 1; } else if ( entry === 'upper' && parsed.handles === 1 ) { parsed.connect = 2; } else if ( entry === true && parsed.handles === 2 ) { parsed.connect = 3; } else if ( entry === false ) { parsed.connect = 0; } else { throw new Error("noUiSlider: 'connect' option doesn't match handle count."); } } function testOrientation ( parsed, entry ) { // Set orientation to an a numerical value for easy // array selection. switch ( entry ){ case 'horizontal': parsed.ort = 0; break; case 'vertical': parsed.ort = 1; break; default: throw new Error("noUiSlider: 'orientation' option is invalid."); } } function testMargin ( parsed, entry ) { if ( !isNumeric(entry) ){ throw new Error("noUiSlider: 'margin' option must be numeric."); } parsed.margin = parsed.spectrum.getMargin(entry); if ( !parsed.margin ) { throw new Error("noUiSlider: 'margin' option is only supported on linear sliders."); } } function testLimit ( parsed, entry ) { if ( !isNumeric(entry) ){ throw new Error("noUiSlider: 'limit' option must be numeric."); } parsed.limit = parsed.spectrum.getMargin(entry); if ( !parsed.limit ) { throw new Error("noUiSlider: 'limit' option is only supported on linear sliders."); } } function testDirection ( parsed, entry ) { // Set direction as a numerical value for easy parsing. // Invert connection for RTL sliders, so that the proper // handles get the connect/background classes. switch ( entry ) { case 'ltr': parsed.dir = 0; break; case 'rtl': parsed.dir = 1; parsed.connect = [0,2,1,3][parsed.connect]; break; default: throw new Error("noUiSlider: 'direction' option was not recognized."); } } function testBehaviour ( parsed, entry ) { // Make sure the input is a string. if ( typeof entry !== 'string' ) { throw new Error("noUiSlider: 'behaviour' must be a string containing options."); } // Check if the string contains any keywords. // None are required. var tap = entry.indexOf('tap') >= 0, drag = entry.indexOf('drag') >= 0, fixed = entry.indexOf('fixed') >= 0, snap = entry.indexOf('snap') >= 0; parsed.events = { tap: tap || snap, drag: drag, fixed: fixed, snap: snap }; } function testFormat ( parsed, entry ) { parsed.format = entry; // Any object with a to and from method is supported. if ( typeof entry.to === 'function' && typeof entry.from === 'function' ) { return true; } throw new Error( "noUiSlider: 'format' requires 'to' and 'from' methods."); } // Test all developer settings and parse to assumption-safe values. function testOptions ( options ) { var parsed = { margin: 0, limit: 0, animate: true, format: defaultFormatter }, tests; // Tests are executed in the order they are presented here. tests = { 'step': { r: false, t: testStep }, 'start': { r: true, t: testStart }, 'connect': { r: true, t: testConnect }, 'direction': { r: true, t: testDirection }, 'snap': { r: false, t: testSnap }, 'animate': { r: false, t: testAnimate }, 'range': { r: true, t: testRange }, 'orientation': { r: false, t: testOrientation }, 'margin': { r: false, t: testMargin }, 'limit': { r: false, t: testLimit }, 'behaviour': { r: true, t: testBehaviour }, 'format': { r: false, t: testFormat } }; // Set defaults where applicable. options = $.extend({ 'connect': false, 'direction': 'ltr', 'behaviour': 'tap', 'orientation': 'horizontal' }, options); // Run all options through a testing mechanism to ensure correct // input. It should be noted that options might get modified to // be handled properly. E.g. wrapping integers in arrays. $.each( tests, function( name, test ){ // If the option isn't set, but it is required, throw an error. if ( options[name] === undefined ) { if ( test.r ) { throw new Error("noUiSlider: '" + name + "' is required."); } return true; } test.t( parsed, options[name] ); }); // Pre-define the styles. parsed.style = parsed.ort ? 'top' : 'left'; return parsed; } // Class handling // Delimit proposed values for handle positions. function getPositions ( a, b, delimit ) { // Add movement to current position. var c = a + b[0], d = a + b[1]; // Only alter the other position on drag, // not on standard sliding. if ( delimit ) { if ( c < 0 ) { d += Math.abs(c); } if ( d > 100 ) { c -= ( d - 100 ); } // Limit values to 0 and 100. return [limit(c), limit(d)]; } return [c,d]; } // Event handling // Provide a clean event with standardized offset values. function fixEvent ( e ) { // Prevent scrolling and panning on touch events, while // attempting to slide. The tap event also depends on this. e.preventDefault(); // Filter the event to register the type, which can be // touch, mouse or pointer. Offset changes need to be // made on an event specific basis. var touch = e.type.indexOf('touch') === 0 ,mouse = e.type.indexOf('mouse') === 0 ,pointer = e.type.indexOf('pointer') === 0 ,x,y, event = e; // IE10 implemented pointer events with a prefix; if ( e.type.indexOf('MSPointer') === 0 ) { pointer = true; } // Get the originalEvent, if the event has been wrapped // by jQuery. Zepto doesn't wrap the event. if ( e.originalEvent ) { e = e.originalEvent; } if ( touch ) { // noUiSlider supports one movement at a time, // so we can select the first 'changedTouch'. x = e.changedTouches[0].pageX; y = e.changedTouches[0].pageY; } if ( mouse || pointer ) { // Polyfill the pageXOffset and pageYOffset // variables for IE7 and IE8; if( !pointer && window.pageXOffset === undefined ){ window.pageXOffset = document.documentElement.scrollLeft; window.pageYOffset = document.documentElement.scrollTop; } x = e.clientX + window.pageXOffset; y = e.clientY + window.pageYOffset; } event.points = [x, y]; event.cursor = mouse; return event; } // DOM additions // Append a handle to the base. function addHandle ( direction, index ) { var handle = $('<div><div/></div>').addClass( Classes[2] ), additions = [ '-lower', '-upper' ]; if ( direction ) { additions.reverse(); } handle.children().addClass( Classes[3] + " " + Classes[3]+additions[index] ); return handle; } // Add the proper connection classes. function addConnection ( connect, target, handles ) { // Apply the required connection classes to the elements // that need them. Some classes are made up for several // segments listed in the class list, to allow easy // renaming and provide a minor compression benefit. switch ( connect ) { case 1: target.addClass( Classes[7] ); handles[0].addClass( Classes[6] ); break; case 3: handles[1].addClass( Classes[6] ); /* falls through */ case 2: handles[0].addClass( Classes[7] ); /* falls through */ case 0: target.addClass(Classes[6]); break; } } // Add handles to the slider base. function addHandles ( nrHandles, direction, base ) { var index, handles = []; // Append handles. for ( index = 0; index < nrHandles; index += 1 ) { // Keep a list of all added handles. handles.push( addHandle( direction, index ).appendTo(base) ); } return handles; } // Initialize a single slider. function addSlider ( direction, orientation, target ) { // Apply classes and data to the target. target.addClass([ Classes[0], Classes[8 + direction], Classes[4 + orientation] ].join(' ')); return $('<div/>').appendTo(target).addClass( Classes[1] ); } function closure ( target, options, originalOptions ){ // Internal variables // All variables local to 'closure' are marked $. var $Target = $(target), $Locations = [-1, -1], $Base, $Handles, $Spectrum = options.spectrum, $Values = [], // libLink. For rtl sliders, 'lower' and 'upper' should not be inverted // for one-handle sliders, so trim 'upper' it that case. triggerPos = ['lower', 'upper'].slice(0, options.handles); // Invert the libLink connection for rtl sliders. if ( options.dir ) { triggerPos.reverse(); } // Helpers // Shorthand for base dimensions. function baseSize ( ) { return $Base[['width', 'height'][options.ort]](); } // External event handling function fireEvents ( events ) { // Use the external api to get the values. // Wrap the values in an array, as .trigger takes // only one additional argument. var index, values = [ $Target.val() ]; for ( index = 0; index < events.length; index += 1 ){ $Target.trigger(events[index], values); } } // Returns the input array, respecting the slider direction configuration. function inSliderOrder ( values ) { // If only one handle is used, return a single value. if ( values.length === 1 ){ return values[0]; } if ( options.dir ) { return values.reverse(); } return values; } // libLink integration // Create a new function which calls .val on input change. function createChangeHandler ( trigger ) { return function ( ignore, value ){ // Determine which array position to 'null' based on 'trigger'. $Target.val( [ trigger ? null : value, trigger ? value : null ], true ); }; } // Called by libLink when it wants a set of links updated. function linkUpdate ( flag ) { var trigger = $.inArray(flag, triggerPos); // The API might not have been set yet. if ( $Target[0].linkAPI && $Target[0].linkAPI[flag] ) { $Target[0].linkAPI[flag].change( $Values[trigger], $Handles[trigger].children(), $Target ); } } // Called by libLink to append an element to the slider. function linkConfirm ( flag, element ) { // Find the trigger for the passed flag. var trigger = $.inArray(flag, triggerPos); // If set, append the element to the handle it belongs to. if ( element ) { element.appendTo( $Handles[trigger].children() ); } // The public API is reversed for rtl sliders, so the changeHandler // should not be aware of the inverted trigger positions. // On rtl slider with one handle, 'lower' should be used. if ( options.dir && options.handles > 1 ) { trigger = trigger === 1 ? 0 : 1; } return createChangeHandler( trigger ); } // Place elements back on the slider. function reAppendLink ( ) { var i, flag; // The API keeps a list of elements: we can re-append them on rebuild. for ( i = 0; i < triggerPos.length; i += 1 ) { if ( this.linkAPI && this.linkAPI[(flag = triggerPos[i])] ) { this.linkAPI[flag].reconfirm(flag); } } } target.LinkUpdate = linkUpdate; target.LinkConfirm = linkConfirm; target.LinkDefaultFormatter = options.format; target.LinkDefaultFlag = 'lower'; target.reappend = reAppendLink; // Handler for attaching events trough a proxy. function attach ( events, element, callback, data ) { // This function can be used to 'filter' events to the slider. // Add the noUiSlider namespace to all events. events = events.replace( /\s/g, namespace + ' ' ) + namespace; // Bind a closure on the target. return element.on( events, function( e ){ // jQuery and Zepto (1) handle unset attributes differently, // but always falsy; #208 if ( !!$Target.attr('disabled') ) { return false; } // Stop if an active 'tap' transition is taking place. if ( $Target.hasClass( Classes[14] ) ) { return false; } e = fixEvent(e); e.calcPoint = e.points[ options.ort ]; // Call the event handler with the event [ and additional data ]. callback ( e, data ); }); } // Handle movement on document for handle and range drag. function move ( event, data ) { var handles = data.handles || $Handles, positions, state = false, proposal = ((event.calcPoint - data.start) * 100) / baseSize(), h = handles[0][0] !== $Handles[0][0] ? 1 : 0; // Calculate relative positions for the handles. positions = getPositions( proposal, data.positions, handles.length > 1); state = setHandle ( handles[0], positions[h], handles.length === 1 ); if ( handles.length > 1 ) { state = setHandle ( handles[1], positions[h?0:1], false ) || state; } // Fire the 'slide' event if any handle moved. if ( state ) { fireEvents(['slide']); } } // Unbind move events on document, call callbacks. function end ( event ) { // The handle is no longer active, so remove the class. $('.' + Classes[15]).removeClass(Classes[15]); // Remove cursor styles and text-selection events bound to the body. if ( event.cursor ) { $('body').css('cursor', '').off( namespace ); } // Unbind the move and end events, which are added on 'start'. doc.off( namespace ); // Remove dragging class. $Target.removeClass(Classes[12]); // Fire the change and set events. fireEvents(['set', 'change']); } // Bind move events on document. function start ( event, data ) { // Mark the handle as 'active' so it can be styled. if( data.handles.length === 1 ) { data.handles[0].children().addClass(Classes[15]); } // A drag should never propagate up to the 'tap' event. event.stopPropagation(); // Attach the move event. attach ( actions.move, doc, move, { start: event.calcPoint, handles: data.handles, positions: [ $Locations[0], $Locations[$Handles.length - 1] ] }); // Unbind all movement when the drag ends. attach ( actions.end, doc, end, null ); // Text selection isn't an issue on touch devices, // so adding cursor styles can be skipped. if ( event.cursor ) { // Prevent the 'I' cursor and extend the range-drag cursor. $('body').css('cursor', $(event.target).css('cursor')); // Mark the target with a dragging state. if ( $Handles.length > 1 ) { $Target.addClass(Classes[12]); } // Prevent text selection when dragging the handles. $('body').on('selectstart' + namespace, false); } } // Move closest handle to tapped location. function tap ( event ) { var location = event.calcPoint, total = 0, to; // The tap event shouldn't propagate up and cause 'edge' to run. event.stopPropagation(); // Add up the handle offsets. $.each( $Handles, function(){ total += this.offset()[ options.style ]; }); // Find the handle closest to the tapped position. total = ( location < total/2 || $Handles.length === 1 ) ? 0 : 1; location -= $Base.offset()[ options.style ]; // Calculate the new position. to = ( location * 100 ) / baseSize(); if ( !options.events.snap ) { // Flag the slider as it is now in a transitional state. // Transition takes 300 ms, so re-enable the slider afterwards. addClassFor( $Target, Classes[14], 300 ); } // Find the closest handle and calculate the tapped point. // The set handle to the new position. setHandle( $Handles[total], to ); fireEvents(['slide', 'set', 'change']); if ( options.events.snap ) { start(event, { handles: [$Handles[total]] }); } } // Attach events to several slider parts. function events ( behaviour ) { var i, drag; // Attach the standard drag event to the handles. if ( !behaviour.fixed ) { for ( i = 0; i < $Handles.length; i += 1 ) { // These events are only bound to the visual handle // element, not the 'real' origin element. attach ( actions.start, $Handles[i].children(), start, { handles: [ $Handles[i] ] }); } } // Attach the tap event to the slider base. if ( behaviour.tap ) { attach ( actions.start, $Base, tap, { handles: $Handles }); } // Make the range dragable. if ( behaviour.drag ){ drag = $Base.find( '.' + Classes[7] ).addClass( Classes[10] ); // When the range is fixed, the entire range can // be dragged by the handles. The handle in the first // origin will propagate the start event upward, // but it needs to be bound manually on the other. if ( behaviour.fixed ) { drag = drag.add($Base.children().not( drag ).children()); } attach ( actions.start, drag, start, { handles: $Handles }); } } // Test suggested values and apply margin, step. function setHandle ( handle, to, noLimitOption ) { var trigger = handle[0] !== $Handles[0][0] ? 1 : 0, lowerMargin = $Locations[0] + options.margin, upperMargin = $Locations[1] - options.margin, lowerLimit = $Locations[0] + options.limit, upperLimit = $Locations[1] - options.limit; // For sliders with multiple handles, // limit movement to the other handle. // Apply the margin option by adding it to the handle positions. if ( $Handles.length > 1 ) { to = trigger ? Math.max( to, lowerMargin ) : Math.min( to, upperMargin ); } // The limit option has the opposite effect, limiting handles to a // maximum distance from another. Limit must be > 0, as otherwise // handles would be unmoveable. 'noLimitOption' is set to 'false' // for the .val() method, except for pass 4/4. if ( noLimitOption !== false && options.limit && $Handles.length > 1 ) { to = trigger ? Math.min ( to, lowerLimit ) : Math.max( to, upperLimit ); } // Handle the step option. to = $Spectrum.getStep( to ); // Limit to 0/100 for .val input, trim anything beyond 7 digits, as // JavaScript has some issues in its floating point implementation. to = limit(parseFloat(to.toFixed(7))); // Return false if handle can't move. if ( to === $Locations[trigger] ) { return false; } // Set the handle to the new position. handle.css( options.style, to + '%' ); // Force proper handle stacking if ( handle.is(':first-child') ) { handle.toggleClass(Classes[17], to > 50 ); } // Update locations. $Locations[trigger] = to; // Convert the value to the slider stepping/range. $Values[trigger] = $Spectrum.fromStepping( to ); linkUpdate(triggerPos[trigger]); return true; } // Loop values from value method and apply them. function setValues ( count, values ) { var i, trigger, to; // With the limit option, we'll need another limiting pass. if ( options.limit ) { count += 1; } // If there are multiple handles to be set run the setting // mechanism twice for the first handle, to make sure it // can be bounced of the second one properly. for ( i = 0; i < count; i += 1 ) { trigger = i%2; // Get the current argument from the array. to = values[trigger]; // Setting with null indicates an 'ignore'. // Inputting 'false' is invalid. if ( to !== null && to !== false ) { // If a formatted number was passed, attemt to decode it. if ( typeof to === 'number' ) { to = String(to); } to = options.format.from( to ); // Request an update for all links if the value was invalid. // Do so too if setting the handle fails. if ( to === false || isNaN(to) || setHandle( $Handles[trigger], $Spectrum.toStepping( to ), i === (3 - options.dir) ) === false ) { linkUpdate(triggerPos[trigger]); } } } } // Set the slider value. function valueSet ( input ) { // LibLink: don't accept new values when currently emitting changes. if ( $Target[0].LinkIsEmitting ) { return this; } var count, values = asArray( input ); // The RTL settings is implemented by reversing the front-end, // internal mechanisms are the same. if ( options.dir && options.handles > 1 ) { values.reverse(); } // Animation is optional. // Make sure the initial values where set before using animated // placement. (no report, unit testing); if ( options.animate && $Locations[0] !== -1 ) { addClassFor( $Target, Classes[14], 300 ); } // Determine how often to set the handles. count = $Handles.length > 1 ? 3 : 1; if ( values.length === 1 ) { count = 1; } setValues ( count, values ); // Fire the 'set' event. As of noUiSlider 7, // this is no longer optional. fireEvents(['set']); return this; } // Get the slider value. function valueGet ( ) { var i, retour = []; // Get the value from all handles. for ( i = 0; i < options.handles; i += 1 ){ retour[i] = options.format.to( $Values[i] ); } return inSliderOrder( retour ); } // Destroy the slider and unbind all events. function destroyTarget ( ) { // Unbind events on the slider, remove all classes and child elements. $(this).off(namespace) .removeClass(Classes.join(' ')) .empty(); delete this.LinkUpdate; delete this.LinkConfirm; delete this.LinkDefaultFormatter; delete this.LinkDefaultFlag; delete this.reappend; delete this.vGet; delete this.vSet; delete this.getCurrentStep; delete this.getInfo; delete this.destroy; // Return the original options from the closure. return originalOptions; } // Get the current step size for the slider. function getCurrentStep ( ) { // Check all locations, map them to their stepping point. // Get the step point, then find it in the input list. var retour = $.map($Locations, function( location, index ){ var step = $Spectrum.getApplicableStep( location ), // As per #391, the comparison for the decrement step can have some rounding issues. // Round the value to the precision used in the step. stepDecimals = countDecimals(String(step[2])), // Get the current numeric value value = $Values[index], // To move the slider 'one step up', the current step value needs to be added. // Use null if we are at the maximum slider value. increment = location === 100 ? null : step[2], // Going 'one step down' might put the slider in a different sub-range, so we // need to switch between the current or the previous step. prev = Number((value - step[2]).toFixed(stepDecimals)), // If the value fits the step, return the current step value. Otherwise, use the // previous step. Return null if the slider is at its minimum value. decrement = location === 0 ? null : (prev >= step[1]) ? step[2] : (step[0] || false); return [[decrement, increment]]; }); // Return values in the proper order. return inSliderOrder( retour ); } // Get the original set of options. function getOriginalOptions ( ) { return originalOptions; } // Initialize slider // Throw an error if the slider was already initialized. if ( $Target.hasClass(Classes[0]) ) { throw new Error('Slider was already initialized.'); } // Create the base element, initialise HTML and set classes. // Add handles and links. $Base = addSlider( options.dir, options.ort, $Target ); $Handles = addHandles( options.handles, options.dir, $Base ); // Set the connect classes. addConnection ( options.connect, $Target, $Handles ); // Attach user events. events( options.events ); // Methods target.vSet = valueSet; target.vGet = valueGet; target.destroy = destroyTarget; target.getCurrentStep = getCurrentStep; target.getOriginalOptions = getOriginalOptions; target.getInfo = function(){ return [ $Spectrum, options.style, options.ort ]; }; // Use the public value method to set the start values. $Target.val( options.start ); } // Run the standard initializer function initialize ( originalOptions ) { // Test the options once, not for every slider. var options = testOptions( originalOptions, this ); // Loop all items, and provide a new closed-scope environment. return this.each(function(){ closure(this, options, originalOptions); }); } // Destroy the slider, then re-enter initialization. function rebuild ( options ) { return this.each(function(){ // The rebuild flag can be used if the slider wasn't initialized yet. if ( !this.destroy ) { $(this).noUiSlider( options ); return; } // Get the current values from the slider, // including the initialization options. var values = $(this).val(), originalOptions = this.destroy(), // Extend the previous options with the newly provided ones. newOptions = $.extend( {}, originalOptions, options ); // Run the standard initializer. $(this).noUiSlider( newOptions ); // Place Link elements back. this.reappend(); // If the start option hasn't changed, // reset the previous values. if ( originalOptions.start === newOptions.start ) { $(this).val(values); } }); } // Access the internal getting and setting methods based on argument count. function value ( ) { return this[0][ !arguments.length ? 'vGet' : 'vSet' ].apply(this[0], arguments); } // Override the .val() method. Test every element. Is it a slider? Go to // the slider value handling. No? Use the standard method. // Note how $.fn.val expects 'this' to be an instance of $. For convenience, // the above 'value' function does too. $.fn.val = function ( arg ) { // this === instanceof $ function valMethod( a ){ return a.hasClass(Classes[0]) ? value : $val; } // If no value is passed, this is 'get'. if ( !arguments.length ) { var first = $(this[0]); return valMethod(first).call(first); } var isFunction = $.isFunction(arg); // Return the set so it remains chainable. Make sure not to break // jQuery's .val(function( index, value ){}) signature. return this.each(function( i ){ var val = arg, $t = $(this); if ( isFunction ) { val = arg.call(this, i, $t.val()); } valMethod($t).call($t, val); }); }; // Extend jQuery/Zepto with the noUiSlider method. $.fn.noUiSlider = function ( options, rebuildFlag ) { switch ( options ) { case 'step': return this[0].getCurrentStep(); case 'options': return this[0].getOriginalOptions(); } return ( rebuildFlag ? rebuild : initialize ).call(this, options); }; });
'use strict' module.exports.findAll = (pattern, str) => { let matches = [] let re = new RegExp(pattern) while (true) { let match = re.exec(str) if (match == null) { break } matches.push(match[1]) str = str.slice(match.index + match[0].length) } return matches }
define(['durandal/app'], function (app) { return { activate: function () { ga('send', 'pageview'); } }; });
/*jshint newcap:false*/ import Ember from "ember-metal/core"; // Ember.lookup import run from "ember-metal/run_loop"; import Namespace from "ember-runtime/system/namespace"; import EmberView from "ember-views/views/view"; import _MetamorphView from "ember-views/views/metamorph_view"; import EmberObject from "ember-runtime/system/object"; import { A } from "ember-runtime/system/native_array"; import { computed } from "ember-metal/computed"; import { observersFor } from "ember-metal/observer"; import { Registry } from "ember-runtime/system/container"; import { set } from "ember-metal/property_set"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; import { equalInnerHTML } from "htmlbars-test-helpers"; import helpers from "ember-htmlbars/helpers"; import compile from "ember-template-compiler/system/compile"; var view; var originalLookup = Ember.lookup; var TemplateTests, registry, container, lookup; /** This module specifically tests integration with Handlebars and Ember-specific Handlebars extensions. If you add additional template support to View, you should create a new file in which to test. */ QUnit.module("ember-htmlbars: {{bind-attr}}", { setup: function() { Ember.lookup = lookup = {}; lookup.TemplateTests = TemplateTests = Namespace.create(); registry = new Registry(); container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.register('view:default', _MetamorphView); registry.register('view:toplevel', EmberView.extend()); }, teardown: function() { runDestroy(container); runDestroy(view); registry = container = view = null; Ember.lookup = lookup = originalLookup; TemplateTests = null; } }); test("should be able to bind element attributes using {{bind-attr}}", function() { var template = compile('<img {{bind-attr src=view.content.url alt=view.content.title}}>'); view = EmberView.create({ template: template, content: EmberObject.create({ url: "http://www.emberjs.com/assets/images/logo.png", title: "The SproutCore Logo" }) }); runAppend(view); equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute"); equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute"); run(function() { set(view, 'content.title', "El logo de Eember"); }); equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes"); run(function() { set(view, 'content', EmberObject.create({ url: "http://www.thegooglez.com/theydonnothing", title: "I CAN HAZ SEARCH" })); }); equal(view.$('img').attr('alt'), "I CAN HAZ SEARCH", "updates alt attribute when content object changes"); run(function() { set(view, 'content', { url: "http://www.emberjs.com/assets/images/logo.png", title: "The SproutCore Logo" }); }); equal(view.$('img').attr('alt'), "The SproutCore Logo", "updates alt attribute when content object is a hash"); run(function() { set(view, 'content', EmberObject.createWithMixins({ url: "http://www.emberjs.com/assets/images/logo.png", title: computed(function() { return "Nanananana Ember!"; }) })); }); equal(view.$('img').attr('alt'), "Nanananana Ember!", "updates alt attribute when title property is computed"); }); test("should be able to bind to view attributes with {{bind-attr}}", function() { view = EmberView.create({ value: 'Test', template: compile('<img src="test.jpg" {{bind-attr alt=view.value}}>') }); runAppend(view); equal(view.$('img').attr('alt'), "Test", "renders initial value"); run(function() { view.set('value', 'Updated'); }); equal(view.$('img').attr('alt'), "Updated", "updates value"); }); test("should be able to bind to globals with {{bind-attr}} (DEPRECATED)", function() { TemplateTests.set('value', 'Test'); view = EmberView.create({ template: compile('<img src="test.jpg" {{bind-attr alt=TemplateTests.value}}>') }); expectDeprecation(function() { runAppend(view); }, /Global lookup of TemplateTests.value from a Handlebars template is deprecated/); equal(view.$('img').attr('alt'), "Test", "renders initial value"); }); test("should not allow XSS injection via {{bind-attr}}", function() { view = EmberView.create({ template: compile('<img src="test.jpg" {{bind-attr alt=view.content.value}}>'), content: { value: 'Trololol" onmouseover="alert(\'HAX!\');' } }); runAppend(view); equal(view.$('img').attr('onmouseover'), undefined); // If the whole string is here, then it means we got properly escaped equal(view.$('img').attr('alt'), 'Trololol" onmouseover="alert(\'HAX!\');'); }); test("should be able to bind use {{bind-attr}} more than once on an element", function() { var template = compile('<img {{bind-attr src=view.content.url}} {{bind-attr alt=view.content.title}}>'); view = EmberView.create({ template: template, content: EmberObject.create({ url: "http://www.emberjs.com/assets/images/logo.png", title: "The SproutCore Logo" }) }); runAppend(view); equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute"); equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute"); run(function() { set(view, 'content.title', "El logo de Eember"); }); equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes"); run(function() { set(view, 'content', EmberObject.create({ url: "http://www.thegooglez.com/theydonnothing", title: "I CAN HAZ SEARCH" })); }); equal(view.$('img').attr('alt'), "I CAN HAZ SEARCH", "updates alt attribute when content object changes"); run(function() { set(view, 'content', { url: "http://www.emberjs.com/assets/images/logo.png", title: "The SproutCore Logo" }); }); equal(view.$('img').attr('alt'), "The SproutCore Logo", "updates alt attribute when content object is a hash"); run(function() { set(view, 'content', EmberObject.createWithMixins({ url: "http://www.emberjs.com/assets/images/logo.png", title: computed(function() { return "Nanananana Ember!"; }) })); }); equal(view.$('img').attr('alt'), "Nanananana Ember!", "updates alt attribute when title property is computed"); }); test("{{bindAttr}} is aliased to {{bind-attr}}", function() { expect(4); var originalBindAttr = helpers['bind-attr']; try { if (Ember.FEATURES.isEnabled('ember-htmlbars')) { helpers['bind-attr'] = { helperFunction: function() { equal(arguments[0], 'foo', 'First arg match'); equal(arguments[1], 'bar', 'Second arg match'); return 'result'; } }; } else { helpers['bind-attr'] = function() { equal(arguments[0], 'foo', 'First arg match'); equal(arguments[1], 'bar', 'Second arg match'); return 'result'; }; } expectDeprecation(function() { var result; if (Ember.FEATURES.isEnabled('ember-htmlbars')) { result = helpers.bindAttr.helperFunction('foo', 'bar'); } else { result = helpers.bindAttr('foo', 'bar'); } equal(result, 'result', 'Result match'); }, "The 'bindAttr' view helper is deprecated in favor of 'bind-attr'"); } finally { helpers['bind-attr'] = originalBindAttr; } }); test("{{bindAttr}} can be used to bind attributes [DEPRECATED]", function() { expect(3); view = EmberView.create({ value: 'Test', template: compile('<img src="test.jpg" {{bindAttr alt=view.value}}>') }); expectDeprecation(function() { runAppend(view); }, /The 'bindAttr' view helper is deprecated in favor of 'bind-attr'/); equal(view.$('img').attr('alt'), "Test", "renders initial value"); run(function() { view.set('value', 'Updated'); }); equal(view.$('img').attr('alt'), "Updated", "updates value"); }); test("should be able to bind element attributes using {{bind-attr}} inside a block", function() { var template = compile('{{#with view.content as image}}<img {{bind-attr src=image.url alt=image.title}}>{{/with}}'); view = EmberView.create({ template: template, content: EmberObject.create({ url: "http://www.emberjs.com/assets/images/logo.png", title: "The SproutCore Logo" }) }); runAppend(view); equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute"); equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute"); run(function() { set(view, 'content.title', "El logo de Eember"); }); equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes"); }); test("should be able to bind class attribute with {{bind-attr}}", function() { var template = compile('<img {{bind-attr class="view.foo"}}>'); view = EmberView.create({ template: template, foo: 'bar' }); runAppend(view); equalInnerHTML(view.element, '<img class="bar">', 'renders class'); run(function() { set(view, 'foo', 'baz'); }); equalInnerHTML(view.element, '<img class="baz">', 'updates rendered class'); }); test("should be able to bind unquoted class attribute with {{bind-attr}}", function() { var template = compile('<img {{bind-attr class=view.foo}}>'); view = EmberView.create({ template: template, foo: 'bar' }); runAppend(view); equal(view.$('img').attr('class'), 'bar', "renders class"); run(function() { set(view, 'foo', 'baz'); }); equal(view.$('img').attr('class'), 'baz', "updates class"); }); test("should be able to bind class attribute via a truthy property with {{bind-attr}}", function() { var template = compile('<img {{bind-attr class="view.isNumber:is-truthy"}}>'); view = EmberView.create({ template: template, isNumber: 5 }); runAppend(view); equalInnerHTML(view.element, '<img class="is-truthy">', 'renders class'); run(function() { set(view, 'isNumber', 0); }); ok(view.element.firstChild.className !== 'is-truthy', 'removes class'); }); test("should be able to bind class to view attribute with {{bind-attr}}", function() { var template = compile('<img {{bind-attr class="view.foo"}}>'); view = EmberView.create({ template: template, foo: 'bar' }); runAppend(view); equal(view.$('img').attr('class'), 'bar', "renders class"); run(function() { set(view, 'foo', 'baz'); }); equal(view.$('img').attr('class'), 'baz', "updates class"); }); test("should not allow XSS injection via {{bind-attr}} with class", function() { view = EmberView.create({ template: compile('<img {{bind-attr class="view.foo"}}>'), foo: '" onmouseover="alert(\'I am in your classes hacking your app\');' }); try { runAppend(view); } catch (e) { } equal(view.$('img').attr('onmouseover'), undefined); }); test("should be able to bind class attribute using ternary operator in {{bind-attr}}", function() { var template = compile('<img {{bind-attr class="view.content.isDisabled:disabled:enabled"}} />'); var content = EmberObject.create({ isDisabled: true }); view = EmberView.create({ template: template, content: content }); runAppend(view); ok(view.$('img').hasClass('disabled'), 'disabled class is rendered'); ok(!view.$('img').hasClass('enabled'), 'enabled class is not rendered'); run(function() { set(content, 'isDisabled', false); }); ok(!view.$('img').hasClass('disabled'), 'disabled class is not rendered'); ok(view.$('img').hasClass('enabled'), 'enabled class is rendered'); }); test("should be able to add multiple classes using {{bind-attr class}}", function() { var template = compile('<div {{bind-attr class="view.content.isAwesomeSauce view.content.isAlsoCool view.content.isAmazing:amazing :is-super-duper view.content.isEnabled:enabled:disabled"}}></div>'); var content = EmberObject.create({ isAwesomeSauce: true, isAlsoCool: true, isAmazing: true, isEnabled: true }); view = EmberView.create({ template: template, content: content }); runAppend(view); ok(view.$('div').hasClass('is-awesome-sauce'), "dasherizes first property and sets classname"); ok(view.$('div').hasClass('is-also-cool'), "dasherizes second property and sets classname"); ok(view.$('div').hasClass('amazing'), "uses alias for third property and sets classname"); ok(view.$('div').hasClass('is-super-duper'), "static class is present"); ok(view.$('div').hasClass('enabled'), "truthy class in ternary classname definition is rendered"); ok(!view.$('div').hasClass('disabled'), "falsy class in ternary classname definition is not rendered"); run(function() { set(content, 'isAwesomeSauce', false); set(content, 'isAmazing', false); set(content, 'isEnabled', false); }); ok(!view.$('div').hasClass('is-awesome-sauce'), "removes dasherized class when property is set to false"); ok(!view.$('div').hasClass('amazing'), "removes aliased class when property is set to false"); ok(view.$('div').hasClass('is-super-duper'), "static class is still present"); ok(!view.$('div').hasClass('enabled'), "truthy class in ternary classname definition is not rendered"); ok(view.$('div').hasClass('disabled'), "falsy class in ternary classname definition is rendered"); }); test("should be able to bind classes to globals with {{bind-attr class}} (DEPRECATED)", function() { TemplateTests.set('isOpen', true); view = EmberView.create({ template: compile('<img src="test.jpg" {{bind-attr class="TemplateTests.isOpen"}}>') }); expectDeprecation(function() { runAppend(view); }, /Global lookup of TemplateTests.isOpen from a Handlebars template is deprecated/); ok(view.$('img').hasClass('is-open'), "sets classname to the dasherized value of the global property"); }); test("should be able to bind-attr to 'this' in an {{#each}} block [DEPRECATED]", function() { expectDeprecation('Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead.'); view = EmberView.create({ template: compile('{{#each view.images}}<img {{bind-attr src=this}}>{{/each}}'), images: A(['one.png', 'two.jpg', 'three.gif']) }); runAppend(view); var images = view.$('img'); ok(/one\.png$/.test(images[0].src)); ok(/two\.jpg$/.test(images[1].src)); ok(/three\.gif$/.test(images[2].src)); }); test("should be able to bind classes to 'this' in an {{#each}} block with {{bind-attr class}} [DEPRECATED]", function() { expectDeprecation('Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead.'); view = EmberView.create({ template: compile('{{#each view.items}}<li {{bind-attr class="this"}}>Item</li>{{/each}}'), items: A(['a', 'b', 'c']) }); runAppend(view); ok(view.$('li').eq(0).hasClass('a'), "sets classname to the value of the first item"); ok(view.$('li').eq(1).hasClass('b'), "sets classname to the value of the second item"); ok(view.$('li').eq(2).hasClass('c'), "sets classname to the value of the third item"); }); test("should be able to bind-attr to var in {{#each var in list}} block", function() { view = EmberView.create({ template: compile('{{#each image in view.images}}<img {{bind-attr src=image}}>{{/each}}'), images: A(['one.png', 'two.jpg', 'three.gif']) }); runAppend(view); var images = view.$('img'); ok(/one\.png$/.test(images[0].src)); ok(/two\.jpg$/.test(images[1].src)); ok(/three\.gif$/.test(images[2].src)); run(function() { var imagesArray = view.get('images'); imagesArray.removeAt(0); }); images = view.$('img'); ok(images.length === 2, ""); ok(/two\.jpg$/.test(images[0].src)); ok(/three\.gif$/.test(images[1].src)); }); test("should teardown observers from bind-attr on rerender", function() { view = EmberView.create({ template: compile('<span {{bind-attr class="view.foo" name=view.foo}}>wat</span>'), foo: 'bar' }); runAppend(view); equal(observersFor(view, 'foo').length, 1); run(function() { view.rerender(); }); equal(observersFor(view, 'foo').length, 1); }); test("should keep class in the order it appears in", function() { view = EmberView.create({ template: compile('<span {{bind-attr class=":foo :baz"}}></span>') }); runAppend(view); equal(view.element.firstChild.className, 'foo baz', 'classes are in expected order'); }); test('should allow either quoted or unquoted values', function() { view = EmberView.create({ value: 'Test', source: 'test.jpg', template: compile('<img {{bind-attr alt="view.value" src=view.source}}>') }); runAppend(view); equal(view.$('img').attr('alt'), "Test", "renders initial value"); equal(view.$('img').attr('src'), "test.jpg", "renders initial value"); run(function() { view.set('value', 'Updated'); view.set('source', 'test2.jpg'); }); equal(view.$('img').attr('alt'), "Updated", "updates value"); equal(view.$('img').attr('src'), "test2.jpg", "updates value"); }); test("property before didInsertElement", function() { var matchingElement; view = EmberView.create({ name: 'bob', template: compile('<div {{bind-attr alt=view.name}}></div>'), didInsertElement: function() { matchingElement = this.$('div[alt=bob]'); } }); runAppend(view); equal(matchingElement.length, 1, 'element is in the DOM when didInsertElement'); }); test("asserts for <div class='foo' {{bind-attr class='bar'}}></div>", function() { var template = compile('<div class="foo" {{bind-attr class=view.foo}}></div>'); view = EmberView.create({ template: template, foo: 'bar' }); expectAssertion(function() { runAppend(view); }, /You cannot set `class` manually and via `{{bind-attr}}` helper on the same element/); }); test("asserts for <div data-bar='foo' {{bind-attr data-bar='blah'}}></div>", function() { var template = compile('<div data-bar="foo" {{bind-attr data-bar=view.blah}}></div>'); view = EmberView.create({ template: template, blah: 'bar' }); expectAssertion(function() { runAppend(view); }, /You cannot set `data-bar` manually and via `{{bind-attr}}` helper on the same element/); });
var searchData= [ ['takedamage',['TakeDamage',['../class_engine_1_1_core_1_1_character.html#a2156c371584ca6a8d2961154f1b49c09',1,'Engine::Core::Character::TakeDamage()'],['../class_engine_1_1_game_play_1_1_enemy.html#a0eec9ea5a61636db10b5f02f9e74189a',1,'Engine::GamePlay::Enemy::TakeDamage()']]] ];
/* *RestLogger.js 利用log4js来进行日志记录 * *exports log日志记录对象,包含 trace,debug,error 等方法 */ var forkid = process.env['_num'], fs = require('fs'), inspect = require('util').inspect; if(_restConfig.isLog){ //如果开启日志 try{//如果不存在mylog文件夹则创建它 var logpath = _restConfig.baseDir+_restConfig.logPath; if(!fs.existsSync(logpath)){ fs.mkdirSync(logpath); } } catch(e){ console.log('create log folder error,please create it manual.') } var restlogname = (_restConfig.isCluster && forkid>=0) ?'restlog_'+(forkid||'main')+'.log' : 'restlog_main.log'; var log4js = require('log4js');//日志模块加载进来 log4js.configure({//log4js配置 "appenders": [ { "category": _restConfig.server, "type": "logLevelFilter", "level": _restConfig.logLevel, "appender": { "type": "file", "filename": _restConfig.baseDir+_restConfig.logPath+'/'+restlogname, "maxLogSize":_restConfig.logMaxSize, "backups":_restConfig.logFileNum, } }, ] })//日志的配置 var restlog = log4js.getLogger(_restConfig.server); module.exports = restlog; } else{ var pid = (_restConfig.isCluster && forkid>=0)?'[pid_'+(forkid||'main')+']: ':''; var output = function(msg){ if(typeof msg === "string") return console.log(pid+msg); try{ console.log(pid+msg.message+' : '+msg.stack); } catch(e){} }; var log = {} log.trace = log.debug = log.info = log.warn = log.error = log.fatal = output; module.exports = log; }
import createSvgIcon from './utils/createSvgIcon'; import { jsx as _jsx } from "react/jsx-runtime"; export default createSvgIcon( /*#__PURE__*/_jsx("path", { d: "M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h16v12zM6 10h2v2H6zm0 4h8v2H6zm10 0h2v2h-2zm-6-4h8v2h-8z" }), 'SubtitlesOutlined');
import r from 'restructure'; import Entity from '../entity'; export default Entity({ id: r.uint32le, radius: r.floatle, radiusPerLevel: r.floatle, maxRadius: r.floatle, });
/*global angular */ (function () { 'use strict'; function TemplateTestController() { var self = this; self.template = '{0} is an important number. {1} is important, too, but not as important as {0}.'; self.number1 = '39,210'; self.number2 = '78'; } angular.module('stache').controller('TemplateTestController', TemplateTestController); }());
module.exports = { siteMetadata: { title: `GatsbyJS RSS`, description: `A blog with RSS powered by GatsbyJS.`, siteUrl: `https://gatsbyjs.org` }, plugins: [ { resolve: `gatsby-source-filesystem`, options: { name: `posts`, path: `${__dirname}/posts` } }, `gatsby-transformer-remark`, { resolve: `gatsby-plugin-sitemap` } ] }
function test(elt) { var tainted = document.location.search.substring(1); WinJS.Utilities.setInnerHTMLUnsafe(elt, tainted); WinJS.Utilities.setOuterHTMLUnsafe(elt, tainted); }
sap.ui.define([ "sap/ui/core/mvc/Controller" ], function(Controller) { "use strict"; return Controller.extend("BikeRentalApp.controller.registration", { /** * Called when a controller is instantiated and its View controls (if available) are already created. * Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization. * @memberOf BikeRentalApp.view.registration */ // onInit: function() { // // }, /** * Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered * (NOT before the first rendering! onInit() is used for that one!). * @memberOf BikeRentalApp.view.registration */ // onBeforeRendering: function() { // // }, /** * Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here. * This hook is the same one that SAPUI5 controls get after being rendered. * @memberOf BikeRentalApp.view.registration */ // onAfterRendering: function() { // // }, /** * Called when the Controller is destroyed. Use this one to free resources and finalize activities. * @memberOf BikeRentalApp.view.registration */ // onExit: function() { // // } onNavBack: function(oEvent) { var oRouter = sap.ui.core.UIComponent.getRouterFor(this); oRouter.navTo("login"); }, register: function(oEvent) { var oModel = this.getView().getModel(); var fname = sap.ui.getCore().byId(this.createId("firstname_id")).getValue(); var lname = sap.ui.getCore().byId(this.createId("lastname_id")).getValue(); var username = sap.ui.getCore().byId(this.createId("username_id")).getValue(); var email = sap.ui.getCore().byId(this.createId("email_id")).getValue(); var password = sap.ui.getCore().byId(this.createId("password_id")).getValue(); var mobile = sap.ui.getCore().byId(this.createId("mobileno_id")).getValue(); var bdate = sap.ui.getCore().byId(this.createId("birthdate_id")).getValue(); var cardno = sap.ui.getCore().byId(this.createId("cardno_id")).getValue(); var pricingModel = this.getView().byId("pricingModelSelect").getSelectedItem().getKey(); password = btoa(password); bdate = bdate+"T00:00:00"; var oRegister = { "d": { "CustomerId": username, "FirstName": fname, "LastName": lname, "Bdate": bdate, "Password": password, "MobilePhoneNumber": mobile, "Email": email, "CardNo": cardno, "ModelId": pricingModel } }; oModel.create('/CustomerRegisterSet', oRegister, { success: function(oData, oResponse) { sap.m.MessageToast.show("Registered succesfully"); }, error: function(oError) { var err_response = JSON.parse(oError.responseText); var err_message = err_response.error.message.value; sap.m.MessageToast.show(err_message); } }); } }); });