<commit_before>/**
Implementation of the 'generate' verb for HackMyResume.
@module generate.js
@license MIT. See LICENSE.md for details.
*/

(function() {

  var PATH = require('path')
    , FS = require('fs')
    , MD = require('marked')
    , MKDIRP = require('mkdirp')
    , EXTEND = require('../utils/extend')
    , parsePath = require('parse-filepath')
    , _opts = require('../core/default-options')
    , FluentTheme = require('../core/fresh-theme')
    , JRSTheme = require('../core/jrs-theme')
    , ResumeFactory = require('../core/resume-factory')
    , _ = require('underscore')
    , _fmts = require('../core/default-formats')
    , extend = require('../utils/extend')
    , chalk = require('chalk')
    , pad = require('string-padding')
    , _err, _log, rez;

  /**
  Handle an exception.
  */
  function error( ex ) {
    throw ex;
  }

  /**
  Given a source resume in FRESH or JRS format, a destination resume path, and a
  theme file, generate 0..N resumes in the desired formats.
  @param src Path to the source JSON resume file: "rez/resume.json".
  @param dst An array of paths to the target resume file(s).
  @param theme Friendly name of the resume theme. Defaults to "modern".
  @param logger Optional logging override.
  */
  function build( src, dst, opts, logger, errHandler ) {

    // Housekeeping
    //_opts = extend( true, _opts, opts );
    _log = logger || console.log;
    _err = errHandler || error;
    _opts.theme = (opts.theme && opts.theme.toLowerCase().trim())|| 'modern';
    _opts.prettify = opts.prettify === true ? _opts.prettify : false;
    _opts.css = opts.css || 'embed';
    _opts.pdf = opts.pdf;
    _opts.wrap = opts.wrap || 60;
    _opts.stitles = opts.sectionTitles;

    // If two or more files are passed to the GENERATE command and the TO
    // keyword is omitted, the last file specifies the output file.
    if( src.length > 1 && ( !dst || !dst.length ) ) {
      dst.push( src.pop() );
    }

    // Load the theme...we do this first because the theme choice (FRESH or
    // JSON Resume) determines what format we'll convert the resume to.
    var tFolder = verify_theme( _opts.theme );
    var theme = load_theme( tFolder );

    // Load input resumes...
    if( !src || !src.length ) { throw { fluenterror: 3 }; }
    var sheets = ResumeFactory.load(src, {
      log: _log, format: theme.render ? 'JRS' : 'FRESH',
      objectify: true, throw: true
    }).map(function(sh){ return sh.rez; });

    // Merge input resumes...
    var msg = '';
    rez = _.reduceRight( sheets, function( a, b, idx ) {
      msg += ((idx == sheets.length - 2) ?
        chalk.cyan('Merging ') + chalk.cyan.bold(a.imp().file) : '') +
        chalk.cyan(' onto ') + chalk.cyan.bold(b.imp().file);
      return extend( true, b, a );
    });
    msg && _log(msg);

    // Output theme messages
    var numFormats = Object.keys(theme.formats).length;
    var themeName = theme.name.toUpperCase();
    _log( chalk.yellow('Applying ') + chalk.yellow.bold(themeName) +
      chalk.yellow(' theme (' + numFormats + ' format' +
        ( numFormats === 1 ? ')' : 's)') ));

    // Expand output resumes...
    var targets = expand( dst, theme );

    // Run the transformation!
    targets.forEach( function(t) {
      t.final = single( t, theme, targets );
    });

    if( theme.message ) {
      var WRAP = require('word-wrap');
      _log( WRAP( chalk.gray('The ' + themeName +
        ' theme says: "') + chalk.white(theme.message) + chalk.gray('"'),
        { width: _opts.wrap, indent: '' } ));
    }

    // Don't send the client back empty-handed
    return { sheet: rez, targets: targets, processed: targets };
  }

  /**
  Generate a single target resume such as "out/rez.html" or "out/rez.doc".
  @param targInfo Information for the target resume.
  @param theme A FRESHTheme or JRSTheme object.
  @returns
  */
  function single( targInfo, theme, finished ) {

    function MDIN(txt) { // TODO: Move this
      return MD(txt || '' ).replace(/^\s*<p>|<\/p>\s*$/gi, '');
    }

    try {
      var f = targInfo.file
        , fType = targInfo.fmt.outFormat
        , fName = PATH.basename(f, '.' + fType)
        , theFormat;

        var suffix = '';
        if( targInfo.fmt.outFormat === 'pdf' ) {
          if( _opts.pdf ) {
            if( _opts.pdf !== 'none' ) {
              suffix = chalk.green(' (with ' + _opts.pdf + ')');
            }
            else {
              _log( chalk.gray('Skipping   ') +
                chalk.white.bold(
                  pad(targInfo.fmt.outFormat.toUpperCase(),4,null,pad.RIGHT)) +
                chalk.gray(' resume') + suffix + chalk.green(': ') +
                chalk.white( PATH.relative(process.cwd(), f )) );
              return;
            }
          }
        }

        _log( chalk.green('Generating ') +
          chalk.green.bold(
            pad(targInfo.fmt.outFormat.toUpperCase(),4,null,pad.RIGHT)) +
          chalk.green(' resume') + suffix + chalk.green(': ') +
          chalk.green.bold( PATH.relative(process.cwd(), f )) );

      // If targInfo.fmt.files exists, this format is backed by a document.
      // Fluent/FRESH themes are handled here.
      if( targInfo.fmt.files && targInfo.fmt.files.length ) {
          theFormat = _fmts.filter(
            function(fmt) { return fmt.name === targInfo.fmt.outFormat; })[0];
          MKDIRP.sync( PATH.dirname( f ) ); // Ensure dest folder exists;
          _opts.targets = finished;
          return theFormat.gen.generate( rez, f, _opts );
      }

      // Otherwise this is either a) a JSON Resume theme or b) an ad-hoc format
      // (JSON, YML, or PNG) that every theme gets "for free".
      else {

        theFormat = _fmts.filter( function(fmt) {
          return fmt.name === targInfo.fmt.outFormat;
        })[0];

        var outFolder = PATH.dirname( f );
        MKDIRP.sync( outFolder ); // Ensure dest folder exists;

        // JSON Resume themes have a 'render' method that needs to be called
        if( theme.render ) {
          var COPY = require('copy');
          var globs = [ '*.css', '*.js', '*.png', '*.jpg', '*.gif', '*.bmp' ];
          COPY.sync( globs , outFolder, {
            cwd: theme.folder, nodir: true,
            ignore: ['node_modules/','node_modules/**']
            // rewrite: function(p1, p2) {
            //   return PATH.join(p2, p1);
            // }
          });

          // Prevent JSON Resume theme .js from chattering (TODO: redirect IO)
          var consoleLog = console.log;
          console.log = function() { };

          // Call the theme's render method
          var rezDupe = rez.harden();
          var rezHtml = theme.render( rezDupe );

          // Turn logging back on
          console.log = consoleLog;

          // Unharden
          rezHtml = rezHtml.replace( /@@@@~.*?~@@@@/gm, function(val){
            return MDIN( val.replace( /~@@@@/gm,'' ).replace( /@@@@~/gm,'' ) );
          });

          // Save the file
          FS.writeFileSync( f, rezHtml );

          // Return markup to the client
          return rezHtml;
        }
        else {
          return theFormat.gen.generate( rez, f, _opts );
        }
      }
    }
    catch( ex ) {
      _err( ex );
    }
  }

  /**
  Expand output files. For example, "foo.all" should be expanded to
  ["foo.html", "foo.doc", "foo.pdf", "etc"].
  @param dst An array of output files as specified by the user.
  @param theTheme A FRESHTheme or JRSTheme object.
  */
  function expand( dst, theTheme ) {

    // Add freebie formats (JSON, YAML, PNG) every theme gets...
    // Add HTML-driven PNG only if the theme has an HTML format.
    theTheme.formats.json = theTheme.formats.json || {
      freebie: true, title: 'json', outFormat: 'json', pre: 'json',
      ext: 'json', path: null, data: null
    };
    theTheme.formats.yml = theTheme.formats.yml || {
      freebie: true, title: 'yaml', outFormat: 'yml', pre: 'yml',
      ext: 'yml', path: null, data: null
    };
    if( theTheme.formats.html && !theTheme.formats.png ) {
      theTheme.formats.png = {
        freebie: true, title: 'png', outFormat: 'png',
        ext: 'yml', path: null, data: null
      };
    }

    // Set up the destination collection. It's either the array of files passed
    // by the user or 'out/resume.all' if no targets were specified.
    var destColl = (dst && dst.length && dst) ||
                   [PATH.normalize('out/resume.all')];

    // Assemble an array of expanded target files... (can't use map() here)
    var targets = [];
    destColl.forEach( function(t) {

      var to = PATH.resolve(t), pa = parsePath(to),fmat = pa.extname || '.all';

      targets.push.apply(
        targets, fmat === '.all' ?
        Object.keys( theTheme.formats ).map( function( k ) {
          var z = theTheme.formats[k];
          return { file: to.replace( /all$/g, z.outFormat ), fmt: z };
        }) :
        [{ file: to, fmt: theTheme.getFormat( fmat.slice(1) ) }]);

      // targets.push.apply(
      //   targets, fmat === '.all' ?
      //   Object.keys( explicitFormats ).map( function( k ) {
      //     var z = theTheme.formats[k];
      //     return { file: to.replace( /all$/g, z.outFormat ), fmt: z };
      //   }) :
      //   [{ file: to, fmt: theTheme.getFormat( fmat.slice(1) ) }]);

    });

    return targets;
  }

  /**
  Verify the specified theme name/path.
  */
  function verify_theme( themeNameOrPath ) {
    var tFolder = PATH.join(
      parsePath ( require.resolve('fresh-themes') ).dirname,
      themeNameOrPath
    );
    var exists = require('path-exists').sync;
    if( !exists( tFolder ) ) {
      tFolder = PATH.resolve( themeNameOrPath );
      if( !exists( tFolder ) ) {
        throw { fluenterror: 1, data: _opts.theme };
      }
    }
    return tFolder;
  }

  /**
  Load the specified theme.
  */
  function load_theme( tFolder ) {

    // Create a FRESH or JRS theme object
    var theTheme = _opts.theme.indexOf('jsonresume-theme-') > -1 ?
      new JRSTheme().open(tFolder) : new FluentTheme().open( tFolder );

    // Cache the theme object
    _opts.themeObj = theTheme;

    return theTheme;
  }

  module.exports = build;

}());
<commit_msg>Emit JSON Resume theme instructions.<commit_after>/**
Implementation of the 'generate' verb for HackMyResume.
@module generate.js
@license MIT. See LICENSE.md for details.
*/
// TODO: EventEmitter

