<commit_before>function updateOnResize() {
  var desc = demoplayer.videojs.videoWidth() +
             "x" +
             demoplayer.videojs.videoHeight();
  var current = document.getElementsByClassName("active button");
  for (var i = 0; i < current.length; i++) {
    if(current[i].id != "auto")
      current[i].setAttribute("class","button");
  }
  var newactive = document.getElementsByName(desc);
  for (var j = 0; j < newactive.length; j++)
    newactive[j].setAttribute("class","active button");
}

function requestResolution() {
  document.getElementById("auto").setAttribute("class","button");
  for (var i = 0; i < qualityLevels.length; i++) {
      qualityLevels[i].enabled = (this.id == i);
  }
}

function requestAuto() {
  for (var i = 0; i < qualityLevels.length; i++) {
      qualityLevels[i].enabled = true;
  }
  document.getElementById("auto").setAttribute("class","active button");
}

function addButton(bid,qlevel,desc,css) {
      var btn = document.createElement("BUTTON");
      adaptive.appendChild(btn);
      btn.addEventListener("click", requestResolution);
      btn.innerHTML = desc;
      btn.setAttribute("id",bid);
      btn.setAttribute("class",css);
      btn.setAttribute("name",desc);
}

function changeOfResolution() {
  for (var i = 0; i < qualityLevels.length; i++) {
    var btn = document.getElementById(i);
    var qlevel = qualityLevels[i];
    var desc = qlevel.width + "x" + qlevel.height;
    var css = "button";
    if (i == qualityLevels.selectedIndex)
        css = "requested button";
    if(btn) {
      if(btn.getAttribute("class") != "active button")
        btn.setAttribute("class",css);
    }
    else
      addButton(i,qlevel,desc,css);
  }
}

function setProfile(radiob) {
  var loop = document.getElementsByClassName("button").length - 1;
  for (var i = 0; i < loop; i++) {
    var btn = document.getElementById(i)
    if(btn)
      adaptive.removeChild(btn);
  }

  demoplayer.source("hd_trim2", { sourceTypes: ['hls'], transformation: {streaming_profile: radiob.value } });
}

var cld = cloudinary.Cloudinary.new({ cloud_name: 'hadar' });

var adaptive = document.getElementById("adaptive");
document.getElementById("demo-adaptive-player").addEventListener('resize',updateOnResize, false);

var demoplayer = cld.videoPlayer('demo-adaptive-player');

var qualityLevels = demoplayer.videojs.qualityLevels();
qualityLevels.on('change', changeOfResolution);
qualityLevels.on('addqualitylevel', function(event) { console.log(event.qualityLevel.width); });

demoplayer.source('hd_trim2',{ sourceTypes: ['hls'],
                              transformation: {streaming_profile: 'hd' } });

function updateOnEvent(eventStr) {
  var eventsDiv = document.querySelector('#vid-events');
  var text = document.createTextNode(eventStr);
  var textDiv = document.createElement('div');
  textDiv.appendChild(text);
  eventsDiv.appendChild(textDiv);
  eventsDiv.scrollTop = eventsDiv.scrollHeight;
}

function checkTime(i) {
        return (i < 10) ? "0" + i : i;
    }

function startTime() {
        var today = new Date(),
            h = checkTime(today.getHours()),
            m = checkTime(today.getMinutes()),
            s = checkTime(today.getSeconds());
        return (h + ":" + m + ":" + s);
}

var eventplayer = cld.videoPlayer('demo-events-player', { playedEventTimes: [3, 10] });

var eventTypes = ['play', 'pause', 'volumechange', 'mute', 'unmute', 'fullscreenchange',
      'seek', 'sourcechanged', 'timeplayed', 'percentsplayed', 'ended'];

eventTypes.forEach(function(eventType) {
      eventplayer.on(eventType, function(event) {
        var eventStr = startTime() + " " + eventType;
        if (event.eventData) {
          eventStr = eventStr + ": " + JSON.stringify(event.eventData)
        }
        updateOnEvent(eventStr);
      })
    });

 eventplayer.source('hd_trim2',{ sourceTypes: ['hls'],
                              transformation: {streaming_profile: 'hd' } });

<commit_msg>Update video.js<commit_after>function updateOnResize() {
  var desc = demoplayer.videojs.videoWidth() +
             "x" +
             demoplayer.videojs.videoHeight();
  var current = document.getElementsByClassName("active button");
  for (var i = 0; i < current.length; i++) {
    if(current[i].id != "auto")
      current[i].setAttribute("class","button");
  }
  var newactive = document.getElementsByName(desc);
  for (var j = 0; j < newactive.length; j++)
    newactive[j].setAttribute("class","active button");
}

function requestResolution() {
  document.getElementById("auto").setAttribute("class","button");
  for (var i = 0; i < qualityLevels.length; i++) {
      qualityLevels[i].enabled = (this.id == i);
  }
}

function requestAuto() {
  for (var i = 0; i < qualityLevels.length; i++) {
      qualityLevels[i].enabled = true;
  }
  document.getElementById("auto").setAttribute("class","active button");
}

function addButton(bid,qlevel,desc,css) {
      var btn = document.createElement("BUTTON");
      adaptive.appendChild(btn);
      btn.addEventListener("click", requestResolution);
      btn.innerHTML = desc;
      btn.setAttribute("id",bid);
      btn.setAttribute("class",css);
      btn.setAttribute("name",desc);
}

function changeOfResolution() {
  for (var i = 0; i < qualityLevels.length; i++) {
    var btn = document.getElementById(i);
    var qlevel = qualityLevels[i];
    var desc = qlevel.width + "x" + qlevel.height;
    var css = "button";
    if (i == qualityLevels.selectedIndex)
        css = "requested button";
    if(btn) {
      if(btn.getAttribute("class") != "active button")
        btn.setAttribute("class",css);
    }
    else
      addButton(i,qlevel,desc,css);
  }
}

function setProfile(radiob) {
  var loop = document.getElementsByClassName("button").length - 1;
  for (var i = 0; i < loop; i++) {
    var btn = document.getElementById(i)
    if(btn)
      adaptive.removeChild(btn);
  }

  demoplayer.source("hd_trim2", { sourceTypes: ['hls'], transformation: {streaming_profile: radiob.value } });
}

var cld = cloudinary.Cloudinary.new({ cloud_name: 'cld-demo' });

var adaptive = document.getElementById("adaptive");
document.getElementById("demo-adaptive-player").addEventListener('resize',updateOnResize, false);

var demoplayer = cld.videoPlayer('demo-adaptive-player');

var qualityLevels = demoplayer.videojs.qualityLevels();
qualityLevels.on('change', changeOfResolution);
qualityLevels.on('addqualitylevel', function(event) { console.log(event.qualityLevel.width); });

demoplayer.source('hd_trim2',{ sourceTypes: ['hls'],
                              transformation: {streaming_profile: 'hd' } });

function updateOnEvent(eventStr) {
  var eventsDiv = document.querySelector('#vid-events');
  var text = document.createTextNode(eventStr);
  var textDiv = document.createElement('div');
  textDiv.appendChild(text);
  eventsDiv.appendChild(textDiv);
  eventsDiv.scrollTop = eventsDiv.scrollHeight;
}

function checkTime(i) {
        return (i < 10) ? "0" + i : i;
    }

function startTime() {
        var today = new Date(),
            h = checkTime(today.getHours()),
            m = checkTime(today.getMinutes()),
            s = checkTime(today.getSeconds());
        return (h + ":" + m + ":" + s);
}

var eventplayer = cld.videoPlayer('demo-events-player', { playedEventTimes: [3, 10] });

var eventTypes = ['play', 'pause', 'volumechange', 'mute', 'unmute', 'fullscreenchange',
      'seek', 'sourcechanged', 'timeplayed', 'percentsplayed', 'ended'];

eventTypes.forEach(function(eventType) {
      eventplayer.on(eventType, function(event) {
        var eventStr = startTime() + " " + eventType;
        if (event.eventData) {
          eventStr = eventStr + ": " + JSON.stringify(event.eventData)
        }
        updateOnEvent(eventStr);
      })
    });

 eventplayer.source('hd_trim2',{ sourceTypes: ['hls'],
                              transformation: {streaming_profile: 'hd' } });

<|endoftext|>


<commit_before>module.exports = {
  someSidebar: [
    {
      type: 'category',
      label: 'Getting Started',
      collapsed: false,
      items: [
        'index',
        'prototype-an-assistant',
        'installation',
        'cheatsheet',
        'migrate-from',
      ],
    },
    {
      type: 'category',
      label: 'Preparing For Production',
      collapsed: false,
      items: [
        'testing-your-assistant',
        'setting-up-ci-cd',
        'how-to-deploy',
        'messaging-and-voice-channels',m
      ],
    },
    {
      type: 'category',
      label: 'NLU',
      collapsed: false,
      items: [
        'training-data-format',
        {
          type: 'category',
          label: 'Components',
          items: [
            'components/language-models',
            'components/tokenizers',
            'components/featurizers',
            'components/intent-classifiers',
            'components/entity-extractors',
            'components/selectors',
            'components/custom-nlu-components',
          ],
        },
      ],
    },
    {
      type: 'category',
      label: 'Dialogue Management',
      collapsed: false,
      items: [
        'stories',
        'domains',
        {
          type: 'category',
          label: 'Policies',
          items: [
            'policies',
          ],
        },
        {
          type: 'category',
          label: 'Actions',
          items: [
            'retrieval-actions',
            'forms',
            'reminders-and-external-events',
          ],
        },
        {
          type: 'category',
          label: 'Channel Connectors',
          items: [
            'connectors/your-own-website',
            'connectors/facebook-messenger',
            'connectors/slack',
            'connectors/telegram',
            'connectors/twilio',
            'connectors/hangouts',
            'connectors/microsoft-bot-framework',
            'connectors/cisco-webex-teams',
            'connectors/rocketchat',
            'connectors/mattermost',
          ],
        },
        {
          type: 'category',
          label: 'Architecture', // name still confusing with architecture page elsewhere
          items: [
            'tracker-stores',
            'event-brokers',
            'lock-stores',
            'nlg',
            'cloud-storage',
          ],
        },
      ],
    },
    {
      type: 'category',
      label: 'Rasa SDK',
      collapsed: false,
      items: [
        {
          type: 'category',
          label: 'Custom Actions',
          items: [
            'actions',
            'knowledge-bases',
          ],
        },
        'tracker',
        'events',
        {
          type: 'category',
          label: 'Reference',
          items: [
            'action-server',
          ],
        },
      ],
    },
    {
      type: 'category',
      label: 'Reference',
      collapsed: false,
      items: [
        'architecture',
        'command-line-interface',
        'http-api',
        {
          type: 'category',
          label: 'Versioning',
          items: [
            'changelog',
            'migration-guide',
          ],
        },
      ],
    },
    {
      type: 'category',
      label: 'Old Content',
      items: [
        'building-assistants',
        'validate-files',
        'configuring-http-api',
        'about-nlu',
        'using-nlu-only',
        'language-support',
        'choosing-a-pipeline',
        'entity-extraction',
        'about-core',
        'responses',
        'slots',
        'interactive-learning',
        'fallback-actions',
        'jupyter-notebooks',
        'agent',
        'rasa-sdk',
        'training-data-importers',
        'core-featurization',
        'tensorflow_usage',
        'glossary',
        ]
    },
  ],
};
<commit_msg>add reference for usage and jupyter notebooks<commit_after>module.exports = {
  someSidebar: [
    {
      type: 'category',
      label: 'Getting Started',
      collapsed: false,
      items: [
        'index',
        'prototype-an-assistant',
        'installation',
        'cheatsheet',
        'migrate-from',
      ],
    },
    {
      type: 'category',
      label: 'Preparing For Production',
      collapsed: false,
      items: [
        'testing-your-assistant',
        'setting-up-ci-cd',
        'how-to-deploy',
        'messaging-and-voice-channels',m
      ],
    },
    {
      type: 'category',
      label: 'NLU',
      collapsed: false,
      items: [
        'training-data-format',
        {
          type: 'category',
          label: 'Components',
          items: [
            'components/language-models',
            'components/tokenizers',
            'components/featurizers',
            'components/intent-classifiers',
            'components/entity-extractors',
            'components/selectors',
            'components/custom-nlu-components',
          ],
        },
      ],
    },
    {
      type: 'category',
      label: 'Reference',
      collapsed: false,
      items: [
        'glossary',
      ],
    },
    {
      type: 'category',
      label: 'Dialogue Management',
      collapsed: false,
      items: [
        'stories',
        'domains',
        {
          type: 'category',
          label: 'Policies',
          items: [
            'policies',
          ],
        },
        {
          type: 'category',
          label: 'Actions',
          items: [
            'retrieval-actions',
            'forms',
            'reminders-and-external-events',
          ],
        },
        {
          type: 'category',
          label: 'Channel Connectors',
          items: [
            'connectors/your-own-website',
            'connectors/facebook-messenger',
            'connectors/slack',
            'connectors/telegram',
            'connectors/twilio',
            'connectors/hangouts',
            'connectors/microsoft-bot-framework',
            'connectors/cisco-webex-teams',
            'connectors/rocketchat',
            'connectors/mattermost',
          ],
        },
        {
          type: 'category',
          label: 'Architecture', // name still confusing with architecture page elsewhere
          items: [
            'tracker-stores',
            'event-brokers',
            'lock-stores',
            'nlg',
            'cloud-storage',
          ],
        },
      ],
    },
    {
      type: 'category',
      label: 'Rasa SDK',
      collapsed: false,
      items: [
        {
          type: 'category',
          label: 'Custom Actions',
          items: [
            'actions',
            'knowledge-bases',
          ],
        },
        'tracker',
        'events',
        {
          type: 'category',
          label: 'Reference',
          items: [
            'action-server',
          ],
        },
      ],
    },
    {
      type: 'category',
      label: 'Reference',
      collapsed: false,
      items: [
        'architecture',
        'command-line-interface',
        'http-api',
        'jupyter-notebooks',
        {
          type: 'category',
          label: 'Versioning',
          items: [
            'changelog',
            'migration-guide',
          ],
        },
      ],
    },
    {
      type: 'category',
      label: 'Old Content',
      items: [
        'building-assistants',
        'validate-files',
        'configuring-http-api',
        'about-nlu',
        'using-nlu-only',
        'language-support',
        'choosing-a-pipeline',
        'entity-extraction',
        'about-core',
        'responses',
        'slots',
        'interactive-learning',
        'fallback-actions',
        'agent',
        'rasa-sdk',
        'training-data-importers',
        'core-featurization',
        'tensorflow_usage',
        ]
    },
  ],
};
<|endoftext|>