(function() {

  var PATH = require('path')
    , FS = require('fs')
    , MD = require('marked')
    , MKDIRP = require('mkdirp')
    , EXTEND = require('../utils/extend')
    , parsePath = require('parse-filepath')
    , _opts = require('../core/default-options')
    , FluentTheme = require('../core/fresh-theme')
    , JRSTheme = require('../core/jrs-theme')
    , ResumeFactory = require('../core/resume-factory')
    , _ = require('underscore')
    , _fmts = require('../core/default-formats')
    , extend = require('../utils/extend')
    , chalk = require('chalk')
    , pad = require('string-padding')
    , _err, _log, rez;

  /**
  Handle an exception.
  */
  function error( ex ) {
    throw ex;
  }

  /**
  Given a source resume in FRESH or JRS format, a destination resume path, and a
  theme file, generate 0..N resumes in the desired formats.
  @param src Path to the source JSON resume file: "rez/resume.json".
  @param dst An array of paths to the target resume file(s).
  @param theme Friendly name of the resume theme. Defaults to "modern".
  @param logger Optional logging override.
  */
  function build( src, dst, opts, logger, errHandler ) {

    // Housekeeping
    //_opts = extend( true, _opts, opts );
    _log = logger || console.log;
    _err = errHandler || error;
    _opts.theme = (opts.theme && opts.theme.toLowerCase().trim())|| 'modern';
    _opts.prettify = opts.prettify === true ? _opts.prettify : false;
    _opts.css = opts.css || 'embed';
    _opts.pdf = opts.pdf;
    _opts.wrap = opts.wrap || 60;
    _opts.stitles = opts.sectionTitles;
    _opts.tips = opts.tips;
    //_opts.noTips = opts.noTips;

    // If two or more files are passed to the GENERATE command and the TO
    // keyword is omitted, the last file specifies the output file.
    if( src.length > 1 && ( !dst || !dst.length ) ) {
      dst.push( src.pop() );
    }

    // Load the theme...we do this first because the theme choice (FRESH or
    // JSON Resume) determines what format we'll convert the resume to.
    var tFolder = verify_theme( _opts.theme );
    var theme = load_theme( tFolder );

    // Load input resumes...
    if( !src || !src.length ) { throw { fluenterror: 3 }; }
    var sheets = ResumeFactory.load(src, {
      log: _log, format: theme.render ? 'JRS' : 'FRESH',
      objectify: true, throw: true
    }).map(function(sh){ return sh.rez; });

    // Merge input resumes...
    var msg = '';
    rez = _.reduceRight( sheets, function( a, b, idx ) {
      msg += ((idx == sheets.length - 2) ?
        chalk.cyan('Merging ') + chalk.cyan.bold(a.imp().file) : '') +
        chalk.cyan(' onto ') + chalk.cyan.bold(b.imp().file);
      return extend( true, b, a );
    });
    msg && _log(msg);

    // Output theme messages
    var numFormats = Object.keys(theme.formats).length;
    var themeName = theme.name.toUpperCase();
    _log( chalk.yellow('Applying ') + chalk.yellow.bold(themeName) +
      chalk.yellow(' theme (' + numFormats + ' format' +
        ( numFormats === 1 ? ')' : 's)') ));

    // Expand output resumes...
    var targets = expand( dst, theme );

    // Run the transformation!
    targets.forEach( function(t) {
      t.final = single( t, theme, targets );
    });

    if( _opts.tips && (theme.message || theme.render) ) {
      var WRAP = require('word-wrap');
      if( theme.message )
        _log( WRAP( chalk.gray('The ' + themeName +
          ' theme says: "') + chalk.white(theme.message) + chalk.gray('"'),
          { width: _opts.wrap, indent: '' } ));
      else
        _log( WRAP( chalk.gray('The ' + themeName +
          ' theme says: "') + chalk.white('For best results view JSON Resume ' +
          'themes over a local or remote HTTP connection. For example:'),
          { width: _opts.wrap, indent: '' }
        ));
        _log('');
        _log(
          '    npm install http-server -g\r' +
          '    http-server <resume-folder>' );
        _log('');
        _log(chalk.white('For more information, see the README."'),
          { width: _opts.wrap, indent: '' } );

    }

    // Don't send the client back empty-handed
    return { sheet: rez, targets: targets, processed: targets };
  }

  /**
  Generate a single target resume such as "out/rez.html" or "out/rez.doc".
  @param targInfo Information for the target resume.
  @param theme A FRESHTheme or JRSTheme object.
  @returns
  */
  function single( targInfo, theme, finished ) {

    function MDIN(txt) { // TODO: Move this
      return MD(txt || '' ).replace(/^\s*<p>|<\/p>\s*$/gi, '');
    }

    try {
      var f = targInfo.file
        , fType = targInfo.fmt.outFormat
        , fName = PATH.basename(f, '.' + fType)
        , theFormat;

        var suffix = '';
        if( targInfo.fmt.outFormat === 'pdf' ) {
          if( _opts.pdf ) {
            if( _opts.pdf !== 'none' ) {
              suffix = chalk.green(' (with ' + _opts.pdf + ')');
            }
            else {
              _log( chalk.gray('Skipping   ') +
                chalk.white.bold(
                  pad(targInfo.fmt.outFormat.toUpperCase(),4,null,pad.RIGHT)) +
                chalk.gray(' resume') + suffix + chalk.green(': ') +
                chalk.white( PATH.relative(process.cwd(), f )) );
              return;
            }
          }
        }

        _log( chalk.green('Generating ') +
          chalk.green.bold(
            pad(targInfo.fmt.outFormat.toUpperCase(),4,null,pad.RIGHT)) +
          chalk.green(' resume') + suffix + chalk.green(': ') +
          chalk.green.bold( PATH.relative(process.cwd(), f )) );

      // If targInfo.fmt.files exists, this format is backed by a document.
      // Fluent/FRESH themes are handled here.
      if( targInfo.fmt.files && targInfo.fmt.files.length ) {
          theFormat = _fmts.filter(
            function(fmt) { return fmt.name === targInfo.fmt.outFormat; })[0];
          MKDIRP.sync( PATH.dirname( f ) ); // Ensure dest folder exists;
          _opts.targets = finished;
          return theFormat.gen.generate( rez, f, _opts );
      }

      // Otherwise this is either a) a JSON Resume theme or b) an ad-hoc format
      // (JSON, YML, or PNG) that every theme gets "for free".
      else {

        theFormat = _fmts.filter( function(fmt) {
          return fmt.name === targInfo.fmt.outFormat;
        })[0];

        var outFolder = PATH.dirname( f );
        MKDIRP.sync( outFolder ); // Ensure dest folder exists;

        // JSON Resume themes have a 'render' method that needs to be called
        if( theme.render ) {
          var COPY = require('copy');
          var globs = [ '*.css', '*.js', '*.png', '*.jpg', '*.gif', '*.bmp' ];
          COPY.sync( globs , outFolder, {
            cwd: theme.folder, nodir: true,
            ignore: ['node_modules/','node_modules/**']
            // rewrite: function(p1, p2) {
            //   return PATH.join(p2, p1);
            // }
          });

          // Prevent JSON Resume theme .js from chattering (TODO: redirect IO)
          var consoleLog = console.log;
          console.log = function() { };

          // Call the theme's render method
          var rezDupe = rez.harden();
          var rezHtml = theme.render( rezDupe );

          // Turn logging back on
          console.log = consoleLog;

          // Unharden
          rezHtml = rezHtml.replace( /@@@@~.*?~@@@@/gm, function(val){
            return MDIN( val.replace( /~@@@@/gm,'' ).replace( /@@@@~/gm,'' ) );
          });

          // Save the file
          FS.writeFileSync( f, rezHtml );

          // Return markup to the client
          return rezHtml;
        }
        else {
          return theFormat.gen.generate( rez, f, _opts );
        }
      }
    }
    catch( ex ) {
      _err( ex );
    }
  }

  /**
  Expand output files. For example, "foo.all" should be expanded to
  ["foo.html", "foo.doc", "foo.pdf", "etc"].
  @param dst An array of output files as specified by the user.
  @param theTheme A FRESHTheme or JRSTheme object.
  */
  function expand( dst, theTheme ) {

    // Add freebie formats (JSON, YAML, PNG) every theme gets...
    // Add HTML-driven PNG only if the theme has an HTML format.
    theTheme.formats.json = theTheme.formats.json || {
      freebie: true, title: 'json', outFormat: 'json', pre: 'json',
      ext: 'json', path: null, data: null
    };
    theTheme.formats.yml = theTheme.formats.yml || {
      freebie: true, title: 'yaml', outFormat: 'yml', pre: 'yml',
      ext: 'yml', path: null, data: null
    };
    if( theTheme.formats.html && !theTheme.formats.png ) {
      theTheme.formats.png = {
        freebie: true, title: 'png', outFormat: 'png',
        ext: 'yml', path: null, data: null
      };
    }

    // Set up the destination collection. It's either the array of files passed
    // by the user or 'out/resume.all' if no targets were specified.
    var destColl = (dst && dst.length && dst) ||
                   [PATH.normalize('out/resume.all')];

    // Assemble an array of expanded target files... (can't use map() here)
    var targets = [];
    destColl.forEach( function(t) {

      var to = PATH.resolve(t), pa = parsePath(to),fmat = pa.extname || '.all';

      targets.push.apply(
        targets, fmat === '.all' ?
        Object.keys( theTheme.formats ).map( function( k ) {
          var z = theTheme.formats[k];
          return { file: to.replace( /all$/g, z.outFormat ), fmt: z };
        }) :
        [{ file: to, fmt: theTheme.getFormat( fmat.slice(1) ) }]);

      // targets.push.apply(
      //   targets, fmat === '.all' ?
      //   Object.keys( explicitFormats ).map( function( k ) {
      //     var z = theTheme.formats[k];
      //     return { file: to.replace( /all$/g, z.outFormat ), fmt: z };
      //   }) :
      //   [{ file: to, fmt: theTheme.getFormat( fmat.slice(1) ) }]);

    });

    return targets;
  }

  /**
  Verify the specified theme name/path.
  */
  function verify_theme( themeNameOrPath ) {
    var tFolder = PATH.join(
      parsePath ( require.resolve('fresh-themes') ).dirname,
      themeNameOrPath
    );
    var exists = require('path-exists').sync;
    if( !exists( tFolder ) ) {
      tFolder = PATH.resolve( themeNameOrPath );
      if( !exists( tFolder ) ) {
        throw { fluenterror: 1, data: _opts.theme };
      }
    }
    return tFolder;
  }

  /**
  Load the specified theme.
  */
  function load_theme( tFolder ) {

    // Create a FRESH or JRS theme object
    var theTheme = _opts.theme.indexOf('jsonresume-theme-') > -1 ?
      new JRSTheme().open(tFolder) : new FluentTheme().open( tFolder );

    // Cache the theme object
    _opts.themeObj = theTheme;

    return theTheme;
  }

  module.exports = build;

}());
<|endoftext|>