<commit_before>function drawAdventure(character) {
    var adventurer = character.adventurer;
    var context = mainContext;
    var cameraX = character.cameraX;
    context.clearRect(0, 0, mainCanvas.width, mainCanvas.height);
    var background = ifdefor(character.area.background, backgrounds.field);
    var cloudX = cameraX + character.time * .5;
    var fullDrawingWidth = Math.ceil(mainCanvas.width / 64) * 64 + 64;
    background.forEach(function(section) {
        var source = section.source;
        var y = ifdefor(section.y, 0);
        var height = ifdefor(section.height, 240 - y);
        var width = ifdefor(section.width, 64);
        var parallax = ifdefor(section.parallax, 1);
        var spacing = ifdefor(section.spacing, 1);
        var velocity = ifdefor(section.velocity, 0);
        var alpha = ifdefor(section.alpha, 1);
        context.globalAlpha = alpha;
        for (var i = 0; i <= fullDrawingWidth; i += 64 * spacing) {
            var x = (fullDrawingWidth + (i - (cameraX - character.time * velocity) * parallax) % fullDrawingWidth) % fullDrawingWidth - 64;
            context.drawImage(source.image, source.x, source.y, source.width, source.height,
                                  x, y, width, height);
        }
        context.globalAlpha = 1;
    });
    character.objects.forEach(function (object, index) {
        object.draw(context, object.x - cameraX, 240 - 128);
    });
    character.enemies.forEach(function (actor, index) {
        drawActor(character, actor, 1 + character.enemies.length - index)
    });
    drawActor(character, adventurer, 0);
    character.allies.forEach(function (actor, index) {
        if (actor == adventurer) return;
        drawActor(character, actor, -index)
    });
    // Draw text popups such as damage dealt, item points gained, and so on.
    context.fillStyle = 'red';
    for (var i = 0; i < character.treasurePopups.length; i++) {
        character.treasurePopups[i].draw(character);
    }
    for (var i = 0; i < character.projectiles.length; i++) {
        character.projectiles[i].draw(character);
    }
    for (var i = 0; i < character.effects.length; i++) {
        character.effects[i].draw(character);
    }
    for (var i = 0; i < character.textPopups.length; i++) {
        var textPopup = character.textPopups[i];
        context.fillStyle = ifdefor(textPopup.color, "red");
        context.font = ifdefor(textPopup.font, "20px sans-serif");
        context.textAlign = 'center'
        context.fillText(textPopup.value, textPopup.x - cameraX, textPopup.y);
    }
    drawMinimap(character);
}
function drawActor(character, actor, index) {
    mainContext.save();
    if (actor.isDead) {
        actor.animationTime = actor.timeOfDeath;
        mainContext.globalAlpha = 1 - (actor.time - actor.timeOfDeath);
    }
    if (actor.personCanvas) drawAdventurer(character, actor, index);
    else if (actor.image) drawMonster(character, actor, index);
    else {
        console.log("Unable to draw actor was neither monster nor adventurer?");
        console.log(actor);
    }
    mainContext.restore();
}
function drawMonster(character, monster, index) {
    var cameraX = character.cameraX;
    var context = mainContext;
    var fps = ifdefor(monster.base.fpsMultiplier, 1) * 3 * monster.speed / 100;
    var source = monster.base.source;
    var frame = Math.floor(monster.animationTime * fps) % source.frames;
    if (monster.pull) {
        frame = 0;
    }
    context.save();
    if (monster.cloaked) {
        context.globalAlpha = .2;
    }
    monster.left = monster.x - cameraX;
    monster.top = 240 - ifdefor(source.height, 64) * 2 - 72 - ifdefor(source.y, 0) * 2 - 2 * index;
    monster.width = source.width * 2;
    monster.height = ifdefor(source.height, 64) * 2;
    context.translate(monster.left + monster.width / 2, 0);
    if ((source.flipped && monster.direction < 0) || (!source.flipped && monster.direction > 0)) {
        context.scale(-1, 1);
    }
    context.drawImage(monster.image, frame * source.width + source.offset, 0 , source.width, ifdefor(source.height, 64),
                      -monster.width / 2, monster.top, monster.width, monster.height);
    context.restore();
    // Uncomment to draw a reference of the character to show where left side of monster should be
    // context.drawImage(character.personCanvas, 0 * 32, 0 , 32, 64, monster.x - cameraX, 240 - 128 - 72, 64, 128);
    //context.fillRect(monster.x - cameraX, 240 - 128 - 72, 64, 128);
    // life bar
    if (monster.isDead) return;
    drawBar(context, monster.x - cameraX + source.width - 32, 240 - 128 - 36 - 2 * index - ifdefor(source.y, 0) * 2, 64, 4, 'white', monster.color, monster.health / monster.maxHealth);
    if (ifdefor(monster.reflectBarrier, 0)) {
        drawBar(context, monster.x - cameraX + source.width - 32, 240 - 128 - 36 - 2 * index - 2 - ifdefor(source.y, 0) * 2, 64, 4, 'white', 'blue', monster.reflectBarrier / monster.maxReflectBarrier);
    }
}
function drawAdventurer(character, adventurer, index) {
    var cameraX = character.cameraX;
    adventurer.left = adventurer.x - cameraX;
    adventurer.top = 240 - 128 - 72 - 2 * index;
    adventurer.width = 64;
    adventurer.height = 128;
    //draw character
    if (adventurer.target && adventurer.lastAction && adventurer.lastAction.attackSpeed) { // attacking loop
        var attackSpeed = adventurer.lastAction.attackSpeed;
        var attackFps = 1 / ((1 / attackSpeed) / fightLoop.length);
        var frame = Math.floor(Math.abs(adventurer.animationTime - adventurer.attackCooldown) * attackFps) % fightLoop.length;
        mainContext.drawImage(adventurer.personCanvas, fightLoop[frame] * 32, 0 , 32, 64,
                        adventurer.x - cameraX, 240 - 128 - 72, 64, 128);
    } else { // walking loop
        if (adventurer.cloaked) {
            mainContext.globalAlpha = .2;
        }
        var fps = Math.floor(3 * adventurer.speed / 100);
        var frame = Math.floor(adventurer.animationTime * fps) % walkLoop.length;
        if (adventurer.pull || adventurer.stunned) {
            frame = 0;
        }
        mainContext.drawImage(adventurer.personCanvas, walkLoop[frame] * 32, 0 , 32, 64,
                        adventurer.x - cameraX, 240 - 128 - 72, 64, 128);
    }
    //mainContext.fillRect(adventurer.x - cameraX, 240 - 128 - 72, 64, 128);
    // life bar
    if (adventurer.isDead) return;
    drawBar(mainContext, adventurer.x - cameraX, 240 - 128 - 36 - 2 * index, 64, 4, 'white', 'red', adventurer.health / adventurer.maxHealth);
    if (ifdefor(adventurer.reflectBarrier, 0)) {
        drawBar(mainContext, adventurer.x - cameraX, 240 - 128 - 36 - 2 * index - 2, 64, 4, 'white', 'blue', adventurer.reflectBarrier / adventurer.maxReflectBarrier);
    }
}
function drawMinimap(character) {
    var y = 240 - 18;
    var height = 6;
    var x = 10;
    var width = 750;
    var context = mainContext;
    drawBar(context, x, y, width, height, 'white', 'white', character.waveIndex / character.area.waves.length);
    for (var i = 0; i < character.area.waves.length; i++) {
        var centerX = x + (i + 1) * width / character.area.waves.length;
        var centerY = y + height / 2;
        context.fillStyle = 'white';
        context.beginPath();
            context.arc(centerX, centerY, 11, 0, 2 * Math.PI);
        context.fill();
    }
    context.fillStyle = 'orange';
    context.fillRect(x + 1, y + 1, (width - 2) * (character.waveIndex / character.area.waves.length) - 10, height - 2);
    for (var i = 0; i < character.area.waves.length; i++) {
        var centerX = x + (i + 1) * width / character.area.waves.length;
        var centerY = y + height / 2;
        if (i < character.waveIndex) {
            context.fillStyle = 'orange';
            context.beginPath();
            context.arc(centerX, centerY, 10, 0, 2 * Math.PI);
            context.fill();
        }
        var waveCompleted = (i < character.waveIndex - 1)  || (i <= character.waveIndex && (character.enemies.length + character.objects.length) === 0);
        character.area.waves[i].draw(context, waveCompleted, centerX, centerY);
    }
}<commit_msg>Add more useful error message, now that I figured out what happened.<commit_after>function drawAdventure(character) {
    var adventurer = character.adventurer;
    var context = mainContext;
    var cameraX = character.cameraX;
    context.clearRect(0, 0, mainCanvas.width, mainCanvas.height);
    var background = ifdefor(character.area.background, backgrounds.field);
    var cloudX = cameraX + character.time * .5;
    var fullDrawingWidth = Math.ceil(mainCanvas.width / 64) * 64 + 64;
    background.forEach(function(section) {
        var source = section.source;
        var y = ifdefor(section.y, 0);
        var height = ifdefor(section.height, 240 - y);
        var width = ifdefor(section.width, 64);
        var parallax = ifdefor(section.parallax, 1);
        var spacing = ifdefor(section.spacing, 1);
        var velocity = ifdefor(section.velocity, 0);
        var alpha = ifdefor(section.alpha, 1);
        context.globalAlpha = alpha;
        for (var i = 0; i <= fullDrawingWidth; i += 64 * spacing) {
            var x = (fullDrawingWidth + (i - (cameraX - character.time * velocity) * parallax) % fullDrawingWidth) % fullDrawingWidth - 64;
            context.drawImage(source.image, source.x, source.y, source.width, source.height,
                                  x, y, width, height);
        }
        context.globalAlpha = 1;
    });
    character.objects.forEach(function (object, index) {
        object.draw(context, object.x - cameraX, 240 - 128);
    });
    character.enemies.forEach(function (actor, index) {
        drawActor(character, actor, 1 + character.enemies.length - index)
    });
    drawActor(character, adventurer, 0);
    character.allies.forEach(function (actor, index) {
        if (actor == adventurer) return;
        drawActor(character, actor, -index)
    });
    // Draw text popups such as damage dealt, item points gained, and so on.
    context.fillStyle = 'red';
    for (var i = 0; i < character.treasurePopups.length; i++) {
        character.treasurePopups[i].draw(character);
    }
    for (var i = 0; i < character.projectiles.length; i++) {
        character.projectiles[i].draw(character);
    }
    for (var i = 0; i < character.effects.length; i++) {
        character.effects[i].draw(character);
    }
    for (var i = 0; i < character.textPopups.length; i++) {
        var textPopup = character.textPopups[i];
        context.fillStyle = ifdefor(textPopup.color, "red");
        context.font = ifdefor(textPopup.font, "20px sans-serif");
        context.textAlign = 'center'
        context.fillText(textPopup.value, textPopup.x - cameraX, textPopup.y);
    }
    drawMinimap(character);
}
function drawActor(character, actor, index) {
    mainContext.save();
    if (actor.isDead) {
        actor.animationTime = actor.timeOfDeath;
        mainContext.globalAlpha = 1 - (actor.time - actor.timeOfDeath);
    }
    if (actor.personCanvas) drawAdventurer(character, actor, index);
    else drawMonster(character, actor, index);
    mainContext.restore();
}
function drawMonster(character, monster, index) {
    if (!monster.image) {
        console.log("Found monster without an image. Last time this happened was because the -enchanged/-imbued version of the image was not being created at load time.");
        console.log(monster);
        return;
    }
    var cameraX = character.cameraX;
    var context = mainContext;
    var fps = ifdefor(monster.base.fpsMultiplier, 1) * 3 * monster.speed / 100;
    var source = monster.base.source;
    var frame = Math.floor(monster.animationTime * fps) % source.frames;
    if (monster.pull) {
        frame = 0;
    }
    context.save();
    if (monster.cloaked) {
        context.globalAlpha = .2;
    }
    monster.left = monster.x - cameraX;
    monster.top = 240 - ifdefor(source.height, 64) * 2 - 72 - ifdefor(source.y, 0) * 2 - 2 * index;
    monster.width = source.width * 2;
    monster.height = ifdefor(source.height, 64) * 2;
    context.translate(monster.left + monster.width / 2, 0);
    if ((source.flipped && monster.direction < 0) || (!source.flipped && monster.direction > 0)) {
        context.scale(-1, 1);
    }
    context.drawImage(monster.image, frame * source.width + source.offset, 0 , source.width, ifdefor(source.height, 64),
                      -monster.width / 2, monster.top, monster.width, monster.height);
    context.restore();
    // Uncomment to draw a reference of the character to show where left side of monster should be
    // context.drawImage(character.personCanvas, 0 * 32, 0 , 32, 64, monster.x - cameraX, 240 - 128 - 72, 64, 128);
    //context.fillRect(monster.x - cameraX, 240 - 128 - 72, 64, 128);
    // life bar
    if (monster.isDead) return;
    drawBar(context, monster.x - cameraX + source.width - 32, 240 - 128 - 36 - 2 * index - ifdefor(source.y, 0) * 2, 64, 4, 'white', monster.color, monster.health / monster.maxHealth);
    if (ifdefor(monster.reflectBarrier, 0)) {
        drawBar(context, monster.x - cameraX + source.width - 32, 240 - 128 - 36 - 2 * index - 2 - ifdefor(source.y, 0) * 2, 64, 4, 'white', 'blue', monster.reflectBarrier / monster.maxReflectBarrier);
    }
}
function drawAdventurer(character, adventurer, index) {
    var cameraX = character.cameraX;
    adventurer.left = adventurer.x - cameraX;
    adventurer.top = 240 - 128 - 72 - 2 * index;
    adventurer.width = 64;
    adventurer.height = 128;
    //draw character
    if (adventurer.target && adventurer.lastAction && adventurer.lastAction.attackSpeed) { // attacking loop
        var attackSpeed = adventurer.lastAction.attackSpeed;
        var attackFps = 1 / ((1 / attackSpeed) / fightLoop.length);
        var frame = Math.floor(Math.abs(adventurer.animationTime - adventurer.attackCooldown) * attackFps) % fightLoop.length;
        mainContext.drawImage(adventurer.personCanvas, fightLoop[frame] * 32, 0 , 32, 64,
                        adventurer.x - cameraX, 240 - 128 - 72, 64, 128);
    } else { // walking loop
        if (adventurer.cloaked) {
            mainContext.globalAlpha = .2;
        }
        var fps = Math.floor(3 * adventurer.speed / 100);
        var frame = Math.floor(adventurer.animationTime * fps) % walkLoop.length;
        if (adventurer.pull || adventurer.stunned) {
            frame = 0;
        }
        mainContext.drawImage(adventurer.personCanvas, walkLoop[frame] * 32, 0 , 32, 64,
                        adventurer.x - cameraX, 240 - 128 - 72, 64, 128);
    }
    //mainContext.fillRect(adventurer.x - cameraX, 240 - 128 - 72, 64, 128);
    // life bar
    if (adventurer.isDead) return;
    drawBar(mainContext, adventurer.x - cameraX, 240 - 128 - 36 - 2 * index, 64, 4, 'white', 'red', adventurer.health / adventurer.maxHealth);
    if (ifdefor(adventurer.reflectBarrier, 0)) {
        drawBar(mainContext, adventurer.x - cameraX, 240 - 128 - 36 - 2 * index - 2, 64, 4, 'white', 'blue', adventurer.reflectBarrier / adventurer.maxReflectBarrier);
    }
}
function drawMinimap(character) {
    var y = 240 - 18;
    var height = 6;
    var x = 10;
    var width = 750;
    var context = mainContext;
    drawBar(context, x, y, width, height, 'white', 'white', character.waveIndex / character.area.waves.length);
    for (var i = 0; i < character.area.waves.length; i++) {
        var centerX = x + (i + 1) * width / character.area.waves.length;
        var centerY = y + height / 2;
        context.fillStyle = 'white';
        context.beginPath();
            context.arc(centerX, centerY, 11, 0, 2 * Math.PI);
        context.fill();
    }
    context.fillStyle = 'orange';
    context.fillRect(x + 1, y + 1, (width - 2) * (character.waveIndex / character.area.waves.length) - 10, height - 2);
    for (var i = 0; i < character.area.waves.length; i++) {
        var centerX = x + (i + 1) * width / character.area.waves.length;
        var centerY = y + height / 2;
        if (i < character.waveIndex) {
            context.fillStyle = 'orange';
            context.beginPath();
            context.arc(centerX, centerY, 10, 0, 2 * Math.PI);
            context.fill();
        }
        var waveCompleted = (i < character.waveIndex - 1)  || (i <= character.waveIndex && (character.enemies.length + character.objects.length) === 0);
        character.area.waves[i].draw(context, waveCompleted, centerX, centerY);
    }
}<|endoftext|>


<commit_before>'use strict';

require('jasmine-given');

describe('the main view', function () {
    var page = require('./main.po');

    Given(function () { page.visitPage(); });

    describe('the acf-entry section', function () {

        describe('should exist at load', function () {
            Then(function () { expect(page.acfEntry.root.isPresent()).toBeTruthy(); });
        });

        describe('should show options at load', function () {
            Then(function () { expect(page.acfEntry.acfSelectOptions.count()).toBeGreaterThan(0); });
        });

        describe('should not be clickable until an option is selected', function () {
            When(function () { submitAcf(page); });

            Then(function () { expect(page.acfEntry.acfSubmitBtn.isEnabled()).toBeFalsy(); });
        });

        describe('should not exist after entering a new ACF and submitting', function () {
            When(function () {
                page.acfEntry.acfNewChk.click().then(function () {
                    return enterNewAcf(page);
                }).then(function () {
                    return submitAcf(page);
                });
            });

            Then(function () { expect(page.acfEntry.root.isPresent()).toBeFalsy(); });
        });

        describe('should not exist after selecting an ACF and submitting', function () {
            When(function () {
                selectAcf(page).then(function () {
                    return submitAcf(page);
                });
            });

            Then(function () { expect(page.acfEntry.root.isPresent()).toBeFalsy(); });
        });
    });

    describe('after selecting an acf', function () {

        describe('the patient-search section', function () {
            describe('should not show errors until button focused on', function () {
                Then(function () { expect(page.patientSearch.submitBtnEl.isEnabled()).toBeTruthy(); });
            });

            /*
            describe('should not send a query without a patient ID', function () {
                When(function () { page.patientSearch.patientIdEl.clear(); });
                When(function () { page.patientSearch.submitBtnEl.click(); });

                Then(function () { expect(page.patientSearch.submitBtnEl.isEnabled()).toBeFalsy(); });
            });

            describe('should re-enable the search button when the patient id is entered', function () {
                When(function () { page.patientSearch.patientIdEl.clear(); });
                When(function () { page.patientSearch.submitBtnEl.click(); });

                Then(function () {
                    doSearch(page).then(function () {
                        Then(function () { expect(page.patientSearch.submitBtnEl.isEnabled()).toBeTruthy(); });
                    });
                });
            });
            */
        });

        describe('the patient-review section', function () {
            describe('should not exist at load', function () {
                Then(function () { expect(page.patientReview.root.isPresent()).toBeFalsy(); });
            });

            describe('should have no queries at load', function () {
                Then(function () { expect(page.patientReview.queries.count()).toBe(0) });
            });

            describe('should have one query after sending a query', function () {
                When(function () { doSearch(page); });

                Then(function () { expect(page.patientReview.queries.count()).toBe(1); });
            });

            describe('should have a way to clear a query', function () {
                When(function () {
                    doSearch(page).then(function () {
                        page.patientReview.queries.first().element(by.tagName('button')).click();
                    });
                });

                Then(function () { expect(page.patientReview.queries.count()).toBe(0); });
            });

            describe('should clear the query when a patient is chosen', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    });
                });

                Then(function () { expect(page.patientReview.queries.count()).toBe(0); });
            });
        });

        describe('the acf-patient-list section', function () {
            describe('should indicate when a document is not cached', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    }).then(function () {
                        return showDocuments(page);
                    });
                });

                Then(function () { expect(page.acfPatientList.documents.first().element(by.tagName('button')).getText()).toBe('Download'); });
                And(function () { expect(page.acfPatientList.documents.first().element(by.tagName('i')).getAttribute('class')).toBe('fa fa-download'); });
            });

            describe('should indicate when a document is cached', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    }).then(function () {
                        return showDocuments(page);
                    }).then(function () {
                        return clickDocument(page)
                    });
                });

                Then(function () { expect(page.acfPatientList.documents.first().element(by.tagName('button')).getText()).toBe('View'); });
                And(function () { expect(page.acfPatientList.documents.first().element(by.tagName('i')).getAttribute('class')).toBe('fa fa-eye'); });
            });
        });

        describe('the document-review section', function () {
            describe('should have no documents at load', function () {
                Then(function () { expect(page.documentReview.root.isPresent()).toBeFalsy(); });
            });

            describe('should display a document when one is selected', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    }).then(function () {
                        return showDocuments(page);
                    }).then(function () {
                        return clickDocument(page)
                    }).then(function () {
                        return clickDocument(page)
                    });
                });

                Then(function () { expect(page.documentReview.document.getText()).not.toBe(''); });
            });

            describe('should clear a displayed document when directed', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    }).then(function () {
                        return showDocuments(page);
                    }).then(function () {
                        return clickDocument(page)
                    }).then(function () {
                        return clickDocument(page)
                    }).then(function () {
                        page.documentReview.close.click()
                    });
                });

                Then(function () { expect(page.documentReview.root.isPresent()).toBeFalsy();});
            });
        });

        describe('the organization status section', function () {
            describe('should exist on page load', function () {
                Then(function () { expect(page.organizationStatus.root.isPresent()).toBeTruthy(); });
            });

            describe('should have more than 0 organizations', function () {
                Then(function () { expect(page.organizationStatus.organizations.count()).toBeGreaterThan(0); });
            });
        });
    });
});

function selectAcf (page) {
    return page.acfEntry.acfSelectOptions.last().click();
}

function enterNewAcf (page) {
    return page.acfEntry.acfNewEl.sendKeys('new ACF');
}

function submitAcf (page) {
    return page.acfEntry.acfSubmitBtn.click();
}

function doSearch (page) {
    return page.patientSearch.submitBtnEl.click();
}

function showDetails (page) {
    return page.patientReview.showDetailsA.click();
}

function selectPatient (page) {
    return page.patientReview.patientResults.first().element(by.tagName('button')).click();
}

function showDocuments (page) {
    return page.acfPatientList.showDocumentsA.click();
}

function clickDocument (page) {
    return page.acfPatientList.documents.first().element(by.tagName('button')).click();
}
<commit_msg>Clear storage after every e2e test<commit_after>'use strict';

require('jasmine-given');

describe('the main view', function () {
    var page = require('./main.po');

    Given(function () { page.visitPage(); });

    afterEach(function () {
        browser.executeScript('window.sessionStorage.clear();');
        browser.executeScript('window.localStorage.clear();');
    });

    describe('the acf-entry section', function () {

        describe('should exist at load', function () {
            Then(function () { expect(page.acfEntry.root.isPresent()).toBeTruthy(); });
        });

        describe('should show options at load', function () {
            Then(function () { expect(page.acfEntry.acfSelectOptions.count()).toBeGreaterThan(0); });
        });

        describe('should not be clickable until an option is selected', function () {
            When(function () { submitAcf(page); });

            Then(function () { expect(page.acfEntry.acfSubmitBtn.isEnabled()).toBeFalsy(); });
        });

        describe('should not exist after entering a new ACF and submitting', function () {
            When(function () {
                page.acfEntry.acfNewChk.click().then(function () {
                    return enterNewAcf(page);
                }).then(function () {
                    return submitAcf(page);
                });
            });

            Then(function () { expect(page.acfEntry.root.isPresent()).toBeFalsy(); });
        });

        describe('should not exist after selecting an ACF and submitting', function () {
            When(function () {
                selectAcf(page).then(function () {
                    return submitAcf(page);
                });
            });

            Then(function () { expect(page.acfEntry.root.isPresent()).toBeFalsy(); });
        });
    });

    describe('after selecting an acf', function () {

        Given(function () {
            selectAcf(page).then(function () {
                return submitAcf(page);
            });
        });

        describe('the patient-search section', function () {
            describe('should not show errors until button focused on', function () {
                Then(function () { expect(page.patientSearch.submitBtnEl.isEnabled()).toBeTruthy(); });
            });

            /*
            describe('should not send a query without a patient ID', function () {
                When(function () { page.patientSearch.patientIdEl.clear(); });
                When(function () { page.patientSearch.submitBtnEl.click(); });

                Then(function () { expect(page.patientSearch.submitBtnEl.isEnabled()).toBeFalsy(); });
            });

            describe('should re-enable the search button when the patient id is entered', function () {
                When(function () { page.patientSearch.patientIdEl.clear(); });
                When(function () { page.patientSearch.submitBtnEl.click(); });

                Then(function () {
                    doSearch(page).then(function () {
                        Then(function () { expect(page.patientSearch.submitBtnEl.isEnabled()).toBeTruthy(); });
                    });
                });
            });
            */
        });

        describe('the patient-review section', function () {
            describe('should not exist at load', function () {
                Then(function () { expect(page.patientReview.root.isPresent()).toBeFalsy(); });
            });

            describe('should have no queries at load', function () {
                Then(function () { expect(page.patientReview.queries.count()).toBe(0) });
            });

            describe('should have one query after sending a query', function () {
                When(function () { doSearch(page); });

                Then(function () { expect(page.patientReview.queries.count()).toBe(1); });
            });

            describe('should have a way to clear a query', function () {
                When(function () {
                    doSearch(page).then(function () {
                        page.patientReview.queries.first().element(by.tagName('button')).click();
                    });
                });

                Then(function () { expect(page.patientReview.queries.count()).toBe(0); });
            });

            describe('should clear the query when a patient is chosen', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    });
                });

                Then(function () { expect(page.patientReview.queries.count()).toBe(0); });
            });
        });

        describe('the acf-patient-list section', function () {
            describe('should indicate when a document is not cached', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    }).then(function () {
                        return showDocuments(page);
                    });
                });

                Then(function () { expect(page.acfPatientList.documents.first().element(by.tagName('button')).getText()).toBe('Download'); });
                And(function () { expect(page.acfPatientList.documents.first().element(by.tagName('i')).getAttribute('class')).toBe('fa fa-download'); });
            });

            describe('should indicate when a document is cached', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    }).then(function () {
                        return showDocuments(page);
                    }).then(function () {
                        return clickDocument(page)
                    });
                });

                Then(function () { expect(page.acfPatientList.documents.first().element(by.tagName('button')).getText()).toBe('View'); });
                And(function () { expect(page.acfPatientList.documents.first().element(by.tagName('i')).getAttribute('class')).toBe('fa fa-eye'); });
            });
        });

        describe('the document-review section', function () {
            describe('should have no documents at load', function () {
                Then(function () { expect(page.documentReview.root.isPresent()).toBeFalsy(); });
            });

            describe('should display a document when one is selected', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    }).then(function () {
                        return showDocuments(page);
                    }).then(function () {
                        return clickDocument(page)
                    }).then(function () {
                        return clickDocument(page)
                    });
                });

                Then(function () { expect(page.documentReview.document.getText()).not.toBe(''); });
            });

            describe('should clear a displayed document when directed', function () {
                When(function () {
                    doSearch(page).then(function () {
                        return showDetails(page)
                    }).then(function () {
                        return selectPatient(page)
                    }).then(function () {
                        return showDocuments(page);
                    }).then(function () {
                        return clickDocument(page)
                    }).then(function () {
                        return clickDocument(page)
                    }).then(function () {
                        page.documentReview.close.click()
                    });
                });

                Then(function () { expect(page.documentReview.root.isPresent()).toBeFalsy();});
            });
        });

        describe('the organization status section', function () {
            describe('should exist on page load', function () {
                Then(function () { expect(page.organizationStatus.root.isPresent()).toBeTruthy(); });
            });

            describe('should have more than 0 organizations', function () {
                Then(function () { expect(page.organizationStatus.organizations.count()).toBeGreaterThan(0); });
            });
        });
    });
});

function selectAcf (page) {
    return page.acfEntry.acfSelectOptions.last().click();
}

function enterNewAcf (page) {
    return page.acfEntry.acfNewEl.sendKeys('new ACF');
}

function submitAcf (page) {
    return page.acfEntry.acfSubmitBtn.click();
}

function doSearch (page) {
    return page.patientSearch.submitBtnEl.click();
}

function showDetails (page) {
    return page.patientReview.showDetailsA.click();
}