<commit_before>(function($) { $(document).ready(function() {

var ratio = Math.sqrt(2);
var vw = window.innerWidth && document.documentElement.clientWidth ? Math.min(window.innerWidth, document.documentElement.clientWidth) : window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
var pxWidth = 595;
var width = vw-20;
var edge = (18*width)/pxWidth;

$(".container").css({
    "width": width,
    "height": (width*ratio),
    "padding": edge,
});
$(".page").css({
    "width": (width-(edge*2)),
    "height": ((width*ratio)-(edge*2)),
});

$(".attrBlock").css({
    "width": ((54*width)/pxWidth),
    "height": ((64*width)/pxWidth),
    "left": ((22*width)/pxWidth),
});
$(".attrBg").css({
    "width": $(".attrBlock").width(),
    "height": $(".attrBlock").height(),
});
$(".attrTxt").css({
    "width": $(".attrBlock").width(),
});

$(".attrBlock.cha").css({
    "top": ((484*width)/pxWidth),
});
$(".attrTxt").css({
    "top": ((6*width)/pxWidth),
    "font-size": ((10*width)/pxWidth),
});
$(".attrTxt").text(vw);

interact('.draggable').draggable();

});
})(jQuery);
<commit_msg>Update functions.js<commit_after>(function($) { $(document).ready(function() {

var ratio = Math.sqrt(2);
var vw = window.innerWidth && document.documentElement.clientWidth ? Math.min(window.innerWidth, document.documentElement.clientWidth) : window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
var pxWidth = 595;
var width = vw-20;
var edge = (18*width)/pxWidth;

$(".container").css({
    "width": width,
    "height": (width*ratio),
    "padding": edge,
});
$(".page").css({
    "width": (width-(edge*2)),
    "height": ((width*ratio)-(edge*2)),
});

$(".attrBlock").css({
    "width": ((54*width)/pxWidth),
    "height": ((64*width)/pxWidth),
    "left": ((22*width)/pxWidth)-edge,
});
$(".attrBg").css({
    "width": $(".attrBlock").width(),
    "height": $(".attrBlock").height(),
});
$(".attrTxt").css({
    "width": $(".attrBlock").width(),
});

$(".attrBlock.cha").css({
    "top": ((484*width)/pxWidth)-edge,
});
$(".attrTxt").css({
    "top": ((6*width)/pxWidth),
    "font-size": ((10*width)/pxWidth),
});
$(".attrTxt").text(vw);

interact('.draggable').draggable();

});
})(jQuery);
<|endoftext|>


<commit_before>describe('Unauthenticated CMS access', function () {
    it('should visit the login page and check the version', function () {

        cy.visit('/login').then(() => {

            cy.url().should('include', '/login');

            cy.contains('Version 4.');
        });
    });

    it('should redirect to login when an authenticated page is requested', function() {
        cy.visit('/logout').then(() => {
            cy.visit('/layout/view').then(() => {
                cy.url().should('include', '/login');
            });
        });
    });
});<commit_msg>Fix cypress version check.<commit_after>describe('Unauthenticated CMS access', function () {
    it('should visit the login page and check the version', function () {

        cy.visit('/login').then(() => {

            cy.url().should('include', '/login');

            cy.contains('Version 3.');
        });
    });

    it('should redirect to login when an authenticated page is requested', function() {
        cy.visit('/logout').then(() => {
            cy.visit('/layout/view').then(() => {
                cy.url().should('include', '/login');
            });
        });
    });
});
<|endoftext|>


<commit_before>import Color from "./../math/color.js";
import Matrix3d from "./../math/matrix3.js";
import video from "./video.js";
import event from "./../system/event.js";
import device from "./../system/device.js";
import { setPrefixed } from "./../utils/agent.js";
import { Texture } from "./texture.js";
import Rect from "./../shapes/rectangle.js";
import Ellipse from "./../shapes/ellipse.js";
import Polygon from "./../shapes/poly.js";
import Line from "./../shapes/line.js";
import Bounds from "./../physics/bounds.js";

/**
 * @classdesc
 * a base renderer object
 * @class Renderer
 * @memberOf me
 * @constructor
 * @param {Object} options The renderer parameters
 * @param {Number} options.width The width of the canvas without scaling
 * @param {Number} options.height The height of the canvas without scaling
 * @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
 * @param {Boolean} [options.doubleBuffering=false] Whether to enable double buffering
 * @param {Boolean} [options.antiAlias=false] Whether to enable anti-aliasing, use false (default) for a pixelated effect.
 * @param {Boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
 * @param {Boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
 * @param {Boolean} [options.blendMode="normal"] the default blend mode to use ("normal", "multiply")
 * @param {Boolean} [options.subPixel=false] Whether to enable subpixel rendering (performance hit when enabled)
 * @param {Boolean} [options.verbose=false] Enable the verbose mode that provides additional details as to what the renderer is doing
 * @param {Number} [options.zoomX=width] The actual width of the canvas with scaling applied
 * @param {Number} [options.zoomY=height] The actual height of the canvas with scaling applied
 */
class Renderer {

    constructor(options) {
        /**
         * The given constructor options
         * @public
         * @name settings
         * @memberOf me.Renderer#
         * @enum {Object}
         */
        this.settings = options;

        /**
         * true if the current rendering context is valid
         * @name isContextValid
         * @memberOf me.Renderer
         * @default true
         * type {Boolean}
         */
        this.isContextValid = true;

        /**
         * @ignore
         */
        this.currentScissor = new Int32Array([ 0, 0, this.settings.width, this.settings.height ]);

        /**
         * @ignore
         */
        this.currentBlendMode = "normal";

        // create the main screen canvas
        if (device.ejecta === true) {
            // a main canvas is already automatically created by Ejecta
            this.canvas = document.getElementById("canvas");
        } else if (typeof window.canvas !== "undefined") {
            // a global canvas is available, e.g. webapp adapter for wechat
            this.canvas = window.canvas;
        } else if (typeof this.settings.canvas !== "undefined") {
            this.canvas = this.settings.canvas;
        } else {
            this.canvas = video.createCanvas(this.settings.zoomX, this.settings.zoomY);
        }

        // canvas object and context
        this.backBufferCanvas = this.canvas;
        this.context = null;

        // global color
        this.currentColor = new Color(0, 0, 0, 1.0);

        // global tint color
        this.currentTint = new Color(255, 255, 255, 1.0);

        // the projectionMatrix (set through setProjection)
        this.projectionMatrix = new Matrix3d();

        // default uvOffset
        this.uvOffset = 0;

        // the parent container bouds
        this.parentBounds = new Rect(0, 0, 0, 0);

        this.Texture = Texture;

        // reset the instantiated renderer on game reset
        event.subscribe(event.GAME_RESET, function () {
            video.renderer.reset();
        });

        return this;
    }

    /**
     * prepare the framebuffer for drawing a new frame
     * @name clear
     * @memberOf me.Renderer.prototype
     * @function
     */
    clear() {}

    /**
     * Reset context state
     * @name reset
     * @memberOf me.Renderer.prototype
     * @function
     */
    reset() {
        this.resetTransform();
        this.setBlendMode(this.settings.blendMode);
        this.setColor("#000000");
        this.clearTint();
        this.cache.clear();
        this.currentScissor[0] = 0;
        this.currentScissor[1] = 0;
        this.currentScissor[2] = this.backBufferCanvas.width;
        this.currentScissor[3] = this.backBufferCanvas.height;
    }

    /**
     * return a reference to the system canvas
     * @name getCanvas
     * @memberOf me.Renderer.prototype
     * @function
     * @return {HTMLCanvasElement}
     */
    getCanvas() {
        return this.backBufferCanvas;
    }

    /**
     * return a reference to the screen canvas
     * @name getScreenCanvas
     * @memberOf me.Renderer.prototype
     * @function
     * @return {HTMLCanvasElement}
     */
    getScreenCanvas() {
        return this.canvas;
    }

    /**
     * return a reference to the screen canvas corresponding 2d Context

     * (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
     * @name getScreenContext
     * @memberOf me.Renderer.prototype
     * @function
     * @return {Context2d}
     */
    getScreenContext() {
        return this.context;
    }

    /**
     * returns the current blend mode for this renderer
     * @name getBlendMode
     * @memberOf me.Renderer.prototype
     * @function
     * @return {String} blend mode
     */
    getBlendMode() {
        return this.currentBlendMode;
    }

    /**
     * Returns the 2D Context object of the given Canvas

     * Also configures anti-aliasing and blend modes based on constructor options.
     * @name getContext2d
     * @memberOf me.Renderer.prototype
     * @function
     * @param {HTMLCanvasElement} canvas
     * @param {Boolean} [transparent=true] use false to disable transparency
     * @return {Context2d}
     */
    getContext2d(c, transparent) {
        if (typeof c === "undefined" || c === null) {
            throw new Error(
                "You must pass a canvas element in order to create " +
                "a 2d context"
            );
        }

        if (typeof c.getContext === "undefined") {
            throw new Error(
                "Your browser does not support HTML5 canvas."
            );
        }

        if (typeof transparent !== "boolean") {
            transparent = true;
        }

        var _context = c.getContext("2d", {
                "alpha" : transparent
        });

        if (!_context.canvas) {
            _context.canvas = c;
        }
        this.setAntiAlias(_context, this.settings.antiAlias);
        return _context;
    }

    /**
     * return the width of the system Canvas
     * @name getWidth
     * @memberOf me.Renderer.prototype
     * @function
     * @return {Number}
     */
    getWidth() {
        return this.backBufferCanvas.width;
    }

    /**
     * return the height of the system Canvas
     * @name getHeight
     * @memberOf me.Renderer.prototype
     * @function
     * @return {Number}
     */
    getHeight() {
        return this.backBufferCanvas.height;
    }

    /**
     * get the current fill & stroke style color.
     * @name getColor
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Color} current global color
     */
    getColor() {
        return this.currentColor;
    }

    /**
     * return the current global alpha
     * @name globalAlpha
     * @memberOf me.Renderer.prototype
     * @function
     * @return {Number}
     */
    globalAlpha() {
        return this.currentColor.glArray[3];
    }

    /**
     * check if the given bounds overlaps with the renderer screen coordinates
     * @name overlaps
     * @memberOf me.Renderer.prototype
     * @function
     * @param  {me.Rect\me.Bounds} bounds
     * @return {boolean} true if overlaps
     */
    overlaps(bounds) {
        return (
            bounds.left <= this.getWidth() && bounds.right >= 0 &&
            bounds.top <= this.getHeight() && bounds.bottom >= 0
        );
    }

    /**
     * resizes the system canvas
     * @name resize
     * @memberOf me.Renderer.prototype
     * @function
     * @param {Number} width new width of the canvas
     * @param {Number} height new height of the canvas
     */
    resize(width, height) {
        if (width !== this.backBufferCanvas.width || height !== this.backBufferCanvas.height) {
            this.canvas.width = this.backBufferCanvas.width = width;
            this.canvas.height = this.backBufferCanvas.height = height;
            this.currentScissor[0] = 0;
            this.currentScissor[1] = 0;
            this.currentScissor[2] = width;
            this.currentScissor[3] = height;
            // publish the corresponding event
            event.publish(event.CANVAS_ONRESIZE, [ width, height ]);
        }
    }

    /**
     * enable/disable image smoothing (scaling interpolation) for the given context
     * @name setAntiAlias
     * @memberOf me.Renderer.prototype
     * @function
     * @param {Context2d} context
     * @param {Boolean} [enable=false]
     */
    setAntiAlias(context, enable) {
        var canvas = context.canvas;

        // enable/disable antialis on the given Context2d object
        setPrefixed("imageSmoothingEnabled", enable === true, context);

        // set antialias CSS property on the main canvas
        if (enable !== true) {
            // https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering
            canvas.style["image-rendering"] = "optimizeSpeed"; // legal fallback
            canvas.style["image-rendering"] = "-moz-crisp-edges"; // Firefox
            canvas.style["image-rendering"] = "-o-crisp-edges"; // Opera
            canvas.style["image-rendering"] = "-webkit-optimize-contrast"; // Safari
            canvas.style["image-rendering"] = "optimize-contrast"; // CSS 3
            canvas.style["image-rendering"] = "crisp-edges"; // CSS 4
            canvas.style["image-rendering"] = "pixelated"; // CSS 4
            canvas.style.msInterpolationMode = "nearest-neighbor"; // IE8+
        } else {
            canvas.style["image-rendering"] = "auto";
        }
    }

    /**
     * set/change the current projection matrix (WebGL only)
     * @name setProjection
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Matrix3d} matrix
     */
    setProjection(matrix) {
        this.projectionMatrix.copy(matrix);
    }

    /**
     * stroke the given shape
     * @name stroke
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Rect|me.Polygon|me.Line|me.Ellipse} shape a shape object to stroke
     */
    stroke(shape, fill) {
        if (shape instanceof Rect || shape instanceof Bounds) {
            this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill);
        } else if (shape instanceof Line || shape instanceof Polygon) {
            this.strokePolygon(shape, fill);
        } else if (shape instanceof Ellipse) {
            this.strokeEllipse(
                shape.pos.x,
                shape.pos.y,
                shape.radiusV.x,
                shape.radiusV.y,
                fill
            );
        }
    }

    /**
     * tint the given image or canvas using the given color
     * @name tint
     * @memberOf me.Renderer.prototype
     * @function
     * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} image the source image to be tinted
     * @param {me.Color|String} color the color that will be used to tint the image
     * @param {String} [mode="multiply"] the composition mode used to tint the image
     * @return {HTMLCanvasElement|OffscreenCanvas} a new canvas element representing the tinted image
     */
    tint(src, color, mode) {
        var canvas = video.createCanvas(src.width, src.height, true);
        var context = this.getContext2d(canvas);

        context.save();

        context.fillStyle = color instanceof Color ? color.toRGB() : color;
        context.fillRect(0, 0, src.width, src.height);

        context.globalCompositeOperation = mode || "multiply";
        context.drawImage(src, 0, 0);
        context.globalCompositeOperation = "destination-atop";
        context.drawImage(src, 0, 0);

        context.restore();

        return canvas;
    }

    /**
     * fill the given shape
     * @name fill
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Rect|me.Polygon|me.Line|me.Ellipse} shape a shape object to fill
     */
    fill(shape) {
        this.stroke(shape, true);
    }

    /**
     * A mask limits rendering elements to the shape and position of the given mask object.
     * So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
     * Mask are not preserved through renderer context save and restore.
     * @name setMask
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Rect|me.Polygon|me.Line|me.Ellipse} [mask] the shape defining the mask to be applied
     */
    setMask(mask) {}

    /**
     * disable (remove) the rendering mask set through setMask.
     * @name clearMask
     * @see me.Renderer#setMask
     * @memberOf me.Renderer.prototype
     * @function
     */
    clearMask() {}

    /**
     * set a coloring tint for sprite based renderables
     * @name setTint
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Color} [tint] the tint color
     */
    setTint(tint) {
        // global tint color
        this.currentTint.copy(tint);
    }

    /**
     * clear the rendering tint set through setTint.
     * @name clearTint
     * @see me.Renderer#setTint
     * @memberOf me.Renderer.prototype
     * @function
     */
    clearTint() {
        // reset to default
        this.currentTint.setColor(255, 255, 255, 1.0);
    }

    /**
     * @ignore
     */
    drawFont(/*bounds*/) {}

};

export default Renderer;
<commit_msg>documentation fix<commit_after>import Color from "./../math/color.js";
import Matrix3d from "./../math/matrix3.js";
import video from "./video.js";
import event from "./../system/event.js";
import device from "./../system/device.js";
import { setPrefixed } from "./../utils/agent.js";
import { Texture } from "./texture.js";
import Rect from "./../shapes/rectangle.js";
import Ellipse from "./../shapes/ellipse.js";
import Polygon from "./../shapes/poly.js";
import Line from "./../shapes/line.js";
import Bounds from "./../physics/bounds.js";

/**
 * @classdesc
 * a base renderer object
 * @class Renderer
 * @memberOf me
 * @constructor
 * @param {Object} options The renderer parameters
 * @param {Number} options.width The width of the canvas without scaling
 * @param {Number} options.height The height of the canvas without scaling
 * @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
 * @param {Boolean} [options.doubleBuffering=false] Whether to enable double buffering
 * @param {Boolean} [options.antiAlias=false] Whether to enable anti-aliasing, use false (default) for a pixelated effect.
 * @param {Boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
 * @param {Boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
 * @param {Boolean} [options.blendMode="normal"] the default blend mode to use ("normal", "multiply")
 * @param {Boolean} [options.subPixel=false] Whether to enable subpixel rendering (performance hit when enabled)
 * @param {Boolean} [options.verbose=false] Enable the verbose mode that provides additional details as to what the renderer is doing
 * @param {Number} [options.zoomX=width] The actual width of the canvas with scaling applied
 * @param {Number} [options.zoomY=height] The actual height of the canvas with scaling applied
 */
class Renderer {