function selectPatient (page) {
    return page.patientReview.patientResults.first().element(by.tagName('button')).click();
}

function showDocuments (page) {
    return page.acfPatientList.showDocumentsA.click();
}

function clickDocument (page) {
    return page.acfPatientList.documents.first().element(by.tagName('button')).click();
}
<|endoftext|>


<commit_before>var DATASETS = [
  {
    name: "Barley",
    url: "data/barley.json"
  },{
    name: "Cars",
    url: "data/cars.json"
  },{
    name: "Crimea",
    url: "data/crimea.json"
  },{
    name: "Driving",
    url: "data/driving.json"
  },{
    name: "Iris",
    url: "data/iris.json"
  },{
    name: "Jobs",
    url: "data/jobs.json"
  },{
    name: "Population",
    url: "data/population.json"
  },{
    name: "Movies",
    url: "data/movies.json"
  },{
    name: "Birdstrikes",
    url: "data/birdstrikes.json"
  },{
    name: "Burtin",
    url: "data/burtin.json"
  },{
    name: "Budget 2016",
    url: "data/budget.json"
  },{
    name: "Climate Normals",
    url: "data/climate.json"
  },{
    name: "Campaigns",
    url: "data/weball26.json"
  }
];

var vled = {
  version: 0.1,
  spec: {}
}

function getParams() {
  var params = location.search.slice(1);

  // remove trailing slash that chrome adds automatically
  if (params[params.length-1] == "/") params = params.substring(0, params.length-1);

  return params.split("&")
    .map(function(x) {
      // don't gobble up any equals within the query value
      var idx = x.indexOf("=");
      return [x.slice(0,idx), x.slice(idx+1)];
    })
    .reduce(function(a, b) {
      a[b[0]] = b[1]; return a;
    }, {});
};

vled.format = function() {
  var el = d3.select("#vlspec"),
      spec = JSON.parse(el.property("value")),
      text = JSON.stringify(spec, null, "  ", 60);
  el.property("value", text);
};

vled.parse = function() {
  var spec, encoding, source, cfg;
  try {
    spec = JSON.parse(d3.select("#vlspec").property("value"));
  } catch (e) {
    console.warn(e);
    return;
  }

  cfg = {
    dataUrl: vled.dataset.url
  }

  encoding = vl.Encoding.fromSpec(spec, {}, cfg);
  vled.loadEncoding(encoding);
}

vled.parseShorthand = function() {
  var shorthand = d3.select("#shorthand").property("value");

  var encoding = vl.Encoding.parseShorthand(shorthand);
  d3.select("#vlspec").node().value = JSON.stringify(encoding.toSpec(), null, "  ", 60);
  vled.parse();
}

vled.loadEncoding = function(encoding) {
  var spec = vl.compile(encoding, vled.dataset.stats);

  d3.select("#shorthand").node().value = encoding.toShorthand();
  d3.select("#vlspec").node().value = JSON.stringify(encoding.toSpec(), null, "  ", 60);
  d3.select("#vgspec").node().value = JSON.stringify(spec, null, "  ", 60);

  $('textarea').trigger('autosize.resize');

  vled.vis = null; // DEBUG
  vg.parse.spec(spec, function(chart) {
    vled.vis = chart({el:"#vis", renderer: "svg"});

    vled.vis.update();
  });
}

vled.datasetChanged = function(dataset, callback) {
  vled.dataset = dataset;

  if (dataset.stats) return;

  d3.json(dataset.url, function(err, data) {
    if (err) return alert("Error loading data " + err.statusText);

    dataset.stats = vl.data.getStats(data);
    callback();
  });
}

vled.init = function() {
  var params = getParams();

  // Specification drop-down menu
  var sel = d3.select("#sel_spec");
  sel.selectAll("option.spec")
    .data(DATASETS)
   .enter().append("option")
    .text(function(d) { return d.name; });

  sel.on("change", function() {
    var item = this.options[this.selectedIndex].__data__;
      vled.datasetChanged(item, function() {
      d3.select("#vgspec").node().value = "";
      d3.select("#vis").node().innerHTML = "";
    });
  });

  // Initialize application
  d3.select("#btn_spec_format").on("click", vled.format);
  d3.select("#btn_spec_parse").on("click", vled.parse);
  d3.select("#btn_shorthand_parse").on("click", vled.parseShorthand);

  var shorthand = params.shortHand;
  if (shorthand) {
    document.getElementById("shorthand").value = shorthand;
    vled.datasetChanged(DATASETS[0], function() {
      vled.parseShorthand();
    });
  } else {
    document.getElementById("vlspec").value = JSON.stringify({
      marktype: "point",
      enc: {
        x: {type: "Q",name: "yield",aggr: "avg"},
        y: {
          sort: [{name: "yield", aggr: "avg", reverse: false}],
          type: "O",
          name: "variety"
        },
        row: {type: "O", name: "site"},
        color: {type: "O", name: "year"}
      }
    });

    vled.datasetChanged(DATASETS[0], function() {
      vled.parse();
    });
  }
};

window.onload = vled.init;<commit_msg>Don’t write to vlspec in editor when we are parsing. <commit_after>var DATASETS = [
  {
    name: "Barley",
    url: "data/barley.json"
  },{
    name: "Cars",
    url: "data/cars.json"
  },{
    name: "Crimea",
    url: "data/crimea.json"
  },{
    name: "Driving",
    url: "data/driving.json"
  },{
    name: "Iris",
    url: "data/iris.json"
  },{
    name: "Jobs",
    url: "data/jobs.json"
  },{
    name: "Population",
    url: "data/population.json"
  },{
    name: "Movies",
    url: "data/movies.json"
  },{
    name: "Birdstrikes",
    url: "data/birdstrikes.json"
  },{
    name: "Burtin",
    url: "data/burtin.json"
  },{
    name: "Budget 2016",
    url: "data/budget.json"
  },{
    name: "Climate Normals",
    url: "data/climate.json"
  },{
    name: "Campaigns",
    url: "data/weball26.json"
  }
];

var vled = {
  version: 0.1,
  spec: {}
}

function getParams() {
  var params = location.search.slice(1);

  // remove trailing slash that chrome adds automatically
  if (params[params.length-1] == "/") params = params.substring(0, params.length-1);

  return params.split("&")
    .map(function(x) {
      // don't gobble up any equals within the query value
      var idx = x.indexOf("=");
      return [x.slice(0,idx), x.slice(idx+1)];
    })
    .reduce(function(a, b) {
      a[b[0]] = b[1]; return a;
    }, {});
};

vled.format = function() {
  var el = d3.select("#vlspec"),
      spec = JSON.parse(el.property("value")),
      text = JSON.stringify(spec, null, "  ", 60);
  el.property("value", text);
};

vled.parse = function() {
  var spec, encoding, source, cfg;
  try {
    spec = JSON.parse(d3.select("#vlspec").property("value"));
  } catch (e) {
    console.warn(e);
    return;
  }

  cfg = {
    dataUrl: vled.dataset.url
  }

  encoding = vl.Encoding.fromSpec(spec, {}, cfg);
  vled.loadEncoding(encoding);
}

vled.parseShorthand = function() {
  var shorthand = d3.select("#shorthand").property("value");

  var encoding = vl.Encoding.parseShorthand(shorthand);
  d3.select("#vlspec").node().value = JSON.stringify(encoding.toSpec(), null, "  ", 60);
  vled.parse();
}

vled.loadEncoding = function(encoding) {
  var spec = vl.compile(encoding, vled.dataset.stats);

  d3.select("#shorthand").node().value = encoding.toShorthand();
  d3.select("#vgspec").node().value = JSON.stringify(spec, null, "  ", 60);

  $('textarea').trigger('autosize.resize');

  vled.vis = null; // DEBUG
  vg.parse.spec(spec, function(chart) {
    vled.vis = chart({el:"#vis", renderer: "svg"});

    vled.vis.update();
  });
}

vled.datasetChanged = function(dataset, callback) {
  vled.dataset = dataset;

  if (dataset.stats) return;

  d3.json(dataset.url, function(err, data) {
    if (err) return alert("Error loading data " + err.statusText);

    dataset.stats = vl.data.getStats(data);
    callback();
  });
}

vled.init = function() {
  var params = getParams();

  // Specification drop-down menu
  var sel = d3.select("#sel_spec");
  sel.selectAll("option.spec")
    .data(DATASETS)
   .enter().append("option")
    .text(function(d) { return d.name; });

  sel.on("change", function() {
    var item = this.options[this.selectedIndex].__data__;
      vled.datasetChanged(item, function() {
      d3.select("#vgspec").node().value = "";
      d3.select("#vis").node().innerHTML = "";
    });
  });

  // Initialize application
  d3.select("#btn_spec_format").on("click", vled.format);
  d3.select("#btn_spec_parse").on("click", vled.parse);
  d3.select("#btn_shorthand_parse").on("click", vled.parseShorthand);

  var shorthand = params.shortHand;
  if (shorthand) {
    document.getElementById("shorthand").value = shorthand;
    vled.datasetChanged(DATASETS[0], function() {
      vled.parseShorthand();
    });
  } else {
    document.getElementById("vlspec").value = JSON.stringify({
      marktype: "point",
      enc: {
        x: {type: "Q",name: "yield",aggr: "avg"},
        y: {
          sort: [{name: "yield", aggr: "avg", reverse: false}],
          type: "O",
          name: "variety"
        },
        row: {type: "O", name: "site"},
        color: {type: "O", name: "year"}
      }
    });

    vled.format();

    vled.datasetChanged(DATASETS[0], function() {
      vled.parse();
    });
  }
};

window.onload = vled.init;<|endoftext|>


<commit_before>const _ = require('lodash');
const userServices = require('./user.services');
const security = require('../routes/security');

function exportUser(user) {
  return _.pick(user, ['phone', 'firstName', 'lastName', 'email', 'profile']);
}

function signIn(req, res) {
  try {
    userServices.createUser(
      req.body.phone,
      req.body.password,
      req.body.firstName,
      req.body.lastName,
      req.body.email,
      req.body.profile,
      req.query.contactsLength,
    )
      .then((user) => {
        res.status(200).json(exportUser(user));
      })
      .catch((e) => {
        const message = e.message || 'Internal server error';
        const status = e.message ? 400 : 500;
        res.status(status).json({ message });
      });
  } catch (e) {
    const message = e.message || 'Internal server error';
    const status = e.message ? 400 : 500;
    res.status(status).json({ message });
  }
}