    constructor(options) {
        /**
         * The given constructor options
         * @public
         * @name settings
         * @memberOf me.Renderer#
         * @enum {Object}
         */
        this.settings = options;

        /**
         * true if the current rendering context is valid
         * @name isContextValid
         * @memberOf me.Renderer
         * @default true
         * type {Boolean}
         */
        this.isContextValid = true;

        /**
         * @ignore
         */
        this.currentScissor = new Int32Array([ 0, 0, this.settings.width, this.settings.height ]);

        /**
         * @ignore
         */
        this.currentBlendMode = "normal";

        // create the main screen canvas
        if (device.ejecta === true) {
            // a main canvas is already automatically created by Ejecta
            this.canvas = document.getElementById("canvas");
        } else if (typeof window.canvas !== "undefined") {
            // a global canvas is available, e.g. webapp adapter for wechat
            this.canvas = window.canvas;
        } else if (typeof this.settings.canvas !== "undefined") {
            this.canvas = this.settings.canvas;
        } else {
            this.canvas = video.createCanvas(this.settings.zoomX, this.settings.zoomY);
        }

        // canvas object and context
        this.backBufferCanvas = this.canvas;
        this.context = null;

        // global color
        this.currentColor = new Color(0, 0, 0, 1.0);

        // global tint color
        this.currentTint = new Color(255, 255, 255, 1.0);

        // the projectionMatrix (set through setProjection)
        this.projectionMatrix = new Matrix3d();

        // default uvOffset
        this.uvOffset = 0;

        // the parent container bouds
        this.parentBounds = new Rect(0, 0, 0, 0);

        this.Texture = Texture;

        // reset the instantiated renderer on game reset
        event.subscribe(event.GAME_RESET, function () {
            video.renderer.reset();
        });

        return this;
    }

    /**
     * prepare the framebuffer for drawing a new frame
     * @name clear
     * @memberOf me.Renderer.prototype
     * @function
     */
    clear() {}

    /**
     * Reset context state
     * @name reset
     * @memberOf me.Renderer.prototype
     * @function
     */
    reset() {
        this.resetTransform();
        this.setBlendMode(this.settings.blendMode);
        this.setColor("#000000");
        this.clearTint();
        this.cache.clear();
        this.currentScissor[0] = 0;
        this.currentScissor[1] = 0;
        this.currentScissor[2] = this.backBufferCanvas.width;
        this.currentScissor[3] = this.backBufferCanvas.height;
    }

    /**
     * return a reference to the system canvas
     * @name getCanvas
     * @memberOf me.Renderer.prototype
     * @function
     * @return {HTMLCanvasElement}
     */
    getCanvas() {
        return this.backBufferCanvas;
    }

    /**
     * return a reference to the screen canvas
     * @name getScreenCanvas
     * @memberOf me.Renderer.prototype
     * @function
     * @return {HTMLCanvasElement}
     */
    getScreenCanvas() {
        return this.canvas;
    }

    /**
     * return a reference to the screen canvas corresponding 2d Context

     * (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
     * @name getScreenContext
     * @memberOf me.Renderer.prototype
     * @function
     * @return {Context2d}
     */
    getScreenContext() {
        return this.context;
    }

    /**
     * returns the current blend mode for this renderer
     * @name getBlendMode
     * @memberOf me.Renderer.prototype
     * @function
     * @return {String} blend mode
     */
    getBlendMode() {
        return this.currentBlendMode;
    }

    /**
     * Returns the 2D Context object of the given Canvas

     * Also configures anti-aliasing and blend modes based on constructor options.
     * @name getContext2d
     * @memberOf me.Renderer.prototype
     * @function
     * @param {HTMLCanvasElement} canvas
     * @param {Boolean} [transparent=true] use false to disable transparency
     * @return {Context2d}
     */
    getContext2d(c, transparent) {
        if (typeof c === "undefined" || c === null) {
            throw new Error(
                "You must pass a canvas element in order to create " +
                "a 2d context"
            );
        }

        if (typeof c.getContext === "undefined") {
            throw new Error(
                "Your browser does not support HTML5 canvas."
            );
        }

        if (typeof transparent !== "boolean") {
            transparent = true;
        }

        var _context = c.getContext("2d", {
                "alpha" : transparent
        });

        if (!_context.canvas) {
            _context.canvas = c;
        }
        this.setAntiAlias(_context, this.settings.antiAlias);
        return _context;
    }

    /**
     * return the width of the system Canvas
     * @name getWidth
     * @memberOf me.Renderer.prototype
     * @function
     * @return {Number}
     */
    getWidth() {
        return this.backBufferCanvas.width;
    }

    /**
     * return the height of the system Canvas
     * @name getHeight
     * @memberOf me.Renderer.prototype
     * @function
     * @return {Number}
     */
    getHeight() {
        return this.backBufferCanvas.height;
    }

    /**
     * get the current fill & stroke style color.
     * @name getColor
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Color} current global color
     */
    getColor() {
        return this.currentColor;
    }

    /**
     * return the current global alpha
     * @name globalAlpha
     * @memberOf me.Renderer.prototype
     * @function
     * @return {Number}
     */
    globalAlpha() {
        return this.currentColor.glArray[3];
    }

    /**
     * check if the given rect or bounds overlaps with the renderer screen coordinates
     * @name overlaps
     * @memberOf me.Renderer.prototype
     * @function
     * @param  {me.Rect|me.Bounds} bounds
     * @return {boolean} true if overlaps
     */
    overlaps(bounds) {
        return (
            bounds.left <= this.getWidth() && bounds.right >= 0 &&
            bounds.top <= this.getHeight() && bounds.bottom >= 0
        );
    }

    /**
     * resizes the system canvas
     * @name resize
     * @memberOf me.Renderer.prototype
     * @function
     * @param {Number} width new width of the canvas
     * @param {Number} height new height of the canvas
     */
    resize(width, height) {
        if (width !== this.backBufferCanvas.width || height !== this.backBufferCanvas.height) {
            this.canvas.width = this.backBufferCanvas.width = width;
            this.canvas.height = this.backBufferCanvas.height = height;
            this.currentScissor[0] = 0;
            this.currentScissor[1] = 0;
            this.currentScissor[2] = width;
            this.currentScissor[3] = height;
            // publish the corresponding event
            event.publish(event.CANVAS_ONRESIZE, [ width, height ]);
        }
    }

    /**
     * enable/disable image smoothing (scaling interpolation) for the given context
     * @name setAntiAlias
     * @memberOf me.Renderer.prototype
     * @function
     * @param {Context2d} context
     * @param {Boolean} [enable=false]
     */
    setAntiAlias(context, enable) {
        var canvas = context.canvas;

        // enable/disable antialis on the given Context2d object
        setPrefixed("imageSmoothingEnabled", enable === true, context);

        // set antialias CSS property on the main canvas
        if (enable !== true) {
            // https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering
            canvas.style["image-rendering"] = "optimizeSpeed"; // legal fallback
            canvas.style["image-rendering"] = "-moz-crisp-edges"; // Firefox
            canvas.style["image-rendering"] = "-o-crisp-edges"; // Opera
            canvas.style["image-rendering"] = "-webkit-optimize-contrast"; // Safari
            canvas.style["image-rendering"] = "optimize-contrast"; // CSS 3
            canvas.style["image-rendering"] = "crisp-edges"; // CSS 4
            canvas.style["image-rendering"] = "pixelated"; // CSS 4
            canvas.style.msInterpolationMode = "nearest-neighbor"; // IE8+
        } else {
            canvas.style["image-rendering"] = "auto";
        }
    }

    /**
     * set/change the current projection matrix (WebGL only)
     * @name setProjection
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Matrix3d} matrix
     */
    setProjection(matrix) {
        this.projectionMatrix.copy(matrix);
    }

    /**
     * stroke the given shape
     * @name stroke
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Rect|me.Polygon|me.Line|me.Ellipse} shape a shape object to stroke
     */
    stroke(shape, fill) {
        if (shape instanceof Rect || shape instanceof Bounds) {
            this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill);
        } else if (shape instanceof Line || shape instanceof Polygon) {
            this.strokePolygon(shape, fill);
        } else if (shape instanceof Ellipse) {
            this.strokeEllipse(
                shape.pos.x,
                shape.pos.y,
                shape.radiusV.x,
                shape.radiusV.y,
                fill
            );
        }
    }

    /**
     * tint the given image or canvas using the given color
     * @name tint
     * @memberOf me.Renderer.prototype
     * @function
     * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} image the source image to be tinted
     * @param {me.Color|String} color the color that will be used to tint the image
     * @param {String} [mode="multiply"] the composition mode used to tint the image
     * @return {HTMLCanvasElement|OffscreenCanvas} a new canvas element representing the tinted image
     */
    tint(src, color, mode) {
        var canvas = video.createCanvas(src.width, src.height, true);
        var context = this.getContext2d(canvas);

        context.save();

        context.fillStyle = color instanceof Color ? color.toRGB() : color;
        context.fillRect(0, 0, src.width, src.height);

        context.globalCompositeOperation = mode || "multiply";
        context.drawImage(src, 0, 0);
        context.globalCompositeOperation = "destination-atop";
        context.drawImage(src, 0, 0);

        context.restore();

        return canvas;
    }

    /**
     * fill the given shape
     * @name fill
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Rect|me.Polygon|me.Line|me.Ellipse} shape a shape object to fill
     */
    fill(shape) {
        this.stroke(shape, true);
    }

    /**
     * A mask limits rendering elements to the shape and position of the given mask object.
     * So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
     * Mask are not preserved through renderer context save and restore.
     * @name setMask
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Rect|me.Polygon|me.Line|me.Ellipse} [mask] the shape defining the mask to be applied
     */
    setMask(mask) {}

    /**
     * disable (remove) the rendering mask set through setMask.
     * @name clearMask
     * @see me.Renderer#setMask
     * @memberOf me.Renderer.prototype
     * @function
     */
    clearMask() {}

    /**
     * set a coloring tint for sprite based renderables
     * @name setTint
     * @memberOf me.Renderer.prototype
     * @function
     * @param {me.Color} [tint] the tint color
     */
    setTint(tint) {
        // global tint color
        this.currentTint.copy(tint);
    }

    /**
     * clear the rendering tint set through setTint.
     * @name clearTint
     * @see me.Renderer#setTint
     * @memberOf me.Renderer.prototype
     * @function
     */
    clearTint() {
        // reset to default
        this.currentTint.setColor(255, 255, 255, 1.0);
    }

    /**
     * @ignore
     */
    drawFont(/*bounds*/) {}

};

export default Renderer;
<|endoftext|>


<commit_before>(function($) { $(document).ready(function() {

var ratio = Math.sqrt(2);
var vw = document.documentElement.clientWidth;
var pxWidth = 595;
var width = /*pxWidth*/ vw-20;

$("#page").css({
    width: width,
    height: width*ratio,
});

$(".attrBlock").css({
    width: (54*width)/pxWidth,
    height: (64*width)/pxWidth,
    left: (22*width)/pxWidth,
});
$(".attrBg").css({
    width: $(".attrBlock").width(),
    height: $(".attrBlock").height(),
});
$(".attrTxt").css({
    width: $(".attrBlock").width(),
});

$(".attrBlock.cha").css({
    top: (484*width)/pxWidth,
});
$(".attrTxt").css({
    top: (6*width)/pxWidth,
    fontSize: (10*width)/pxWidth,
});

interact('.draggable').draggable({
    restrict: {
        restriction: "#page",
    }
});

});
})(jQuery);
<commit_msg>Update functions.js<commit_after>(function($) { $(document).ready(function() {

var ratio = Math.sqrt(2);
var vw = document.documentElement.clientWidth;
var pxWidth = 595;
var width = /*pxWidth*/ vw-20;

$("#page").css({
    width: width,
    height: width*ratio,
});

$(".attrBlock").css({
    width: (54*width)/pxWidth,
    height: (64*width)/pxWidth,
    left: (22*width)/pxWidth,
});
$(".attrBg").css({
    width: $(".attrBlock").width(),
    height: $(".attrBlock").height(),
});
$(".attrTxt").css({
    width: $(".attrBlock").width(),
});

$(".attrBlock.cha").css({
    top: (484*width)/pxWidth,
});
$(".attrTxt").css({
    top: (6*width)/pxWidth,
    fontSize: (10*width)/pxWidth,
});

interact('.draggable').draggable();

});
})(jQuery);
<|endoftext|>


<commit_before>function (x) :: (U(int, bool) -> bool) {
  //the typed scheme paper example
  return (isInt(x) ? (x<<3)==8 : !x);
} :: (U(int, bool) -> bool);

//make sure we can filter out not only equal types:
function (x) :: (U(int, bool) -> bool) {
  return (typeof x == "number" ? (x<<3)==8 : !x);
} :: (U(int, bool) -> bool);

function (x) :: (U(int, bool, string) -> bool) {
  return (isInt(x) ? (x<<3)==8 : !x);
} @@ fails;

function (x) :: U(string, bool) -> string { return x; } @@ fails;
function (x) :: U(string, bool) -> string {
  if (true) return x;
  return "h";
} @@ fails;

function (x) :: (U(string, bool) -> string) {
  if (typeof x == "string") {
    //TODO: change return stmt checking so that occurrence typing has an effect
    //on it! (i.e. move it into typeCheckStmts)
    return x;
  }
  return "was not a string";
} :: (U(string, bool) -> string);

function (x) :: (U(int, bool) -> bool) {
  if (typeof x == "boolean") {
    if (x) { return false; }
  }
  return true;
} :: (U(int, bool) -> bool);

//!= instead of ==:
function (x) :: (U(int, bool) -> bool) {
  if (typeof x == "boolean") {
    if (x) { return false; }
  }
  return true;
} :: (U(int, bool) -> bool);

function (x) :: (U(int, bool) -> bool) {
  if (typeof x != "boolean") {
    var f :: int = 0;
    f = x >> 3;
    return true;
  }
  else
  {
    if (x) { return false; }
  }
  return true;
} :: (U(int, bool) -> bool);
function (x) :: (U(int, bool) -> bool) {
  if (typeof x != "boolean") {
    var f :: int = 0;
    f = x >> 3;
    return true;
  }
  else
  {
    if (x) { return false; }
    var b :: 'false = false; //'
    b = x; //x should be false here
    return true;
  }
} :: (U(int, bool) -> bool);

function (x) :: (U(int, bool) -> bool) {
  if ((typeof x) != "boolean") {
    var f :: int = 0;
    f = x >> 3;
    return true;
  }
  if (x) { return false; }
  return true;
} :: (U(int, bool) -> bool);
function (x) :: (U(int, bool) -> bool) {
  if (!((typeof x) == "boolean")) {
    var f :: int = 0;
    f = x >> 3;
    return true;
  }
  if (x) { return false; }
  return true;
} :: (U(int, bool) -> bool);

//x shouldn't turn into "false" just because of occurrence typing:
function (x) :: int -> bool {
  if (!x)
    return x;
  return false;
} @@ fails;

//make sure we can filter out not only equal types:
function (x) :: (U(int, bool) -> bool) {
  return (typeof x == "number" ? (x<<3)==8 : !x);
} :: (U(int, bool) -> bool);

function (x) :: (U(int, bool) -> bool) {
  if (typeof x == "boolean") {
    if (x) { return false; }
  }
  return true;
} :: (U(int, bool) -> bool);

function (x) :: (any -> bool) {
  if (typeof x == "boolean") {
    if (x) { return false; }
  }
  return true;
} :: (any -> bool);

//what if we return on the if statement branch?
function (x) :: (U(int, bool) -> string) {
  if (typeof x == "boolean") {
    return "x was a boolean";
  }
  //now, x should be an integer
  var xshift :: int = 5;
  xshift = x >> 3;
  return "x was an int, here it is: " + x;
} :: (U(int, bool) -> string);

//what if we return on the if statement else branch?
function (x) :: (U(int, bool) -> string) {
  var result :: string = "tmp";
  if (typeof x == "number") {
    result = "x is a number.";
  }
  else
  {
    result = "x is a boolean";
    return result;
  }

  //x should be an int here
  var b :: int = 0;
  b = x << 3;
  return result + ", and x is an int here, and it's value * 8 = " + b;
} :: (U(int, bool) -> string);

//these should work even with var decls:
function (x) :: (U(string, bool) -> string) {
  if (typeof x == "string") {
    //TODO: change var processing so that occurrence typing has an effect
    //on it!
    var z = x;
    return z;
  }
  return "was not a string";
} :: (U(string, bool) -> string);

function (x) :: (U(int, bool) -> string) {
  if (typeof x == "boolean") {
    return "x was a boolean";
  }
  //now, x should be an integer
  var xshift :: int = x >> 3;
  return "x was an int, here it is: " + x;
} :: (U(int, bool) -> bool);

function (x) :: (U(int, bool) -> string) {
  var result :: string = "tmp";
  if (typeof x == "number") {
    result = "x is a number.";
  }
  else
  {
    result = "x is a boolean";
    return result;
  }

  //x should be an int here
  var b :: int = x << 3;
  return result + ", and x is an int here, and it's value * 8 = " + b;
} :: (U(int, bool) -> bool);

<commit_msg>minor typos in occurrence.js<commit_after>function (x) :: (U(int, bool) -> bool) {
  //the typed scheme paper example
  return (typeof x == "number" ? (x<<3)==8 : !x);
} :: (U(int, bool) -> bool);

//make sure we can filter out not only equal types:
function (x) :: (U(int, bool) -> bool) {
  return (typeof x == "number" ? (x<<3)==8 : !x);
} :: (U(int, bool) -> bool);

function (x) :: (U(int, bool, string) -> bool) {
  return (isInt(x) ? (x<<3)==8 : !x);
} @@ fails;

function (x) :: U(string, bool) -> string { return x; } @@ fails;
function (x) :: U(string, bool) -> string {
  if (true) return x;
  return "h";
} @@ fails;

function (x) :: (U(string, bool) -> string) {
  if (typeof x == "string") {
    //TODO: change return stmt checking so that occurrence typing has an effect
    //on it! (i.e. move it into typeCheckStmts)
    return x;
  }
  return "was not a string";
} :: (U(string, bool) -> string);

function (x) :: (U(int, bool) -> bool) {
  if (typeof x == "boolean") {
    if (x) { return false; }
  }
  return true;
} :: (U(int, bool) -> bool);

//!= instead of ==:
function (x) :: (U(int, bool) -> bool) {
  if (typeof x == "boolean") {
    if (x) { return false; }
  }
  return true;
} :: (U(int, bool) -> bool);

function (x) :: (U(int, bool) -> bool) {
  if (typeof x != "boolean") {
    var f :: int = 0;
    f = x >> 3;
    return true;
  }
  else
  {
    if (x) { return false; }
  }
  return true;
} :: (U(int, bool) -> bool);
function (x) :: (U(int, bool) -> bool) {
  if (typeof x != "boolean") {
    var f :: int = 0;
    f = x >> 3;
    return true;
  }
  else
  {
    if (x) { return false; }
    var b :: 'false = false; //'
    b = x; //x should be false here
    return true;
  }
} :: (U(int, bool) -> bool);

function (x) :: (U(int, bool) -> bool) {
  if ((typeof x) != "boolean") {
    var f :: int = 0;
    f = x >> 3;
    return true;
  }
  if (x) { return false; }
  return true;
} :: (U(int, bool) -> bool);
function (x) :: (U(int, bool) -> bool) {
  if (!((typeof x) == "boolean")) {
    var f :: int = 0;
    f = x >> 3;
    return true;
  }
  if (x) { return false; }
  return true;
} :: (U(int, bool) -> bool);

//x shouldn't turn into "false" just because of occurrence typing:
function (x) :: int -> bool {
  if (!x)
    return x;
  return false;
} @@ fails;

//make sure we can filter out not only equal types:
function (x) :: (U(int, bool) -> bool) {
  return (typeof x == "number" ? (x<<3)==8 : !x);
} :: (U(int, bool) -> bool);

function (x) :: (U(int, bool) -> bool) {
  if (typeof x == "boolean") {
    if (x) { return false; }
  }
  return true;
} :: (U(int, bool) -> bool);

function (x) :: (any -> bool) {
  if (typeof x == "boolean") {
    if (x) { return false; }
  }
  return true;
} :: (any -> bool);