function logIn(req, res) {
  security.doLogin(req.body.phone, req.body.password)
    .then((isMatch) => {
      if (isMatch) {
        const token = security.generateToken(req.body.phone);
        res.status(200).json({ token });
      } else {
        res.status(401).json({ message: 'Password is not valid' });
      }
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function forgottenPassord(req, res) {
  security.forgottenPassord(req.body.phone)
    .then(() => {
      res.status(204).send();
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function updateUser(req, res) {
  userServices.updateUser(
    req.user._id,
    req.body.firstName,
    req.body.lastName,
    req.body.email,
    req.body.profile,
  )
    .then((user) => {
      res.status(200).json(exportUser(user));
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function getUsers(req, res) {
  userServices.getUsers()
    .then((users) => {
      res.status(200).json(_.map(users, user => exportUser(user)));
    })
    .catch(() => {
      res.status(500).json({ message: 'Internal server error' });
    });
}

function getAuthenticatedUser(req, res) {
  userServices.getUserById(req.user._id)
    .then((user) => {
      res.status(200).json(exportUser(user));
    })
    .catch(() => {
      res.status(500).json({ message: 'Internal server error' });
    });
}

function getContacts(req, res) {
  userServices.getContacts(req.user.phone)
    .then((contacts) => {
      res.status(200).json(contacts);
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function deleteContact(req, res) {
  userServices.deleteContact(req.user.phone, req.params.idContact)
    .then(() => {
      res.status(204).send();
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function updateContact(req, res) {
  userServices.updateContact(
    req.user.phone,
    req.params.idContact,
    req.body.firstName,
    req.body.lastName,
    req.body.email,
    req.body.profile,
    req.body.gravatar,
    req.body.isFamilinkUser,
    req.body.isFamilinkUser,
    req.body.isEmergencyUser,
  )
    .then(() => {
      res.status(204).send();
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function createContact(req, res) {
  userServices.addContact(
    req.user.phone,
    req.body.phone,
    req.body.firstName,
    req.body.lastName,
    req.body.email,
    req.body.profile,
    req.body.gravatar,
    req.body.isFamilinkUser,
    req.body.isFamilinkUser,
    req.body.isEmergencyUser,
  )
    .then((contact) => {
      res.status(200).json(contact);
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

module.exports = {
  signIn,
  logIn,
  forgottenPassord,
  getUsers,
  getAuthenticatedUser,
  updateUser,
  getContacts,
  deleteContact,
  updateContact,
  createContact,
};
<commit_msg>Fix the http status code when password is wrong (#20)<commit_after>const _ = require('lodash');
const userServices = require('./user.services');
const security = require('../routes/security');

function exportUser(user) {
  return _.pick(user, ['phone', 'firstName', 'lastName', 'email', 'profile']);
}

function signIn(req, res) {
  try {
    userServices.createUser(
      req.body.phone,
      req.body.password,
      req.body.firstName,
      req.body.lastName,
      req.body.email,
      req.body.profile,
      req.query.contactsLength,
    )
      .then((user) => {
        res.status(200).json(exportUser(user));
      })
      .catch((e) => {
        const message = e.message || 'Internal server error';
        const status = e.message ? 400 : 500;
        res.status(status).json({ message });
      });
  } catch (e) {
    const message = e.message || 'Internal server error';
    const status = e.message ? 400 : 500;
    res.status(status).json({ message });
  }
}

function logIn(req, res) {
  security.doLogin(req.body.phone, req.body.password)
    .then((isMatch) => {
      if (isMatch) {
        const token = security.generateToken(req.body.phone);
        res.status(200).json({ token });
      } else {
        res.status(400).json({ message: 'Password is not valid' });
      }
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function forgottenPassord(req, res) {
  security.forgottenPassord(req.body.phone)
    .then(() => {
      res.status(204).send();
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function updateUser(req, res) {
  userServices.updateUser(
    req.user._id,
    req.body.firstName,
    req.body.lastName,
    req.body.email,
    req.body.profile,
  )
    .then((user) => {
      res.status(200).json(exportUser(user));
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function getUsers(req, res) {
  userServices.getUsers()
    .then((users) => {
      res.status(200).json(_.map(users, user => exportUser(user)));
    })
    .catch(() => {
      res.status(500).json({ message: 'Internal server error' });
    });
}

function getAuthenticatedUser(req, res) {
  userServices.getUserById(req.user._id)
    .then((user) => {
      res.status(200).json(exportUser(user));
    })
    .catch(() => {
      res.status(500).json({ message: 'Internal server error' });
    });
}

function getContacts(req, res) {
  userServices.getContacts(req.user.phone)
    .then((contacts) => {
      res.status(200).json(contacts);
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function deleteContact(req, res) {
  userServices.deleteContact(req.user.phone, req.params.idContact)
    .then(() => {
      res.status(204).send();
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function updateContact(req, res) {
  userServices.updateContact(
    req.user.phone,
    req.params.idContact,
    req.body.firstName,
    req.body.lastName,
    req.body.email,
    req.body.profile,
    req.body.gravatar,
    req.body.isFamilinkUser,
    req.body.isFamilinkUser,
    req.body.isEmergencyUser,
  )
    .then(() => {
      res.status(204).send();
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

function createContact(req, res) {
  userServices.addContact(
    req.user.phone,
    req.body.phone,
    req.body.firstName,
    req.body.lastName,
    req.body.email,
    req.body.profile,
    req.body.gravatar,
    req.body.isFamilinkUser,
    req.body.isFamilinkUser,
    req.body.isEmergencyUser,
  )
    .then((contact) => {
      res.status(200).json(contact);
    })
    .catch((e) => {
      const message = e.message || 'Internal server error';
      const status = e.message ? 400 : 500;
      res.status(status).json({ message });
    });
}

module.exports = {
  signIn,
  logIn,
  forgottenPassord,
  getUsers,
  getAuthenticatedUser,
  updateUser,
  getContacts,
  deleteContact,
  updateContact,
  createContact,
};
<|endoftext|>


<commit_before>(function() {
  'use strict';

  var fs = require('fs'),
    gm = require('gm'),
    config = require('config'),
    restify = require('restify'),
    Picture = require('../model/picture');

  var picturesConfig = config.get('pictureTemplates');

  exports.get = function get(req, res, next) {

    var pictureFormat = req.params.formatName,
      pictureId = req.params.pictureId;

    var onPictureBufferReady = function onPictureBufferReady(error, buffer) {
      if (error) return next(new restify.InternalServerError(error));

      res.writeHead(200, {
        'Content-Type': 'image/jpg'
      });
      res.end(buffer, 'binary');
      return next();
    };

    var onPictureDocumentFound = function onPictureFound(error, picture) {

      if (error) return next(new restify.InternalServerError(error));
      if (!picture) return next(new restify.NotFoundError());

      var cfg = picturesConfig[picture.template].formats[pictureFormat];

      if (!cfg) return next(new restify.BadRequestError('%s is not a valid format', pictureFormat));

      var img = gm(picture.data, pictureId)
        .resize(cfg.width, cfg.height, cfg.options);

      if (cfg.crop)
        img
        .gravity(cfg.gravity)
        .crop(cfg.width, cfg.height);

      img.quality(cfg.quality)
        .autoOrient()
        .noProfile()
        .toBuffer('JPG', onPictureBufferReady);
    };

    try {
      Picture.findById(pictureId, onPictureDocumentFound);
    } catch (e) {
      return next(new restify.NotFoundError());
    }
  };

  exports.create = function create(req, res, next) {
    //console.log(req.files.picture);

    var type = req.files.picture.type;

    fs.readFile(req.files.picture.path, function(err, data) {

      var pic = new Picture({
        template: req.params.template,
        data: data
      });
      pic.save();

      var picCreated = {
        id: pic._id
      };

      res.send(picCreated);
      next();
    });
  };

  exports.update = function update(req, res, next) {

    var pictureDataReady = false,
      pictureDocumentReady = false,
      pictureDocument = null,
      pictureData = null;

    var pictureId = req.params.pictureId;

    var updatePictureData = function updatePictureData() {
      if(!pictureFileReady || !pictureDataReady)
        return;

        pictureDocument.data = pictureData;
        pictureDocument.save();

        var picUpdated = {
          id: pictureDocument._id
        };

        res.send(picUpdated);
    };

    var onPictureFileReady = function onPictureFileReady(error, data) {
      error = error || 'aqui';
      if (error) return next(new restify.InternalServerError(error));

      pictureData = data;
      pictureFileReady = true;
      updatePictureData();
    };

    var onPictureDocumentFound = function onPictureDocumentFound(error, picture) {
      error = error || 'ali';
      if (error) return next(new restify.InternalServerError(error));
      if (!picture) return next(new restify.NotFoundError());

      pictureDocument = picture;
      pictureDocumentReady = true;
      updatePictureData();
    };

    try {
      Picture.findById(pictureId, onPictureDocumentFound);
      fs.readFile(req.files.picture.path, onPictureFileReady);
    } catch (e) {
      return next(new restify.NotFoundError('ndjsad'));
    }
  };

}());
<commit_msg>teste 3<commit_after>(function() {
  'use strict';

  var fs = require('fs'),
    gm = require('gm'),
    config = require('config'),
    restify = require('restify'),
    Picture = require('../model/picture');

  var picturesConfig = config.get('pictureTemplates');

  exports.get = function get(req, res, next) {

    var pictureFormat = req.params.formatName,
      pictureId = req.params.pictureId;

    var onPictureBufferReady = function onPictureBufferReady(error, buffer) {
      if (error) return next(new restify.InternalServerError(error));

      res.writeHead(200, {
        'Content-Type': 'image/jpg'
      });
      res.end(buffer, 'binary');
      return next();
    };

    var onPictureDocumentFound = function onPictureFound(error, picture) {

      if (error) return next(new restify.InternalServerError(error));
      if (!picture) return next(new restify.NotFoundError());

      var cfg = picturesConfig[picture.template].formats[pictureFormat];

      if (!cfg) return next(new restify.BadRequestError('%s is not a valid format', pictureFormat));

      var img = gm(picture.data, pictureId)
        .resize(cfg.width, cfg.height, cfg.options);

      if (cfg.crop)
        img
        .gravity(cfg.gravity)
        .crop(cfg.width, cfg.height);

      img.quality(cfg.quality)
        .autoOrient()
        .noProfile()
        .toBuffer('JPG', onPictureBufferReady);
    };

    try {
      Picture.findById(pictureId, onPictureDocumentFound);
    } catch (e) {
      return next(new restify.NotFoundError());
    }
  };

  exports.create = function create(req, res, next) {
    //console.log(req.files.picture);

    var type = req.files.picture.type;

    fs.readFile(req.files.picture.path, function(err, data) {

      var pic = new Picture({
        template: req.params.template,
        data: data
      });
      pic.save();

      var picCreated = {
        id: pic._id
      };

      res.send(picCreated);
      next();
    });
  };

  exports.update = function update(req, res, next) {

    var pictureDataReady = false,
      pictureDocumentReady = false,
      pictureDocument = null,
      pictureData = null;

    var pictureId = req.params.pictureId;

    var updatePictureData = function updatePictureData() {
      if(!pictureFileReady || !pictureDataReady)
        return;

        pictureDocument.data = pictureData;
        pictureDocument.save();

        var picUpdated = {
          id: pictureDocument._id
        };

        res.send(picUpdated);
    };

    var onPictureFileReady = function onPictureFileReady(error, data) {
      error = 'aqui';
      if (error) return next(new restify.InternalServerError(error));

      pictureData = data;
      pictureFileReady = true;
      updatePictureData();
    };

    var onPictureDocumentFound = function onPictureDocumentFound(error, picture) {
      error = 'ali';
      if (error) return next(new restify.InternalServerError(error));
      if (!picture) return next(new restify.NotFoundError());

      pictureDocument = picture;
      pictureDocumentReady = true;
      updatePictureData();
    };

    try {
      Picture.findById(pictureId, onPictureDocumentFound);
      fs.readFile(req.files.picture.path, onPictureFileReady);
    } catch (e) {
      return next(new restify.NotFoundError('ndjsad'));
    }
  };

}());
<|endoftext|>


<commit_before>Exhibit.Localization.importLocale("es", {
    "%general.missingLabel": "falta",
    "%general.missingSortKey": "(falta)",
    "%general.notApplicableSortKey": "(n/a)",
    "%general.itemLinkLabel": undefined,
    "%general.busyIndicatorMessage": "Procesando...",
    "%general.showDocumentationMessage": "Te enseñaremos la documentación asociada después de este mensaje.",
    "%general.showJavascriptValidationMessage": "Te explicaremos los detalles del error después de este mensaje.",
    "%general.showJsonValidationMessage": "Te explicaremos los detalles del error después de este mensaje.",
    "%general.showJsonValidationFormMessage": "Te redirigiremos a un servicio web donde podrás subir y verificar tu código después de este mensaje.",
    "%general.badJsonMessage": "El fichero de datos JSON\n %1$s\ncontiene errores =\n\n%2$s",
    "%general.failedToLoadDataFileMessage": "No podemos localizar el fichero de datos\n %1$s\nComprueba que el nombre del archivo es correcto.",
    "%export.exportButtonLabel": undefined,
    "%export.exportAllButtonLabel": undefined,
    "%export.exportDialogBoxCloseButtonLabel": undefined,
    "%export.exportDialogBoxPrompt": undefined,
    "%export.focusDialogBoxCloseButtonLabel": "Cerrar",
    "%export.rdfXmlExporterLabel": "RDF/XML",
    "%export.smwExporterLabel": "Semantic wikitext",
    "%export.exhibitJsonExporterLabel": "Exhibit JSON",
    "%export.tsvExporterLabel": undefined,
    "%export.htmlExporterLabel": undefined,
    "%export.bibtexExporterLabel": undefined,
    "%import.couldNotLoad": undefined,
    "%import.couldNotParse": undefined,
    "%import.missingOrFilesystem": undefined,
    "%import.httpError": undefined,
    "%import.failedAccess": undefined,
    "%import.failedAccessHttpStatus": undefined,
    "%database.itemType.label": "Elemento",
    "%database.itemType.pluralLabel": "Elementos",
    "%database.labelProperty.label": "etiqueta",
    "%database.labelProperty.pluralLabel": "etiquetas",
    "%database.labelProperty.reverseLabel": "etiqueta de",
    "%database.labelProperty.reversePluralLabel": "etiquetas de",
    "%database.typeProperty.label": "tipo",
    "%database.typeProperty.pluralLabel": "tipos",
    "%database.typeProperty.reverseLabel": "tipo de",
    "%database.typeProperty.reversePluralLabel": "tipos de",
    "%database.uriProperty.label": "URI",
    "%database.uriProperty.pluralLabel": "URIs",
    "%database.uriProperty.reverseLabel": "URI de",
    "%database.uriProperty.reversePuralLabel": undefined,
    "%database.sortLabels.text.ascending": "a - z",
    "%database.sortLabels.text.descending": "z - a",
    "%database.sortLabels.number.ascending": "menor primero",
    "%database.sortLabels.number.descending": "mayor primero",
    "%database.sortLabels.date.ascending": "la más antigua primero",
    "%database.sortLabels.date.descending": "la más reciente primero",
    "%database.sortLabels.boolean.ascending": "falso primero",
    "%database.sortLabels.boolean.descending": "verdadero primero",
    "%database.sortLabels.item.ascending": "a - z",
    "%database.sortLabels.item.descending": "z - a",
    "%database.reverseLabel": undefined,
    "%database.reversePluralLabel": undefined,
    "%coders.mixedCaseLabel": undefined,
    "%coders.missingCaseLabel": undefined,
    "%coders.othersCaseLabel": undefined,
    "%facets.clearSelectionsTooltip": "Eliminar estas selecciones",
    "%facets.facetSelectActionTitle": undefined,
    "%facets.facetUnselectActionTitle": undefined,
    "%facets.facetSelectOnlyActionTitle": undefined,
    "%facets.facetClearSelectionsActionTitle": undefined,
    "%facets.facetTextSearchActionTitle": undefined,
    "%facets.facetClearTextSearchActionTitle": undefined,
    "%facets.missingThisField": undefined,
    "%facets.missingLabel": undefined,
    "%facets.numeric.rangeShort": undefined,
    "%facets.numeric.rangeWords": undefined,
    "%facets.alpha.rangeShort": undefined,
    "%facets.alpha.rangeWords": undefined,
    "%facets.hierarchical.othersLabel": undefined,
    "%facets.hierarchical.rootLabel": undefined,
    "%views.unplottableTemplate": undefined,
    "%views.resultLabel": undefined,
    "%views.resultsLabel": undefined,
    "%viewPanel.selectViewActionTitle": "selecciona %1$s vista",
    "%viewPanel.missingViewClassMessage": "En la especificación de una de las vistas falta el campo viewClass.",
    "%viewPanel.viewClassNotFunctionMessage": "El valor del atributo viewClass '%1$s' espeficicado\nen una de las vistas no se corresponde con una función Javascript.",
    "%viewPanel.badViewClassMessage": "El valor del atributo viewClass '%1$s' especificado\nen una de las vistas no es una expresión Javascript válida.",
    "%viewPanel.viewSeparator": " • ",
    "%viewPanel.noViewLabel": undefined,
    "%TileView.label": undefined,
    "%TileView.tooltip": "Ver elementos en una lista detallada",
    "%ThumbnailView.label": undefined,
    "%ThumbnailView.tooltip": "Ver elementos como iconos",
    "%TabularView.label": "Tabla",
    "%TabularView.tooltip": "Ver elementos como una tabla",
    "%TabularView.columnHeaderSortTooltip": "Click para ordenar por esta columna",
    "%TabularView.columnHeaderReSortTooltip": "Click para ordenar inversamente",
    "%TabularView.sortColumnAscending": "ordenado acendentemente por %1$s",
    "%TabularView.sortColumnDescending": "ordenado descendentemente por %1$s",
    "%orderedViewFrame.removeOrderLabel": "Eliminar este orden",
    "%orderedViewFrame.sortingControlsTemplate": "ordenados por: ; luego por...",
    "%orderedViewFrame.formatSortActionTitle": "Ordenados por %1$s (%2$s)",
    "%orderedViewFrame.formatRemoveOrderActionTitle": "Eliminar ordenación por %1$s (%2$s)",
    "%orderedViewFrame.groupedAsSortedOptionLabel": "agrupar según orden",
    "%orderedViewFrame.groupAsSortedActionTitle": "agrupar según orden",
    "%orderedViewFrame.ungroupAsSortedActionTitle": "sin agrupar",
    "%orderedViewFrame.showAllActionTitle": undefined,
    "%orderedViewFrame.dontShowAllActionTitle": undefined,
    "%orderedViewFrame.formatDontShowAll": "Mostrar solamente %1$d resultados",
    "%orderedViewFrame.formatShowAll": "Mostrar %1$d resultados",
    "%orderedViewFrame.pageWindowEllipses": undefined,
    "%orderedViewFrame.pageSeparator": undefined,
    "%orderedViewFrame.previousPage": undefined,
    "%orderedViewFrame.nextPage": undefined,
    "%orderedViewFrame.pagingActionTitle": undefined,
    "%orderedViewFrame.pagingLinkTooltip": undefined,
    "%widget.bookmark.tooltip": undefined,
    "%widget.collectionSummary.resetFiltersLabel": undefined,
    "%widget.collectionSummary.resetFiltersTooltip": "Elimina algunos filtros para obtener resultados.",
    "%widget.collectionSummary.resetActionTitle": undefined,
    "%widget.collectionSummary.allResultsTemplate": "",
    "%widget.collectionSummary.noResultsTemplate": "0 resultados ()",
    "%widget.collectionSummary.filteredResultsTemplate": " filtered from 0 originally ()",
    "%formatter.listSeparator": ", ",
    "%formatter.listLastSeparator": ", y ",
    "%formatter.listPairSeparator": " y ",
    "%formatter.textEllipsis": "...",
    "%formatter.booleanTrue": undefined,
    "%formatter.booleanFalse": undefined,
    "%formatter.currencySymbol": "$",
    "%formatter.currencySymbolPlacement": "first",
    "%formatter.currencyShowSign": true,
    "%formatter.currencyShowRed": false,
    "%formatter.currencyShowParentheses": false,
    "%formatter.dateTimeDefaultFormat": "EEE, MMM d, yyyy, hh:mm a",
    "%formatter.dateShortFormat": "dd/MM/yy",
    "%formatter.timeShortFormat": "hh:mm a",
    "%formatter.dateTimeShortFormat": "dd/MM/yy hh:mm a",
    "%formatter.dateMediumFormat": "EEE, MMM d, yyyy",
    "%formatter.timeMediumFormat": "hh:mm a",
    "%formatter.dateTimeMediumFormat": "EEE, MMM d, yyyy, hh:mm a",
    "%formatter.dateLongFormat": "EEEE, MMMM d, yyyy",
    "%formatter.timeLongFormat": "HH:mm:ss z",
    "%formatter.dateTimeLongFormat": "EEEE, MMMM d, yyyy, HH:mm:ss z",
    "%formatter.dateFullFormat": "EEEE, MMMM d, yyyy",
    "%formatter.timeFullFormat": "HH:mm:ss.S z",
    "%formatter.dateTimeFullFormat": "EEEE, MMMM d, yyyy G, HH:mm:ss.S z",
    "%formatter.shortDaysOfWeek": undefined,
    "%formatter.daysOfWeek": undefined,
    "%formatter.shortMonths": undefined,
    "%formatter.months": undefined,
    "%formatter.commonEra": "CE",
    "%formatter.beforeCommonEra": "BCE",
    "%formatter.beforeNoon": "am",
    "%formatter.afterNoon": "pm",
    "%formatter.BeforeNoon": "AM",
    "%formatter.AfterNoon": "PM"
});
<commit_msg>Improving spanish translation<commit_after>Exhibit.Localization.importLocale("es", {
    "%general.missingLabel": "falta",
    "%general.missingSortKey": "(falta)",
    "%general.notApplicableSortKey": "(n/a)",
    "%general.itemLinkLabel": "enlace",
    "%general.busyIndicatorMessage": "Procesando...",
    "%general.showDocumentationMessage": "Te enseñaremos la documentación asociada después de este mensaje.",
    "%general.showJavascriptValidationMessage": "Te explicaremos los detalles del error después de este mensaje.",
    "%general.showJsonValidationMessage": "Te explicaremos los detalles del error después de este mensaje.",
    "%general.showJsonValidationFormMessage": "Te redirigiremos a un servicio web donde podrás subir y verificar tu código después de este mensaje.",
    "%general.badJsonMessage": "El fichero de datos JSON\n %1$s\ncontiene errores =\n\n%2$s",
    "%general.failedToLoadDataFileMessage": "No podemos localizar el fichero de datos\n %1$s\nComprueba que el nombre del archivo es correcto.",
    "%general.error.disposeCollection": "Error al disponer de la collección",
    "%general.error.cannotRegister": "No se puede registrar componente %1$s --",
    "%general.error.componentNameTaken": "otro componente ha cogido ese nombre",
    "%general.error.noComponentObject": "%1$s no component object provided",
    "%general.error.missingCreateFunction": "%1$s component has no create function",
    "%general.error.missingDOMCreateFunction": "%1$s component has no createFromDOM function",
    "%general.error.unknownViewClass": "Unknown viewClass: %1$s",
    "%general.error.unknownFacetClass": "Unknown facetClass: %1$s",
    "%general.error.unknownCoderClass": "Unknown coderClass: %1$s",
    "%general.error.unknownClass": "Unknown class: %1$s",
    "%general.error.unknownLensType": "Unknown Exhibit.UI.showItemInPopup opts.lensType: %1$s",
    "%general.error.lensSelectorNotFunction": "lensSelector is not a function",
    "%general.error.lensSelectorExpressionNotFunction": "lensSelector expression %1$s is not a function",
    "%general.error.badLensSelectorExpression": "Bad lensSelector expression: %1$s",
    "%general.error.dataloadExecution": "Could not run your ondataload function; consider using a jQuery event listener for 'dataload.exhibit' instead of embedding it in the document body.",

    "%export.exportButtonLabel": "Exportar",
    "%export.exportAllButtonLabel": "Exportar todo",
    "%export.exportDialogBoxCloseButtonLabel": undefined,
    "%export.exportDialogBoxPrompt": undefined,
    "%export.focusDialogBoxCloseButtonLabel": "Cerrar",
    "%export.rdfXmlExporterLabel": "RDF/XML",
    "%export.smwExporterLabel": "Semantic wikitext",
    "%export.exhibitJsonExporterLabel": "Exhibit JSON",
    "%export.tsvExporterLabel": undefined,
    "%export.htmlExporterLabel": undefined,
    "%export.bibtexExporterLabel": undefined,
    "%import.couldNotLoad": undefined,
    "%import.couldNotParse": undefined,
    "%import.missingOrFilesystem": undefined,
    "%import.httpError": undefined,
    "%import.failedAccess": undefined,
    "%import.failedAccessHttpStatus": undefined,
    "%database.itemType.label": "Elemento",
    "%database.itemType.pluralLabel": "Elementos",
    "%database.labelProperty.label": "etiqueta",
    "%database.labelProperty.pluralLabel": "etiquetas",
    "%database.labelProperty.reverseLabel": "etiqueta de",
    "%database.labelProperty.reversePluralLabel": "etiquetas de",
    "%database.typeProperty.label": "tipo",
    "%database.typeProperty.pluralLabel": "tipos",
    "%database.typeProperty.reverseLabel": "tipo de",
    "%database.typeProperty.reversePluralLabel": "tipos de",
    "%database.uriProperty.label": "URI",
    "%database.uriProperty.pluralLabel": "URIs",
    "%database.uriProperty.reverseLabel": "URI de",
    "%database.uriProperty.reversePuralLabel": undefined,
    "%database.sortLabels.text.ascending": "a - z",
    "%database.sortLabels.text.descending": "z - a",
    "%database.sortLabels.number.ascending": "menor primero",
    "%database.sortLabels.number.descending": "mayor primero",
    "%database.sortLabels.date.ascending": "la más antigua primero",
    "%database.sortLabels.date.descending": "la más reciente primero",
    "%database.sortLabels.boolean.ascending": "falso primero",
    "%database.sortLabels.boolean.descending": "verdadero primero",
    "%database.sortLabels.item.ascending": "a - z",
    "%database.sortLabels.item.descending": "z - a",
    "%database.reverseLabel": undefined,
    "%database.reversePluralLabel": undefined,
    "%coders.mixedCaseLabel": undefined,
    "%coders.missingCaseLabel": undefined,
    "%coders.othersCaseLabel": undefined,
    "%facets.clearSelectionsTooltip": "Eliminar estas selecciones",
    "%facets.facetSelectActionTitle": undefined,
    "%facets.facetUnselectActionTitle": undefined,
    "%facets.facetSelectOnlyActionTitle": undefined,
    "%facets.facetClearSelectionsActionTitle": undefined,
    "%facets.facetTextSearchActionTitle": undefined,
    "%facets.facetClearTextSearchActionTitle": undefined,
    "%facets.missingThisField": undefined,
    "%facets.missingLabel": undefined,
    "%facets.numeric.rangeShort": undefined,
    "%facets.numeric.rangeWords": undefined,
    "%facets.alpha.rangeShort": undefined,
    "%facets.alpha.rangeWords": undefined,
    "%facets.hierarchical.othersLabel": undefined,
    "%facets.hierarchical.rootLabel": undefined,
    "%views.unplottableTemplate": undefined,
    "%views.resultLabel": undefined,
    "%views.resultsLabel": undefined,
    "%viewPanel.selectViewActionTitle": "selecciona %1$s vista",
    "%viewPanel.missingViewClassMessage": "En la especificación de una de las vistas falta el campo viewClass.",
    "%viewPanel.viewClassNotFunctionMessage": "El valor del atributo viewClass '%1$s' espeficicado\nen una de las vistas no se corresponde con una función Javascript.",
    "%viewPanel.badViewClassMessage": "El valor del atributo viewClass '%1$s' especificado\nen una de las vistas no es una expresión Javascript válida.",
    "%viewPanel.viewSeparator": " • ",
    "%viewPanel.noViewLabel": undefined,
    "%TileView.label": undefined,
    "%TileView.tooltip": "Ver elementos en una lista detallada",
    "%ThumbnailView.label": undefined,
    "%ThumbnailView.tooltip": "Ver elementos como iconos",
    "%TabularView.label": "Tabla",
    "%TabularView.tooltip": "Ver elementos como una tabla",
    "%TabularView.columnHeaderSortTooltip": "Click para ordenar por esta columna",
    "%TabularView.columnHeaderReSortTooltip": "Click para ordenar inversamente",
    "%TabularView.sortColumnAscending": "ordenado acendentemente por %1$s",
    "%TabularView.sortColumnDescending": "ordenado descendentemente por %1$s",
    "%orderedViewFrame.removeOrderLabel": "Eliminar este orden",
    "%orderedViewFrame.sortingControlsTemplate": "ordenados por: ; luego por...",
    "%orderedViewFrame.formatSortActionTitle": "Ordenados por %1$s (%2$s)",
    "%orderedViewFrame.formatRemoveOrderActionTitle": "Eliminar ordenación por %1$s (%2$s)",
    "%orderedViewFrame.groupedAsSortedOptionLabel": "agrupar según orden",
    "%orderedViewFrame.groupAsSortedActionTitle": "agrupar según orden",
    "%orderedViewFrame.ungroupAsSortedActionTitle": "sin agrupar",
    "%orderedViewFrame.showAllActionTitle": undefined,
    "%orderedViewFrame.dontShowAllActionTitle": undefined,
    "%orderedViewFrame.formatDontShowAll": "Mostrar solamente %1$d resultados",
    "%orderedViewFrame.formatShowAll": "Mostrar %1$d resultados",
    "%orderedViewFrame.pageWindowEllipses": undefined,
    "%orderedViewFrame.pageSeparator": undefined,
    "%orderedViewFrame.previousPage": undefined,
    "%orderedViewFrame.nextPage": undefined,
    "%orderedViewFrame.pagingActionTitle": undefined,
    "%orderedViewFrame.pagingLinkTooltip": undefined,
    "%widget.bookmark.tooltip": undefined,

    "%widget.collectionSummary.resetFiltersLabel": "Reiniciar los filtros",
    "%widget.collectionSummary.resetFiltersTooltip": "Elimina algunos filtros para obtener resultados.",
    "%widget.collectionSummary.resetActionTitle": "Reiniciar los filtros",
    "%widget.collectionSummary.allResultsTemplate": "",
    "%widget.collectionSummary.noResultsTemplate": "0 resultados ()",
    "%widget.collectionSummary.filteredResultsTemplate": " filtrados de 0 en total ()",
    "%formatter.listSeparator": ", ",
    "%formatter.listLastSeparator": ", y ",
    "%formatter.listPairSeparator": " y ",
    "%formatter.textEllipsis": "...",
    "%formatter.booleanTrue": undefined,
    "%formatter.booleanFalse": undefined,
    "%formatter.currencySymbol": "$",
    "%formatter.currencySymbolPlacement": "first",
    "%formatter.currencyShowSign": true,
    "%formatter.currencyShowRed": false,
    "%formatter.currencyShowParentheses": false,
    "%formatter.dateTimeDefaultFormat": "EEE, MMM d, yyyy, hh:mm a",
    "%formatter.dateShortFormat": "dd/MM/yy",
    "%formatter.timeShortFormat": "hh:mm a",
    "%formatter.dateTimeShortFormat": "dd/MM/yy hh:mm a",
    "%formatter.dateMediumFormat": "EEE, MMM d, yyyy",
    "%formatter.timeMediumFormat": "hh:mm a",
    "%formatter.dateTimeMediumFormat": "EEE, MMM d, yyyy, hh:mm a",
    "%formatter.dateLongFormat": "EEEE, MMMM d, yyyy",
    "%formatter.timeLongFormat": "HH:mm:ss z",
    "%formatter.dateTimeLongFormat": "EEEE, MMMM d, yyyy, HH:mm:ss z",
    "%formatter.dateFullFormat": "EEEE, MMMM d, yyyy",
    "%formatter.timeFullFormat": "HH:mm:ss.S z",
    "%formatter.dateTimeFullFormat": "EEEE, MMMM d, yyyy G, HH:mm:ss.S z",
    "%formatter.shortDaysOfWeek": undefined,
    "%formatter.daysOfWeek": undefined,
    "%formatter.shortMonths": undefined,
    "%formatter.months": undefined,
    "%formatter.commonEra": "CE",
    "%formatter.beforeCommonEra": "BCE",
    "%formatter.beforeNoon": "am",
    "%formatter.afterNoon": "pm",
    "%formatter.BeforeNoon": "AM",
    "%formatter.AfterNoon": "PM"
});
<|endoftext|>