//what if we return on the if statement branch?
function (x) :: (U(int, bool) -> string) {
  if (typeof x == "boolean") {
    return "x was a boolean";
  }
  //now, x should be an integer
  var xshift :: int = 5;
  xshift = x >> 3;
  return "x was an int, here it is: " + x;
} :: (U(int, bool) -> string);

//what if we return on the if statement else branch?
function (x) :: (U(int, bool) -> string) {
  var result :: string = "tmp";
  if (typeof x == "number") {
    result = "x is a number.";
  }
  else
  {
    result = "x is a boolean";
    return result;
  }

  //x should be an int here
  var b :: int = 0;
  b = x << 3;
  return result + ", and x is an int here, and it's value * 8 = " + b;
} :: (U(int, bool) -> string);

//these should work even with var decls:
function (x) :: (U(string, bool) -> string) {
  if (typeof x == "string") {
    //TODO: change var processing so that occurrence typing has an effect
    //on it!
    var z = x;
    return z;
  }
  return "was not a string";
} :: (U(string, bool) -> string);

function (x) :: (U(int, bool) -> string) {
  if (typeof x == "boolean") {
    return "x was a boolean";
  }
  //now, x should be an integer
  var xshift :: int = x >> 3;
  return "x was an int, here it is: " + x;
} :: (U(int, bool) -> string);

function (x) :: (U(int, bool) -> string) {
  var result :: string = "tmp";
  if (typeof x == "number") {
    result = "x is a number.";
  }
  else
  {
    result = "x is a boolean";
    return result;
  }

  //x should be an int here
  var b :: int = x << 3;
  return result + ", and x is an int here, and it's value * 8 = " + b;
} :: (U(int, bool) -> bool);

<|endoftext|>


<commit_before>/*!
 * Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */

// jQuery to collapse the navbar on scroll
$(window).scroll(function() {
    if ($(".navbar").offset().top > 50) {
        $(".navbar-fixed-top").addClass("top-nav-collapse");
    } else {
        $(".navbar-fixed-top").removeClass("top-nav-collapse");
    }
});

// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function() {
    $('a.page-scroll').bind('click', function(event) {
        var $anchor = $(this);
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1500, 'easeInOutExpo');
        event.preventDefault();
    });
});

// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
    $('.navbar-toggle:visible').click();
});

// Google Maps Scripts
// When the window has finished loading create our google map below
google.maps.event.addDomListener(window, 'load', init);

function init() {
    // Basic options for a simple Google Map
    // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
    var mapOptions = {
        // How zoomed in you want the map to start at (always required)
        zoom: 15,

        // The latitude and longitude to center the map (always required)
        center: new google.maps.LatLng(40.6700, -73.9400), // New York

        // Disables the default Google Maps UI components
        disableDefaultUI: true,
        scrollwheel: false,
        draggable: false,

        // How you would like to style the map.
        // This is where you would paste any style found on Snazzy Maps.
        styles: [{
            "featureType": "water",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }]
        }, {
            "featureType": "landscape",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 20
            }]
        }, {
            "featureType": "road.highway",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }]
        }, {
            "featureType": "road.highway",
            "elementType": "geometry.stroke",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 29
            }, {
                "weight": 0.2
            }]
        }, {
            "featureType": "road.arterial",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 18
            }]
        }, {
            "featureType": "road.local",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 16
            }]
        }, {
            "featureType": "poi",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 21
            }]
        }, {
            "elementType": "labels.text.stroke",
            "stylers": [{
                "visibility": "on"
            }, {
                "color": "#000000"
            }, {
                "lightness": 16
            }]
        }, {
            "elementType": "labels.text.fill",
            "stylers": [{
                "saturation": 36
            }, {
                "color": "#000000"
            }, {
                "lightness": 40
            }]
        }, {
            "elementType": "labels.icon",
            "stylers": [{
                "visibility": "off"
            }]
        }, {
            "featureType": "transit",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 19
            }]
        }, {
            "featureType": "administrative",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 20
            }]
        }, {
            "featureType": "administrative",
            "elementType": "geometry.stroke",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }, {
                "weight": 1.2
            }]
        }]
    };

    // Get the HTML DOM element that will contain your map
    // We are using a div with id="map" seen below in the <body>
    var mapElement = document.getElementById('map');

    // Create the Google Map using out element and options defined above
    var map = new google.maps.Map(mapElement, mapOptions);

    // Custom Map Marker Icon - Customize the map-marker.png file to customize your icon
    var image = 'img/map-marker.png';
    var myLatLng = new google.maps.LatLng(40.6700, -73.9400);
    var beachMarker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        icon: image
    });
}
<commit_msg>using edtm email<commit_after>/*!
 * Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */

// jQuery to collapse the navbar on scroll
$(window).scroll(function() {
    if ($(".navbar").offset().top > 50) {
        $(".navbar-fixed-top").addClass("top-nav-collapse");
    } else {
        $(".navbar-fixed-top").removeClass("top-nav-collapse");
    }
});

// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function() {
    $('a.page-scroll').bind('click', function(event) {
        var $anchor = $(this);
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1500, 'easeInOutExpo');
        event.preventDefault();
    });
});

// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
    $('.navbar-toggle:visible').click();
});

// Google Maps Scripts
// When the window has finished loading create our google map below
google.maps.event.addDomListener(window, 'load', init);

function init() {
    // Basic options for a simple Google Map
    // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
    var mapOptions = {
        // How zoomed in you want the map to start at (always required)
        zoom: 15,

        // The latitude and longitude to center the map (always required)
        center: new google.maps.LatLng(40.6700, -73.9400), // New York

        // Disables the default Google Maps UI components
        disableDefaultUI: true,
        scrollwheel: false,
        draggable: false,

        // How you would like to style the map.
        // This is where you would paste any style found on Snazzy Maps.
        styles: [{
            "featureType": "water",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }]
        }, {
            "featureType": "landscape",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 20
            }]
        }, {
            "featureType": "road.highway",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }]
        }, {
            "featureType": "road.highway",
            "elementType": "geometry.stroke",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 29
            }, {
                "weight": 0.2
            }]
        }, {
            "featureType": "road.arterial",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 18
            }]
        }, {
            "featureType": "road.local",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 16
            }]
        }, {
            "featureType": "poi",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 21
            }]
        }, {
            "elementType": "labels.text.stroke",
            "stylers": [{
                "visibility": "on"
            }, {
                "color": "#000000"
            }, {
                "lightness": 16
            }]
        }, {
            "elementType": "labels.text.fill",
            "stylers": [{
                "saturation": 36
            }, {
                "color": "#000000"
            }, {
                "lightness": 40
            }]
        }, {
            "elementType": "labels.icon",
            "stylers": [{
                "visibility": "off"
            }]
        }, {
            "featureType": "transit",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 19
            }]
        }, {
            "featureType": "administrative",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 20
            }]
        }, {
            "featureType": "administrative",
            "elementType": "geometry.stroke",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }, {
                "weight": 1.2
            }]
        }]
    };

    // Get the HTML DOM element that will contain your map
    // We are using a div with id="map" seen below in the <body>
    var mapElement = document.getElementById('map');

    // Create the Google Map using out element and options defined above
    var map = new google.maps.Map(mapElement, mapOptions);

    // Custom Map Marker Icon - Customize the map-marker.png file to customize your icon
    var image = 'img/map-marker.png';
    var myLatLng = new google.maps.LatLng(40.6700, -73.9400);
    var beachMarker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        icon: image
    });
}
<|endoftext|>


<commit_before>import { configurations, cleanup } from '../helpers/setup';

configurations({ only: '2.0' }, ({ module, test, createStore, config }) => {

  let store;
  let db;
  let mango;

  module('couch-mango', () => {
    store = createStore();
    db = store.get('db.main.documents');
    mango = db.get('mango');
    return cleanup(store, [ 'main' ]);
  });

  test('create index', assert => {
    return mango.save('foof', 'one', { fields: [ 'a', 'b' ] }).then(res => {
      assert.deepEqual(res, {
        "id": "_design/foof",
        "name": "one",
        "result": "created"
      });
      return db.get('design').load('foof');
    }).then(doc => {
      assert.deepEqual_(doc, {
        "_id": "_design/foof",
        "_rev": "ignored",
        "language": "query",
        "views": {
          "one": {
            "map": {
              "fields": {
                "a": "asc",
                "b": "asc"
              }
            },
            "options": {
              "def": {
                "fields": [ 'a', 'b' ]
              }
            },
            "reduce": "_count"
          }
        }
      });
    });
  });

  test('load indexes', assert => {
    return mango.save('foof', 'type', { fields: [ 'type' ] }).then(() => {
      return mango.all();
    }).then(doc => {
      assert.deepEqual(doc, {
        "total_rows": 2,
        "indexes": [
          {
            "ddoc": null,
            "name": "_all_docs",
            "type": "special",
            "def": {
              "fields": [
                {
                  "_id": "asc"
                }
              ]
            }
          },
          {
            "ddoc": "_design/foof",
            "name": "type",
            "type": "json",
            "def": {
              "fields": [
                {
                  "type": "asc"
                }
              ]
            }
          }
        ]
      });
    });
  });

  test('delete index', assert => {
    return mango.save('foof', 'type', { fields: [ 'type' ] }).then(() => {
      return mango.save('foof', 'name', { fields: [ 'name' ] });
    }).then(() => {
      return mango.delete('foof', 'type');
    }).then(json => {
      assert.deepEqual(json, {
        ok: true
      });
      return db.get('design').load('foof');
    }).then(json => {
      assert.deepEqual_(json, {
        "_id": "_design/foof",
        "_rev": "ignored",
        "language": "query",
        "views": {
          "name": {
            "map": {
              "fields": {
                "name": "asc"
              }
            },
            "reduce": "_count",
            "options": {
              "def": {
                "fields": [
                  "name"
                ]
              }
            }
          }
        }
      });
    });
  });

});
<commit_msg>jshint<commit_after>import { configurations, cleanup } from '../helpers/setup';

configurations({ only: '2.0' }, ({ module, test, createStore }) => {

  let store;
  let db;
  let mango;

  module('couch-mango', () => {
    store = createStore();
    db = store.get('db.main.documents');
    mango = db.get('mango');
    return cleanup(store, [ 'main' ]);
  });

  test('create index', assert => {
    return mango.save('foof', 'one', { fields: [ 'a', 'b' ] }).then(res => {
      assert.deepEqual(res, {
        "id": "_design/foof",
        "name": "one",
        "result": "created"
      });
      return db.get('design').load('foof');
    }).then(doc => {
      assert.deepEqual_(doc, {
        "_id": "_design/foof",
        "_rev": "ignored",
        "language": "query",
        "views": {
          "one": {
            "map": {
              "fields": {
                "a": "asc",
                "b": "asc"
              }
            },
            "options": {
              "def": {
                "fields": [ 'a', 'b' ]
              }
            },
            "reduce": "_count"
          }
        }
      });
    });
  });

  test('load indexes', assert => {
    return mango.save('foof', 'type', { fields: [ 'type' ] }).then(() => {
      return mango.all();
    }).then(doc => {
      assert.deepEqual(doc, {
        "total_rows": 2,
        "indexes": [
          {
            "ddoc": null,
            "name": "_all_docs",
            "type": "special",
            "def": {
              "fields": [
                {
                  "_id": "asc"
                }
              ]
            }
          },
          {
            "ddoc": "_design/foof",
            "name": "type",
            "type": "json",
            "def": {
              "fields": [
                {
                  "type": "asc"
                }
              ]
            }
          }
        ]
      });
    });
  });

  test('delete index', assert => {
    return mango.save('foof', 'type', { fields: [ 'type' ] }).then(() => {
      return mango.save('foof', 'name', { fields: [ 'name' ] });
    }).then(() => {
      return mango.delete('foof', 'type');
    }).then(json => {
      assert.deepEqual(json, {
        ok: true
      });
      return db.get('design').load('foof');
    }).then(json => {
      assert.deepEqual_(json, {
        "_id": "_design/foof",
        "_rev": "ignored",
        "language": "query",
        "views": {
          "name": {
            "map": {
              "fields": {
                "name": "asc"
              }
            },
            "reduce": "_count",
            "options": {
              "def": {
                "fields": [
                  "name"
                ]
              }
            }
          }
        }
      });
    });
  });

});
<|endoftext|>


<commit_before>/*!
 * Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */

// jQuery to collapse the navbar on scroll
function collapseNavbar() {
    if ($(".navbar").offset().top > 50) {
        $(".navbar-fixed-top").addClass("top-nav-collapse");
    } else {
        $(".navbar-fixed-top").removeClass("top-nav-collapse");
    }
}

$(window).scroll(collapseNavbar);
$(document).ready(collapseNavbar);

// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function() {
    $('a.page-scroll').bind('click', function(event) {
        var $anchor = $(this);
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1500, 'easeInOutExpo');
        event.preventDefault();
    });
});

// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
  if ($(this).attr('class') != 'dropdown-toggle active' && $(this).attr('class') != 'dropdown-toggle') {
    $('.navbar-toggle:visible').click();
  }
});

// Getting Quote from Quotes on Design
/* $.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_jsonp=?",function(a){
   $(".quote").append(a[0].content + "
- " + a[0].title + "
")
 });

$.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1", function(a){
  $(".quote").append(a[0].content + "
- " + a[0].title + "
")
});
*/

$.getJSON("https://www.joyalstudios.com/quotes", function(a){
  $(".quote").append(a[0].content + "
- " + a[0].title + "
")
});

// Google Maps Scripts
var map = null;
// When the window has finished loading create our google map below
google.maps.event.addDomListener(window, 'load', init);
google.maps.event.addDomListener(window, 'resize', function() {
    map.setCenter(new google.maps.LatLng(40.6700, -73.9400));
});

function init() {
    // Basic options for a simple Google Map
    // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
    var mapOptions = {
        // How zoomed in you want the map to start at (always required)
        zoom: 15,

        // The latitude and longitude to center the map (always required)
        center: new google.maps.LatLng(53.3424,-6.2406), // New York

        // Disables the default Google Maps UI components
        disableDefaultUI: true,
        scrollwheel: false,
        draggable: false,

        // How you would like to style the map.
        // This is where you would paste any style found on Snazzy Maps.
        styles: [{
            "featureType": "water",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }]
        }, {
            "featureType": "landscape",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 20
            }]
        }, {
            "featureType": "road.highway",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }]
        }, {
            "featureType": "road.highway",
            "elementType": "geometry.stroke",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 29
            }, {
                "weight": 0.2
            }]
        }, {
            "featureType": "road.arterial",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 18
            }]
        }, {
            "featureType": "road.local",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 16
            }]
        }, {
            "featureType": "poi",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 21
            }]
        }, {
            "elementType": "labels.text.stroke",
            "stylers": [{
                "visibility": "on"
            }, {
                "color": "#000000"
            }, {
                "lightness": 16
            }]
        }, {
            "elementType": "labels.text.fill",
            "stylers": [{
                "saturation": 36
            }, {
                "color": "#000000"
            }, {
                "lightness": 40
            }]
        }, {
            "elementType": "labels.icon",
            "stylers": [{
                "visibility": "off"
            }]
        }, {
            "featureType": "transit",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 19
            }]
        }, {
            "featureType": "administrative",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 20
            }]
        }, {
            "featureType": "administrative",
            "elementType": "geometry.stroke",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }, {
                "weight": 1.2
            }]
        }]
    };

    // Get the HTML DOM element that will contain your map
    // We are using a div with id="map" seen below in the
    var mapElement = document.getElementById('map');

    // Create the Google Map using out element and options defined above
    map = new google.maps.Map(mapElement, mapOptions);

    // Custom Map Marker Icon - Customize the map-marker.png file to customize your icon
    var image = 'img/map-marker.png';
    var myLatLng = new google.maps.LatLng(53.342423,-6.2406834);
    var beachMarker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        icon: image
    });
}
<commit_msg>added missing slash<commit_after>/*!
 * Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */

// jQuery to collapse the navbar on scroll
function collapseNavbar() {
    if ($(".navbar").offset().top > 50) {
        $(".navbar-fixed-top").addClass("top-nav-collapse");
    } else {
        $(".navbar-fixed-top").removeClass("top-nav-collapse");
    }
}

$(window).scroll(collapseNavbar);
$(document).ready(collapseNavbar);

// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function() {
    $('a.page-scroll').bind('click', function(event) {
        var $anchor = $(this);
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1500, 'easeInOutExpo');
        event.preventDefault();
    });
});

// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
  if ($(this).attr('class') != 'dropdown-toggle active' && $(this).attr('class') != 'dropdown-toggle') {
    $('.navbar-toggle:visible').click();
  }
});

// Getting Quote from Quotes on Design
/* $.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_jsonp=?",function(a){
   $(".quote").append(a[0].content + "
- " + a[0].title + "
")
 });

$.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1", function(a){
  $(".quote").append(a[0].content + "
- " + a[0].title + "
")
});
*/

$.getJSON("https://www.joyalstudios.com/quotes/", function(a){
  $(".quote").append(a[0].content + "
- " + a[0].title + "
")
});

// Google Maps Scripts
var map = null;
// When the window has finished loading create our google map below
google.maps.event.addDomListener(window, 'load', init);
google.maps.event.addDomListener(window, 'resize', function() {
    map.setCenter(new google.maps.LatLng(40.6700, -73.9400));
});

function init() {
    // Basic options for a simple Google Map
    // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
    var mapOptions = {
        // How zoomed in you want the map to start at (always required)
        zoom: 15,

        // The latitude and longitude to center the map (always required)
        center: new google.maps.LatLng(53.3424,-6.2406), // New York

        // Disables the default Google Maps UI components
        disableDefaultUI: true,
        scrollwheel: false,
        draggable: false,

        // How you would like to style the map.
        // This is where you would paste any style found on Snazzy Maps.
        styles: [{
            "featureType": "water",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }]
        }, {
            "featureType": "landscape",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 20
            }]
        }, {
            "featureType": "road.highway",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }]
        }, {
            "featureType": "road.highway",
            "elementType": "geometry.stroke",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 29
            }, {
                "weight": 0.2
            }]
        }, {
            "featureType": "road.arterial",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 18
            }]
        }, {
            "featureType": "road.local",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 16
            }]
        }, {
            "featureType": "poi",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 21
            }]
        }, {
            "elementType": "labels.text.stroke",
            "stylers": [{
                "visibility": "on"
            }, {
                "color": "#000000"
            }, {
                "lightness": 16
            }]
        }, {
            "elementType": "labels.text.fill",
            "stylers": [{
                "saturation": 36
            }, {
                "color": "#000000"
            }, {
                "lightness": 40
            }]
        }, {
            "elementType": "labels.icon",
            "stylers": [{
                "visibility": "off"
            }]
        }, {
            "featureType": "transit",
            "elementType": "geometry",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 19
            }]
        }, {
            "featureType": "administrative",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 20
            }]
        }, {
            "featureType": "administrative",
            "elementType": "geometry.stroke",
            "stylers": [{
                "color": "#000000"
            }, {
                "lightness": 17
            }, {
                "weight": 1.2
            }]
        }]
    };

    // Get the HTML DOM element that will contain your map
    // We are using a div with id="map" seen below in the
    var mapElement = document.getElementById('map');

    // Create the Google Map using out element and options defined above
    map = new google.maps.Map(mapElement, mapOptions);

    // Custom Map Marker Icon - Customize the map-marker.png file to customize your icon
    var image = 'img/map-marker.png';
    var myLatLng = new google.maps.LatLng(53.342423,-6.2406834);
    var beachMarker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        icon: image
    });
}
<|endoftext|>