code stringlengths 2 1.05M |
|---|
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var cp = require('child_process');
var cssnano = require('gulp-cssnano');
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
var messages = {
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
};
/**
* Compile files from _scss into both _site/css (for live injecting) and site (for future jekyll builds)
*/
gulp.task('sass', gulp.series(function (done) {
return gulp.src('_scss/main.scss')
.pipe(sass({
includePaths: ['scss'],
onError: browserSync.notify
}))
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
.pipe(cssnano())
.pipe(gulp.dest('_site/css'))
.pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest('css'));
}));
/**
* Build the Jekyll Site
*/
gulp.task('jekyll-build', gulp.series(function (done) {
browserSync.notify(messages.jekyllBuild);
return cp.spawn( jekyll , ['build'], {stdio: 'inherit'})
.on('close', done);
}));
/**
* Rebuild Jekyll & do page reload
*/
gulp.task('jekyll-rebuild', gulp.series('jekyll-build', function (done) {
browserSync.reload();
done();
}));
/**
* Wait for jekyll-build, then launch the Server
*/
gulp.task('browser-sync', gulp.series('sass', 'jekyll-build', function(done) {
browserSync({
port: 4000,
server: {
baseDir: '_site'
},
browser: 'google chrome'
});
done();
}));
/**
* Watch scss files for changes & recompile
* Watch html/md files, run jekyll & reload BrowserSync
*/
gulp.task('watch', gulp.parallel(function () {
gulp.watch('_scss/**/*.scss', gulp.series('sass'));
gulp.watch(['*.html', '_situations/*.md', '_layouts/*.html', '_includes/*.html', '_posts/*', '_situations/*', 'style-guide/*', 'brightx/*'], gulp.series('jekyll-rebuild'));
}));
/**
* Default task, running just `gulp` will compile the sass,
* compile the jekyll site, launch BrowserSync & watch files.
*/
gulp.task('default', gulp.series('browser-sync', 'watch'));
|
var fs = require('fs');
fs.readFile('input.txt', 'utf8', function(err, contents) {
var distances = contents.split('\n');
var distanceMap = buildDistanceMap(distances);
var solution = calculatePaths(distanceMap);
console.log(solution);
});
// Build a map so that given any initial point a, it is easy
// to lookup the distance to any other point b.
var buildDistanceMap = function(distances) {
var distanceMap = {};
distances.forEach(function(distance) {
var split = distance.split(' ');
var a = split[0];
var b = split[2];
var dist = parseInt(split[4]);
if (!distanceMap[a]) {
distanceMap[a] = {};
}
if (!distanceMap[b]) {
distanceMap[b] = {};
}
distanceMap[a][b] = dist;
distanceMap[b][a] = dist;
});
return distanceMap;
};
var calculatePaths = function(distanceMap) {
var nodes = Object.keys(distanceMap);
var permutations = permutateNodes(nodes);
var shortestPath = {};
var longestPath = { distance: 0 };
permutations.forEach(function(perm) {
var totalDistance = 0;
for (var i = 0; i < perm.length - 1; i++) {
totalDistance += distanceMap[perm[i]][perm[i+1]];
}
if (totalDistance < shortestPath.distance || !shortestPath.distance) {
shortestPath.distance = totalDistance;
shortestPath.route = perm;
}
if (totalDistance > longestPath.distance) {
longestPath.distance = totalDistance;
longestPath.route = perm;
}
});
return [shortestPath, longestPath];
};
var permutateNodes = function(nodes) {
var permutations = [];
if (nodes.length === 1) {
return [nodes];
}
for (var i = 0; i < nodes.length; i++) {
var subPermutations = permutateNodes(nodes.slice(0, i).concat(nodes.slice(i + 1)));
for (var j = 0; j < subPermutations.length; j++) {
subPermutations[j].unshift(nodes[i]);
permutations.push(subPermutations[j]);
}
}
return permutations;
} |
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<g><path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" /></g>
, 'ExitToApp');
|
/**
* The OpenWeatherJS Library.
* The JavaScript library to work with weather information and forecasts data
* provided by Open Weather Map. Built using TypeScript.
*
* The MIT License (MIT)
*
* Copyright (C) 2016 The OpenWeatherJS Project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
QUnit.test('CurrentWeather', function(assert) {
var options = OpenWeatherJS.Options.getInstance();
options.setKey('1d334b0f0f23fccba1cee7d3f4934ea7');
options.setUnits(OpenWeatherJS.Units.DEFAULT);
var location = OpenWeatherJS.Location.getById(6198442);
var done = assert.async();
OpenWeatherJS.CurrentWeather.getWeather(location,
function(entry, request) {
assert.ok(true, 'API call is success.');
assert.ok(OpenWeatherJS.WeatherCondition[entry.getWeatherCondition()], 'Weather condition value is valid.');
entry.getWeatherDescription();
entry.getWeatherIconId();
assert.ok((entry.getTemperature() >= 230) && (entry.getTemperature() <= 320), 'Temperature value is in the range');
assert.ok((entry.getPressure() >= 980) && (entry.getPressure() <= 1050), 'Pressure value is in the range');
assert.ok((entry.getHumidity() >= 0) && (entry.getHumidity() <= 100), 'Humidity value is in the range');
assert.ok((entry.getMinimum() >= 230) && (entry.getMinimum() <= 320), 'Minimum value is in the range');
assert.ok((entry.getMaximum() >= 230) && (entry.getMaximum() <= 320), 'Maximum value is in the range');
assert.ok((entry.getSeaLevelPressure() >= 980) && (entry.getSeaLevelPressure() <= 1050), 'Sea level pressure value is in the range');
assert.ok((entry.getGroundLevelPressure() >= 980) && (entry.getGroundLevelPressure() <= 1050), 'Ground level pressure value is in the range');
assert.ok((entry.getWindSpeed() >= 0) && (entry.getWindSpeed() <= 16), 'Wind speed value is in the range');
assert.ok((entry.getWindDirection() >= 0) && (entry.getWindDirection() <= 360), 'Wind direction value is in the range');
assert.ok((entry.getCloudiness() >= 0) && (entry.getCloudiness() <= 100), 'Cloudiness value is in the range');
assert.ok((entry.getRainVolume() >= 0) && (entry.getRainVolume() <= 10), 'Rain volume is in the range');
assert.ok((entry.getSnowVolume() >= 0) && (entry.getSnowVolume() <= 10), 'Snow volume value is in the range');
assert.strictEqual(entry.getLocation().getId(), 6198442, 'Location id is 6198442.');
assert.strictEqual(entry.getLocation().getName(), 'Cheboksary', 'Location name is Cheboksary.');
assert.strictEqual(entry.getLocation().getLatitude(), 56.17, 'Location latitude is 56.17.');
assert.strictEqual(entry.getLocation().getLongitude(), 47.29, 'Location longitude is 47.29.');
assert.strictEqual(entry.getLocation().getCountry(), 'RU', 'Location country is RU.');
entry.getTime();
done();
}.bind(this),
function(request, message) {
assert.notOk(true, 'API call is failed: ' + request.responseText + ' ' + message);
done();
}.bind(this));
/* Metrics */
var doneMetric = assert.async();
options.setUnits(OpenWeatherJS.Units.METRIC);
OpenWeatherJS.CurrentWeather.getWeather(location,
function(entry, request) {
assert.ok((entry.getTemperature() >= -43) && (entry.getTemperature() <= 46), 'Temperature value is in the range');
assert.ok((entry.getMinimum() >= -43) && (entry.getMinimum() <= 46), 'Minimum value is in the range');
assert.ok((entry.getMaximum() >= -43) && (entry.getMaximum() <= 46), 'Maximum value is in the range');
assert.ok((entry.getWindSpeed() >= 0) && (entry.getWindSpeed() <= 16), 'Wind speed value is in the range');
doneMetric();
}.bind(this),
function(request, message) {
assert.notOk(true, 'API call is failed: ' + request.responseText + ' ' + message);
doneMetric();
}.bind(this));
/* Imperial */
var doneImperial = assert.async();
options.setUnits(OpenWeatherJS.Units.IMPERIAL);
OpenWeatherJS.CurrentWeather.getWeather(location,
function(entry, request) {
assert.ok((entry.getTemperature() >= -45) && (entry.getTemperature() <= 116), 'Temperature value is in the range');
assert.ok((entry.getMinimum() >= -45) && (entry.getMinimum() <= 116), 'Minimum value is in the range');
assert.ok((entry.getMaximum() >= -45) && (entry.getMaximum() <= 116), 'Maximum value is in the range');
assert.ok((entry.getWindSpeed() >= 0) && (entry.getWindSpeed() <= 35), 'Wind speed value is in the range');
doneImperial();
}.bind(this),
function(request, message) {
assert.notOk(true, 'API call is failed: ' + request.responseText + ' ' + message);
doneImperial();
}.bind(this));
}); |
/* The view. This takes care of hooking into the Gmail page,
* and sending appropriate events to the controller whenever
* the user or Gmail does something we're interested in.
*
* There are two views: RegularView and UpdatedView.
* RegularView takes care of interposing on the old
* Gmail Compose, whereas UpdatedView is for the new
* Compose that came out in November 2012.
*/
var UpdatedView = function () {
if (arguments.callee.singleton_instance) {
// return existing instance
return arguments.callee.singleton_instance;
}
// create singleton instance
arguments.callee.singleton_instance = new (function () {
/* PROPERTIES */
// reference to the view ("this")
var cloudy_view;
// enabled/disabled boolean
var view_enabled;
// a temporary <input type="file"> element. Used when simulating local
// attachments (when the users has turned Cloudy off)
var tmpinputelem;
// JQuery callbacks, through which the view talks to its observers
var view_callbacks;
// URL to Cloudy icons, on and off
var cloudimgurl;
var cloudimgoffurl;
// URLs to status images -- success and error
var dwnldcompleteimgurl;
var errorimgurl;
// in the new Compose, we can have many compose windows open.
// This is a map: ID -> compose window. The ID we use is the
// DOM id of the "attach" button of the message.
var composeMessages = {};
/* PUBLIC METHODS */
/* Registers a callback function. Used by objects to subscribe to
* events that this View is interposing on.
*/
this.addObserver = function(fn) {
view_callbacks.add(fn);
}
/* Callers use this function to pass a file to Gmail to be attached.
* With the new-style compose, we need to know which message the file
* is being attached to, so we pass the messageID.
*/
this.attachFiles = function (filesArray, messageId) {
// This should never happen. If we don't have a handle to the input
// element added by Gmail, we cannot signal to Gmail that files
// were added.
var inputElem = composeMessages[messageId].inputElem;
if (!inputElem) {
alert("General error in Cloudy extension. " +
"Disabling and reverting to regular " +
"attachment mechanism.");
view_enabled = false;
return;
}
inputElem.__defineGetter__("files", function(){
return filesArray;
});
if (!inputElem.parentNode) {
// Gmail removes the <input type="file"> element upon detecting
// that the user chose a file. If already removed because of
// another attachment, we insert the element back into the DOM,
// so that we don't get a nullPointer error when Gmail calls
// removeChild() on its parent.
inputElem.style.display = "none";
$jQcl(inputElem).prependTo($jQcl(document.body));
}
if ("fireEvent" in inputElem)
inputElem.fireEvent("onchange");
else {
var evt = top.document.createEvent("HTMLEvents");
evt.initEvent("change", false, true);
inputElem.dispatchEvent(evt);
}
}
/* Add download view to show the user a file's download progress from
* the cloud.
*/
this.addDownloadView = function(dwnldViewId, filename, size,
messageId) {
var downloadview = $jQcl(downloaddivUpdatedViewhtml)
.prependTo(composeMessages[messageId].injectionPoint);
downloadview.attr("id", dwnldViewId);
downloadview.parents().eq(1).css("display", "");
downloadview.find(".cloudy_updatedview_download_filename").text(
filename);
var sizestr = isNaN(size) ? "" : "(" + Math.ceil(size/1024) + "K)";
downloadview.find(".cloudy_updatedview_download_size").html(
sizestr);
downloadview.find(".cloudy_updatedview_download_statusicon")
.attr("src",
getData("downloadloading_path"));
}
/* Update the download view of a file to reflect new state of the
* download.
*/
this.updateDownloadView = function(dwnldViewId, state, messageId) {
if (state === "done") {
setDownloadViewStatus(dwnldViewId, "Done!",
dwnldcompleteimgurl, true);
} else if (state === "processing") {
setDownloadViewStatus(dwnldViewId, "Processing:");
} else if (state === "maxSizeExceeded") {
setDownloadViewStatus(dwnldViewId,
"25MB limit exceeded:", errorimgurl, true);
} else if (state === "error") {
setDownloadViewStatus(dwnldViewId,
"Error:", errorimgurl, true);
}
}
/* PRIVATE METHODS */
/* Retrieve data passed by content script.
*/
var getBootstrapData = function(id) {
return document.getElementById(id + "_gmailr_data")
.getAttribute('data-val');
}
/* Called every second by a timer. Checks if the user has a new-style
* Compose window open in Gmail. This is done by checking the page
* for textareas named "subject". For each uninitialized such textarea,
* we have to remember the new compose message in our composeMessages
* dictionary, and override the default attachment icon with Cloudy's
* icon.
*/
var checkCompose = function() {
// #selector
var tofields = $jQcl(document.getElementsByName('subject'));
var foundUninitialized = false;
for (var i = 0; i < tofields.length; i++) {
if (!tofields.eq(i).data("cloudy_initialized")) {
foundUninitialized = true;
break;
}
}
if (foundUninitialized) {
console.log("setting Cloudy icons");
// #selector
var attachmentIcons =
$jQcl("[command=Files]").children().children()
.children();
attachmentIcons.each(function () {
if (!$jQcl(this).data("cloudy_initialized")) {
//$jQcl(this).css("background-image", "url(" +
// getData("cloudicon_newcompose_thick_path") + ")");
$jQcl(this).css("cssText", "background: " +
"url(" + getData("cloudicon_newcompose_thick_path")+
") no-repeat 0px 0px / 21px 16px!important");
$jQcl(this).addClass("cloudy_icon_updatedview");
composeMessages[this.id] = {};
// This <span> is the element above which we'll inject
// notification areas in the Compose window we're
// currently initializing.
composeMessages[this.id]["injectionPoint"] =
$jQcl(this).parents("tbody").find("span.el.vK")
.parents().eq(0);
$jQcl(this).data("cloudy_initialized", true);
}
});
tofields.data("cloudy_initialized", true);
}
}
/* Toggle enabled/disabled state of the view (i.e. of the application)
* Update GUI to reflect this change.
* Note: with the new-style Compose, there is no easy way to disable
* Cloudy. The only way it will happen is if Cloudy encounters an error
* and disables itself.
*/
var toggleEnabled = function() {
view_enabled = !view_enabled;
/*TODO for (var i=0; i<rows.length; i++) {
updateCloudyIcon(rows[i], false);
}*/
}
/* In case of an error, even if we have already interposed on Gmail's
* original attachment mechanisms, we need to bring up a local file
* selection dialog. This function creates a temporary <input> element
* and sets our custom element's .files field to the <input> element's
* .files array.
*/
var simulateLocalAttachment = function(messageId) {
if (tmpinputelem)
$jQcl(tmpinputelem).remove();
tmpinputelem = $jQcl('<input type="file" class="cloudy_invisible">')
.appendTo("#tmpparent");
tmpinputelem.change(function() {
cloudy_view.attachFiles(this.files, messageId);
$jQcl(this).remove();
tmpinputelem = null;
});
$jQcl(tmpinputelem).trigger('click');
}
/* Helper method used by updateDownloadView to set the status of a
* downloading file's notification area.
*/
var setDownloadViewStatus = function(dwnldViewId, text, imgurl,
clear) {
var progdiv = $jQcl(document.getElementById(dwnldViewId));
progdiv.find(".cloudy_updatedview_download_msg").text(text);
if (imgurl)
progdiv.find(".cloudy_updatedview_download_statusicon")
.attr("src", imgurl);
if (clear)
setTimeout(function(){
progdiv.remove();
}, 7500);
}
/* Initialize an element of type <input> (which we have in fact turned
* into a <div>).
*/
var initInputElement = function(elem) {
/* Remember the <input> element associated with this
* message, so that we can later simulate a "change"
* event on it.
*/
var currentMsg = $jQcl(document.activeElement).children()
.children().children().eq(0)[0];
composeMessages[currentMsg.id]["inputElem"] = elem;
/* Define behavior on click() -- open a FilePicker
* dialog and, once the user chooses a file, notify Controller (by
* firing an attach event), which will take care of creating a
* handler to start downloading the file.
*/
$jQcl(elem).click(function (e) {
var currentEmail = $jQcl(document.activeElement).children()
.children().children().eq(0)[0];
if (view_enabled && Gmailr.filepickerLoaded){
e.preventDefault();
// check if user has removed some services
var services_enabled = getBootstrapData("cloudy_services");
var options = {};
if (services_enabled !== "undefined") {
options.services = window.JSON.parse(services_enabled);
}
var multifile = getBootstrapData("cloudy_multifile");
var pickfunc = multifile === "multiple"?
filepicker.pickMultiple : filepicker.pick;
pickfunc(options, function(fpfiles) {
// user successfully picked one or more files
// fire "attach" event
if (Object.prototype.toString.call(fpfiles) !==
'[object Array]') {
view_callbacks.fire("attach", fpfiles,
currentEmail.id);
} else {
for (var i = 0; i < fpfiles.length; i++) {
view_callbacks.fire("attach", fpfiles[i],
currentEmail.id);
}
}
// add signature to email (if option enabled)
var signature_enabled =
getBootstrapData("cloudy_signature");
if (signature_enabled === "true") {
// find "editable" div
// #selector
var email_textarea = $jQcl(currentEmail).parents(".I5")
.find("div.editable");
if (composeMessages[currentMsg.id].addedSignature ||
email_textarea.eq(0)
.find("a:contains('Cloudy for Gmail')")
.length > 0) {
return;
}
var link = $jQcl("<div />").addClass(
"cloudy_share_link").html("<p>Sent with " +
"<a href='https://chrome.google.com/webstore/detail/cloudy-for-gmail/fcfnjfpcmnoabmbhponbioedjceaddaa?utm_source=gmail&utm_medium=email&utm_campaign=gmail_signature' " +
"target='_blank' >Cloudy for Gmail" +
"</a></p>");
$jQcl("<br />").appendTo(email_textarea);
$jQcl("<br />").appendTo(email_textarea);
link.appendTo(email_textarea);
composeMessages[currentMsg.id].addedSignature =
true;
}
}, function (FPError) {
elem.parentNode.removeChild(elem);
});
} else {
simulateLocalAttachment();
}
});
}
/* Gmail uses a container div to create <input type="file"> elements.
* Override the div's removeChild method to return an element
* which we control.
* Set that element to be a 'div' instead of 'input', as we later
* need to set elem.files = [blob], which is not allowed
* on input elements for security reasons.
*/
var initContainerDiv = function(container) {
// IMPORTANT: IF YOU REUSE THIS CODE, RENAME THIS PROPERTY
// TO container.<yourapp>_orig_removeChild. THIS WILL ALLOW
// CLOUDY AND YOUR EXTENSION TO COEXIST.
container.cloudy_orig_removeChild = container.removeChild;
container.removeChild = function(child) {
child = this.cloudy_orig_removeChild(child);
var currentElem = document.activeElement;
if (child.tagName && child.tagName.toLowerCase() === "input" &&
child.type && child.type.toLowerCase() === "file" &&
currentElem.innerText.length < 30 &&
currentElem.attributes.command &&
currentElem.attributes.command.value === "Files") {
var parentdiv = top.document.createElement("div");
parentdiv.appendChild(child);
childhtml = parentdiv.innerHTML;
parentdiv.cloudy_orig_removeChild(child);
childhtml = childhtml.replace("input", "div");
parentdiv.innerHTML = childhtml;
child = parentdiv.cloudy_orig_removeChild(parentdiv.firstChild);
initInputElement(child);
}
return child;
}
}
/* Override the default createElement method to be able to intercept
* creation of div elements, which might be used by Gmail to create
* a <input> element.
* Currently, Gmail creates a parent div, then sets its innerHTML
* to <input type="file" id=...>, and finally calls removeChild()
* on that div to return the new <input> element.
*/
var interposeCreateElem = function() {
// IMPORTANT: IF YOU REUSE THIS CODE, RENAME THIS PROPERTY
// TO top.document.<yourapp>_gmail_createElement. THIS WILL ALLOW
// CLOUDY AND YOUR EXTENSION TO COEXIST.
top.document.cloudy_gmail_createElement = top.document.createElement;
top.document.createElement = function(htmlstr) {
var currentElem = document.activeElement;
var result;
if (htmlstr.indexOf("div") !== -1) {
result = top.document.cloudy_gmail_createElement(htmlstr);
initContainerDiv(result);
} else if (currentElem.innerText.length < 30 &&
currentElem.command === "Files" &&
htmlstr.indexOf("input") !== -1) {
htmlstr.replace("input", "div");
result = top.document.cloudy_gmail_createElement(htmlstr);
cloudy_view._initInputElement(result);
} else {
result = top.document.cloudy_gmail_createElement(htmlstr);
}
return result;
}
}
/* Override the default appendChild method to intercept appending
* of the <input type='file'> element we need to catch in order
* to modify the default behavior.
*/
var interposeAppendChild = function() {
var body = top.document.body;
body.cloudy_gmail_appendChild = body.appendChild;
body.appendChild = function(child) {
var currentElem = document.activeElement;
if (child.tagName && child.tagName.toLowerCase() === "input" &&
child.type && child.type.toLowerCase() === "file" &&
currentElem.innerText.length < 30 &&
currentElem.attributes.command &&
currentElem.attributes.command.value === "Files") {
initInputElement(child);
}
this.cloudy_gmail_appendChild(child);
return child;
}
}
var init = function() {
// get templates from DOM
var templates = Templates();
// get URL to cloud icon -- to add next to "attach a file" link
cloudimgurl = getData("cloudiconon_path");
cloudimgoffurl = getData("cloudiconoff_path");
errorimgurl = getData("erroricon_path");
dwnldcompleteimgurl = getData("downloadcomplete_path");
downloaddivUpdatedViewhtml = templates.updatedViewDownload;
// erase data divs passed in DOM
$jQcl("#filepicker_customrow_template").remove();
$jQcl("#filepicker_customprogress_template").remove();
// add tmpparent div, used to add elements temporarily to the DOM
var tmpParentHtml =
$jQcl("<div id='tmpparent' style='display: none;'></div>");
tmpParentHtml.prependTo($jQcl(document.body));
// initialize callbacks object, so the Controller can bind callbacks
// to the View.
view_callbacks = $jQcl.Callbacks();
// Check for "Compose" mode every second.
setInterval(function() {checkCompose()}, 500);
// interpose on key document functions to catch when the user is
// attaching a file
interposeCreateElem();
interposeAppendChild();
// set View as enabled. Marking this as false effectively disables
// the entire extension, as it will no longer receive any inputs.
view_enabled = true;
// set the reference to the view
cloudy_view = this;
}
init.call(this);
return this;
})();
return arguments.callee.singleton_instance;
}
|
;(function(ns, window, document, undefined){
var fextend = function(f, a){
f.prototype = Object.create(this.prototype);
for (var k in a) {
Object.defineProperty(f.prototype, k, Object.getOwnPropertyDescriptor(a, k));
}
f.prototype.constructor = f;
f.extend = extend;
f.fextend = fextend;
return f;
}, extend = function(a){
var f = function(){
if (this.init){
this.init.apply(this, arguments);
}
};
return fextend.call(this, f, a);
};
var zero = ns['olamedia'] || {
isUndefined: function(v){
return 'undefined' === typeof v;
},
Class: extend.call(Function, {}),
uuidv4: function(){
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
},
localStorage: window.localStorage || null,
WebSocket: window.WebSocket || window.MozWebSocket || null,
JSON: window.JSON || null,
cookie: {
get: function(n){
return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(n).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
}
},
eon: function(el, type, listener){
if (window.addEventListener) {
el.addEventListener(type, listener);
}else{ //IE8
el.attachEvent('on' + type, listener);
}
return this;
},
on: function(type, listener) {
return zero.eon(window, type, listener);
},
don: function(type, listener) {
return zero.eon(document, type, listener);
},
microtime: function() {
return (new Date()).getTime() / 1000;
},
mtime: function() {
return Math.round(zero.microtime()*1000)/1000;
},
time: function(){
return Math.round(zero.microtime());
}
};
ns['olamedia'] = zero;
})(this, window, window.document);
|
const _PROJECTNAME = 'dbarjs';
var gulp = require('gulp'),
watch = require('gulp-watch'),
batch = require('gulp-batch'),
print = require('gulp-print'),
plumber = require('gulp-plumber'),
concat = require('gulp-concat'),
concatCSS = require('gulp-concat-css'),
//cleanCSS = require('gulp-clean-css'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
imageResize = require('gulp-image-resize'),
tinypng = require('gulp-tinypng'),
browserSync = require('browser-sync').create();
/*
* To use the gulp-image-resize, it needs of some dependencies:
* https://www.npmjs.com/package/gulp-image-resize
*
* Or, install:
*
* Ubuntu:
* apt-get install imagemagick
* apt-get install graphicsmagick
*
* Mac:
* brew install imagemagick
* brew install graphicsmagick
*
* Windows & others:
* http://www.imagemagick.org/script/binary-releases.php
* */
const tinypngToken = 'c8yyMiCZDZU7wE4SWDTxiKdNcEq7krZU';
// Source Content structure
var source = {
content: '*',
location: './_src/'
};
source.css = {
content: '**/*.css',
location: source.location + 'css/'
};
source.js = {
content: '*.js',
location: source.location + 'js/'
};
source.index = {
content: '**/*.html',
location: source.location
};
source.images = {
content: '*.*',
location: source.location + 'img/'
};
source.images.photos = {
content: 'photo-*.*',
location: source.images.location
};
source.images.largePhotos = {
content: '*.*',
location: source.images.location + 'largePhotos/'
};
// Public Content structure
var public = {
location: './'
};
// Dist Content structure
var dist = {
content: '*',
location: public.location + 'dist/'
};
dist.css = {
content: '*.css',
location: dist.location + 'css/'
};
dist.js = {
content: '*.js',
location: dist.location + 'js/'
};
dist.images = {
content: '*',
location: dist.location + 'img/'
};
// CSS
gulp.task('css', function() {
gulp.src(source.css.location + source.css.content)
.pipe(concatCSS(_PROJECTNAME + '.css'))
.pipe(gulp.dest(dist.css.location))
.pipe(plumber())
//.pipe(cleanCSS())
.pipe(rename({
extname: '.min.css'
}))
.pipe(gulp.dest(dist.css.location));
});
gulp.task('css-watch', ['css'], function () {
watch(source.css.location + source.css.content, batch(function (events, done) {
gulp.start('css', done);
browserSync.reload();
}));
});
// JS
gulp.task('js', function() {
gulp.src(source.js.location + source.js.content)
.pipe(concat(_PROJECTNAME + '.js'))
.pipe(gulp.dest(dist.js.location))
.pipe(plumber())
.pipe(uglify({
preserveComments: 'some'
}))
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest(dist.js.location));
});
gulp.task('js-watch', ['js'], function () {
watch(source.js.location + source.js.content, batch(function (events, done) {
gulp.start('js', done);
browserSync.reload();
}));
});
// IMAGES
gulp.task('resizePhotos', function () {
gulp.src(source.images.photos.location + source.images.photos.content)
.pipe(imageResize({
width : 1080,
upscale : false
}))
.pipe(gulp.dest(dist.images.location));
});
gulp.task('tinySource', function () {
if (tinypngToken)
gulp.src(source.images.location + source.images.content)
.pipe(tinypng(tinypngToken))
.pipe(gulp.dest(source.images.location));
else
console.log('TinyPNG Token Required');
});
// SERVER
gulp.task('serve', function () {
// Serve files from the root of this project
browserSync.init({
server: {
baseDir: "./",
index: "index.html",
routes: {
"/home": "./index.html"
}
}
});
gulp.watch(source.index.content).on('change', browserSync.reload);
});
gulp.task('default', ['serve', 'css-watch', 'js-watch']); |
import Ember from 'ember';
export default Ember.View.extend({
didInsertElement: function () {
$("[type='checkbox']").bootstrapSwitch();
}
});
|
define([
'lib/sortable',
'services/search'
], function(Sortable, search) {
const $content = document.getElementById('content-editor');
const $remove = document.getElementById('content-editor-remove');
const $add = document.getElementById('content-editor-add');
const $filter = document.getElementById('filter');
const $blockForm = document.querySelector('[data-block-form]');
const $contentsInput = document.querySelector('[data-contents]');
for (let $el of [$content, $remove, $add]) {
Sortable.create($el, {
group: 'main'
});
}
const serialize = function() {
let list = [];
for (let $entry of $content.querySelectorAll('li')) {
list.push($entry.dataset.contentId);
}
return JSON.stringify(list);
};
$blockForm.addEventListener('submit', () => {
$contentsInput.value = serialize();
});
$filter.addEventListener('keyup', event => {
search.complete($filter.value, entries => {
while ($add.lastChild) {
$add.removeChild($add.lastChild);
}
for (let entry of entries) {
const $item = document.createElement('li');
$item.dataset.contentId = entry.id;
$item.textContent = entry.value;
$add.appendChild($item);
}
}, 10);
});
});
|
/**
* Created by Rahul Jujarey on 03-03-2016.
*/
(function () {
'use strict';
angular
.module('angular-utilities', [])
})(); |
import React, { Component, Children } from 'react';
import PropTypes from 'prop-types';
import TitleBar from '../../TitleBar/macOs';
import View from '../../View/macOs';
import styles from './styles/10.11';
import WindowFocus from '../../windowFocus';
import Padding, {
paddingPropTypes,
removePaddingProps
} from '../../style/padding';
import Background, {
backgroundPropTypes,
removeBackgroundProps
} from '../../style/background/macOs';
import Alignment, { alignmentPropTypes } from '../../style/alignment';
import Hidden, { hiddenPropTypes } from '../../style/hidden';
import Dimension, { dimensionPropTypes } from '../../style/dimension';
@WindowFocus()
@Alignment()
@Hidden()
@Dimension({ width: '100vw', height: '100vh' })
class Window extends Component {
static propTypes = {
...paddingPropTypes,
...backgroundPropTypes,
...alignmentPropTypes,
...hiddenPropTypes,
...dimensionPropTypes,
chrome: PropTypes.bool
};
filterChildren() {
let titleBar = '';
let otherChildren = [];
Children.map(this.props.children, element => {
const TitleBarEl = <TitleBar />;
if (element.type === TitleBarEl.type) {
titleBar = element;
} else {
otherChildren = [...otherChildren, element];
}
});
return [titleBar, ...otherChildren];
}
render() {
let { style, chrome, isWindowFocused, ...props } = this.props;
let componentStyle = { ...styles.window, ...style };
if (chrome) {
componentStyle = {
...componentStyle,
...styles.chrome
};
if (!isWindowFocused) {
componentStyle = { ...componentStyle, ...styles.unfocused };
}
}
const [titleBar, ...children] = this.filterChildren();
let contentStyle = styles.content;
if (chrome) {
contentStyle = {
...contentStyle,
borderBottomLeftRadius: '4px',
borderBottomRightRadius: '4px'
};
}
let content = Background(
Padding(<View style={contentStyle}>{children}</View>, props),
props
);
props = removePaddingProps(props);
props = removeBackgroundProps(props);
return (
<div style={componentStyle} {...props}>
{titleBar}
{content}
</div>
);
}
}
export default Window;
|
if(typeof exports === 'object') {
var assert = require("assert");
var alasql = require('..');
} else {
__dirname = '.';
};
describe('Test 251 Overwrite XLSX file', function() {
it('1. Overwrite',function(done){
alasql('SELECT HOUR(NOW()), MINUTE(NOW()), SECOND(NOW()) \
INTO XLSX("restest251.xlsx",{sourcefilename:"test251.xlsx", \
sheetid:"test2", range:"B3"})',[],function(res){
assert(res == 1);
done();
});
});
});
|
// plugins/pulsewire/pulsewire.js
// Copyright (C) 2014 Rob Colbert <rob.isConnected@gmail.com>
// License: MIT
'use strict';
var PuretechFoundation = require('puretech-foundation');
var RouteAssembler = PuretechFoundation.Express.RouteAssembler;
var GUID = PuretechFoundation.Tools.GUID;
var PulseWireLoadBalancer = require('./lib/pulsewire-load-balancer');
var PulseWireClient = require('./lib/pulsewire-client');
/*
* PLUGIN
* PulseWire
*
* PURPOSE
* Implement Pulsar Conversations and real-time messaging using Pulsar's
* managed interfaces for ExpressJS (REST API), Mongoose (MongoDB access)
* and socket.io.
*
* Pulsar creates a dedicated socket.io channel for plugins requesting
* socket.io service. Your plugin generally won't be aware of socket.io
* traffic from other plugins using socket.io services on Pulsar.
*
* socket.io implements rooms within channels. Thus, developers can have
* group chats happening in rooms provided by socket.io. They will directly
* use the socket.io API to manage room memberships. Pulsar "manages"
* socket.io in that it hands you the result of on('/YourChannelUUID') as
* your "io" instance.
*
* PulseWire will also be the basis for the Pulsar Matchmaking system. More on
* that later, but yes, it's a game-centric feature intended to empower game
* developers with a truly unique matchmaking platform that can be easily tuned
* to your game's specific needs. Not like I haven't built a few of them in
* years past.
*
* This is just a fun exercise in, "Here, watch me do that in a fraction of the
* time with a better result thanks to MEAN and socket.io." I'd actually like
* to print this system out and set it next to a printout of SportsConnect (the
* system I built at Sony). I bet it's quite the hilarious difference in
* overall lines of code. And, given I wrote SportsConnect entirely along the
* async model of Node.js - but had to do that by hand in C++ - I already know
* how this is going to perform at scale.
*
* Like...I've gone down into the depths of Node and fucking looked at how it
* does things. Same for socket.io. This is going to work just fine (or, I
* would *not* be building it).
*
* CONNECTION PROCESS
* 1. Client HTTP requests a session on PulseWire using Pulsar API
* 2. The PulseWireLoadBalancer selects a host.
* 3. PulseWire connects to the selected host and requests a session.
* 4. Host, if possible, reserves a session and generates an auth token.
* 5. PulseWire passes the host's address, port and auth token back to client.
* 6. Client connects to selected PulseWire host using socket.io
* 7. Client presents auth token
* 8. Host checks token against the token it generated for the session
* a. If token matches, proceed to step 9
* b. If token does not match, the host closes the socket. [end process]
* 9. Client enables messaging on PulseWire and configures any loaded plugins
* for use with the PulseWire service (it's an event in the reference Pulsar
* HTML5 Single-Page Application).
*
* HIGHER ORDER CONCEPTS
* 1. There simply is no "deleteConversation" method. No single user has the
* authority to do that. All a user can do is remove themselves from the
* conversation. They can even later be added back. To them, it was a
* delete. To other members, they "went away" for a while or perhaps
* forever.
* 2. Conversations *are* physically removed from storage when they have no
* remaining members. As the last member leaves the conversation, the
* conversation record will simply be removed.
* 3. Some REST calls trigger socket.io transmissions, and those can get
* quit out of hand. So, they are fire-n-forget operations. If the plugin
* is exhausted, it will just start dropping the real-time message
* notifiers and let users get their messages in the message center later.
* That's part of the reason why Conversations are backed by the database.
*/
function PulseWire (app, http, config) {
var self = this;
self.packageMeta = PulseWire.packageMeta;
self.config = config;
self.app = app;
self.log = app.log;
self.http = http;
self.config = config;
self.routeAssembler = new RouteAssembler(self.app, self.config);
self.clients = [ ];
self.loadBalancer = new PulseWireLoadBalancer(self);
self.packageMeta.pulsar.socketio.hosts.forEach(function (host) {
self.loadBalancer.addHost(host);
});
/*
* MODELS
*/
require('./server/models/conversations');
}
/*
* STATIC METHOD
* buildServiceUrl (url)
*
* PURPOSE
* Builds a service URL that considers pulsar-plugin.mountPoint.
*/
PulseWire.buildServiceUrl = function (url) {
return PulseWire.packageMeta.pulsar.mountPoint + url;
};
PulseWire.onClientConnection = function (socket) {
return PulseWire.instance.onClientConnection(socket);
};
/*
* INSTANCE METHOD
* start
*
* PURPOSE
* Pulsar API modules must implement an instance method named start. Pulsar
* will call the method when it wants to enable the plugin for online service.
*/
PulseWire.prototype.start = function (io) {
var self = this;
if (!io) {
return;
}
self.io = io;
self.injectSessionRoutes();
self.injectConversationsRoutes();
self.io.on('connection', PulseWire.onClientConnection);
};
PulseWire.prototype.injectSessionRoutes = function ( ) {
var self = this;
var serviceUrl = PulseWire.buildServiceUrl('/sessions');
self.routeAssembler.add({
'method': 'POST',
'uri': serviceUrl,
'controllerMethod': self.createUserSession.bind(self)
});
self.routeAssembler.add({
'method': 'GET',
'uri': serviceUrl,
'controllerMethod': self.getUserSession.bind(self)
});
};
PulseWire.prototype.injectConversationsRoutes = function ( ) {
var self = this;
var serviceUrl;
var ConversationsController = require('./server/controllers/conversations');
var conversations = new ConversationsController(self);
var routeAssembler = new RouteAssembler(self.app, self.config);
/*
* /conversations
*/
serviceUrl = PulseWire.buildServiceUrl(
'/conversations'
);
self.routeAssembler.add({
'method': 'POST',
'uri': serviceUrl,
'controllerMethod': conversations.createConversation.bind(conversations)
});
self.routeAssembler.add({
'method': 'GET',
'uri': serviceUrl,
'controllerMethod': conversations.listConversations.bind(conversations)
});
/*
* /conversations/:conversationId
*/
serviceUrl = PulseWire.buildServiceUrl(
'/conversations/:conversationId'
);
self.routeAssembler.add({
'method': 'GET',
'uri': serviceUrl,
'controllerMethod': conversations.getConversation.bind(conversations)
});
self.routeAssembler.add({
'method': 'PUT',
'uri': serviceUrl,
'controllerMethod': conversations.updateConversation.bind(conversations)
});
/*
* /conversations/:conversationId/members
*/
// serviceUrl = PulseWire.buildServiceUrl(
// '/conversations/:conversationId/members'
// );
// self.routeAssembler.add({
// 'method': 'POST',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.addMember.bind(conversations)
// });
// self.routeAssembler.add({
// 'method': 'GET',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.listMembers.bind(conversations)
// });
/*
* /conversations/:conversationId/members/:userId
*/
// serviceUrl = PulseWire.buildServiceUrl(
// '/conversations/:conversationId/members/:userId'
// );
// self.routeAssembler.add({
// 'method': 'GET',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.getMember.bind(conversations)
// });
// self.routeAssembler.add({
// 'method': 'DELETE',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.deleteMember.bind(conversations)
// });
/*
* /conversations/:conversationId/members/:userId/messages
*/
// serviceUrl = PulseWire.buildServiceUrl(
// '/conversations/:conversationId/members/:userId/messages'
// );
// self.routeAssembler.add({
// 'method': 'GET',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.listMemberMessages.bind(conversations)
// });
/*
* /conversations/:conversationId/messages
*/
// serviceUrl = PulseWire.buildServiceUrl(
// '/conversations/:conversationId/messages'
// );
// self.routeAssembler.add({
// 'method': 'POST',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.createMessage.bind(conversations)
// });
// self.routeAssembler.add({
// 'method': 'GET',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.listMessages.bind(conversations)
// });
/*
* INDIVIDUAL MESSAGES
*/
// serviceUrl = PulseWire.buildServiceUrl(
// '/conversations/:conversationId/messages/:messageId'
// );
// self.routeAssembler.add({
// 'method': 'GET',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.getMessage.bind(conversations)
// });
// self.routeAssembler.add({
// 'method': 'PUT',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.updateMessage.bind(conversations)
// });
// self.routeAssembler.add({
// 'method': 'DELETE',
// 'uri': serviceUrl,
// 'controllerMethod': conversations.deleteMessage.bind(conversations)
// });
};
/*
* INSTANCE METHOD
* stop
*
* PURPOSE
* Pulsar API modules must implement an instance method named stop. Pulsar will
* call the method when it wants the plugin to stop doing whatever it does.
* This is commonly during system shutdown, or if the plugin exceeds a resource
* quota configured by the Pulsar administrator.
*/
PulseWire.prototype.stop = function ( ) {
var self = this;
self.io.removeListener('connection', PulseWire.onClientConnection);
self.routeAssembler.detach();
};
/*
* REST METHOD
* createUserSession
*
* PURPOSE
* Create a new user session for the authenticated user and grant them an
* access token. The client must then present the access token when connecting
* to PulseWire to gain message-passing access to the server.
*/
PulseWire.prototype.createUserSession = function (req, res) {
var self = this;
// make sure only authenticated users receive new PulseWire sessions
if (!self.app.checkAuthentication(req, res, 'Only authenticated users can request PulseWire sessions')) {
return;
}
var channelUuid = PulseWire.packageMeta.pulsar.socketio.channelUuid;
self.loadBalancer.createSessionOnChannel(
channelUuid,
function (err, session) {
if (err) {
res.json(500, err);
return;
}
session.channel = channelUuid;
req.session.pulsewire = session;
res.json(200, req.session.pulsewire);
}
);
};
/*
* REST METHOD
* getUserSession
*
* PURPOSE
* Retrieves the authenticated user's PulseWire session, if any.
*/
PulseWire.prototype.getUserSession = function (req, res) {
var self = this;
if (!self.app.checkAuthentication(req, res, 'Only authenticated users can retrieve their PulseWire session')) {
return;
}
if (!req.session.pulsewire) {
res.json(404, {'message':'No PulseWire session currently exists'});
return;
}
res.json(200, req.session.pulsewire);
};
/*
* SOCKET.IO EVENT
* onClientConnection
*
* PURPOSE:
* Called when socket.io receives an ingress connection/socket. Wraps the
* PulseWire prototocol around the socket presented with closures for
* PulseWire protocol message handlers.
*/
PulseWire.prototype.onClientConnection = function (socket) {
this.log.info('ingress socket.io connection');
var client = new PulseWireClient(this, socket);
this.clients[socket.id] = client;
};
/*
* INSTANCE METHOD
* emitMessage
*
* PURPOSE
* Deliver a PulseWire Conversations message to all interested parties
* who are presently online.
*/
PulseWire.prototype.emitConversationMessage = function (message) {
this.log.info('pulsewire.emitConversationMessage', message);
this.io.emit('message', message);
};
/*
* MODULE EXPORTS
* Pulsar plugins *must* load their own package.json and pulsar-plugin.json
* files and expose them as a static property on the module export. The
* export is expected to be a function and Pulsar calls new on that function
* to create an instance of the plugin.
*/
PulseWire.packageMeta = require('../package.json');
PulseWire.packageMeta.pulsar = require('../pulsar-plugin.json');
delete PulseWire.packageMeta.main;
module.exports = exports = PulseWire;
|
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | course-visualize-vocabulary', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
const route = this.owner.lookup('route:course-visualize-vocabulary');
assert.ok(route);
});
});
|
/* jshint node: true */
/* global describe, it */
'use strict';
var assert = require('assert');
var fs = require('fs');
var PassThrough = require('stream').PassThrough;
var path = require('path');
var usemin = require('../index');
var vfs = require('vinyl-fs');
var Vinyl = require('vinyl');
function getFile(filePath) {
return new Vinyl({
path: filePath,
base: path.dirname(filePath),
contents: fs.readFileSync(filePath)
});
}
function getFixture(filePath) {
return getFile(path.join('test', 'fixtures', filePath));
}
function getExpected(filePath) {
return getFile(path.join('test', 'expected', filePath));
}
describe('gulp-usemin', function() {
describe('allow removal sections', function() {
function compare(name, expectedName, done) {
var htmlmin = require('gulp-htmlmin');
var stream = usemin({html: [htmlmin({collapseWhitespace: true})]});
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === name) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
done();
}
});
stream.write(getFixture(name));
}
it('simple js block', function(done) {
compare('simple-js-removal.html', 'simple-js-removal.html', done);
});
it('minified js block', function(done) {
compare('min-html-simple-removal.html', 'min-html-simple-removal.html', done);
});
it('many blocks', function(done) {
compare('many-blocks-removal.html', 'many-blocks-removal.html', done);
});
it('robust pattern recognition (no whitespace after build:remove)', function(done) {
compare('build-remove-no-trailing-whitespace.html', 'build-remove-no-trailing-whitespace.html', done);
});
});
describe('negative test:', function() {
it('shouldn\'t work in stream mode', function(done) {
var stream = usemin();
var t;
var fakeStream = new PassThrough();
var fakeFile = new Vinyl({
contents: fakeStream
});
fakeStream.end();
stream.on('error', function() {
clearTimeout(t);
done();
});
t = setTimeout(function() {
assert.fail('', '', 'Should throw error', '');
done();
}, 1000);
stream.write(fakeFile);
});
it('html without blocks', function(done) {
var stream = usemin();
var content = '<div>content</div>';
var fakeFile = new Vinyl({
path: 'test.file',
contents: new Buffer(content)
});
stream.on('data', function(newFile) {
assert.equal(content, String(newFile.contents));
done();
});
stream.write(fakeFile);
});
});
describe('should work in buffer mode with', function() {
describe('minified HTML:', function() {
function compare(name, expectedName, done, fail) {
var htmlmin = require('gulp-htmlmin');
var stream = usemin({
html: [function() {
return htmlmin({collapseWhitespace: true, removeAttributeQuotes: true});
}]
});
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === name) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
done();
}
});
stream.on('error', function() {
if (fail)
fail();
});
stream.write(getFixture(name));
}
it('simple js block', function(done) {
compare('simple-js.html', 'min-simple-js.html', done);
});
it('simple js block with path', function(done) {
compare('simple-js-path.html', 'min-simple-js-path.html', done);
});
it('simple css block', function(done) {
compare('simple-css.html', 'min-simple-css.html', done);
});
it('css block with media query', function(done) {
compare('css-with-media-query.html', 'min-css-with-media-query.html', done);
});
it('css block with mixed incompatible media queries should error', function(done) {
compare('css-with-media-query-error.html', 'min-css-with-media-query.html', function() {
assert.fail('', '', 'should error', '');
done();
}, done);
});
it('simple css block with path', function(done) {
compare('simple-css-path.html', 'min-simple-css-path.html', done);
});
it('complex (css + js)', function(done) {
compare('complex.html', 'min-complex.html', done);
});
it('complex with path (css + js)', function(done) {
compare('complex-path.html', 'min-complex-path.html', done);
});
it('paths with querystring', function(done) {
compare('paths-with-querystring.html', 'min-paths-with-querystring.html', done);
});
});
describe('not minified HTML:', function() {
function compare(name, expectedName, done) {
var stream = usemin();
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === name) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
done();
}
});
stream.write(getFixture(name));
}
it('simple js block with single quotes', function (done) {
compare('single-quotes-js.html', 'single-quotes-js.html', done);
});
it('simple css block with single quotes', function (done) {
compare('single-quotes-css.html', 'single-quotes-css.html', done);
});
it('simple (js block)', function(done) {
compare('simple-js.html', 'simple-js.html', done);
});
it('simple (js block) (html minified)', function(done) {
compare('min-html-simple-js.html', 'min-html-simple-js.html', done);
});
it('simple with path (js block)', function(done) {
compare('simple-js-path.html', 'simple-js-path.html', done);
});
it('simple (css block)', function(done) {
compare('simple-css.html', 'simple-css.html', done);
});
it('simple (css block) (html minified)', function(done) {
compare('min-html-simple-css.html', 'min-html-simple-css.html', done);
});
it('simple with path (css block)', function(done) {
compare('simple-css-path.html', 'simple-css-path.html', done);
});
it('complex (css + js)', function(done) {
compare('complex.html', 'complex.html', done);
});
it('complex with path (css + js)', function(done) {
compare('complex-path.html', 'complex-path.html', done);
});
it('multiple alternative paths', function(done) {
compare('multiple-alternative-paths.html', 'multiple-alternative-paths.html', done);
});
it('paths with querystring', function(done) {
compare('paths-with-querystring.html', 'paths-with-querystring.html', done);
});
});
describe('minified CSS:', function() {
function compare(fixtureName, name, expectedName, end) {
var cssmin = require('gulp-clean-css');
var stream = usemin({css: ['concat', cssmin()]});
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === name) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
end();
}
});
stream.write(getFixture(fixtureName));
}
it('simple (css block)', function(done) {
var name = 'style.css';
var expectedName = 'min-style.css';
compare('simple-css.html', name, expectedName, done);
});
it('simple with path (css block)', function(done) {
var name = 'style.css';
var expectedName = path.join('data', 'css', 'min-style.css');
compare('simple-css-path.html', name, expectedName, done);
});
it('simple with alternate path (css block)', function(done) {
var name = 'style.css';
var expectedName = path.join('data', 'css', 'min-style.css');
compare('simple-css-alternate-path.html', name, expectedName, done);
});
});
describe('not minified CSS:', function() {
function compare(fixtureName, expectedName, end) {
var stream = usemin();
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === path.basename(expectedName)) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
end();
}
});
stream.write(getFixture(fixtureName));
}
it('simple (css block)', function(done) {
compare('simple-css.html', 'style.css', done);
});
it('simple (css block) (minified html)', function(done) {
compare('min-html-simple-css.html', 'style.css', done);
});
it('simple with path (css block)', function(done) {
compare('simple-css-path.html', path.join('data', 'css', 'style.css'), done);
});
it('simple with alternate path (css block)', function(done) {
compare('simple-css-alternate-path.html', path.join('data', 'css', 'style.css'), done);
});
});
describe('minified JS:', function() {
function compare(fixtureName, name, expectedName, end) {
var jsmin = require('gulp-uglify');
var stream = usemin({js: [jsmin()]});
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === path.basename(name)) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
end();
}
});
stream.write(getFixture(fixtureName));
}
it('simple (js block)', function(done) {
compare('simple-js.html', 'app.js', 'min-app.js', done);
});
it('simple with path (js block)', function(done) {
var name = path.join('data', 'js', 'app.js');
var expectedName = path.join('data', 'js', 'min-app.js');
compare('simple-js-path.html', name, expectedName, done);
});
it('simple with alternate path (js block)', function(done) {
var name = path.join('data', 'js', 'app.js');
var expectedName = path.join('data', 'js', 'min-app.js');
compare('simple-js-alternate-path.html', name, expectedName, done);
});
});
describe('not minified JS:', function() {
function compare(fixtureName, expectedName, end) {
var stream = usemin();
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === path.basename(expectedName)) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
end();
}
});
stream.write(getFixture(fixtureName));
}
it('simple (js block)', function(done) {
compare('simple-js.html', 'app.js', done);
});
it('simple (js block) (minified html)', function(done) {
compare('min-html-simple-js.html', 'app.js', done);
});
it('simple with path (js block)', function(done) {
compare('simple-js-path.html', path.join('data', 'js', 'app.js'), done);
});
it('simple with alternate path (js block)', function(done) {
compare('simple-js-alternate-path.html', path.join('data', 'js', 'app.js'), done);
});
});
it('many html files', function(done) {
var cssmin = require('gulp-clean-css');
var jsmin = require('gulp-uglify');
var rev = require('gulp-rev');
var stream = usemin({
css: ['concat', cssmin],
js: ['concat', jsmin]
});
var nameCss = 'style.css';
var expectedNameCss = 'min-style.css';
var nameJs = 'app.js';
var expectedNameJs = 'min-app.js';
var cssExist = false;
var jsExist = false;
var htmlCount = 0;
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === path.basename(nameCss)) {
cssExist = true;
assert.equal(String(getExpected(expectedNameCss).contents), String(newFile.contents));
}
else if (path.basename(newFile.path) === path.basename(nameJs)) {
jsExist = true;
assert.equal(String(getExpected(expectedNameJs).contents), String(newFile.contents));
}
else {
htmlCount += 1;
}
});
stream.on('end', function() {
assert.equal(htmlCount, 2);
assert.ok(cssExist);
assert.ok(jsExist);
done();
});
stream.write(getFixture('simple-css.html'));
stream.write(getFixture('simple-js.html'));
stream.end();
});
it('many blocks', function(done) {
var cssmin = require('gulp-clean-css');
var jsmin = require('gulp-uglify');
var rev = require('gulp-rev');
var stream = usemin({
css1: ['concat', cssmin],
js1: [jsmin, 'concat', rev]
});
var nameCss = path.join('data', 'css', 'style.css');
var expectedNameCss = path.join('data', 'css', 'min-style.css');
var nameJs = path.join('data', 'js', 'app.js');
var expectedNameJs = path.join('data', 'js', 'app.js');
var nameJs1 = 'app1';
var expectedNameJs1 = path.join('data', 'js', 'app_min_concat.js');
var nameJs2 = 'app2';
var expectedNameJs2 = path.join('data', 'js', 'app_min_concat.js');
var cssExist = false;
var jsExist = false;
var js1Exist = false;
var js2Exist = false;
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === path.basename(nameCss)) {
cssExist = true;
assert.equal(String(getExpected(expectedNameCss).contents), String(newFile.contents));
}
else if (path.basename(newFile.path) === path.basename(nameJs)) {
jsExist = true;
assert.equal(String(getExpected(expectedNameJs).contents), String(newFile.contents));
}
else if (newFile.path.indexOf(nameJs1) != -1) {
js1Exist = true;
assert.equal(String(getExpected(expectedNameJs1).contents), String(newFile.contents));
}
else if (newFile.path.indexOf(nameJs2) != -1) {
js2Exist = true;
assert.equal(String(getExpected(expectedNameJs2).contents), String(newFile.contents));
}
else {
assert.ok(cssExist);
assert.ok(jsExist);
assert.ok(js1Exist);
assert.ok(js2Exist);
done();
}
});
stream.write(getFixture('many-blocks.html'));
});
describe('assetsDir option:', function() {
function compare(assetsDir, done) {
var stream = usemin({assetsDir: assetsDir});
var expectedName = 'style.css';
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === expectedName) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
done();
}
});
stream.write(getFixture('simple-css.html'));
}
it('absolute path', function(done) {
compare(path.join(process.cwd(), 'test', 'fixtures'), done);
});
it('relative path', function(done) {
compare(path.join('test', 'fixtures'), done);
});
});
describe('conditional comments:', function() {
function compare(name, expectedName, done) {
var stream = usemin();
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === name) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
done();
}
});
stream.write(getFixture(name));
}
it('conditional (js block)', function(done) {
compare('conditional-js.html', 'conditional-js.html', done);
});
it('conditional (css block)', function(done) {
compare('conditional-css.html', 'conditional-css.html', done);
});
it('conditional (css + js)', function(done) {
compare('conditional-complex.html', 'conditional-complex.html', done);
});
it('conditional (inline js block)', function(done) {
compare('conditional-inline-js.html', 'conditional-inline-js.html', done);
});
it('conditional (inline css block)', function(done) {
compare('conditional-inline-css.html', 'conditional-inline-css.html', done);
});
});
describe('globbed files:', function() {
function compare(fixtureName, name, end) {
var stream = usemin();
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === name) {
assert.equal(String(newFile.contents), String(getExpected(name).contents));
end();
}
});
stream.write(getFixture(fixtureName));
}
it('glob (js block)', function(done) {
compare('glob-js.html', 'app.js', done);
});
it('glob (css block)', function(done) {
compare('glob-css.html', 'style.css', done);
});
it('glob inline (js block)', function(done) {
compare('glob-inline-js.html', 'glob-inline-js.html', done);
});
it('glob inline (css block)', function(done) {
compare('glob-inline-css.html', 'glob-inline-css.html', done);
});
});
describe('comment files:', function() {
function compare(name, callback) {
var stream = usemin({enableHtmlComment: true});
stream.on('data', callback);
stream.write(getFixture(name));
}
it('comment (js block)', function(done) {
var expectedName = 'app.js';
compare(
'comment-js.html',
function(newFile) {
if (path.basename(newFile.path) === expectedName) {
assert.equal(String(newFile.contents), String(getExpected(expectedName).contents));
done();
}
}
);
});
});
describe('inline Sources:', function() {
function compare(fixtureName, name, end) {
var stream = usemin();
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === name) {
assert.equal(String(newFile.contents), String(getExpected(name).contents));
end();
}
});
stream.write(getFixture(fixtureName));
}
it('simple inline js block', function (done) {
compare('simple-inline-js.html', 'simple-inline-js.html', done);
});
it('simple inline css block', function (done) {
compare('simple-inline-css.html', 'simple-inline-css.html', done);
});
it('simple inline js block width single quotes', function (done) {
compare('single-quotes-inline-js.html', 'single-quotes-inline-js.html', done);
});
it('simple inline css block with single quotes', function (done) {
compare('single-quotes-inline-css.html', 'single-quotes-inline-css.html', done);
});
});
describe('array jsAttributes:', function() {
function compare(fixtureName, name, end) {
var stream = usemin({
jsAttributes: {
seq: [1, 2, 1, 3],
color: ['blue', 'red', 'yellow', 'pink']
},
js: [],
js1: [],
js2: [],
js3: []
});
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === name) {
assert.equal(String(newFile.contents), String(getExpected(name).contents));
end();
}
});
stream.write(getFixture(fixtureName));
}
it('js attributes with array define', function (done) {
compare('array-js-attributes.html', 'array-js-attributes.html', done);
});
});
it('async task', function(done) {
var less = require('gulp-less');
var cssmin = require('gulp-clean-css');
var stream = usemin({
less: [less(), 'concat', cssmin()]
});
var name = 'style.css';
var expectedName = 'min-style.css';
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === path.basename(name)) {
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
done();
}
});
stream.write(getFixture('async-less.html'));
});
it('subfolders', function(done) {
var stream = usemin();
var jsExist = false;
var nameJs = path.join('subfolder', 'app.js');
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === path.basename(nameJs)) {
jsExist = true;
assert.equal(path.relative(newFile.base, newFile.path), nameJs);
assert.equal(String(getExpected(nameJs).contents), String(newFile.contents));
}
else {
assert.ok(jsExist);
done();
}
});
vfs.src('test/fixtures/**/index.html')
.pipe(stream);
});
});
it('multiple files in stream', function(done) {
var multipleFiles = function() {
var through = require('through2');
return through.obj(function(file) {
var stream = this;
stream.push(new Vinyl({
cwd: file.cwd,
base: file.base,
path: file.path,
contents: new Buffer('test1')
}));
stream.push(new Vinyl({
cwd: file.cwd,
base: file.base,
path: file.path,
contents: new Buffer('test2')
}));
});
};
var stream = usemin({
css: [multipleFiles],
js: [multipleFiles]
});
stream.on('data', function(newFile) {
if (path.basename(newFile.path) === path.basename('multiple-files.html')) {
assert.equal(String(getExpected('multiple-files.html').contents), String(newFile.contents));
done();
}
});
stream.write(getFixture('multiple-files.html'));
});
});
|
'use strict';
action('generate portfolio settings');
describe('generate the necessary setting defaults for the portfolio project');
cli(function (program, dispatch) {
var action = this;
program.command('settings:generate').description('generate settings files for a portfolio').action(dispatch(action.api.runner));
return program;
});
/**
* generate settings files
*
*/
execute(function (services, context) {
var project = context.project;
// copy from the plugin src/portfolio/**/*.yml templates
}); |
'use strict';
exports.before = exports.before || 'fail';
exports.after = 'fail';
|
'use strict';
// Declare app level module which depends on views, and components
angular.module('JokesMaker', ['ngRoute']).
config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'mainCtrl'
})
.when('/loadjokes',{
templateUrl: 'views/loadJokes.html',
controller: 'loadJokesCtrl'
});
}]);
|
var React = require('react'),
githubActions = require('../../actions/githubActions'),
githubStore = require('../../stores/githubStore'),
Middle;
Middle = React.createClass({
getInitialState () {
return {
repos: githubStore.getRepos()
};
},
componentWillReceiveProps (obj) {
githubActions.getUserRepos(obj.username)
},
_onChange () {
this.setState({
repos: githubStore.getRepos()
});
},
componentDidMount () {
githubActions.getUserRepos(this.props.username);
githubStore.addChangeListener(this._onChange);
},
render () {
var repos = this.state.repos.map(function(repo, index) {
return (
<li key={index} style={{borderBottom: '1px solid #DDD', marginBottom: 10}}>
{repo.html_url && <h5 style={{marginTop: 10}}><a href={repo.html_url} target="_blank">{repo.name}</a></h5>}
{repo.description && <p>{repo.description}</p>}
</li>
);
});
var repoList =
<ul className="no-bullet">
{repos}
</ul> ;
var emptyList =
<p>There are no repositories available</p> ;
return (
<div>
<div className="row">
<div className="columns small-12">
<h3>User Repos</h3>
</div>
</div>
<div className="section condensed">
{this.state.repos.length ? repoList : emptyList}
</div>
</div>
);
}
});
module.exports = Middle; |
'use strict';
const join = require('path').join; // 连接字符串方法
const path = join(__dirname, '../app/controllers');
const routeTools = require('./routeTools');
const urlTools = require('url');
const env = process.env.NODE_ENV || 'development';
const csrf = require('csurf');
const envConfig = require('./index');
/**
* 添加session路由方法以及添加校验方法
*/
~ function () {
let sessionPermissions = {};
/**
* 添加验证session的url地址处理方法
*/
routeTools.addRouteMethod('session', function (url, ...values) {
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
throw new Error('permission url muse be string and not empty');
}
url = url.trim();
if (!values || values.length === 0) {
throw new Error('url: ' + url + ' permission value is empty');
}
let result = [];
values.forEach(function (element) {
if (Object.prototype.toString.call(element) === '[object String]') {
result.push(element.trim());
}
}, this);
if (result.length === 0) {
throw new Error('url: ' + url + ' permission value is empty');
}
sessionPermissions[url] = result.join(',');
});
/**
* 校验页面配置属性是否存在用户session中
* @param {*} req
* @param {*} value
*/
let pageValidate = function (req, value) {
if (!value || Object.prototype.toString.call(value) !== '[object String]') {
throw new Error('PERMISSION value muse be string and not empty');
}
if (!req.session || !req.session.menus) {
return false;
}
let values = value.split(',');
for (let i = 0; i < values.length; i++) {
values[i] = values[i].trim();
}
let menus = req.session.menus;
for (let i = 0; i < menus.length; i++) {
if (values.includes(menus[i].permission)) {
return true;
}
}
return false;
};
/**
* @return 返回none表示不验证session,success表示session验证成功,fail表示失败
*/
routeTools.addValidateMethod('session', function (req, res) {
let url = urlTools.parse(req.url).pathname;
let value = sessionPermissions[url];
if (!value) {
return true;
}
if (!req.session || !req.session.user || !req.session.menus) {
res.redirect('/manage/login');
return false;
}
let values = value.split(',');
let menus = req.session.menus;
for (let i = 0; i < menus.length; i++) {
if (values.includes(menus[i].permission)) {
// session验证成功则为页面添加校验属性权限的方法
res.locals.PERMISSION = function (value) {
return pageValidate(req, value);
};
return true;
}
}
res.status(403).render('403');
return false;
});
}();
/**
* 添加session路由方法以及添加校验方法
*/
~ function () {
let sessionPermissions = [];
/**
* 添加验证session的url地址处理方法
*/
routeTools.addRouteMethod('weixinSession', function (url) {
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
throw new Error('permission url muse be string and not empty');
}
sessionPermissions.push(url.trim());
});
/**
* @return 返回true表示session验证成功,false表示失败
*/
routeTools.addValidateMethod('weixinSession', function (req, res) {
let url = urlTools.parse(req.url).pathname;
if (!sessionPermissions.includes(url)) {
return true;
}
if (!req.session || !req.session.weixinUser) {
/* req.session.weixinUser = {
userId:'ef33dbe06d1a11e7b0888d5cfe5cb851',
user_parent_id: null,
user_union_id: 'o8tmf1SKPfrswmrXvry6lqYm1UGo',
user_login_name: null,
user_is_proxy: 0,
user_name: '董恒',
user_photo: 'http://wx.qlogo.cn/mmhead/hqDXUD6csUibS9dA7LdUPKuchYthicHZiaO2h62ODU33BBu3RMb8OKFZA/0'
};
return true; */
let winxinCallbackUrl = envConfig.server.myUrl + '/api/weixin/req_weixinuser_info';
let visitUrl = req.protocol + '://' + req.host + req.originalUrl;
res.redirect('https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx72878a9eb500ef96&redirect_uri=' + encodeURIComponent(winxinCallbackUrl).toLowerCase() + '&response_type=code&scope=snsapi_userinfo&state=' + encodeURIComponent(visitUrl).toLowerCase() + '#wechat_redirect');
return false;
}
return true;
});
}();
/**
* 添加sign路由方法以及添加sign校验方法
*/
~ function () {
/**
* 验证sign名具体代码
* @param {*} req
* @param {*} res
*/
let signValidate = function (req, res) {
/*
如果验证失败,返回结果取消此段注释
res.json({
result: 403,
message: "You don't have permission"
});
return false;
*/
return true;
};
let signPermissions = [];
/**
* @return 返回true表示session验证成功,false表示失败
*/
routeTools.addRouteMethod('sign', function (url) {
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
throw new Error('sign url is empty');
}
signPermissions.push(url.trim());
});
routeTools.addValidateMethod('sign', function (req, res) {
let url = urlTools.parse(req.url).pathname;
if (!signPermissions.includes[url]) {
return true;
}
return signValidate(req, res);
});
}();
/**
* 添加防重复提交验证令牌url
*/
let Csurf = function () {
let csrfs = [];
/**
* @return 返回none表示不验证session,success表示session验证成功,fail表示失败
*/
routeTools.addRouteMethod('csurf', function (path) {
if (!path || Object.prototype.toString.call(path) !== '[object String]') {
throw new Error('path url is empty');
}
csrfs.push(path.trim());
});
this.getPath = function () {
return csrfs;
};
};
let csurf = new Csurf();
/**
* Expose routes
*/
module.exports = function (app) {
// routes相关拦截
app.use(function (req, res, next) {
let result = routeTools.validate(req, res);
for (let r in result) {
if (result.hasOwnProperty(r)) {
if (!result[r]) {
return;
}
}
}
next();
});
routeTools.scan(app, path); // 扫描路由到工具
let routes = routeTools.getRoutes(); // 得到扫描到的路由
let routesGroup = {};
let csurfGroup = {};
let csurfPath = csurf.getPath();
for (let i in routes) {
if (csurfPath.includes(i)) {
csurfGroup[i] = routes[i];
} else {
routesGroup[i] = routes[i];
}
}
routeTools.excute(routesGroup); // 执行添加路由(必须先声明权限拦截在执行添加路由,否则无法拦截路由地址)
if (env !== 'test') {
app.use(csrf());
// This could be moved to view-helpers :-)
app.use(function (req, res, next) {
let t = req.csrfToken();
res.locals.csrf_token = t;
next();
});
// error handler
app.use(function (err, req, res, next) {
if (err.code !== 'EBADCSRFTOKEN') return next(err);
res.status(403).json({
result: 403,
message: "You don't have permission"
});
return false;
});
}
routeTools.excute(csurfGroup);
/**
* Error handling
*/
app.use(function (err, req, res, next) {
// treat as 404
if (err.message &&
(~err.message.indexOf('not found') ||
(~err.message.indexOf('Cast to ObjectId failed')))) {
return next();
}
console.error(err.stack);
if (err.stack.includes('ValidationError')) {
res.status(422).render('422', {
error: err.stack
});
return;
}
// error page
res.status(500).render('500', {
error: err.stack
});
});
// assume 404 since no middleware responded
app.use(function (req, res) {
const payload = {
url: req.originalUrl,
error: 'Not found'
};
// if (req.accepts('json')) return res.status(404).json(payload);
res.status(404).render('404', payload);
});
}; |
let counter = -1;
function nextId() {
counter += 1;
return counter;
}
export default nextId;
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _formsyReact = require('formsy-react');
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _datetime = require('@blueprintjs/datetime');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var FormsyDateInput = function (_Component) {
_inherits(FormsyDateInput, _Component);
function FormsyDateInput(props) {
_classCallCheck(this, FormsyDateInput);
var _this = _possibleConstructorReturn(this, (FormsyDateInput.__proto__ || Object.getPrototypeOf(FormsyDateInput)).call(this, props));
_this.state = { focused: false };
_this.changeValue = _this.changeValue.bind(_this);
_this.onFocus = _this.onFocus.bind(_this);
_this.onBlur = _this.onBlur.bind(_this);
return _this;
}
_createClass(FormsyDateInput, [{
key: 'componentDidMount',
value: function componentDidMount() {
if (this.props.initialValue) {
this.props.setValue(this.props.initialValue);
} else {
this.props.setValue(this.props.getValue());
}
}
}, {
key: 'changeValue',
value: function changeValue(value) {
this.props.setValue(value);
}
}, {
key: 'onFocus',
value: function onFocus() {
this.setState({ focused: true });
}
}, {
key: 'onBlur',
value: function onBlur(e) {
this.setState({ focused: false });
this.props.setValue(this.props.getValue());
if (this.props.onBlur) {
this.props.onBlur(this.props.getValue());
}
}
}, {
key: 'render',
value: function render() {
var output = void 0;
var configuration = {
disabled: false,
className: 'pt-label ',
classNameInput: null,
type: 'text',
validationError: null,
format: this.props.format || 'YYYY-MM-DD',
isPristine: this.props.isPristine(),
errorMessage: this.props.getErrorMessage(),
minDate: this.props.minDate || null,
maxDate: this.props.maxDate || null
};
if (this.props.placeholder) {
configuration.placeholder = this.props.placeholder;
}
if (this.props.type) {
configuration.type = this.props.type;
}
if (this.props.inline) {
configuration.className += 'pt-inline ';
}
if (this.props.fill) {
configuration.className += 'pt-fill ';
configuration.classNameInput += 'pt-fill ';
}
if (this.props.disabled) {
configuration.className += 'pt-disabled ';
configuration.disabled = true;
}
if (!this.state.focused && this.props.showRequired()) {
configuration.classNameInput = 'pt-intent-warning ';
if (this.props.inline) {
configuration.validationError = _react2.default.createElement(
'span',
{ style: { color: '#D9822B' } },
'*'
);
} else {
configuration.validationError = _react2.default.createElement(
'span',
{ style: { color: '#D9822B' } },
'*Required'
);
}
}
if (!this.state.focused && this.props.showError()) {
configuration.classNameInput = 'pt-intent-danger ';
if (this.props.inline) {
configuration.validationError = _react2.default.createElement(
'span',
{ style: { color: '#DB3737' } },
'!'
);
} else {
configuration.validationError = _react2.default.createElement(
'span',
{ style: { color: '#DB3737' } },
this.getErrorMessage()
);
}
}
if (this.props.label) {
output = _react2.default.createElement(
'label',
{ className: configuration.className },
this.props.label,
configuration.validationError,
_react2.default.createElement(_datetime.DateInput, {
format: configuration.format,
className: configuration.classNameInput,
disabled: configuration.disabled,
name: this.props.name,
maxDate: configuration.maxDate,
minDate: configuration.minDate,
value: this.props.getValue(),
onChange: this.changeValue,
onKeyDown: this.onKeyDown,
onFocus: this.onFocus,
onBlur: this.onBlur })
);
} else {
output = _react2.default.createElement(_datetime.DateInput, {
format: configuration.format,
className: configuration.classNameInput,
disabled: configuration.disabled,
name: this.props.name,
maxDate: configuration.maxDate,
minDate: configuration.minDate,
value: this.props.getValue(),
onChange: this.changeValue,
onKeyDown: this.onKeyDown,
onFocus: this.onFocus,
onBlur: this.onBlur });
}
return _react2.default.createElement(
'div',
null,
output
);
}
}]);
return FormsyDateInput;
}(_react.Component);
FormsyDateInput.propTypes = {
label: _propTypes2.default.string,
name: _propTypes2.default.string,
inline: _propTypes2.default.bool,
format: _propTypes2.default.string,
initialValue: _propTypes2.default.instanceOf(Date),
maxDate: _propTypes2.default.PropTypes.instanceOf(Date),
minDate: _propTypes2.default.PropTypes.instanceOf(Date),
value: _propTypes2.default.string,
placeholder: _propTypes2.default.string,
fill: _propTypes2.default.bool,
disabled: _propTypes2.default.bool
};
exports.default = (0, _formsyReact.withFormsy)(FormsyDateInput); |
(function() {
'use strict';
angular
.module('g2MatriculaApp')
.factory('Activate', Activate);
Activate.$inject = ['$resource'];
function Activate ($resource) {
var service = $resource('api/activate', {}, {
'get': { method: 'GET', params: {}, isArray: false}
});
return service;
}
})();
|
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
import React, { Component } from 'react';
import styles from './Feedback.css';
import withStyles from '../../decorators/withStyles';
@withStyles(styles)
class Feedback extends Component {
render() {
return (
<div className="Feedback">
</div>
);
}
}
export default Feedback;
|
import { SearchParameters, SearchResults } from 'algoliasearch-helper';
import connect from '../connectMenu';
jest.mock('../../core/createConnector', () => (x) => x);
let props;
let params;
describe('connectMenu', () => {
describe('single index', () => {
const contextValue = { mainTargetedIndex: 'index' };
it('provides the correct props to the component', () => {
const results = {
getFacetValues: jest.fn(() => []),
getFacetByName: () => true,
hits: [],
};
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue },
{},
{}
);
expect(props).toEqual({
items: [],
currentRefinement: null,
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue },
{ menu: { ok: 'wat' } },
{ results }
);
expect(props).toEqual({
items: [],
currentRefinement: 'wat',
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue },
{ menu: { ok: 'wat' } },
{ results }
);
expect(props).toEqual({
items: [],
currentRefinement: 'wat',
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
props = connect.getProvidedProps(
{ attribute: 'ok', defaultRefinement: 'wat', contextValue },
{},
{ results }
);
expect(props).toEqual({
items: [],
currentRefinement: 'wat',
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue },
{},
{ results }
);
expect(props).toEqual({
items: [],
currentRefinement: null,
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
results.getFacetValues.mockClear();
results.getFacetValues.mockImplementation(() => [
{
name: 'wat',
isRefined: true,
count: 20,
},
{
name: 'oy',
isRefined: false,
count: 10,
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue },
{},
{ results }
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
{
value: 'oy',
label: 'oy',
isRefined: false,
count: 10,
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', limit: 1, contextValue },
{},
{ results }
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
]);
props = connect.getProvidedProps(
{
attribute: 'ok',
showMore: true,
limit: 0,
showMoreLimit: 1,
contextValue,
},
{},
{ results }
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', limit: 1, contextValue },
{},
{ results },
{},
{
query: 'query',
ok: [
{
value: 'wat',
count: 10,
highlighted: 'wat',
isRefined: false,
},
],
}
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: false,
count: 10,
_highlightResult: { label: { value: 'wat' } },
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', limit: 1, contextValue },
{},
{ results },
{},
{ query: '' }
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
]);
const transformItems = jest.fn(() => ['items']);
props = connect.getProvidedProps(
{ attribute: 'ok', transformItems, contextValue },
{},
{ results }
);
expect(transformItems.mock.calls[0][0]).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
{
value: 'oy',
label: 'oy',
isRefined: false,
count: 10,
},
]);
expect(props.items).toEqual(['items']);
});
it('if an item is equal to the currentRefinement, its value should be an empty string', () => {
const results = {
getFacetValues: jest.fn(() => []),
getFacetByName: () => true,
hits: [],
};
results.getFacetValues.mockImplementation(() => [
{
name: 'wat',
isRefined: true,
count: 20,
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue },
{ menu: { ok: 'wat' } },
{ results }
);
expect(props.items).toEqual([
{
value: '',
label: 'wat',
isRefined: true,
count: 20,
},
]);
});
it('facetValues have facetOrdering by default', () => {
const userProps = {
...connect.defaultProps,
attribute: 'ok',
contextValue,
};
const searchState = {
menu: { ok: 'wat' },
};
const parameters = connect.getSearchParameters(
new SearchParameters(),
userProps,
searchState
);
const searchResults = new SearchResults(parameters, [
{
hits: [],
renderingContent: {
facetOrdering: {
values: {
ok: {
order: ['wat'],
},
},
},
},
facets: {
ok: {
wat: 20,
lol: 2000,
},
},
},
]);
const providedProps = connect.getProvidedProps(userProps, searchState, {
results: searchResults,
});
expect(providedProps.items).toEqual([
{
count: 20,
isRefined: true,
label: 'wat',
value: '',
},
{
count: 2000,
isRefined: false,
label: 'lol',
value: 'lol',
},
]);
expect(providedProps.isFromSearch).toBe(false);
});
it('facetValues results does not use facetOrdering if disabled', () => {
const userProps = { attribute: 'ok', facetOrdering: false, contextValue };
const searchState = {
menu: { ok: 'wat' },
};
const parameters = connect.getSearchParameters(
new SearchParameters(),
userProps,
searchState
);
const searchResults = new SearchResults(parameters, [
{
hits: [],
renderingContent: {
facetOrdering: {
values: {
ok: {
order: ['wat'],
},
},
},
},
facets: {
ok: {
wat: 20,
lol: 2000,
},
},
},
]);
const providedProps = connect.getProvidedProps(userProps, searchState, {
results: searchResults,
});
expect(providedProps.items).toEqual([
{
count: 2000,
isRefined: false,
label: 'lol',
value: 'lol',
},
{
count: 20,
isRefined: true,
label: 'wat',
value: '',
},
]);
expect(providedProps.isFromSearch).toBe(false);
});
it("calling refine updates the widget's search state", () => {
const nextState = connect.refine(
{ attribute: 'ok', contextValue },
{ otherKey: 'val', menu: { otherKey: 'val' } },
'yep'
);
expect(nextState).toEqual({
otherKey: 'val',
page: 1,
menu: { ok: 'yep', otherKey: 'val' },
});
});
it("increases maxValuesPerFacet when it isn't big enough", () => {
const initSP = new SearchParameters({ maxValuesPerFacet: 100 });
params = connect.getSearchParameters(
initSP,
{
limit: 101,
contextValue,
},
{}
);
expect(params.maxValuesPerFacet).toBe(101);
params = connect.getSearchParameters(
initSP,
{
showMore: true,
showMoreLimit: 101,
contextValue,
},
{}
);
expect(params.maxValuesPerFacet).toBe(101);
params = connect.getSearchParameters(
initSP,
{
limit: 99,
contextValue,
},
{}
);
expect(params.maxValuesPerFacet).toBe(100);
params = connect.getSearchParameters(
initSP,
{
showMore: true,
showMoreLimit: 99,
contextValue,
},
{}
);
expect(params.maxValuesPerFacet).toBe(100);
});
it('correctly applies its state to search parameters', () => {
const initSP = new SearchParameters();
params = connect.getSearchParameters(
initSP,
{
attribute: 'ok',
limit: 1,
contextValue,
},
{ menu: { ok: 'wat' } }
);
expect(params).toEqual(
initSP
.addDisjunctiveFacet('ok')
.addDisjunctiveFacetRefinement('ok', 'wat')
.setQueryParameter('maxValuesPerFacet', 1)
);
});
it('registers its id in metadata', () => {
const metadata = connect.getMetadata(
{ attribute: 'ok', contextValue },
{}
);
expect(metadata).toEqual({ id: 'ok', index: 'index', items: [] });
});
it('registers its filter in metadata', () => {
const metadata = connect.getMetadata(
{ attribute: 'wot', contextValue },
{ menu: { wot: 'wat' } }
);
expect(metadata).toEqual({
id: 'wot',
index: 'index',
items: [
{
label: 'wot: wat',
attribute: 'wot',
currentRefinement: 'wat',
// Ignore clear, we test it later
value: metadata.items[0].value,
},
],
});
});
it('items value function should clear it from the search state', () => {
const metadata = connect.getMetadata(
{ attribute: 'one', contextValue },
{ menu: { one: 'one', two: 'two' } }
);
const searchState = metadata.items[0].value({
menu: { one: 'one', two: 'two' },
});
expect(searchState).toEqual({ page: 1, menu: { one: '', two: 'two' } });
});
it('should return the right searchState when clean up', () => {
let searchState = connect.cleanUp(
{ attribute: 'name', contextValue },
{
menu: { name: 'searchState', name2: 'searchState' },
another: { searchState: 'searchState' },
}
);
expect(searchState).toEqual({
menu: { name2: 'searchState' },
another: { searchState: 'searchState' },
});
searchState = connect.cleanUp(
{ attribute: 'name2', contextValue },
searchState
);
expect(searchState).toEqual({
menu: {},
another: { searchState: 'searchState' },
});
});
it('calling searchForItems return the right searchForItems parameters with limit', () => {
const parameters = connect.searchForFacetValues(
{ attribute: 'ok', limit: 15, showMoreLimit: 25, showMore: false },
{},
'yep'
);
expect(parameters).toEqual({
facetName: 'ok',
query: 'yep',
maxFacetHits: 15,
});
});
it('calling searchForItems return the right searchForItems parameters with showMoreLimit', () => {
const parameters = connect.searchForFacetValues(
{ attribute: 'ok', limit: 15, showMoreLimit: 25, showMore: true },
{},
'yep'
);
expect(parameters).toEqual({
facetName: 'ok',
query: 'yep',
maxFacetHits: 25,
});
});
it('if not searchable: uses a static sortBy order', () => {
const results = {
getFacetValues: jest.fn(() => [
{
name: 'oy',
isRefined: true,
count: 10,
},
{
name: 'wat',
isRefined: false,
count: 20,
},
]),
getFacetByName: () => true,
hits: [],
};
props = connect.getProvidedProps(
{ ...connect.defaultProps, attribute: 'ok', contextValue },
{},
{ results }
);
expect(results.getFacetValues).toHaveBeenCalledWith('ok', {
sortBy: ['count:desc', 'name:asc'],
facetOrdering: true,
});
expect(props.items).toEqual([
{
value: 'oy',
label: 'oy',
isRefined: true,
count: 10,
},
{
value: 'wat',
label: 'wat',
isRefined: false,
count: 20,
},
]);
});
it('if searchable: use the default sortBy order', () => {
const results = {
getFacetValues: jest.fn(() => [
{
name: 'oy',
isRefined: true,
count: 10,
},
{
name: 'wat',
isRefined: false,
count: 20,
},
]),
getFacetByName: () => true,
hits: [],
};
props = connect.getProvidedProps(
{
...connect.defaultProps,
attribute: 'ok',
searchable: true,
contextValue,
},
{},
{ results }
);
expect(results.getFacetValues).toHaveBeenCalledWith('ok', {
sortBy: undefined,
facetOrdering: true,
});
expect(props.items).toEqual([
{
value: 'oy',
label: 'oy',
isRefined: true,
count: 10,
},
{
value: 'wat',
label: 'wat',
isRefined: false,
count: 20,
},
]);
});
it('computes canRefine based on the length of the transformed items list', () => {
const transformItems = () => [];
const results = {
getFacetValues: () => [
{ count: 1, id: 'test', isRefined: true, name: 'test' },
],
getFacetByName: () => true,
hits: [],
};
props = connect.getProvidedProps(
{ attribute: 'ok', transformItems, contextValue },
{},
{ results }
);
expect(props.canRefine).toEqual(false);
});
});
describe('multi index', () => {
const contextValue = { mainTargetedIndex: 'first' };
const indexContextValue = { targetedIndex: 'second' };
it('provides the correct props to the component', () => {
const results = {
second: {
getFacetValues: jest.fn(() => []),
getFacetByName: () => true,
},
};
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue, indexContextValue },
{},
{}
);
expect(props).toEqual({
items: [],
currentRefinement: null,
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue, indexContextValue },
{ indices: { second: { menu: { ok: 'wat' } } } },
{ results }
);
expect(props).toEqual({
items: [],
currentRefinement: 'wat',
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue, indexContextValue },
{ indices: { second: { menu: { ok: 'wat' } } } },
{ results }
);
expect(props).toEqual({
items: [],
currentRefinement: 'wat',
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
props = connect.getProvidedProps(
{
attribute: 'ok',
defaultRefinement: 'wat',
contextValue,
indexContextValue,
},
{},
{ results }
);
expect(props).toEqual({
items: [],
currentRefinement: 'wat',
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue, indexContextValue },
{},
{ results }
);
expect(props).toEqual({
items: [],
currentRefinement: null,
isFromSearch: false,
canRefine: false,
searchForItems: undefined,
});
results.second.getFacetValues.mockClear();
results.second.getFacetValues.mockImplementation(() => [
{
name: 'wat',
isRefined: true,
count: 20,
},
{
name: 'oy',
isRefined: false,
count: 10,
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue, indexContextValue },
{},
{ results }
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
{
value: 'oy',
label: 'oy',
isRefined: false,
count: 10,
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', limit: 1, contextValue, indexContextValue },
{},
{ results }
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
]);
props = connect.getProvidedProps(
{
attribute: 'ok',
showMore: true,
limit: 0,
showMoreLimit: 1,
contextValue,
indexContextValue,
},
{},
{ results }
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', limit: 1, contextValue, indexContextValue },
{},
{ results },
{},
{
query: 'query',
ok: [
{
value: 'wat',
count: 10,
highlighted: 'wat',
isRefined: false,
},
],
}
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: false,
count: 10,
_highlightResult: { label: { value: 'wat' } },
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', limit: 1, contextValue, indexContextValue },
{},
{ results },
{},
{ query: '' }
);
expect(props.items).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
]);
const transformItems = jest.fn(() => ['items']);
props = connect.getProvidedProps(
{ attribute: 'ok', transformItems, contextValue, indexContextValue },
{},
{ results }
);
expect(transformItems.mock.calls[0][0]).toEqual([
{
value: 'wat',
label: 'wat',
isRefined: true,
count: 20,
},
{
value: 'oy',
label: 'oy',
isRefined: false,
count: 10,
},
]);
expect(props.items).toEqual(['items']);
});
it('if an item is equal to the currentRefinement, its value should be an empty string', () => {
const results = {
second: {
getFacetValues: jest.fn(() => []),
getFacetByName: () => true,
},
};
results.second.getFacetValues.mockImplementation(() => [
{
name: 'wat',
isRefined: true,
count: 20,
},
]);
props = connect.getProvidedProps(
{ attribute: 'ok', contextValue, indexContextValue },
{ indices: { second: { menu: { ok: 'wat' } } } },
{ results }
);
expect(props.items).toEqual([
{
value: '',
label: 'wat',
isRefined: true,
count: 20,
},
]);
});
it("calling refine updates the widget's search state", () => {
let nextState = connect.refine(
{ attribute: 'ok', contextValue, indexContextValue },
{
indices: {
second: { otherKey: 'val', menu: { ok: 'wat', otherKey: 'val' } },
},
},
'yep'
);
expect(nextState).toEqual({
indices: {
second: {
page: 1,
otherKey: 'val',
menu: { ok: 'yep', otherKey: 'val' },
},
},
});
nextState = connect.refine(
{
attribute: 'ok',
contextValue,
indexContextValue: { targetedIndex: 'second' },
},
{
indices: {
first: { otherKey: 'val', menu: { ok: 'wat', otherKey: 'val' } },
},
},
'yep'
);
expect(nextState).toEqual({
indices: {
first: { otherKey: 'val', menu: { ok: 'wat', otherKey: 'val' } },
second: { page: 1, menu: { ok: 'yep' } },
},
});
});
it('correctly applies its state to search parameters', () => {
const initSP = new SearchParameters();
params = connect.getSearchParameters(
initSP,
{
attribute: 'ok',
limit: 1,
contextValue,
indexContextValue,
},
{ indices: { second: { menu: { ok: 'wat' } } } }
);
expect(params).toEqual(
initSP
.addDisjunctiveFacet('ok')
.addDisjunctiveFacetRefinement('ok', 'wat')
.setQueryParameter('maxValuesPerFacet', 1)
);
});
it('registers its filter in metadata', () => {
const metadata = connect.getMetadata(
{ attribute: 'wot', contextValue, indexContextValue },
{ indices: { second: { menu: { wot: 'wat' } } } }
);
expect(metadata).toEqual({
id: 'wot',
index: 'second',
items: [
{
label: 'wot: wat',
attribute: 'wot',
currentRefinement: 'wat',
// Ignore clear, we test it later
value: metadata.items[0].value,
},
],
});
});
it('items value function should clear it from the search state', () => {
const metadata = connect.getMetadata(
{ attribute: 'one', contextValue, indexContextValue },
{ indices: { second: { menu: { one: 'one', two: 'two' } } } }
);
const searchState = metadata.items[0].value({
indices: { second: { menu: { one: 'one', two: 'two' } } },
});
expect(searchState).toEqual({
indices: { second: { page: 1, menu: { one: '', two: 'two' } } },
});
});
it('should return the right searchState when clean up', () => {
let searchState = connect.cleanUp(
{ attribute: 'name', contextValue, indexContextValue },
{
indices: {
first: {
random: { untouched: 'yes' },
},
second: {
menu: { name: 'searchState', name2: 'searchState2' },
another: { searchState: 'searchState' },
},
},
}
);
expect(searchState).toEqual({
indices: {
first: {
random: { untouched: 'yes' },
},
second: {
another: {
searchState: 'searchState',
},
menu: {
name2: 'searchState2',
},
},
},
});
searchState = connect.cleanUp(
{ attribute: 'name2', contextValue, indexContextValue },
searchState
);
expect(searchState).toEqual({
indices: {
first: {
random: { untouched: 'yes' },
},
second: { another: { searchState: 'searchState' }, menu: {} },
},
});
});
it('errors if searchable is used in a multi index context', () => {
expect(() => {
connect.getProvidedProps(
{
contextValue,
indexContextValue,
searchable: true,
},
{},
{}
);
}).toThrowErrorMatchingInlineSnapshot(
`"react-instantsearch: searching in *List is not available when used inside a multi index context"`
);
});
});
});
|
define(['jquery', 'cfgs', 'API',
'core/core-modules/framework.event',
'core/core-modules/framework.ajax',
'core/core-modules/framework.base64',
'core/core-modules/framework.block',
'core/core-modules/framework.dialog',
'core/core-modules/framework.generator',
'core/core-modules/framework.layout',
'core/core-modules/framework.util',
'core/core-modules/framework.form',
'core/core-modules/framework.table',
'core/core-modules/framework.dict',
"core/core-modules/framework.cookie",
'core/core-plugins/plugins-logging'],
function ($, cfgs, api, event, ajax, base64, block, dialog, generator, layout, util, form, table, dict, cookie) {
String.prototype.startWith = function (str) {
var reg = new RegExp("^" + str);
return reg.test(this);
}
String.prototype.endWith = function (str) {
var reg = new RegExp(str + "$");
return reg.test(this);
}
form.source = layout;
var exportModule = {
config: cfgs,
api: api,
// event: event,
// ajax: ajax,
base64: base64,
block: block,
generator: generator,
layout: layout,
util: util,
form: form,
table: table,
dict: dict,
cookie: cookie,
// 对话框处理
alert: dialog.alertText,
confirm: dialog.confirm,
// ajax处理
get: ajax.get,
post: ajax.post,
// 事件处理
on: event.on,
off: event.off,
raise: event.raise,
Start: function (dependencies) {
console.info("应用程序启动");
require(dependencies, function () {
layout.init();
})();
}
};
return exportModule
}); |
import Vue from 'vue'
import { looseEqual } from 'shared/util'
/**
* setting <select>'s value in IE9 doesn't work
* we have to manually loop through the options
*/
function updateSelect (el, value) {
var options = el.options
var i = options.length
while (i--) {
if (looseEqual(getValue(options[i]), value)) {
options[i].selected = true
break
}
}
}
function getValue (option) {
return '_value' in option
? option._value
: option.value || option.text
}
describe('Directive v-model select', () => {
it('should work', done => {
const vm = new Vue({
data: {
test: 'b'
},
template:
'<select v-model="test">' +
'<option>a</option>' +
'<option>b</option>' +
'<option>c</option>' +
'</select>'
}).$mount()
document.body.appendChild(vm.$el)
expect(vm.test).toBe('b')
expect(vm.$el.value).toBe('b')
expect(vm.$el.childNodes[1].selected).toBe(true)
vm.test = 'c'
waitForUpdate(function () {
expect(vm.$el.value).toBe('c')
expect(vm.$el.childNodes[2].selected).toBe(true)
updateSelect(vm.$el, 'a')
triggerEvent(vm.$el, 'change')
expect(vm.test).toBe('a')
}).then(done)
})
it('should work with value bindings', done => {
const vm = new Vue({
data: {
test: 2
},
template:
'<select v-model="test">' +
'<option value="1">a</option>' +
'<option :value="2">b</option>' +
'<option :value="3">c</option>' +
'</select>'
}).$mount()
document.body.appendChild(vm.$el)
expect(vm.$el.value).toBe('2')
expect(vm.$el.childNodes[1].selected).toBe(true)
vm.test = 3
waitForUpdate(function () {
expect(vm.$el.value).toBe('3')
expect(vm.$el.childNodes[2].selected).toBe(true)
updateSelect(vm.$el, '1')
triggerEvent(vm.$el, 'change')
expect(vm.test).toBe('1')
}).then(done)
})
it('should work with value bindings (object loose equal)', done => {
const vm = new Vue({
data: {
test: { a: 2 }
},
template:
'<select v-model="test">' +
'<option value="1">a</option>' +
'<option :value="{ a: 2 }">b</option>' +
'<option :value="{ a: 3 }">c</option>' +
'</select>'
}).$mount()
document.body.appendChild(vm.$el)
expect(vm.$el.childNodes[1].selected).toBe(true)
vm.test = { a: 3 }
waitForUpdate(function () {
expect(vm.$el.childNodes[2].selected).toBe(true)
updateSelect(vm.$el, '1')
triggerEvent(vm.$el, 'change')
expect(vm.test).toBe('1')
updateSelect(vm.$el, { a: 2 })
triggerEvent(vm.$el, 'change')
expect(vm.test).toEqual({ a: 2 })
}).then(done)
})
it('should work with v-for', done => {
const vm = new Vue({
data: {
test: 'b',
opts: ['a', 'b', 'c']
},
template:
'<select v-model="test">' +
'<option v-for="o in opts">{{ o }}</option>' +
'</select>'
}).$mount()
document.body.appendChild(vm.$el)
expect(vm.test).toBe('b')
expect(vm.$el.value).toBe('b')
expect(vm.$el.childNodes[1].selected).toBe(true)
vm.test = 'c'
waitForUpdate(function () {
expect(vm.$el.value).toBe('c')
expect(vm.$el.childNodes[2].selected).toBe(true)
updateSelect(vm.$el, 'a')
triggerEvent(vm.$el, 'change')
expect(vm.test).toBe('a')
// update v-for opts
vm.opts = ['d', 'a']
}).then(() => {
expect(vm.$el.childNodes[0].selected).toBe(false)
expect(vm.$el.childNodes[1].selected).toBe(true)
}).then(done)
})
it('should work with v-for & value bindings', done => {
const vm = new Vue({
data: {
test: 2,
opts: [1, 2, 3]
},
template:
'<select v-model="test">' +
'<option v-for="o in opts" :value="o">optio {{ o }}</option>' +
'</select>'
}).$mount()
document.body.appendChild(vm.$el)
expect(vm.$el.value).toBe('2')
expect(vm.$el.childNodes[1].selected).toBe(true)
vm.test = 3
waitForUpdate(function () {
expect(vm.$el.value).toBe('3')
expect(vm.$el.childNodes[2].selected).toBe(true)
updateSelect(vm.$el, 1)
triggerEvent(vm.$el, 'change')
expect(vm.test).toBe(1)
// update v-for opts
vm.opts = [0, 1]
}).then(() => {
expect(vm.$el.childNodes[0].selected).toBe(false)
expect(vm.$el.childNodes[1].selected).toBe(true)
}).then(done)
})
it('multiple', done => {
const vm = new Vue({
data: {
test: ['b']
},
template:
'<select v-model="test" multiple>' +
'<option>a</option>' +
'<option>b</option>' +
'<option>c</option>' +
'</select>'
}).$mount()
var opts = vm.$el.options
expect(opts[0].selected).toBe(false)
expect(opts[1].selected).toBe(true)
expect(opts[2].selected).toBe(false)
vm.test = ['a', 'c']
waitForUpdate(() => {
expect(opts[0].selected).toBe(true)
expect(opts[1].selected).toBe(false)
expect(opts[2].selected).toBe(true)
opts[0].selected = false
opts[1].selected = true
triggerEvent(vm.$el, 'change')
expect(vm.test).toEqual(['b', 'c'])
}).then(done)
})
it('multiple with static template', () => {
const vm = new Vue({
template:
'<select multiple>' +
'<option selected>a</option>' +
'<option selected>b</option>' +
'<option selected>c</option>' +
'</select>'
}).$mount()
var opts = vm.$el.options
expect(opts[0].selected).toBe(true)
expect(opts[1].selected).toBe(true)
expect(opts[2].selected).toBe(true)
})
it('multiple + v-for', done => {
const vm = new Vue({
data: {
test: ['b'],
opts: ['a', 'b', 'c']
},
template:
'<select v-model="test" multiple>' +
'<option v-for="o in opts">{{ o }}</option>' +
'</select>'
}).$mount()
var opts = vm.$el.options
expect(opts[0].selected).toBe(false)
expect(opts[1].selected).toBe(true)
expect(opts[2].selected).toBe(false)
vm.test = ['a', 'c']
waitForUpdate(() => {
expect(opts[0].selected).toBe(true)
expect(opts[1].selected).toBe(false)
expect(opts[2].selected).toBe(true)
opts[0].selected = false
opts[1].selected = true
triggerEvent(vm.$el, 'change')
expect(vm.test).toEqual(['b', 'c'])
// update v-for opts
vm.opts = ['c', 'd']
}).then(() => {
expect(opts[0].selected).toBe(true)
expect(opts[1].selected).toBe(false)
expect(vm.test).toEqual(['c']) // should remove 'd' which no longer has a matching option
}).then(done)
})
it('should warn inline selected', () => {
const vm = new Vue({
data: {
test: null
},
template:
'<select v-model="test">' +
'<option selected>a</option>' +
'</select>'
}).$mount()
expect(vm.$el.selectedIndex).toBe(-1)
expect('inline selected attributes on <option> will be ignored when using v-model')
.toHaveBeenWarned()
})
it('should warn multiple with non-Array value', () => {
new Vue({
data: {
test: 'meh'
},
template:
'<select v-model="test" multiple></select>'
}).$mount()
expect('<select multiple v-model="test"> expects an Array value for its binding, but got String')
.toHaveBeenWarned()
})
})
|
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
/**
* Skill Schema
*/
var SkillSchema = new Schema({
name: {
type: String,
default: '',
required: 'Please fill Skill name',
trim: true
},
description:{
type: String,
default: '',
trim: true
},
check:{
type: String,
default: '',
trim: true
},
action:{
type: String,
default: '',
trim: true
},
tryAgain:{
type: String,
default: '',
trim: true
},
special: {
type: String,
default: '',
trim: true
},
synergy:{
type: String,
default: '',
trim: true
},
untrained:{
type: String,
default: '',
trim: true
},
keyAbility:{
type: String,
default: 'Str',
trim: true
},
trainedOnly:{
type: Boolean,
default: false
},
armorCheckPen: {
type: Boolean,
default: false
},
book:{
type: String,
default: '',
required: 'Please select the book this class comes from',
trim: true
},
bookid:{
type:String,
default: '',
trim: true
},
gameversion: {
type: String,
default: '',
trim: true
},
gameversionID:{
type: String,
default: '',
trim: true
},
created: {
type: Date,
default: Date.now
},
user: {
type: Schema.ObjectId,
ref: 'User'
}
});
mongoose.model('Skill', SkillSchema);
|
//$("#markItUp").markItUp(myMarkdownSettings);
var editor = new EpicEditor().load();
var btn_edit_doc = $('#btn_edit_doc');
btn_edit_doc.click(function () {
$.get('http://localhost/kuku.html', function(data) {
editor.importFile('kuku', data); //Imports a file when the user clicks this button
});
});
|
/*globals TemplateTests:true,MyApp:true,App:true,Ember:true */
/*jshint newcap:false*/
import Ember from "ember-metal/core"; // Ember.lookup
import jQuery from "ember-views/system/jquery";
// import {expectAssertion} from "ember-metal/tests/debug_helpers";
import { forEach } from "ember-metal/enumerable_utils";
import run from "ember-metal/run_loop";
import Namespace from "ember-runtime/system/namespace";
import EmberView from "ember-views/views/view";
import _MetamorphView from "ember-handlebars/views/metamorph_view";
import EmberHandlebars from "ember-handlebars";
import EmberObject from "ember-runtime/system/object";
import ObjectController from "ember-runtime/controllers/object_controller";
import { A } from "ember-runtime/system/native_array";
import { computed } from "ember-metal/computed";
import { fmt } from "ember-runtime/system/string";
import { typeOf } from "ember-metal/utils";
import ArrayProxy from "ember-runtime/system/array_proxy";
import CollectionView from "ember-views/views/collection_view";
import ContainerView from "ember-views/views/container_view";
import { Binding } from "ember-metal/binding";
import { observersFor } from "ember-metal/observer";
import TextField from "ember-handlebars/controls/text_field";
import Container from "ember-runtime/system/container";
import Logger from "ember-metal/logger";
import htmlSafe from "ember-handlebars/string";
// for global lookups in template. :(
Ember.View = EmberView;
Ember.ContainerView = ContainerView;
Ember.Logger = Logger;
var trim = jQuery.trim;
import { get } from "ember-metal/property_get";
import { set } from "ember-metal/property_set";
function firstGrandchild(view) {
return get(get(view, 'childViews').objectAt(0), 'childViews').objectAt(0);
}
function nthChild(view, nth) {
return get(view, 'childViews').objectAt(nth || 0);
}
var firstChild = nthChild;
var originalLog, logCalls;
var caretPosition = function (element) {
var ctrl = element[0];
var caretPos = 0;
// IE Support
if (document.selection) {
ctrl.focus();
var selection = document.selection.createRange();
selection.moveStart('character', -ctrl.value.length);
caretPos = selection.text.length;
}
// Firefox support
else if (ctrl.selectionStart || ctrl.selectionStart === '0') {
caretPos = ctrl.selectionStart;
}
return caretPos;
};
var setCaretPosition = function (element, pos) {
var ctrl = element[0];
if (ctrl.setSelectionRange) {
ctrl.focus();
ctrl.setSelectionRange(pos,pos);
} else if (ctrl.createTextRange) {
var range = ctrl.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
};
var view;
var appendView = function() {
run(function() { view.appendTo('#qunit-fixture'); });
};
var originalLookup = Ember.lookup, lookup;
var TemplateTests, container;
/**
This module specifically tests integration with Handlebars and Ember-specific
Handlebars extensions.
If you add additional template support to View, you should create a new
file in which to test.
*/
QUnit.module("View - handlebars integration", {
setup: function() {
Ember.lookup = lookup = { Ember: Ember };
lookup.TemplateTests = window.TemplateTests = TemplateTests = Namespace.create();
container = new Container();
container.optionsForType('template', { instantiate: false });
container.register('view:default', _MetamorphView);
container.register('view:toplevel', EmberView.extend());
},
teardown: function() {
run(function() {
if (container) {
container.destroy();
}
if (view) {
view.destroy();
}
container = view = null;
});
Ember.lookup = originalLookup;
window.TemplateTests = TemplateTests = undefined;
}
});
test("template view should call the function of the associated template", function() {
container.register('template:testTemplate', EmberHandlebars.compile("<h1 id='twas-called'>template was called</h1>"));
view = EmberView.create({
container: container,
templateName: 'testTemplate'
});
appendView();
ok(view.$('#twas-called').length, "the named template was called");
});
test("template view should call the function of the associated template with itself as the context", function() {
container.register('template:testTemplate', EmberHandlebars.compile("<h1 id='twas-called'>template was called for {{view.personName}}. Yea {{view.personName}}</h1>"));
view = EmberView.createWithMixins({
container: container,
templateName: 'testTemplate',
_personName: "Tom DAAAALE",
_i: 0,
personName: computed(function() {
this._i++;
return this._personName + this._i;
})
});
appendView();
equal("template was called for Tom DAAAALE1. Yea Tom DAAAALE1", view.$('#twas-called').text(), "the named template was called with the view as the data source");
});
test("should allow values from normal JavaScript hash objects to be used", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#with view.person}}{{firstName}} {{lastName}} (and {{pet.name}}){{/with}}'),
person: {
firstName: 'Señor',
lastName: 'CFC',
pet: {
name: 'Fido'
}
}
});
appendView();
equal(view.$().text(), "Señor CFC (and Fido)", "prints out values from a hash");
});
test("htmlSafe should return an instance of Handlebars.SafeString", function() {
var safeString = htmlSafe("you need to be more <b>bold</b>");
ok(safeString instanceof Handlebars.SafeString, "should return SafeString");
});
test("should escape HTML in normal mustaches", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{view.output}}'),
output: "you need to be more <b>bold</b>"
});
appendView();
equal(view.$('b').length, 0, "does not create an element");
equal(view.$().text(), 'you need to be more <b>bold</b>', "inserts entities, not elements");
run(function() { set(view, 'output', "you are so <i>super</i>"); });
equal(view.$().text(), 'you are so <i>super</i>', "updates with entities, not elements");
equal(view.$('i').length, 0, "does not create an element when value is updated");
});
test("should not escape HTML in triple mustaches", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{{view.output}}}'),
output: "you need to be more <b>bold</b>"
});
appendView();
equal(view.$('b').length, 1, "creates an element");
run(function() {
set(view, 'output', "you are so <i>super</i>");
});
equal(view.$('i').length, 1, "creates an element when value is updated");
});
test("should not escape HTML if string is a Handlebars.SafeString", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{view.output}}'),
output: new Handlebars.SafeString("you need to be more <b>bold</b>")
});
appendView();
equal(view.$('b').length, 1, "creates an element");
run(function() {
set(view, 'output', new Handlebars.SafeString("you are so <i>super</i>"));
});
equal(view.$('i').length, 1, "creates an element when value is updated");
});
test("child views can be inserted using the {{view}} Handlebars helper", function() {
container.register('template:nester', EmberHandlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.LabelView\"}}"));
container.register('template:nested', EmberHandlebars.compile("<div id='child-view'>Goodbye {{cruel}} {{world}}</div>"));
var context = {
world: "world!"
};
TemplateTests.LabelView = EmberView.extend({
container: container,
tagName: "aside",
templateName: 'nested'
});
view = EmberView.create({
container: container,
templateName: 'nester',
context: context
});
set(context, 'cruel', "cruel");
appendView();
ok(view.$("#hello-world:contains('Hello world!')").length, "The parent view renders its contents");
ok(view.$("#child-view:contains('Goodbye cruel world!')").length === 1, "The child view renders its content once");
ok(view.$().text().match(/Hello world!.*Goodbye cruel world\!/), "parent view should appear before the child view");
});
test("should accept relative paths to views", function() {
view = EmberView.create({
template: EmberHandlebars.compile('Hey look, at {{view "view.myCool.view"}}'),
myCool: EmberObject.create({
view: EmberView.extend({
template: EmberHandlebars.compile("my cool view")
})
})
});
appendView();
equal(view.$().text(), "Hey look, at my cool view");
});
test("child views can be inserted inside a bind block", function() {
container.register('template:nester', EmberHandlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.BQView\"}}"));
container.register('template:nested', EmberHandlebars.compile("<div id='child-view'>Goodbye {{#with content}}{{blah}} {{view \"TemplateTests.OtherView\"}}{{/with}} {{world}}</div>"));
container.register('template:other', EmberHandlebars.compile("cruel"));
var context = {
world: "world!"
};
TemplateTests.BQView = EmberView.extend({
container: container,
tagName: "blockquote",
templateName: 'nested'
});
TemplateTests.OtherView = EmberView.extend({
container: container,
templateName: 'other'
});
view = EmberView.create({
container: container,
context: context,
templateName: 'nester'
});
set(context, 'content', EmberObject.create({ blah: "wot" }));
appendView();
ok(view.$("#hello-world:contains('Hello world!')").length, "The parent view renders its contents");
ok(view.$("blockquote").text().match(/Goodbye.*wot.*cruel.*world\!/), "The child view renders its content once");
ok(view.$().text().match(/Hello world!.*Goodbye.*wot.*cruel.*world\!/), "parent view should appear before the child view");
});
test("View should bind properties in the parent context", function() {
var context = {
content: EmberObject.create({
wham: 'bam'
}),
blam: "shazam"
};
view = EmberView.create({
context: context,
template: EmberHandlebars.compile('<h1 id="first">{{#with content}}{{wham}}-{{../blam}}{{/with}}</h1>')
});
appendView();
equal(view.$('#first').text(), "bam-shazam", "renders parent properties");
});
test("using Handlebars helper that doesn't exist should result in an error", function() {
var names = [{ name: 'Alex' }, { name: 'Stef' }],
context = {
content: A(names)
};
throws(function() {
view = EmberView.create({
context: context,
template: EmberHandlebars.compile('{{#group}}{{#each name in content}}{{name}}{{/each}}{{/group}}')
});
appendView();
}, "Missing helper: 'group'");
});
test("View should bind properties in the grandparent context", function() {
var context = {
content: EmberObject.create({
wham: 'bam',
thankYou: EmberObject.create({
value: "ma'am"
})
}),
blam: "shazam"
};
view = EmberView.create({
context: context,
template: EmberHandlebars.compile('<h1 id="first">{{#with content}}{{#with thankYou}}{{value}}-{{../wham}}-{{../../blam}}{{/with}}{{/with}}</h1>')
});
appendView();
equal(view.$('#first').text(), "ma'am-bam-shazam", "renders grandparent properties");
});
test("View should update when a property changes and the bind helper is used", function() {
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#with view.content}}{{bind "wham"}}{{/with}}</h1>'));
view = EmberView.create({
container: container,
templateName: 'foo',
content: EmberObject.create({
wham: 'bam',
thankYou: "ma'am"
})
});
appendView();
equal(view.$('#first').text(), "bam", "precond - view renders Handlebars template");
run(function() { set(get(view, 'content'), 'wham', 'bazam'); });
equal(view.$('#first').text(), "bazam", "view updates when a bound property changes");
});
test("View should not use keyword incorrectly - Issue #1315", function() {
container.register('template:foo', EmberHandlebars.compile('{{#each value in view.content}}{{value}}-{{#each option in view.options}}{{option.value}}:{{option.label}} {{/each}}{{/each}}'));
view = EmberView.create({
container: container,
templateName: 'foo',
content: A(['X', 'Y']),
options: A([
{ label: 'One', value: 1 },
{ label: 'Two', value: 2 }
])
});
appendView();
equal(view.$().text(), 'X-1:One 2:Two Y-1:One 2:Two ');
});
test("View should update when a property changes and no bind helper is used", function() {
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>'));
var templates = EmberObject.create({
foo: EmberHandlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>')
});
view = EmberView.create({
container: container,
templateName: 'foo',
content: EmberObject.create({
wham: 'bam',
thankYou: "ma'am"
})
});
appendView();
equal(view.$('#first').text(), "bam", "precond - view renders Handlebars template");
run(function() { set(get(view, 'content'), 'wham', 'bazam'); });
equal(view.$('#first').text(), "bazam", "view updates when a bound property changes");
});
test("View should update when the property used with the #with helper changes", function() {
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>'));
view = EmberView.create({
container: container,
templateName: 'foo',
content: EmberObject.create({
wham: 'bam',
thankYou: "ma'am"
})
});
appendView();
equal(view.$('#first').text(), "bam", "precond - view renders Handlebars template");
run(function() {
set(view, 'content', EmberObject.create({
wham: 'bazam'
}));
});
equal(view.$('#first').text(), "bazam", "view updates when a bound property changes");
});
test("should not update when a property is removed from the view", function() {
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#bind "view.content"}}{{#bind "foo"}}{{bind "baz"}}{{/bind}}{{/bind}}</h1>'));
view = EmberView.create({
container: container,
templateName: 'foo',
content: EmberObject.create({
foo: EmberObject.create({
baz: "unicorns"
})
})
});
appendView();
equal(view.$('#first').text(), "unicorns", "precond - renders the bound value");
var oldContent = get(view, 'content');
run(function() {
set(view, 'content', EmberObject.create({
foo: EmberObject.create({
baz: "ninjas"
})
}));
});
equal(view.$('#first').text(), 'ninjas', "updates to new content value");
run(function() {
set(oldContent, 'foo.baz', 'rockstars');
});
run(function() {
set(oldContent, 'foo.baz', 'ewoks');
});
equal(view.$('#first').text(), "ninjas", "does not update removed object");
});
test("Handlebars templates update properties if a content object changes", function() {
container.register('template:menu', EmberHandlebars.compile('<h1>Today\'s Menu</h1>{{#bind "view.coffee"}}<h2>{{color}} coffee</h2><span id="price">{{bind "price"}}</span>{{/bind}}'));
run(function() {
view = EmberView.create({
container: container,
templateName: 'menu',
coffee: EmberObject.create({
color: 'brown',
price: '$4'
})
});
});
appendView();
equal(view.$('h2').text(), "brown coffee", "precond - renders color correctly");
equal(view.$('#price').text(), '$4', "precond - renders price correctly");
run(function() {
set(view, 'coffee', EmberObject.create({
color: "mauve",
price: "$4.50"
}));
});
equal(view.$('h2').text(), "mauve coffee", "should update name field when content changes");
equal(view.$('#price').text(), "$4.50", "should update price field when content changes");
run(function() {
set(view, 'coffee', EmberObject.create({
color: "mauve",
price: "$5.50"
}));
});
equal(view.$('h2').text(), "mauve coffee", "should update name field when content changes");
equal(view.$('#price').text(), "$5.50", "should update price field when content changes");
run(function() {
set(view, 'coffee.price', "$5");
});
equal(view.$('#price').text(), "$5", "should update price field when price property is changed");
run(function() {
view.destroy();
});
});
test("Template updates correctly if a path is passed to the bind helper", function() {
container.register('template:menu', EmberHandlebars.compile('<h1>{{bind "view.coffee.price"}}</h1>'));
view = EmberView.create({
container: container,
templateName: 'menu',
coffee: EmberObject.create({
price: '$4'
})
});
appendView();
equal(view.$('h1').text(), "$4", "precond - renders price");
run(function() {
set(view, 'coffee.price', "$5");
});
equal(view.$('h1').text(), "$5", "updates when property changes");
run(function() {
set(view, 'coffee', { price: "$6" });
});
equal(view.$('h1').text(), "$6", "updates when parent property changes");
});
test("Template updates correctly if a path is passed to the bind helper and the context object is an ObjectController", function() {
container.register('template:menu', EmberHandlebars.compile('<h1>{{bind "view.coffee.price"}}</h1>'));
var controller = ObjectController.create();
var realObject = EmberObject.create({
price: "$4"
});
set(controller, 'model', realObject);
view = EmberView.create({
container: container,
templateName: 'menu',
coffee: controller
});
appendView();
equal(view.$('h1').text(), "$4", "precond - renders price");
run(function() {
set(realObject, 'price', "$5");
});
equal(view.$('h1').text(), "$5", "updates when property is set on real object");
run(function() {
set(controller, 'price', "$6" );
});
equal(view.$('h1').text(), "$6", "updates when property is set on object controller");
});
test("should update the block when object passed to #if helper changes", function() {
container.register('template:menu', EmberHandlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{/if}}</h1>'));
view = EmberView.create({
container: container,
templateName: 'menu',
INCEPTION: "BOOOOOOOONG doodoodoodoodooodoodoodoo",
inception: 'OOOOoooooOOOOOOooooooo'
});
appendView();
equal(view.$('h1').text(), "BOOOOOOOONG doodoodoodoodooodoodoodoo", "renders block if a string");
var tests = [false, null, undefined, [], '', 0];
forEach(tests, function(val) {
run(function() {
set(view, 'inception', val);
});
equal(view.$('h1').text(), '', fmt("hides block when conditional is '%@'", [String(val)]));
run(function() {
set(view, 'inception', true);
});
equal(view.$('h1').text(), "BOOOOOOOONG doodoodoodoodooodoodoodoo", "precond - renders block when conditional is true");
});
});
test("should update the block when object passed to #unless helper changes", function() {
container.register('template:advice', EmberHandlebars.compile('<h1>{{#unless view.onDrugs}}{{view.doWellInSchool}}{{/unless}}</h1>'));
view = EmberView.create({
container: container,
templateName: 'advice',
onDrugs: true,
doWellInSchool: "Eat your vegetables"
});
appendView();
equal(view.$('h1').text(), "", "hides block if true");
var tests = [false, null, undefined, [], '', 0];
forEach(tests, function(val) {
run(function() {
set(view, 'onDrugs', val);
});
equal(view.$('h1').text(), 'Eat your vegetables', fmt("renders block when conditional is '%@'; %@", [String(val), typeOf(val)]));
run(function() {
set(view, 'onDrugs', true);
});
equal(view.$('h1').text(), "", "precond - hides block when conditional is true");
});
});
test("should update the block when object passed to #if helper changes and an inverse is supplied", function() {
container.register('template:menu', EmberHandlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{else}}{{view.SAD}}{{/if}}</h1>'));
view = EmberView.create({
container: container,
templateName: 'menu',
INCEPTION: "BOOOOOOOONG doodoodoodoodooodoodoodoo",
inception: false,
SAD: 'BOONG?'
});
appendView();
equal(view.$('h1').text(), "BOONG?", "renders alternate if false");
run(function() { set(view, 'inception', true); });
var tests = [false, null, undefined, [], '', 0];
forEach(tests, function(val) {
run(function() {
set(view, 'inception', val);
});
equal(view.$('h1').text(), 'BOONG?', fmt("renders alternate if %@", [String(val)]));
run(function() {
set(view, 'inception', true);
});
equal(view.$('h1').text(), "BOOOOOOOONG doodoodoodoodooodoodoodoo", "precond - renders block when conditional is true");
});
});
test("edge case: child conditional should not render children if parent conditional becomes false", function() {
var childCreated = false;
view = EmberView.create({
cond1: true,
cond2: false,
viewClass: EmberView.extend({
init: function() {
this._super();
childCreated = true;
}
}),
template: EmberHandlebars.compile('{{#if view.cond1}}{{#if view.cond2}}{{#view view.viewClass}}test{{/view}}{{/if}}{{/if}}')
});
appendView();
run(function() {
// The order of these sets is important for the test
view.set('cond2', true);
view.set('cond1', false);
});
ok(!childCreated, 'child should not be created');
});
test("Template views return throw if their template cannot be found", function() {
view = EmberView.create({
templateName: 'cantBeFound',
container: { lookup: function() { }}
});
expectAssertion(function() {
get(view, 'template');
}, /cantBeFound/);
});
test("Layout views return throw if their layout cannot be found", function() {
view = EmberView.create({
layoutName: 'cantBeFound'
});
expectAssertion(function() {
get(view, 'layout');
}, /cantBeFound/);
});
test("Template views add an elementId to child views created using the view helper", function() {
container.register('template:parent', EmberHandlebars.compile('<div>{{view "TemplateTests.ChildView"}}</div>'));
container.register('template:child', EmberHandlebars.compile("I can't believe it's not butter."));
TemplateTests.ChildView = EmberView.extend({
container: container,
templateName: 'child'
});
view = EmberView.create({
container: container,
templateName: 'parent'
});
appendView();
var childView = get(view, 'childViews.firstObject');
equal(view.$().children().first().children().first().attr('id'), get(childView, 'elementId'));
});
test("views set the template of their children to a passed block", function() {
container.register('template:parent', EmberHandlebars.compile('<h1>{{#view "TemplateTests.NoTemplateView"}}<span>It worked!</span>{{/view}}</h1>'));
TemplateTests.NoTemplateView = EmberView.extend();
view = EmberView.create({
container: container,
templateName: 'parent'
});
appendView();
ok(view.$('h1:has(span)').length === 1, "renders the passed template inside the parent template");
});
test("views render their template in the context of the parent view's context", function() {
container.register('template:parent', EmberHandlebars.compile('<h1>{{#with content}}{{#view}}{{firstName}} {{lastName}}{{/view}}{{/with}}</h1>'));
var context = {
content: {
firstName: "Lana",
lastName: "del Heeeyyyyyy"
}
};
view = EmberView.create({
container: container,
templateName: 'parent',
context: context
});
appendView();
equal(view.$('h1').text(), "Lana del Heeeyyyyyy", "renders properties from parent context");
});
test("views make a view keyword available that allows template to reference view context", function() {
container.register('template:parent', EmberHandlebars.compile('<h1>{{#with view.content}}{{#view subview}}{{view.firstName}} {{lastName}}{{/view}}{{/with}}</h1>'));
view = EmberView.create({
container: container,
templateName: 'parent',
content: {
subview: EmberView.extend({
firstName: "Brodele"
}),
firstName: "Lana",
lastName: "del Heeeyyyyyy"
}
});
appendView();
equal(view.$('h1').text(), "Brodele del Heeeyyyyyy", "renders properties from parent context");
});
test("a view helper's bindings are to the parent context", function() {
var Subview = EmberView.extend({
classNameBindings: ['color'],
controller: EmberObject.create({
color: 'green',
name: "bar"
}),
template: EmberHandlebars.compile('{{view.someController.name}} {{name}}')
});
var View = EmberView.extend({
controller: EmberObject.create({
color: "mauve",
name: 'foo'
}),
Subview: Subview,
template: EmberHandlebars.compile('<h1>{{view view.Subview colorBinding="color" someControllerBinding="this"}}</h1>')
});
view = View.create();
appendView();
equal(view.$('h1 .mauve').length, 1, "renders property on helper declaration from parent context");
equal(view.$('h1 .mauve').text(), "foo bar", "renders property bound in template from subview context");
});
// test("should warn if setting a template on a view with a templateName already specified", function() {
// view = EmberView.create({
// childView: EmberView.extend({
// templateName: 'foo'
// }),
// template: EmberHandlebars.compile('{{#view childView}}test{{/view}}')
// });
// expectAssertion(function() {
// appendView();
// }, "Unable to find view at path 'childView'");
// run(function() {
// view.destroy();
// });
// view = EmberView.create({
// childView: EmberView.extend(),
// template: EmberHandlebars.compile('{{#view childView templateName="foo"}}test{{/view}}')
// });
// expectAssertion(function() {
// appendView();
// }, "Unable to find view at path 'childView'");
// });
test("Child views created using the view helper should have their parent view set properly", function() {
TemplateTests = {};
var template = '{{#view "Ember.View"}}{{#view "Ember.View"}}{{view "Ember.View"}}{{/view}}{{/view}}';
view = EmberView.create({
template: EmberHandlebars.compile(template)
});
appendView();
var childView = firstGrandchild(view);
equal(childView, get(firstChild(childView), 'parentView'), 'parent view is correct');
});
test("Child views created using the view helper should have their IDs registered for events", function() {
TemplateTests = {};
var template = '{{view "Ember.View"}}{{view "Ember.View" id="templateViewTest"}}';
view = EmberView.create({
template: EmberHandlebars.compile(template)
});
appendView();
var childView = firstChild(view);
var id = childView.$()[0].id;
equal(EmberView.views[id], childView, 'childView without passed ID is registered with View.views so that it can properly receive events from EventDispatcher');
childView = nthChild(view, 1);
id = childView.$()[0].id;
equal(id, 'templateViewTest', 'precond -- id of childView should be set correctly');
equal(EmberView.views[id], childView, 'childView with passed ID is registered with View.views so that it can properly receive events from EventDispatcher');
});
test("Child views created using the view helper and that have a viewName should be registered as properties on their parentView", function() {
TemplateTests = {};
var template = '{{#view Ember.View}}{{view Ember.View viewName="ohai"}}{{/view}}';
view = EmberView.create({
template: EmberHandlebars.compile(template)
});
appendView();
var parentView = firstChild(view),
childView = firstGrandchild(view);
equal(get(parentView, 'ohai'), childView);
});
test("Collection views that specify an example view class have their children be of that class", function() {
TemplateTests.ExampleViewCollection = CollectionView.extend({
itemViewClass: EmberView.extend({
isCustom: true
}),
content: A(['foo'])
});
var parentView = EmberView.create({
template: EmberHandlebars.compile('{{#collection "TemplateTests.ExampleViewCollection"}}OHAI{{/collection}}')
});
run(function() {
parentView.append();
});
ok(firstGrandchild(parentView).isCustom, "uses the example view class");
run(function() {
parentView.destroy();
});
});
test("itemViewClass works in the #collection helper", function() {
TemplateTests.ExampleController = ArrayProxy.create({
content: A(['alpha'])
});
TemplateTests.ExampleItemView = EmberView.extend({
isAlsoCustom: true
});
var parentView = EmberView.create({
template: EmberHandlebars.compile('{{#collection contentBinding="TemplateTests.ExampleController" itemViewClass="TemplateTests.ExampleItemView"}}beta{{/collection}}')
});
run(function() {
parentView.append();
});
ok(firstGrandchild(parentView).isAlsoCustom, "uses the example view class specified in the #collection helper");
run(function() {
parentView.destroy();
});
});
test("itemViewClass works in the #collection helper relatively", function() {
TemplateTests.ExampleController = ArrayProxy.create({
content: A(['alpha'])
});
TemplateTests.ExampleItemView = EmberView.extend({
isAlsoCustom: true
});
TemplateTests.CollectionView = CollectionView.extend({
possibleItemView: TemplateTests.ExampleItemView
});
var parentView = EmberView.create({
template: EmberHandlebars.compile('{{#collection TemplateTests.CollectionView contentBinding="TemplateTests.ExampleController" itemViewClass="possibleItemView"}}beta{{/collection}}')
});
run(function() {
parentView.append();
});
ok(firstGrandchild(parentView).isAlsoCustom, "uses the example view class specified in the #collection helper");
run(function() {
parentView.destroy();
});
});
test("should update boundIf blocks if the conditional changes", function() {
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#boundIf "view.content.myApp.isEnabled"}}{{view.content.wham}}{{/boundIf}}</h1>'));
view = EmberView.create({
container: container,
templateName: 'foo',
content: EmberObject.create({
wham: 'bam',
thankYou: "ma'am",
myApp: EmberObject.create({
isEnabled: true
})
})
});
appendView();
equal(view.$('#first').text(), "bam", "renders block when condition is true");
run(function() {
set(get(view, 'content'), 'myApp.isEnabled', false);
});
equal(view.$('#first').text(), "", "re-renders without block when condition is false");
run(function() {
set(get(view, 'content'), 'myApp.isEnabled', true);
});
equal(view.$('#first').text(), "bam", "re-renders block when condition changes to true");
});
test("should not update boundIf if truthiness does not change", function() {
var renderCount = 0;
view = EmberView.create({
template: EmberHandlebars.compile('<h1 id="first">{{#boundIf "view.shouldDisplay"}}{{view view.InnerViewClass}}{{/boundIf}}</h1>'),
shouldDisplay: true,
InnerViewClass: EmberView.extend({
template: EmberHandlebars.compile("bam"),
render: function() {
renderCount++;
return this._super.apply(this, arguments);
}
})
});
appendView();
equal(renderCount, 1, "precond - should have rendered once");
equal(view.$('#first').text(), "bam", "renders block when condition is true");
run(function() {
set(view, 'shouldDisplay', 1);
});
equal(renderCount, 1, "should not have rerendered");
equal(view.$('#first').text(), "bam", "renders block when condition is true");
});
test("boundIf should support parent access", function() {
view = EmberView.create({
template: EmberHandlebars.compile(
'<h1 id="first">{{#with view.content}}{{#with thankYou}}'+
'{{#boundIf ../view.show}}parent{{/boundIf}}-{{#boundIf ../../view.show}}grandparent{{/boundIf}}'+
'{{/with}}{{/with}}</h1>'
),
content: EmberObject.create({
show: true,
thankYou: EmberObject.create()
}),
show: true
});
appendView();
equal(view.$('#first').text(), "parent-grandparent", "renders boundIfs using ..");
});
test("{{view}} id attribute should set id on layer", function() {
container.register('template:foo', EmberHandlebars.compile('{{#view "TemplateTests.IdView" id="bar"}}baz{{/view}}'));
TemplateTests.IdView = EmberView;
view = EmberView.create({
container: container,
templateName: 'foo'
});
appendView();
equal(view.$('#bar').length, 1, "adds id attribute to layer");
equal(view.$('#bar').text(), 'baz', "emits content");
});
test("{{view}} tag attribute should set tagName of the view", function() {
container.register('template:foo', EmberHandlebars.compile('{{#view "TemplateTests.TagView" tag="span"}}baz{{/view}}'));
TemplateTests.TagView = EmberView;
view = EmberView.create({
container: container,
templateName: 'foo'
});
appendView();
equal(view.$('span').length, 1, "renders with tag name");
equal(view.$('span').text(), 'baz', "emits content");
});
test("{{view}} class attribute should set class on layer", function() {
container.register('template:foo', EmberHandlebars.compile('{{#view "TemplateTests.IdView" class="bar"}}baz{{/view}}'));
TemplateTests.IdView = EmberView;
view = EmberView.create({
container: container,
templateName: 'foo'
});
appendView();
equal(view.$('.bar').length, 1, "adds class attribute to layer");
equal(view.$('.bar').text(), 'baz', "emits content");
});
test("{{view}} should not allow attributeBindings to be set", function() {
expectAssertion(function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{view "Ember.View" attributeBindings="one two"}}')
});
appendView();
}, /Setting 'attributeBindings' via Handlebars is not allowed/);
});
test("{{view}} should be able to point to a local view", function() {
view = EmberView.create({
template: EmberHandlebars.compile("{{view view.common}}"),
common: EmberView.extend({
template: EmberHandlebars.compile("common")
})
});
appendView();
equal(view.$().text(), "common", "tries to look up view name locally");
});
test("{{view}} should evaluate class bindings set to global paths", function() {
var App;
run(function() {
lookup.App = App = Namespace.create({
isApp: true,
isGreat: true,
directClass: "app-direct",
isEnabled: true
});
});
view = EmberView.create({
template: EmberHandlebars.compile('{{view Ember.TextField class="unbound" classBinding="App.isGreat:great App.directClass App.isApp App.isEnabled:enabled:disabled"}}')
});
appendView();
ok(view.$('input').hasClass('unbound'), "sets unbound classes directly");
ok(view.$('input').hasClass('great'), "evaluates classes bound to global paths");
ok(view.$('input').hasClass('app-direct'), "evaluates classes bound directly to global paths");
ok(view.$('input').hasClass('is-app'), "evaluates classes bound directly to booleans in global paths - dasherizes and sets class when true");
ok(view.$('input').hasClass('enabled'), "evaluates ternary operator in classBindings");
ok(!view.$('input').hasClass('disabled'), "evaluates ternary operator in classBindings");
run(function() {
App.set('isApp', false);
App.set('isEnabled', false);
});
ok(!view.$('input').hasClass('is-app'), "evaluates classes bound directly to booleans in global paths - removes class when false");
ok(!view.$('input').hasClass('enabled'), "evaluates ternary operator in classBindings");
ok(view.$('input').hasClass('disabled'), "evaluates ternary operator in classBindings");
run(function() {
lookup.App.destroy();
});
});
test("{{view}} should evaluate class bindings set in the current context", function() {
view = EmberView.create({
isView: true,
isEditable: true,
directClass: "view-direct",
isEnabled: true,
template: EmberHandlebars.compile('{{view Ember.TextField class="unbound" classBinding="view.isEditable:editable view.directClass view.isView view.isEnabled:enabled:disabled"}}')
});
appendView();
ok(view.$('input').hasClass('unbound'), "sets unbound classes directly");
ok(view.$('input').hasClass('editable'), "evaluates classes bound in the current context");
ok(view.$('input').hasClass('view-direct'), "evaluates classes bound directly in the current context");
ok(view.$('input').hasClass('is-view'), "evaluates classes bound directly to booleans in the current context - dasherizes and sets class when true");
ok(view.$('input').hasClass('enabled'), "evaluates ternary operator in classBindings");
ok(!view.$('input').hasClass('disabled'), "evaluates ternary operator in classBindings");
run(function() {
view.set('isView', false);
view.set('isEnabled', false);
});
ok(!view.$('input').hasClass('is-view'), "evaluates classes bound directly to booleans in the current context - removes class when false");
ok(!view.$('input').hasClass('enabled'), "evaluates ternary operator in classBindings");
ok(view.$('input').hasClass('disabled'), "evaluates ternary operator in classBindings");
});
test("{{view}} should evaluate class bindings set with either classBinding or classNameBindings", function() {
var App;
run(function() {
lookup.App = App = Namespace.create({
isGreat: true,
isEnabled: true
});
});
view = EmberView.create({
template: EmberHandlebars.compile('{{view Ember.TextField class="unbound" classBinding="App.isGreat:great App.isEnabled:enabled:disabled" classNameBindings="App.isGreat:really-great App.isEnabled:really-enabled:really-disabled"}}')
});
appendView();
ok(view.$('input').hasClass('unbound'), "sets unbound classes directly");
ok(view.$('input').hasClass('great'), "evaluates classBinding");
ok(view.$('input').hasClass('really-great'), "evaluates classNameBinding");
ok(view.$('input').hasClass('enabled'), "evaluates ternary operator in classBindings");
ok(view.$('input').hasClass('really-enabled'), "evaluates ternary operator in classBindings");
ok(!view.$('input').hasClass('disabled'), "evaluates ternary operator in classBindings");
ok(!view.$('input').hasClass('really-disabled'), "evaluates ternary operator in classBindings");
run(function() {
App.set('isEnabled', false);
});
ok(!view.$('input').hasClass('enabled'), "evaluates ternary operator in classBindings");
ok(!view.$('input').hasClass('really-enabled'), "evaluates ternary operator in classBindings");
ok(view.$('input').hasClass('disabled'), "evaluates ternary operator in classBindings");
ok(view.$('input').hasClass('really-disabled'), "evaluates ternary operator in classBindings");
run(function() {
lookup.App.destroy();
});
});
test("{{view}} should evaluate other attribute bindings set to global paths", function() {
run(function() {
lookup.App = Namespace.create({
name: "myApp"
});
});
view = EmberView.create({
template: EmberHandlebars.compile('{{view Ember.TextField valueBinding="App.name"}}')
});
appendView();
equal(view.$('input').attr('value'), "myApp", "evaluates attributes bound to global paths");
run(function() {
lookup.App.destroy();
});
});
test("{{view}} should evaluate other attributes bindings set in the current context", function() {
view = EmberView.create({
name: "myView",
template: EmberHandlebars.compile('{{view Ember.TextField valueBinding="view.name"}}')
});
appendView();
equal(view.$('input').attr('value'), "myView", "evaluates attributes bound in the current context");
});
test("{{view}} should be able to bind class names to truthy properties", function() {
container.register('template:template', EmberHandlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy"}}foo{{/view}}'));
TemplateTests.classBindingView = EmberView.extend();
view = EmberView.create({
container: container,
number: 5,
templateName: 'template'
});
appendView();
equal(view.$('.is-truthy').length, 1, "sets class name");
run(function() {
set(view, 'number', 0);
});
equal(view.$('.is-truthy').length, 0, "removes class name if bound property is set to falsey");
});
test("{{view}} should be able to bind class names to truthy or falsy properties", function() {
container.register('template:template', EmberHandlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy:is-falsy"}}foo{{/view}}'));
TemplateTests.classBindingView = EmberView.extend();
view = EmberView.create({
container: container,
number: 5,
templateName: 'template'
});
appendView();
equal(view.$('.is-truthy').length, 1, "sets class name to truthy value");
equal(view.$('.is-falsy').length, 0, "doesn't set class name to falsy value");
run(function() {
set(view, 'number', 0);
});
equal(view.$('.is-truthy').length, 0, "doesn't set class name to truthy value");
equal(view.$('.is-falsy').length, 1, "sets class name to falsy value");
});
test("should be able to bind element attributes using {{bind-attr}}", function() {
var template = EmberHandlebars.compile('<img {{bind-attr src="view.content.url" alt="view.content.title"}}>');
view = EmberView.create({
template: template,
content: EmberObject.create({
url: "http://www.emberjs.com/assets/images/logo.png",
title: "The SproutCore Logo"
})
});
appendView();
equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute");
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");
run(function() {
set(view, 'content.title', "El logo de Eember");
});
equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
run(function() {
set(view, 'content', EmberObject.create({
url: "http://www.thegooglez.com/theydonnothing",
title: "I CAN HAZ SEARCH"
}));
});
equal(view.$('img').attr('alt'), "I CAN HAZ SEARCH", "updates alt attribute when content object changes");
run(function() {
set(view, 'content', {
url: "http://www.emberjs.com/assets/images/logo.png",
title: "The SproutCore Logo"
});
});
equal(view.$('img').attr('alt'), "The SproutCore Logo", "updates alt attribute when content object is a hash");
run(function() {
set(view, 'content', EmberObject.createWithMixins({
url: "http://www.emberjs.com/assets/images/logo.png",
title: computed(function() {
return "Nanananana Ember!";
})
}));
});
equal(view.$('img').attr('alt'), "Nanananana Ember!", "updates alt attribute when title property is computed");
});
test("should be able to bind to view attributes with {{bind-attr}}", function() {
view = EmberView.create({
value: 'Test',
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr alt="view.value"}}>')
});
appendView();
equal(view.$('img').attr('alt'), "Test", "renders initial value");
run(function() {
view.set('value', 'Updated');
});
equal(view.$('img').attr('alt'), "Updated", "updates value");
});
test("should be able to bind to globals with {{bind-attr}}", function() {
TemplateTests.set('value', 'Test');
view = EmberView.create({
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr alt="TemplateTests.value"}}>')
});
appendView();
equal(view.$('img').attr('alt'), "Test", "renders initial value");
run(function() {
TemplateTests.set('value', 'Updated');
});
equal(view.$('img').attr('alt'), "Updated", "updates value");
});
test("should not allow XSS injection via {{bind-attr}}", function() {
view = EmberView.create({
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr alt="view.content.value"}}>'),
content: {
value: 'Trololol" onmouseover="alert(\'HAX!\');'
}
});
appendView();
equal(view.$('img').attr('onmouseover'), undefined);
// If the whole string is here, then it means we got properly escaped
equal(view.$('img').attr('alt'), 'Trololol" onmouseover="alert(\'HAX!\');');
});
test("should be able to bind use {{bind-attr}} more than once on an element", function() {
var template = EmberHandlebars.compile('<img {{bind-attr src="view.content.url"}} {{bind-attr alt="view.content.title"}}>');
view = EmberView.create({
template: template,
content: EmberObject.create({
url: "http://www.emberjs.com/assets/images/logo.png",
title: "The SproutCore Logo"
})
});
appendView();
equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute");
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");
run(function() {
set(view, 'content.title', "El logo de Eember");
});
equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
run(function() {
set(view, 'content', EmberObject.create({
url: "http://www.thegooglez.com/theydonnothing",
title: "I CAN HAZ SEARCH"
}));
});
equal(view.$('img').attr('alt'), "I CAN HAZ SEARCH", "updates alt attribute when content object changes");
run(function() {
set(view, 'content', {
url: "http://www.emberjs.com/assets/images/logo.png",
title: "The SproutCore Logo"
});
});
equal(view.$('img').attr('alt'), "The SproutCore Logo", "updates alt attribute when content object is a hash");
run(function() {
set(view, 'content', EmberObject.createWithMixins({
url: "http://www.emberjs.com/assets/images/logo.png",
title: computed(function() {
return "Nanananana Ember!";
})
}));
});
equal(view.$('img').attr('alt'), "Nanananana Ember!", "updates alt attribute when title property is computed");
});
test("{{bindAttr}} is aliased to {{bind-attr}}", function() {
var originalBindAttr = EmberHandlebars.helpers['bind-attr'],
originalWarn = Ember.warn;
Ember.warn = function(msg) {
equal(msg, "The 'bindAttr' view helper is deprecated in favor of 'bind-attr'", 'Warning called');
};
EmberHandlebars.helpers['bind-attr'] = function() {
equal(arguments[0], 'foo', 'First arg match');
equal(arguments[1], 'bar', 'Second arg match');
return 'result';
};
var result = EmberHandlebars.helpers.bindAttr('foo', 'bar');
equal(result, 'result', 'Result match');
EmberHandlebars.helpers['bind-attr'] = originalBindAttr;
Ember.warn = originalWarn;
});
test("should not reset cursor position when text field receives keyUp event", function() {
view = TextField.create({
value: "Broseidon, King of the Brocean"
});
run(function() {
view.append();
});
view.$().val('Brosiedoon, King of the Brocean');
setCaretPosition(view.$(), 5);
run(function() {
view.trigger('keyUp', {});
});
equal(caretPosition(view.$()), 5, "The keyUp event should not result in the cursor being reset due to the bind-attr observers");
run(function() {
view.destroy();
});
});
test("should be able to bind element attributes using {{bind-attr}} inside a block", function() {
var template = EmberHandlebars.compile('{{#with view.content}}<img {{bind-attr src="url" alt="title"}}>{{/with}}');
view = EmberView.create({
template: template,
content: EmberObject.create({
url: "http://www.emberjs.com/assets/images/logo.png",
title: "The SproutCore Logo"
})
});
appendView();
equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute");
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");
run(function() {
set(view, 'content.title', "El logo de Eember");
});
equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
});
test("should be able to bind class attribute with {{bind-attr}}", function() {
var template = EmberHandlebars.compile('<img {{bind-attr class="view.foo"}}>');
view = EmberView.create({
template: template,
foo: 'bar'
});
appendView();
equal(view.$('img').attr('class'), 'bar', "renders class");
run(function() {
set(view, 'foo', 'baz');
});
equal(view.$('img').attr('class'), 'baz', "updates class");
});
test("should be able to bind class attribute via a truthy property with {{bind-attr}}", function() {
var template = EmberHandlebars.compile('<img {{bind-attr class="view.isNumber:is-truthy"}}>');
view = EmberView.create({
template: template,
isNumber: 5
});
appendView();
equal(view.$('.is-truthy').length, 1, "sets class name");
run(function() {
set(view, 'isNumber', 0);
});
equal(view.$('.is-truthy').length, 0, "removes class name if bound property is set to something non-truthy");
});
test("should be able to bind class to view attribute with {{bind-attr}}", function() {
var template = EmberHandlebars.compile('<img {{bind-attr class="view.foo"}}>');
view = EmberView.create({
template: template,
foo: 'bar'
});
appendView();
equal(view.$('img').attr('class'), 'bar', "renders class");
run(function() {
set(view, 'foo', 'baz');
});
equal(view.$('img').attr('class'), 'baz', "updates class");
});
test("should not allow XSS injection via {{bind-attr}} with class", function() {
view = EmberView.create({
template: EmberHandlebars.compile('<img {{bind-attr class="view.foo"}}>'),
foo: '" onmouseover="alert(\'I am in your classes hacking your app\');'
});
appendView();
equal(view.$('img').attr('onmouseover'), undefined);
// If the whole string is here, then it means we got properly escaped
equal(view.$('img').attr('class'), '" onmouseover="alert(\'I am in your classes hacking your app\');');
});
test("should be able to bind class attribute using ternary operator in {{bind-attr}}", function() {
var template = EmberHandlebars.compile('<img {{bind-attr class="view.content.isDisabled:disabled:enabled"}} />');
var content = EmberObject.create({
isDisabled: true
});
view = EmberView.create({
template: template,
content: content
});
appendView();
ok(view.$('img').hasClass('disabled'), 'disabled class is rendered');
ok(!view.$('img').hasClass('enabled'), 'enabled class is not rendered');
run(function() {
set(content, 'isDisabled', false);
});
ok(!view.$('img').hasClass('disabled'), 'disabled class is not rendered');
ok(view.$('img').hasClass('enabled'), 'enabled class is rendered');
});
test("should be able to add multiple classes using {{bind-attr class}}", function() {
var template = EmberHandlebars.compile('<div {{bind-attr class="view.content.isAwesomeSauce view.content.isAlsoCool view.content.isAmazing:amazing :is-super-duper view.content.isEnabled:enabled:disabled"}}></div>');
var content = EmberObject.create({
isAwesomeSauce: true,
isAlsoCool: true,
isAmazing: true,
isEnabled: true
});
view = EmberView.create({
template: template,
content: content
});
appendView();
ok(view.$('div').hasClass('is-awesome-sauce'), "dasherizes first property and sets classname");
ok(view.$('div').hasClass('is-also-cool'), "dasherizes second property and sets classname");
ok(view.$('div').hasClass('amazing'), "uses alias for third property and sets classname");
ok(view.$('div').hasClass('is-super-duper'), "static class is present");
ok(view.$('div').hasClass('enabled'), "truthy class in ternary classname definition is rendered");
ok(!view.$('div').hasClass('disabled'), "falsy class in ternary classname definition is not rendered");
run(function() {
set(content, 'isAwesomeSauce', false);
set(content, 'isAmazing', false);
set(content, 'isEnabled', false);
});
ok(!view.$('div').hasClass('is-awesome-sauce'), "removes dasherized class when property is set to false");
ok(!view.$('div').hasClass('amazing'), "removes aliased class when property is set to false");
ok(view.$('div').hasClass('is-super-duper'), "static class is still present");
ok(!view.$('div').hasClass('enabled'), "truthy class in ternary classname definition is not rendered");
ok(view.$('div').hasClass('disabled'), "falsy class in ternary classname definition is rendered");
});
test("should be able to bind classes to globals with {{bind-attr class}}", function() {
TemplateTests.set('isOpen', true);
view = EmberView.create({
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr class="TemplateTests.isOpen"}}>')
});
appendView();
ok(view.$('img').hasClass('is-open'), "sets classname to the dasherized value of the global property");
run(function() {
TemplateTests.set('isOpen', false);
});
ok(!view.$('img').hasClass('is-open'), "removes the classname when the global property has changed");
});
test("should be able to bind-attr to 'this' in an {{#each}} block", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#each view.images}}<img {{bind-attr src="this"}}>{{/each}}'),
images: A(['one.png', 'two.jpg', 'three.gif'])
});
appendView();
var images = view.$('img');
ok(/one\.png$/.test(images[0].src));
ok(/two\.jpg$/.test(images[1].src));
ok(/three\.gif$/.test(images[2].src));
});
test("should be able to bind classes to 'this' in an {{#each}} block with {{bind-attr class}}", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#each view.items}}<li {{bind-attr class="this"}}>Item</li>{{/each}}'),
items: A(['a', 'b', 'c'])
});
appendView();
ok(view.$('li').eq(0).hasClass('a'), "sets classname to the value of the first item");
ok(view.$('li').eq(1).hasClass('b'), "sets classname to the value of the second item");
ok(view.$('li').eq(2).hasClass('c'), "sets classname to the value of the third item");
});
test("should be able to bind-attr to var in {{#each var in list}} block", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#each image in view.images}}<img {{bind-attr src="image"}}>{{/each}}'),
images: A(['one.png', 'two.jpg', 'three.gif'])
});
appendView();
var images = view.$('img');
ok(/one\.png$/.test(images[0].src));
ok(/two\.jpg$/.test(images[1].src));
ok(/three\.gif$/.test(images[2].src));
run(function() {
var imagesArray = view.get('images');
imagesArray.removeAt(0);
});
images = view.$('img');
ok(images.length === 2, "");
ok(/two\.jpg$/.test(images[0].src));
ok(/three\.gif$/.test(images[1].src));
});
test("should be able to output a property without binding", function() {
var context = {
content: EmberObject.create({
anUnboundString: "No spans here, son."
}),
anotherUnboundString: "Not here, either."
};
view = EmberView.create({
context: context,
template: EmberHandlebars.compile(
'<div id="first">{{unbound content.anUnboundString}}</div>'+
'{{#with content}}<div id="second">{{unbound ../anotherUnboundString}}</div>{{/with}}'
)
});
appendView();
equal(view.$('#first').html(), "No spans here, son.");
equal(view.$('#second').html(), "Not here, either.");
});
test("should allow standard Handlebars template usage", function() {
view = EmberView.create({
context: { name: "Erik" },
template: Handlebars.compile("Hello, {{name}}")
});
appendView();
equal(view.$().text(), "Hello, Erik");
});
test("should be able to use standard Handlebars #each helper", function() {
view = EmberView.create({
context: { items: ['a', 'b', 'c'] },
template: Handlebars.compile("{{#each items}}{{this}}{{/each}}")
});
appendView();
equal(view.$().html(), "abc");
});
test("should be able to use unbound helper in #each helper", function() {
view = EmberView.create({
items: A(['a', 'b', 'c', 1, 2, 3]),
template: EmberHandlebars.compile(
"<ul>{{#each view.items}}<li>{{unbound this}}</li>{{/each}}</ul>")
});
appendView();
equal(view.$().text(), "abc123");
equal(view.$('li').children().length, 0, "No markers");
});
test("should be able to use unbound helper in #each helper (with objects)", function() {
view = EmberView.create({
items: A([{wham: 'bam'}, {wham: 1}]),
template: EmberHandlebars.compile(
"<ul>{{#each view.items}}<li>{{unbound wham}}</li>{{/each}}</ul>")
});
appendView();
equal(view.$().text(), "bam1");
equal(view.$('li').children().length, 0, "No markers");
});
test("should work with precompiled templates", function() {
var templateString = EmberHandlebars.precompile("{{view.value}}"),
compiledTemplate = EmberHandlebars.template(eval(templateString));
view = EmberView.create({
value: "rendered",
template: compiledTemplate
});
appendView();
equal(view.$().text(), "rendered", "the precompiled template was rendered");
run(function() { view.set('value', 'updated'); });
equal(view.$().text(), "updated", "the precompiled template was updated");
});
test("should expose a controller keyword when present on the view", function() {
var templateString = "{{controller.foo}}{{#view}}{{controller.baz}}{{/view}}";
view = EmberView.create({
container: container,
controller: EmberObject.create({
foo: "bar",
baz: "bang"
}),
template: EmberHandlebars.compile(templateString)
});
appendView();
equal(view.$().text(), "barbang", "renders values from controller and parent controller");
var controller = get(view, 'controller');
run(function() {
controller.set('foo', "BAR");
controller.set('baz', "BLARGH");
});
equal(view.$().text(), "BARBLARGH", "updates the DOM when a bound value is updated");
run(function() {
view.destroy();
});
view = EmberView.create({
controller: "aString",
template: EmberHandlebars.compile("{{controller}}")
});
appendView();
equal(view.$().text(), "aString", "renders the controller itself if no additional path is specified");
});
test("should expose a controller keyword that can be used in conditionals", function() {
var templateString = "{{#view}}{{#if controller}}{{controller.foo}}{{/if}}{{/view}}";
view = EmberView.create({
container: container,
controller: EmberObject.create({
foo: "bar"
}),
template: EmberHandlebars.compile(templateString)
});
appendView();
equal(view.$().text(), "bar", "renders values from controller and parent controller");
run(function() {
view.set('controller', null);
});
equal(view.$().text(), "", "updates the DOM when the controller is changed");
});
test("should expose a controller keyword that persists through Ember.ContainerView", function() {
var templateString = "{{view Ember.ContainerView}}";
view = EmberView.create({
container: container,
controller: EmberObject.create({
foo: "bar"
}),
template: EmberHandlebars.compile(templateString)
});
appendView();
var containerView = get(view, 'childViews.firstObject');
var viewInstanceToBeInserted = EmberView.create({
template: EmberHandlebars.compile('{{controller.foo}}')
});
run(function() {
containerView.pushObject(viewInstanceToBeInserted);
});
equal(trim(viewInstanceToBeInserted.$().text()), "bar", "renders value from parent's controller");
});
test("should expose a view keyword", function() {
var templateString = '{{#with view.differentContent}}{{view.foo}}{{#view baz="bang"}}{{view.baz}}{{/view}}{{/with}}';
view = EmberView.create({
container: container,
differentContent: {
view: {
foo: "WRONG",
baz: "WRONG"
}
},
foo: "bar",
template: EmberHandlebars.compile(templateString)
});
appendView();
equal(view.$().text(), "barbang", "renders values from view and child view");
});
test("should be able to explicitly set a view's context", function() {
var context = EmberObject.create({
test: 'test'
});
TemplateTests.CustomContextView = EmberView.extend({
context: context,
template: EmberHandlebars.compile("{{test}}")
});
view = EmberView.create({
template: EmberHandlebars.compile("{{view TemplateTests.CustomContextView}}")
});
appendView();
equal(view.$().text(), "test");
});
test("should escape HTML in primitive value contexts when using normal mustaches", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#each view.kiddos}}{{this}}{{/each}}'),
kiddos: A(['<b>Max</b>', '<b>James</b>'])
});
appendView();
equal(view.$('b').length, 0, "does not create an element");
equal(view.$().text(), '<b>Max</b><b>James</b>', "inserts entities, not elements");
run(function() { set(view, 'kiddos', A(['<i>Max</i>','<i>James</i>'])); });
equal(view.$().text(), '<i>Max</i><i>James</i>', "updates with entities, not elements");
equal(view.$('i').length, 0, "does not create an element when value is updated");
});
test("should not escape HTML in primitive value contexts when using triple mustaches", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#each view.kiddos}}{{{this}}}{{/each}}'),
kiddos: A(['<b>Max</b>', '<b>James</b>'])
});
appendView();
equal(view.$('b').length, 2, "creates an element");
run(function() { set(view, 'kiddos', A(['<i>Max</i>','<i>James</i>'])); });
equal(view.$('i').length, 2, "creates an element when value is updated");
});
QUnit.module("Ember.View - handlebars integration", {
setup: function() {
Ember.lookup = lookup = { Ember: Ember };
originalLog = Ember.Logger.log;
logCalls = [];
Ember.Logger.log = function(arg) { logCalls.push(arg); };
},
teardown: function() {
if (view) {
run(function() {
view.destroy();
});
view = null;
}
Ember.Logger.log = originalLog;
Ember.lookup = originalLookup;
}
});
test("should be able to log a property", function() {
var context = {
value: 'one',
valueTwo: 'two',
content: EmberObject.create({})
};
view = EmberView.create({
context: context,
template: EmberHandlebars.compile('{{log value}}{{#with content}}{{log ../valueTwo}}{{/with}}')
});
appendView();
equal(view.$().text(), "", "shouldn't render any text");
equal(logCalls[0], 'one', "should call log with value");
equal(logCalls[1], 'two', "should call log with valueTwo");
});
test("should be able to log a view property", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{log view.value}}'),
value: 'one'
});
appendView();
equal(view.$().text(), "", "shouldn't render any text");
equal(logCalls[0], 'one', "should call log with value");
});
test("should be able to log `this`", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#each view.items}}{{log this}}{{/each}}'),
items: A(['one', 'two'])
});
appendView();
equal(view.$().text(), "", "shouldn't render any text");
equal(logCalls[0], 'one', "should call log with item one");
equal(logCalls[1], 'two', "should call log with item two");
});
var MyApp;
QUnit.module("Templates redrawing and bindings", {
setup: function() {
Ember.lookup = lookup = { Ember: Ember };
MyApp = lookup.MyApp = EmberObject.create({});
},
teardown: function() {
run(function() {
if (view) view.destroy();
});
Ember.lookup = originalLookup;
}
});
test("should be able to update when bound property updates", function() {
MyApp.set('controller', EmberObject.create({name: 'first'}));
var View = EmberView.extend({
template: EmberHandlebars.compile('<i>{{view.value.name}}, {{view.computed}}</i>'),
valueBinding: 'MyApp.controller',
computed: computed(function() {
return this.get('value.name') + ' - computed';
}).property('value')
});
run(function() {
view = View.create();
});
appendView();
run(function() {
MyApp.set('controller', EmberObject.create({
name: 'second'
}));
});
equal(view.get('computed'), "second - computed", "view computed properties correctly update");
equal(view.$('i').text(), 'second, second - computed', "view rerenders when bound properties change");
});
test("properties within an if statement should not fail on re-render", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#if view.value}}{{view.value}}{{/if}}'),
value: null
});
appendView();
equal(view.$().text(), '');
run(function() {
view.set('value', 'test');
});
equal(view.$().text(), 'test');
run(function() {
view.set('value', null);
});
equal(view.$().text(), '');
});
test('should cleanup bound properties on rerender', function() {
view = EmberView.create({
controller: EmberObject.create({name: 'wycats'}),
template: EmberHandlebars.compile('{{name}}')
});
appendView();
equal(view.$().text(), 'wycats', 'rendered binding');
run(view, 'rerender');
equal(view._childViews.length, 1);
});
test("views within an if statement should be sane on re-render", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#if view.display}}{{view Ember.TextField}}{{/if}}'),
display: false
});
appendView();
equal(view.$('input').length, 0);
run(function() {
// Setting twice will trigger the observer twice, this is intentional
view.set('display', true);
view.set('display', 'yes');
});
var textfield = view.$('input');
equal(textfield.length, 1);
// Make sure the view is still registered in View.views
ok(EmberView.views[textfield.attr('id')]);
});
test("the {{this}} helper should not fail on removal", function() {
view = EmberView.create({
template: EmberHandlebars.compile('{{#if view.show}}{{#each view.list}}{{this}}{{/each}}{{/if}}'),
show: true,
list: A(['a', 'b', 'c'])
});
appendView();
equal(view.$().text(), 'abc', "should start property - precond");
run(function() {
view.set('show', false);
});
equal(view.$().text(), '');
});
test("bindings should be relative to the current context", function() {
view = EmberView.create({
museumOpen: true,
museumDetails: EmberObject.create({
name: "SFMoMA",
price: 20
}),
museumView: EmberView.extend({
template: EmberHandlebars.compile('Name: {{view.name}} Price: ${{view.dollars}}')
}),
template: EmberHandlebars.compile('{{#if view.museumOpen}} {{view view.museumView nameBinding="view.museumDetails.name" dollarsBinding="view.museumDetails.price"}} {{/if}}')
});
appendView();
equal(trim(view.$().text()), "Name: SFMoMA Price: $20", "should print baz twice");
});
test("bindings should respect keywords", function() {
view = EmberView.create({
museumOpen: true,
controller: {
museumOpen: true,
museumDetails: EmberObject.create({
name: "SFMoMA",
price: 20
})
},
museumView: EmberView.extend({
template: EmberHandlebars.compile('Name: {{view.name}} Price: ${{view.dollars}}')
}),
template: EmberHandlebars.compile('{{#if view.museumOpen}}{{view view.museumView nameBinding="controller.museumDetails.name" dollarsBinding="controller.museumDetails.price"}}{{/if}}')
});
appendView();
equal(trim(view.$().text()), "Name: SFMoMA Price: $20", "should print baz twice");
});
test("bindings can be 'this', in which case they *are* the current context", function() {
view = EmberView.create({
museumOpen: true,
museumDetails: EmberObject.create({
name: "SFMoMA",
price: 20,
museumView: EmberView.extend({
template: EmberHandlebars.compile('Name: {{view.museum.name}} Price: ${{view.museum.price}}')
})
}),
template: EmberHandlebars.compile('{{#if view.museumOpen}} {{#with view.museumDetails}}{{view museumView museumBinding="this"}} {{/with}}{{/if}}')
});
appendView();
equal(trim(view.$().text()), "Name: SFMoMA Price: $20", "should print baz twice");
});
// https://github.com/emberjs/ember.js/issues/120
test("should not enter an infinite loop when binding an attribute in Handlebars", function() {
var App;
run(function() {
lookup.App = App = Namespace.create();
});
App.test = EmberObject.create({ href: 'test' });
App.Link = EmberView.extend({
classNames: ['app-link'],
tagName: 'a',
attributeBindings: ['href'],
href: '#none',
click: function() {
return false;
}
});
var parentView = EmberView.create({
template: EmberHandlebars.compile('{{#view App.Link hrefBinding="App.test.href"}} Test {{/view}}')
});
run(function() {
parentView.appendTo('#qunit-fixture');
});
// Use match, since old IE appends the whole URL
var href = parentView.$('a').attr('href');
ok(href.match(/(^|\/)test$/), "Expected href to be 'test' but got '"+href+"'");
run(function() {
parentView.destroy();
});
run(function() {
lookup.App.destroy();
});
});
test("should update bound values after the view is removed and then re-appended", function() {
view = EmberView.create({
template: EmberHandlebars.compile("{{#if view.showStuff}}{{view.boundValue}}{{else}}Not true.{{/if}}"),
showStuff: true,
boundValue: "foo"
});
appendView();
equal(trim(view.$().text()), "foo");
run(function() {
set(view, 'showStuff', false);
});
equal(trim(view.$().text()), "Not true.");
run(function() {
set(view, 'showStuff', true);
});
equal(trim(view.$().text()), "foo");
run(function() {
view.remove();
set(view, 'showStuff', false);
});
run(function() {
set(view, 'showStuff', true);
});
appendView();
run(function() {
set(view, 'boundValue', "bar");
});
equal(trim(view.$().text()), "bar");
});
test("should update bound values after view's parent is removed and then re-appended", function() {
var controller = EmberObject.create();
var parentView = ContainerView.create({
childViews: ['testView'],
controller: controller,
testView: EmberView.create({
template: EmberHandlebars.compile("{{#if showStuff}}{{boundValue}}{{else}}Not true.{{/if}}")
})
});
controller.setProperties({
showStuff: true,
boundValue: "foo"
});
run(function() {
parentView.appendTo('#qunit-fixture');
});
view = parentView.get('testView');
equal(trim(view.$().text()), "foo");
run(function() {
set(controller, 'showStuff', false);
});
equal(trim(view.$().text()), "Not true.");
run(function() {
set(controller, 'showStuff', true);
});
equal(trim(view.$().text()), "foo");
run(function() {
parentView.remove();
set(controller, 'showStuff', false);
});
run(function() {
set(controller, 'showStuff', true);
});
run(function() {
parentView.appendTo('#qunit-fixture');
});
run(function() {
set(controller, 'boundValue', "bar");
});
equal(trim(view.$().text()), "bar");
run(function() {
parentView.destroy();
});
});
test("should call a registered helper for mustache without parameters", function() {
EmberHandlebars.registerHelper('foobar', function() {
return 'foobar';
});
view = EmberView.create({
template: EmberHandlebars.compile("{{foobar}}")
});
appendView();
ok(view.$().text() === 'foobar', "Regular helper was invoked correctly");
});
test("should bind to the property if no registered helper found for a mustache without parameters", function() {
view = EmberView.createWithMixins({
template: EmberHandlebars.compile("{{view.foobarProperty}}"),
foobarProperty: computed(function() {
return 'foobarProperty';
})
});
appendView();
ok(view.$().text() === 'foobarProperty', "Property was bound to correctly");
});
test("should accept bindings as a string or an Ember.Binding", function() {
var viewClass = EmberView.extend({
template: EmberHandlebars.compile("binding: {{view.bindingTest}}, string: {{view.stringTest}}")
});
EmberHandlebars.registerHelper('boogie', function(id, options) {
options.hash = options.hash || {};
options.hash.bindingTestBinding = Binding.oneWay('context.' + id);
options.hash.stringTestBinding = id;
return EmberHandlebars.ViewHelper.helper(this, viewClass, options);
});
view = EmberView.create({
context: EmberObject.create({
direction: 'down'
}),
template: EmberHandlebars.compile("{{boogie direction}}")
});
appendView();
equal(trim(view.$().text()), "binding: down, string: down");
});
test("should teardown observers from bound properties on rerender", function() {
view = EmberView.create({
template: EmberHandlebars.compile("{{view.foo}}"),
foo: 'bar'
});
appendView();
equal(observersFor(view, 'foo').length, 1);
run(function() {
view.rerender();
});
equal(observersFor(view, 'foo').length, 1);
});
test("should teardown observers from bind-attr on rerender", function() {
view = EmberView.create({
template: EmberHandlebars.compile('<span {{bind-attr class="view.foo" name="view.foo"}}>wat</span>'),
foo: 'bar'
});
appendView();
equal(observersFor(view, 'foo').length, 2);
run(function() {
view.rerender();
});
equal(observersFor(view, 'foo').length, 2);
});
|
export const EXAMPLE_PATH = 'cms-strapi'
export const CMS_NAME = 'Strapi'
export const CMS_URL = 'https://strapi.io/'
export const HOME_OG_IMAGE_URL =
'https://og-image.now.sh/Next.js%20Blog%20Example%20with%20**Strapi**.png?theme=light&md=1&fontSize=100px&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1590740734%2Fnextjs%2Fexamples%2Fstrapi-logo.svg'
|
import Kibo from "@brianpeiris/kibo";
const getShortcut = function(key) {
key = key || "";
return ["alt shift " + key, "ctrl shift " + key];
};
export default class KeyboardHandler {
constructor(sketchController) {
this._sketchController = sketchController;
}
_bindNumberShortcuts(domTextArea, file, kibo) {
kibo.down(getShortcut("u"), () => {
this._sketchController.spinNumberAndKeepSelection(domTextArea, file, -1, 10);
return false;
});
kibo.down(getShortcut("i"), () => {
this._sketchController.spinNumberAndKeepSelection(domTextArea, file, 1, 10);
return false;
});
kibo.down(getShortcut("j"), () => {
this._sketchController.spinNumberAndKeepSelection(domTextArea, file, -1, 1);
return false;
});
kibo.down(getShortcut("k"), () => {
this._sketchController.spinNumberAndKeepSelection(domTextArea, file, 1, 1);
return false;
});
kibo.down(getShortcut("n"), () => {
this._sketchController.spinNumberAndKeepSelection(domTextArea, file, -1, 0.1);
return false;
});
kibo.down(getShortcut("m"), () => {
this._sketchController.spinNumberAndKeepSelection(domTextArea, file, 1, 0.1);
return false;
});
}
bindKeyboardShortcuts(domTextArea, file) {
const kibo = new Kibo(domTextArea);
kibo.down(getShortcut("z"), () => {
this._sketchController.resetSensor();
return false;
});
kibo.down(getShortcut("e"), () => {
this._sketchController.toggleTextAreas();
return false;
});
kibo.down(getShortcut("r"), () => {
this.riftSandbox.toggleMonitor();
return false;
});
kibo.down(getShortcut("v"), () => {
this._sketchController.startVrMode();
return false;
});
if (file) {
this._bindNumberShortcuts(domTextArea, file, kibo);
}
}
}
|
var version={taracotjs:"0.5.170"};module.exports=version; |
var find = require('lodash.find');
var mutil = require('miaow-util');
var path = require('path');
var postcss = require('postcss');
var Promise = require('promise');
function generateUrl(css, context) {
var root;
var srcAbsPath = path.resolve(context.context, context.src);
try {
root = postcss.parse(css, {from: srcAbsPath});
} catch (err) {
return Promise.reject(err);
}
var decls = [];
var infos = [];
var reg = /miaow\(['"]?(.*?)['"]?\)/g;
root.eachDecl(function(decl) {
if (decl.value && reg.test(decl.value)) {
var value = decl.value;
decls.push(decl);
reg.lastIndex = 0;
var searchResult = reg.exec(value);
while (searchResult) {
infos.push(JSON.parse(searchResult[1]));
searchResult = reg.exec(value);
}
}
});
return Promise.all(infos.map(function(info) {
return new Promise(function(resolve, reject) {
var relativeInfo = /^([^?#]+)([?#].*)?$/.exec(info.value);
context.resolveModule(relativeInfo[1], {
basedir: path.dirname(info.filename || srcAbsPath)
}, function(err, module) {
if (err) {
return reject(err);
}
info.src = path.resolve(context.context, module.src);
info.src += relativeInfo[2] || '';
return resolve();
});
});
})).then(function() {
decls.forEach(function(decl) {
reg.lastIndex = 0;
decl.value = decl.value.replace(reg, function(str, infoStr) {
var info = JSON.parse(infoStr);
var src = find(infos, function(item) {
return info.value === item.value && info.filename === item.filename;
}).src;
var relative = mutil.relative(path.dirname(srcAbsPath), src);
if (!/^\./.test(relative)) {
relative = './' + relative;
}
return 'url(' + relative + ')';
});
});
return root.toResult().css;
});
}
module.exports = generateUrl;
|
"use strict";
var fs = require('fs'),
soap = require('..'),
assert = require('assert'),
request = require('request'),
http = require('http');
var test = {};
test.server = null;
test.service = {
StockQuoteService: {
StockQuotePort: {
GetLastTradePrice: function(args) {
if (args.tickerSymbol === 'trigger error') {
throw new Error('triggered server error');
} else {
return { price: 19.56 };
}
}
}
}
};
describe('SOAP Server', function() {
before(function(done) {
fs.readFile(__dirname + '/wsdl/strict/stockquote.wsdl', 'utf8', function(err, data) {
assert.ok(!err);
test.wsdl = data;
done();
});
});
beforeEach(function(done) {
test.server = http.createServer(function(req, res) {
res.statusCode = 404;
res.end();
});
test.server.listen(15099, null, null, function() {
test.soapServer = soap.listen(test.server, '/stockquote', test.service, test.wsdl);
test.baseUrl =
'http://' + test.server.address().address + ":" + test.server.address().port;
//windows return 0.0.0.0 as address and that is not
//valid to use in a request
if (test.server.address().address === '0.0.0.0' || test.server.address().address === '::') {
test.baseUrl =
'http://127.0.0.1:' + test.server.address().port;
}
done();
});
});
afterEach(function(done) {
test.server.close(function() {
test.server = null;
delete test.soapServer;
test.soapServer = null;
done();
});
});
it('should be running', function(done) {
request(test.baseUrl, function(err, res, body) {
assert.ok(!err);
done();
});
});
it('should 404 on non-WSDL path', function(done) {
request(test.baseUrl, function(err, res, body) {
assert.ok(!err);
assert.equal(res.statusCode, 404);
done();
});
});
it('should server up WSDL', function(done) {
request(test.baseUrl + '/stockquote?wsdl', function(err, res, body) {
assert.ok(!err);
assert.equal(res.statusCode, 200);
assert.ok(body.length);
done();
});
});
it('should return complete client description', function(done) {
soap.createClient(test.baseUrl + '/stockquote?wsdl', function(err, client) {
assert.ok(!err);
var description = client.describe(),
expected = { input: { tickerSymbol: "string" }, output:{ price: "float" } };
assert.deepEqual(expected , description.StockQuoteService.StockQuotePort.GetLastTradePrice);
done();
});
});
it('should return correct results', function(done) {
soap.createClient(test.baseUrl + '/stockquote?wsdl', function(err, client) {
assert.ok(!err);
client.GetLastTradePrice({ tickerSymbol: 'AAPL'}, function(err, result) {
assert.ok(!err);
assert.equal(19.56, parseFloat(result.price));
done();
});
});
});
it('should include response and body in error object', function(done) {
soap.createClient(test.baseUrl + '/stockquote?wsdl', function(err, client) {
assert.ok(!err);
client.GetLastTradePrice({ tickerSymbol: 'trigger error' }, function(err, response, body) {
assert.ok(err);
assert.strictEqual(err.response, response);
assert.strictEqual(err.body, body);
done();
});
});
});
// NOTE: this is actually a -client- test
/*
it('should return a valid error if the server stops responding': function(done) {
soap.createClient(test.baseUrl + '/stockquote?wsdl', function(err, client) {
assert.ok(!err);
server.close(function() {
server = null;
client.GetLastTradePrice({ tickerSymbol: 'trigger error' }, function(err, response, body) {
assert.ok(err);
done();
});
});
});
});
*/
});
|
import React from 'react';
import Helmet from 'react-helmet';
import styles from './styles.scss';
export default () => (
<div className={styles.NotFound}>
<Helmet title="Oops" />
<p>Oops, Page was not found!</p>
</div>
);
|
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2017 The Regents of the University of California
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
/**
* @author Jim Robinson
*/
/**
* Barebones event bus.
*/
class EventBus {
constructor() {
// Map eventType -> list of subscribers
this.subscribers = {};
this.stack = []
}
subscribe(eventType, object) {
var subscriberList = this.subscribers[eventType];
if (subscriberList == undefined) {
subscriberList = [];
this.subscribers[eventType] = subscriberList;
}
subscriberList.push(object);
}
post(event) {
const eventType = event.type
if (this._hold) {
this.stack.push(event)
} else {
const subscriberList = this.subscribers[eventType];
if (subscriberList) {
for (let subscriber of subscriberList) {
if ("function" === typeof subscriber.receiveEvent) {
subscriber.receiveEvent(event);
} else if ("function" === typeof subscriber) {
subscriber(event);
}
}
}
}
}
hold() {
this._hold = true;
}
release() {
this._hold = false;
for (let event of this.stack) {
this.post(event)
}
this.stack = []
}
}
// The global event bus
EventBus.globalBus = new EventBus()
export default EventBus
|
module.exports = function(grunt) {
grunt.initConfig({
elm: {
compile: {
files: {
"tomato-tracker.js": ["Tomato.elm"]
}
}
},
watch: {
elm: {
files: ["Tomato.elm"],
tasks: ["elm"]
}
},
clean: ["elm-stuff/build-artifacts"]
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-elm');
grunt.registerTask('default', ['elm']);
}; |
import { combineReducers } from 'redux';
import user from './user';
const app = combineReducers({
user,
});
export default app;
|
// Warning at test_files/quote_props/quote.ts:9:13: Quoted has a string index type but is accessed using dotted access. Quoting the access.
// Warning at test_files/quote_props/quote.ts:10:1: Quoted has a string index type but is accessed using dotted access. Quoting the access.
// Warning at test_files/quote_props/quote.ts:13:1: Quoted has a string index type but is accessed using dotted access. Quoting the access.
// Warning at test_files/quote_props/quote.ts:29:1: Declared property foo accessed with quotes. This can lead to renaming bugs. A better fix is to use 'declare interface' on the declaration.
goog.module('test_files.quote_props.quote');var module = module || {id: 'test_files/quote_props/quote.js'};/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @record
*/
function Quoted() { }
function Quoted_tsickle_Closure_declarations() {
/* TODO: handle strange member:
[k: string]: number;
*/
}
let /** @type {!Quoted} */ quoted = {};
console.log(quoted["hello"]);
quoted["hello"] = 1;
quoted['hello'] = 1;
/** some comment */
quoted["hello"] = 1;
/**
* @record
* @extends {Quoted}
*/
function QuotedMixed() { }
function QuotedMixed_tsickle_Closure_declarations() {
/** @type {number} */
QuotedMixed.prototype.foo;
/* TODO: handle strange member:
'invalid-identifier': number;
*/
/** @type {number} */
QuotedMixed.prototype.quotedIdent;
}
let /** @type {!QuotedMixed} */ quotedMixed = { foo: 1, 'invalid-identifier': 2, 'quotedIdent': 3 };
console.log(quotedMixed.foo);
quotedMixed.foo = 1;
// Intentionally kept as a quoted access, but gives a warning.
quotedMixed['foo'] = 1;
// Must not be converted to non-quoted access, as it's not valid JS.
// Does not give a warning.
quotedMixed['invalid-identifier'] = 1;
// Must not be converted to non-quoted access because it was declared quoted.
quotedMixed['quotedIdent'] = 1;
// any does not declare any symbols.
let /** @type {?} */ anyTyped;
console.log(anyTyped['token']);
|
/**
* Created by lawrencenyakiso on 2016/06/13.
*/
(function() {
angular
.module('jdapp')
.constant('authConstants', {
path:"CloudCommandService/oauth/token",
mockPath:'jdashboard/mock/auth.json',
client_id:"test",
client_secret:"d3dbe8e9888f454a9079489c9265dbf5",
grant_type:"password",
response_type:"token"
})
})(); |
exports.up = knex =>
knex.schema.createTable('user_repository_rights', table => {
table.bigincrements('id').primary()
table
.bigInteger('userId')
.notNullable()
.index()
table.foreign('userId').references('users.id')
table
.bigInteger('repositoryId')
.notNullable()
.index()
table.foreign('repositoryId').references('repositories.id')
table.dateTime('createdAt').notNullable()
table.dateTime('updatedAt').notNullable()
table.unique(['userId', 'repositoryId'])
})
exports.down = knex => knex.schema.dropTableIfExists('user_repository_rights')
|
Color = function(options){
this.palette = [];
this.customColors = [];
this.starterColors = [];
this.hexadecimalChar = "";
this.init(options);
};
Color.hexadecimalChar = "0123456789ABCDEF";
Color.prototype.init = function(options){
if(options.starteColors != undefined && options.starterColors != null){
this.starterColors = options.starterColors;
}
else{
this.starterColors = ["#F2EAD0", "#006383", "#F2B872", "#268080", "#F2561D", "#672A41", "#00B7B7", "#D92E1E", "#D91657",
"#9D5A7B", "#6E8AC8", "#B05E65", "#BF8C60", "#51BBFE", "#FA4731", "#143259", "#51FED2", "#102D40", "#81A5F7", "#51FEA8",
"#2D5159", "#F2561D", "#78CFDA", "#51A8FE", "#8C2A5B", "#F2B872", "#8C2A5B", "#F9CA3D", "#517DFE", "#DFF2ED", "#6951FE",
"#51D4FF", "#D9C7C1", "#B7EDFF", "#85B9CA", "#85CACA", "#BF7534", "#BFAB28", "#F2EAD0", "#A65C32", "#BF6545", "#51FED3",
"#7F468B", "#BF8C60", "#6295D9", "#040037", "#FF9335", "#5B1409", "#9451FE", "#143259", "#FFC040", "#518FFE", "#00EAEA",
"#5164FF", "#E49D6B", "#008383", "#6393A6", "#294D9E", "#E49D6B", "#A61C1C", "#51FEFE", "#732C02", "#F27F1B", "#6BC6E4",
"#BB5255"];
}
if(options.customColors != undefined && options.customColors != null){
this.customColors = options.customColors;
}
this.palette.push(new Palette("redvariant",["#D32F2F", "#F44336","#FF5252","#FFCDD2","#FFFFFF"]));
this.palette.push(new Palette("greenvariant",["#388E3C", "#4CAF50","#C8E6C9","#8BC34A","#FFFFFF"]));
this.palette.push(new Palette("bluevariant",["#303F9F", "#3F51B5","#C5CAE9","#448AFF","#FFFFFF"]));
this.palette.push(new Palette("yellowvariant",["#FBC02D", "#FFEB3B","#FFF9C4","#FFEB3B","#FFFFFF"]));
this.hexadecimalChar = Color.hexadecimalChar;
};
Color.prototype.getStarterColors = function(){
return this.starterColors;
};
Color.prototype.getCustomColors = function(){
return this.customColors;
};
Color.prototype.setCustomColors = function(colors){
if( colors instanceof Array){
this.customColors = colors;
}
else{
throw Error("You must pass an Array to that method");
}
};
Color.prototype.getPalette = function(){
return this.palette;
};
Color.prototype.addPalette = function(palette){
if(palette.hasOwnProperty("name") && palette.hasOwnProperty("colors")){
this.palette.push(new Palette(palette.name,palette.colors));
}
else{
throw Error("You must pass an Object with name and colors properties");
}
};
Color.prototype.removePaletteByIndex = function(index){
if(typeof(index) === 'number'){
return this.palette.splice(0,index).concat(this.palette.slice(index,this.palette.length));
}
else{
throw Error("You must pass an valid index");
}
};
Color.prototype.removePaletteByName = function(name){
if(typeof(index) === 'string'){
var found = false;
var index;
for(var i = 0; i < this.palette.length && !found; i++){
if(this.palette[i].hasName(name)){
found = true;
index = i;
}
}
if(index !== undefined){
this.palette.splice(0,index).concat(this.palette.slice(index,this.palette.length));
}
else{
throw Error("there is no palette with this name");
}
return found;
}
else{
throw Error("You must pass an valid key name");
}
};
Color.prototype.getPaletteByIndex = function(index){
if(typeof(index) === 'number'){
return this.palette[index];
}
else{
throw Error("You must pass an valid index");
}
};
Color.prototype.getPaletteByName = function(name){
if(typeof(name) === 'string'){
for(var i = 0; i < this.palette.length; i++){
if(this.palette[i].hasName(name)){
return this.palette[i];
}
}
return false;
}
else{
throw Error("You must pass an valid key name");
}
};
Color.prototype.getRandomStarterColor = function(){
return this.starterColor[(Math.floor(Math.random() * this.starterColors.length) )];
};
Color.prototype.getRandomCustomColor = function(){
return this.starterColor[(Math.floor(Math.random() * this.starterColors.length) )];
};
Color.prototype.getRandomPalette = function(){
return this.palette[(Math.floor(Math.random() * this.palette.length))];
};
Color.prototype.getRandomColorFromPaletteIndex = function(index){
return this.getPaletteByIndex(index).getRandomColor();
};
Color.prototype.getRandomColorFromPaletteName = function(name){
return this.getPaletteByName(name).getRandomColor();
};
Color.prototype.getRandomColorFromRandomPalette = function(){
return this.getRandomPalette().getRandomColor();
};
/*STATIC FUNCTION*/
Color.convertFromHextoRGB = function(color){
var total = [];
if(color.length <= 7 && color.length > 3){
color = color.substring(1,7);// remove "#"
var counter = 0;
for(var i = 0; i < 3; i ++){
total.push(parseInt(color.substring(counter,(counter = counter + 2)),16));
}
}
else{
throw Error("You must pass a valid Hex Color!");
}
return total;
};
Color.convertFromRGBtoHex = function(r,g,b){
var color = "";
var total = [r,g,b];
for(var i = 0; i < total.length; i++){
if(typeof(total[i]) === 'number' && total[i] >= 0 && total[i] <= 255 ){
color = color + Color.hexadecimalChar.charAt((total[i]-total[i]%16)/16);
color = color + Color.hexadecimalChar.charAt(total[i]%16);
}
else{
throw Error("You must pass a valid RBG color!");
}
}
return '#'+color;
};
Color.getRangeOfHexColors = function(from,to){
from = from.substring(1,7);
to = to.substring(1,7);
var fromInt = parseInt(from,16);
var toInt = parseInt(to,16);
var color = [];
while(fromInt < toInt){
color.push("#"+fromInt.toString(16).toUpperCase());
fromInt = fromInt + 1;
}
color.push("#"+toInt.toString(16).toUpperCase());
return color;
};
Color.getRangeOfRGBColors = function(from,to){
var colorFrom = "";
var colorTo = "";
for(var i = 0; i < from.length; i++){
if(typeof(from[i]) === 'number' && from[i] >= 0 && from[i] <= 255 ){
colorFrom = colorFrom + Color.hexadecimalChar.charAt((from[i]-from[i]%16)/16);
colorFrom = colorFrom + Color.hexadecimalChar.charAt(from[i]%16);
}
else{
throw Error("You must pass a valid RBG color!");
}
}
for( i = 0; i < to.length; i++){
if(typeof(to[i]) === 'number' && to[i] >= 0 && to[i] <= 255 ){
colorTo = colorTo + Color.hexadecimalChar.charAt((to[i]-to[i]%16)/16);
colorTo = colorTo + Color.hexadecimalChar.charAt(to[i]%16);
}
else{
throw Error("You must pass a valid RBG color!");
}
}
var fromInt = parseInt(colorFrom,16);
var toInt = parseInt(colorTo,16);
var color = [];
while(fromInt < toInt){
color.push(Color.convertFromHextoRGB("#"+fromInt.toString(16).toUpperCase()));
fromInt = fromInt + 1;
}
color.push(Color.convertFromHextoRGB("#"+toInt.toString(16).toUpperCase()));
return color;
};
Color.getRandomColor = function(){
return ('#'+Math.floor(Math.random()*16777215).toString(16)).toUpperCase();
};
Color.generateRandomPalette = function(){
return Palette.generateRandomPalette();
};
/*Injecting STATIC function in object*/
Color.prototype.convertFromHextoRGB = Color.convertFromHextoRGB;
Color.prototype.cconvertFromRGBtoHex = Color.convertFromRGBtoHex;
Color.prototype.getRangeOfHexColors = Color.getRangeOfHexColors;
Color.prototype.getRangeOfRGBColors = Color.getRangeOfRGBColors;
Color.prototype.getRandomColor = Color.getRandomColor;
Color.prototype.generateRandomPalette = Color.generateRandomPalette ;
|
export function RoutesRun ($rootScope, $state, $auth, AclService, $timeout, API, ContextService,editableOptions) {
'ngInject'
AclService.resume()
editableOptions.theme = 'bs3'
/*eslint-disable */
let deregisterationCallback = $rootScope.$on('$stateChangeStart', function (event, toState) {
if (toState.data && toState.data.auth) {
if (!$auth.isAuthenticated()) {
event.preventDefault()
return $state.go('login')
}
}
$rootScope.bodyClass = 'hold-transition login-page'
})
function stateChange () {
$timeout(function () {
// fix sidebar
var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight()
var window_height = $(window).height()
var sidebar_height = $('.sidebar').height()
if ($('body').hasClass('fixed')) {
$('.content-wrapper, .right-side').css('min-height', window_height - $('.main-footer').outerHeight())
} else {
if (window_height >= sidebar_height) {
$('.content-wrapper, .right-side').css('min-height', window_height - neg)
} else {
$('.content-wrapper, .right-side').css('min-height', sidebar_height)
}
}
// get user current context
if ($auth.isAuthenticated() && !$rootScope.me) {
ContextService.getContext()
.then((response) => {
response = response.plain()
$rootScope.me = response.data
})
}
})
}
$rootScope.$on('$destroy', deregisterationCallback)
$rootScope.$on('$stateChangeSuccess', stateChange)
/*eslint-enable */
}
|
/**
* DevExtreme (viz/chart_components/multi_axes_synchronizer.js)
* Version: 16.2.6
* Build date: Tue Mar 28 2017
*
* Copyright (c) 2012 - 2017 Developer Express Inc. ALL RIGHTS RESERVED
* EULA: https://www.devexpress.com/Support/EULAs/DevExtreme.xml
*/
"use strict";
var $ = require("jquery"),
debug = require("../../core/utils/console").debug,
Range = require("../translators/range").Range,
commonUtils = require("../../core/utils/common"),
vizUtils = require("../core/utils"),
_adjustValue = vizUtils.adjustValue,
_applyPrecisionByMinDelta = vizUtils.applyPrecisionByMinDelta,
_isDefined = commonUtils.isDefined,
_math = Math,
_floor = _math.floor,
_max = _math.max,
_abs = _math.abs,
_each = $.each,
_map = require("../core/utils").map,
MIN_RANGE_FOR_ADJUST_BOUNDS = .1;
var getValueAxesPerPanes = function(valueAxes) {
var result = {};
_each(valueAxes, function(_, axis) {
var pane = axis.pane;
if (!result[pane]) {
result[pane] = []
}
result[pane].push(axis)
});
return result
};
var restoreOriginalBusinessRange = function(axis) {
var businessRange, translator = axis.getTranslator();
if (!translator._originalBusinessRange) {
translator._originalBusinessRange = new Range(translator.getBusinessRange())
} else {
businessRange = new Range(translator._originalBusinessRange);
translator.updateBusinessRange(businessRange)
}
};
var linearConverter = {
transform: function(v, b) {
return vizUtils.getLog(v, b)
},
addInterval: function(v, i) {
return v + i
},
getInterval: function(base, tickInterval) {
return tickInterval
},
adjustValue: _floor
};
var logConverter = {
transform: function(v, b) {
return vizUtils.raiseTo(v, b)
},
addInterval: function(v, i) {
return v * i
},
getInterval: function(base, tickInterval) {
return _math.pow(base, tickInterval)
},
adjustValue: _adjustValue
};
var convertAxisInfo = function(axisInfo, converter) {
if (!axisInfo.isLogarithmic) {
return
}
var tick, interval, i, base = axisInfo.logarithmicBase,
tickValues = axisInfo.tickValues,
ticks = [];
axisInfo.minValue = converter.transform(axisInfo.minValue, base);
axisInfo.oldMinValue = converter.transform(axisInfo.oldMinValue, base);
axisInfo.maxValue = converter.transform(axisInfo.maxValue, base);
axisInfo.oldMaxValue = converter.transform(axisInfo.oldMaxValue, base);
axisInfo.tickInterval = _math.round(axisInfo.tickInterval);
if (axisInfo.tickInterval < 1) {
axisInfo.tickInterval = 1
}
interval = converter.getInterval(base, axisInfo.tickInterval);
tick = converter.transform(tickValues[0], base);
for (i = 0; i < tickValues.length; i++) {
ticks.push(converter.adjustValue(tick));
tick = converter.addInterval(tick, interval)
}
ticks.tickInterval = axisInfo.tickInterval;
axisInfo.tickValues = ticks
};
var populateAxesInfo = function(axes) {
return _map(axes, function(axis) {
restoreOriginalBusinessRange(axis);
var minValue, maxValue, businessRange, tickInterval, synchronizedValue, ticksValues = axis.getTicksValues(),
majorTicks = ticksValues.majorTicksValues,
options = axis.getOptions(),
axisInfo = null;
if (majorTicks && majorTicks.length > 0 && commonUtils.isNumber(majorTicks[0]) && "discrete" !== options.type) {
businessRange = axis.getTranslator().getBusinessRange();
tickInterval = axis._tickManager.getTickInterval();
minValue = businessRange.minVisible;
maxValue = businessRange.maxVisible;
synchronizedValue = options.synchronizedValue;
if (minValue === maxValue && _isDefined(synchronizedValue)) {
tickInterval = _abs(majorTicks[0] - synchronizedValue) || 1;
minValue = majorTicks[0] - tickInterval;
maxValue = majorTicks[0] + tickInterval
}
axisInfo = {
axis: axis,
isLogarithmic: "logarithmic" === options.type,
logarithmicBase: businessRange.base,
tickValues: majorTicks,
minorValues: ticksValues.minorTicksValues,
minValue: minValue,
oldMinValue: minValue,
maxValue: maxValue,
oldMaxValue: maxValue,
inverted: businessRange.invert,
tickInterval: tickInterval,
synchronizedValue: synchronizedValue
};
if (businessRange.stubData) {
axisInfo.stubData = true;
axisInfo.tickInterval = axisInfo.tickInterval || options.tickInterval;
axisInfo.isLogarithmic = false
}
convertAxisInfo(axisInfo, linearConverter)
}
return axisInfo
})
};
var updateTickValues = function(axesInfo) {
var maxTicksCount = 0;
_each(axesInfo, function(_, axisInfo) {
maxTicksCount = _max(maxTicksCount, axisInfo.tickValues.length)
});
_each(axesInfo, function(_, axisInfo) {
var ticksMultiplier, ticksCount, additionalStartTicksCount = 0,
synchronizedValue = axisInfo.synchronizedValue,
tickValues = axisInfo.tickValues,
tickInterval = axisInfo.tickInterval;
if (_isDefined(synchronizedValue)) {
axisInfo.baseTickValue = axisInfo.invertedBaseTickValue = synchronizedValue;
axisInfo.tickValues = [axisInfo.baseTickValue]
} else {
if (tickValues.length > 1 && tickInterval) {
ticksMultiplier = _floor((maxTicksCount + 1) / tickValues.length);
ticksCount = ticksMultiplier > 1 ? _floor((maxTicksCount + 1) / ticksMultiplier) : maxTicksCount;
additionalStartTicksCount = _floor((ticksCount - tickValues.length) / 2);
while (additionalStartTicksCount > 0 && 0 !== tickValues[0]) {
tickValues.unshift(_applyPrecisionByMinDelta(tickValues[0], tickInterval, tickValues[0] - tickInterval));
additionalStartTicksCount--
}
while (tickValues.length < ticksCount) {
tickValues.push(_applyPrecisionByMinDelta(tickValues[0], tickInterval, tickValues[tickValues.length - 1] + tickInterval))
}
axisInfo.tickInterval = tickInterval / ticksMultiplier
}
axisInfo.baseTickValue = tickValues[0];
axisInfo.invertedBaseTickValue = tickValues[tickValues.length - 1]
}
})
};
var getAxisRange = function(axisInfo) {
return axisInfo.maxValue - axisInfo.minValue || 1
};
var getMainAxisInfo = function(axesInfo) {
for (var i = 0; i < axesInfo.length; i++) {
if (!axesInfo[i].stubData) {
return axesInfo[i]
}
}
return null
};
var correctMinMaxValues = function(axesInfo) {
var mainAxisInfo = getMainAxisInfo(axesInfo),
mainAxisInfoTickInterval = mainAxisInfo.tickInterval;
_each(axesInfo, function(_, axisInfo) {
var scale, move, mainAxisBaseValueOffset, valueFromAxisInfo;
if (axisInfo !== mainAxisInfo) {
if (mainAxisInfoTickInterval && axisInfo.tickInterval) {
if (axisInfo.stubData && _isDefined(axisInfo.synchronizedValue)) {
axisInfo.oldMinValue = axisInfo.minValue = axisInfo.baseTickValue - (mainAxisInfo.baseTickValue - mainAxisInfo.minValue) / mainAxisInfoTickInterval * axisInfo.tickInterval;
axisInfo.oldMaxValue = axisInfo.maxValue = axisInfo.baseTickValue - (mainAxisInfo.baseTickValue - mainAxisInfo.maxValue) / mainAxisInfoTickInterval * axisInfo.tickInterval
}
scale = mainAxisInfoTickInterval / getAxisRange(mainAxisInfo) / axisInfo.tickInterval * getAxisRange(axisInfo);
axisInfo.maxValue = axisInfo.minValue + getAxisRange(axisInfo) / scale
}
if (mainAxisInfo.inverted && !axisInfo.inverted || !mainAxisInfo.inverted && axisInfo.inverted) {
mainAxisBaseValueOffset = mainAxisInfo.maxValue - mainAxisInfo.invertedBaseTickValue
} else {
mainAxisBaseValueOffset = mainAxisInfo.baseTickValue - mainAxisInfo.minValue
}
valueFromAxisInfo = getAxisRange(axisInfo);
move = (mainAxisBaseValueOffset / getAxisRange(mainAxisInfo) - (axisInfo.baseTickValue - axisInfo.minValue) / valueFromAxisInfo) * valueFromAxisInfo;
axisInfo.minValue -= move;
axisInfo.maxValue -= move
}
})
};
var calculatePaddings = function(axesInfo) {
var minPadding, maxPadding, startPadding = 0,
endPadding = 0;
_each(axesInfo, function(_, axisInfo) {
var inverted = axisInfo.inverted;
minPadding = axisInfo.minValue > axisInfo.oldMinValue ? (axisInfo.minValue - axisInfo.oldMinValue) / getAxisRange(axisInfo) : 0;
maxPadding = axisInfo.maxValue < axisInfo.oldMaxValue ? (axisInfo.oldMaxValue - axisInfo.maxValue) / getAxisRange(axisInfo) : 0;
startPadding = _max(startPadding, inverted ? maxPadding : minPadding);
endPadding = _max(endPadding, inverted ? minPadding : maxPadding)
});
return {
start: startPadding,
end: endPadding
}
};
var correctMinMaxValuesByPaddings = function(axesInfo, paddings) {
_each(axesInfo, function(_, info) {
var range = getAxisRange(info),
inverted = info.inverted;
info.minValue -= paddings[inverted ? "end" : "start"] * range;
info.maxValue += paddings[inverted ? "start" : "end"] * range;
if (range > MIN_RANGE_FOR_ADJUST_BOUNDS) {
info.minValue = _math.min(info.minValue, _adjustValue(info.minValue));
info.maxValue = _max(info.maxValue, _adjustValue(info.maxValue))
}
})
};
var updateTickValuesIfSynchronizedValueUsed = function(axesInfo) {
var hasSynchronizedValue = false;
_each(axesInfo, function(_, info) {
hasSynchronizedValue = hasSynchronizedValue || _isDefined(info.synchronizedValue)
});
_each(axesInfo, function(_, info) {
var lastTickValue, tickInterval = info.tickInterval,
tickValues = info.tickValues,
maxValue = info.maxValue,
minValue = info.minValue;
if (hasSynchronizedValue && tickInterval) {
while (tickValues[0] - tickInterval >= minValue) {
tickValues.unshift(_adjustValue(tickValues[0] - tickInterval))
}
lastTickValue = tickValues[tickValues.length - 1];
while ((lastTickValue += tickInterval) <= maxValue) {
tickValues.push(commonUtils.isExponential(lastTickValue) ? _adjustValue(lastTickValue) : _applyPrecisionByMinDelta(minValue, tickInterval, lastTickValue))
}
}
while (tickValues[0] < minValue) {
tickValues.shift()
}
while (tickValues[tickValues.length - 1] > maxValue) {
tickValues.pop()
}
})
};
var applyMinMaxValues = function(axesInfo) {
_each(axesInfo, function(_, info) {
var axis = info.axis,
range = axis.getTranslator().getBusinessRange();
if (range.min === range.minVisible) {
range.min = info.minValue
}
if (range.max === range.maxVisible) {
range.max = info.maxValue
}
range.minVisible = info.minValue;
range.maxVisible = info.maxValue;
if (_isDefined(info.stubData)) {
range.stubData = info.stubData
}
if (range.min > range.minVisible) {
range.min = range.minVisible
}
if (range.max < range.maxVisible) {
range.max = range.maxVisible
}
range.isSynchronized = true;
axis.getTranslator().updateBusinessRange(range);
axis.setTicks({
majorTicks: info.tickValues,
minorTicks: info.minorValues
})
})
};
var correctAfterSynchronize = function(axesInfo) {
var correctValue, validAxisInfo, invalidAxisInfo = [];
_each(axesInfo, function(i, info) {
if (info.oldMaxValue - info.oldMinValue === 0) {
invalidAxisInfo.push(info)
} else {
if (!_isDefined(correctValue) && !_isDefined(info.synchronizedValue)) {
correctValue = _abs((info.maxValue - info.minValue) / (info.tickValues[_floor(info.tickValues.length / 2)] - info.minValue || info.maxValue));
validAxisInfo = info
}
}
});
if (!_isDefined(correctValue)) {
return
}
_each(invalidAxisInfo, function(i, info) {
var firstTick = info.tickValues[0],
correctedTick = firstTick * correctValue,
tickValues = validAxisInfo.tickValues,
centralTick = tickValues[_floor(tickValues.length / 2)];
if (firstTick > 0) {
info.maxValue = correctedTick;
info.minValue = 0
} else {
if (firstTick < 0) {
info.minValue = correctedTick;
info.maxValue = 0
} else {
if (0 === firstTick) {
info.maxValue = validAxisInfo.maxValue - centralTick;
info.minValue = validAxisInfo.minValue - centralTick
}
}
}
})
};
var multiAxesSynchronizer = {
synchronize: function(valueAxes) {
_each(getValueAxesPerPanes(valueAxes), function(_, axes) {
var axesInfo, paddings;
if (axes.length > 1) {
axesInfo = populateAxesInfo(axes);
if (0 === axesInfo.length || !getMainAxisInfo(axesInfo)) {
return
}
updateTickValues(axesInfo);
correctMinMaxValues(axesInfo);
paddings = calculatePaddings(axesInfo);
correctMinMaxValuesByPaddings(axesInfo, paddings);
correctAfterSynchronize(axesInfo);
updateTickValuesIfSynchronizedValueUsed(axesInfo);
_each(axesInfo, function() {
convertAxisInfo(this, logConverter)
});
applyMinMaxValues(axesInfo)
}
})
}
};
module.exports = multiAxesSynchronizer;
|
import React from 'react'
import dedent from 'dedent-js'
import { DescriptionBlock } from '../../styled'
import { Markdown } from '../../Markdown'
import { Highlight } from '../../Highlight'
const ColorsColor = () => (
<DescriptionBlock>
<h2>Single color property</h2>
<Markdown
source={dedent(`
The main \`colors\` property defines the main colors to use
for your charts for main elements, for example the bars of a
[Bar](self:/bar) chart or the rectangles of a [TreeMap](self:/treemap).
For other elements such as borders, links (for [Pie](self:/pie) radial
labels for example), dots… you'll often have a dedicated color
property such as \`borderColor\` or \`linkColor\`.
Those are peripheral elements and sometimes to have a coherent
style you might want to use a color derived from the main element
they're bound to (rect —> border), or from the main theme.
So those properties support several strategies:
`)}
/>
<h3>Inheriting from parent element color</h3>
<Markdown
source={dedent(`
The following example will use the \`nivo\` color scheme
to determine main element's color and then use this color
for the border of those elements.
`)}
/>
<Highlight
code={dedent(`
<Chart
colors={{ scheme: 'nivo' }}
borderColor={{ from: 'color' }}
/>
`)}
language="jsx"
/>
<Markdown
source={dedent(`
However it's not that useful as increasing the elements
size would visually give the same result.
That's where **modifiers** come into play, you can inherit
from the main color but apply modifiers to dissociate it
from the main element while keeping consistency.
The folowing code will inherit use the color from parent
element and darken it by an amount of \`.6\` and change its
opacity to \`.5\`:
`)}
/>
<Highlight
code={dedent(`
<Chart
colors={{ scheme: 'nivo' }}
borderColor={{
from: 'color',
modifiers: [
['darker', .6],
['opacity', .5]
]
}}
/>
`)}
language="jsx"
/>
<Markdown
source={dedent(`
Available modifiers are \`darker\`, \`brighter\` and \`opacity\`.
`)}
/>
<h3>Using a color from current theme</h3>
<Markdown
source={dedent(`
If you want to use a fixed color but want it to match current
theme, you can use the following config:
`)}
/>
<Highlight
code={dedent(`
<Chart
colors={{ scheme: 'nivo' }}
borderColor={{ theme: 'background' }}
/>
`)}
language="jsx"
/>
<Markdown
source={dedent(`
Now all borders will use the \`background\` property
from current theme.
`)}
/>
<h3>Using a static custom color</h3>
<Markdown
source={dedent(`
Using a custom color is pretty straightforward:
`)}
/>
<Highlight
code={dedent(`
<Chart
colors={{ scheme: 'nivo' }}
borderColor="#000000"
/>
`)}
language="jsx"
/>
</DescriptionBlock>
)
export default ColorsColor
|
/* Objects
Variables are containers for data values.
Objects are also variables that can contain many values.
Information stored as name:value pairs (properties).
Methods are functions stored as object propeties.
*/
// In JS everything is an object
// Functions are also objects
// Below a variable Person is created and assigned a pointer to a function
// This is a constructor function, commonly used to create 'classes' and objects of that 'class'
var Person = function(name){
this.name = name;
};
// Creating object of Person 'class'
// Code below creates a new variable Kelly.
// On the right, the new keyword is used with Person (pointer to a function)
/* When new is called with a function, the function creates a new object ('this' in the func references this object)
and returns it */
/* Therefore, on right, a new object is created,
"Kelly" is assigned to its name proeprty,
it is returned,
then assigned to Kelly (variable) */
var Kelly = new Person("Kelly");
/* Statement above is SAME as:
var Kelly = new function(name){
this.name = name;
};
AND
var Kelly = function(name){
this.name = name;
return this;
};
*/
// 'class' declaration of an object
// since it's a function,
// CAP name to distinguish as constructor func
function Computer(name, cpu, ram) {
this.name = name;
this.cpu = cpu;
this.ram = ram;
}
// adding method to the prototype of the object
// when called, the compiler will travel up the object's
// prototype chain until it finds the function
Computer.prototype.describe = function () {
console.log('I am a ' + Computer.name + ' with CPU: '
+ this.cpu + ' and RAM ' + this.ram);
}
// creating a new object
// 'new' keyword actually
// 1. creates a new empty object
// 2. calls constructor.apply() with that object
// as the 'this' instance (first arg)
// and the 'new' keyword args as the following args
let pi = new Computer('raspberry', 'arm', 2096);
/* Inheritance
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Inheritance
*/
// another object declaration
function Supercomputer(name, cpu, ram, cores) {
Computer.call(this, name, cpu, ram);
this.cores = cores;
}
// setting prototype to equal instance of Computer
// this means new class inherits from Computer
Supercomputer.prototype = Object.create(Computer.prototype);
// but this also sets constructor to equal Computer's
// set constructor of new class correctly
Supercomputer.prototype.constructor = Supercomputer;
// adding function to new class, uses inherited props
Supercomputer.prototype.describe = function() {
console.log('Using supercomputer ' + Computer.name + ' with CPU: '
+ this.cpu + ' and RAM ' + this.ram);
} |
Package.describe({
name: 'jss:meteor-google-prediction',
version: '0.3.2',
summary: 'Google Prediction API v1.6 client',
git: 'https://github.com/JSSolutions/meteor-google-prediction'
});
Package.onUse(function (api) {
api.versionsFrom('1.1.0.2');
api.addFiles('connector.js', 'server');
api.export('GooglePrediction', 'server');
});
Npm.depends({
"google-oauth-jwt": "0.2.0"
}); |
/*
* Copyright (c) 2016 airbug Inc. http://airbug.com
*
* bugcore may be freely distributed under the MIT license.
*/
//-------------------------------------------------------------------------------
// Annotations
//-------------------------------------------------------------------------------
//@Export('AddChange')
//@Require('Change')
//@Require('Class')
//@Require('Obj')
//-------------------------------------------------------------------------------
// Context
//-------------------------------------------------------------------------------
require('bugpack').context("*", function(bugpack) {
//-------------------------------------------------------------------------------
// BugPack
//-------------------------------------------------------------------------------
var Change = bugpack.require('Change');
var Class = bugpack.require('Class');
var Obj = bugpack.require('Obj');
//-------------------------------------------------------------------------------
// Declare Class
//-------------------------------------------------------------------------------
/**
* @class
* @extends {Change}
*/
var AddChange = Class.extend(Change, /** @lends {AddChange.prototype} */ {
_name: "AddChange",
//-------------------------------------------------------------------------------
// Constructor
//-------------------------------------------------------------------------------
/**
* @constructs
* @param {*} value
*/
_constructor: function(value) {
this._super(AddChange.CHANGE_TYPE);
//-------------------------------------------------------------------------------
// Private Properties
//-------------------------------------------------------------------------------
/**
* @private
* @type {*}
*/
this.value = value;
},
//-------------------------------------------------------------------------------
// Getters and Setters
//-------------------------------------------------------------------------------
/**
* @return {*}
*/
getValue: function() {
return this.value;
},
//-------------------------------------------------------------------------------
// Obj Methods
//-------------------------------------------------------------------------------
/**
* @param {boolean=} deep
* @return {AddChange}
*/
clone: function(deep) {
var value = this.getValue();
if (deep) {
value = Obj.clone(value, deep);
}
return new AddChange(value);
}
});
//-------------------------------------------------------------------------------
// Static Properties
//-------------------------------------------------------------------------------
/**
* @static
* @const {string}
*/
AddChange.CHANGE_TYPE = "Add";
//-------------------------------------------------------------------------------
// Exports
//-------------------------------------------------------------------------------
bugpack.export('AddChange', AddChange);
});
|
'use strict';
// http://docs.webix.com/api__refs__ui.datatable.html
var dataTable = {
view: 'datatable',
id: 'datatable',
// Columns can usually be omitted and they can be automatically detected with autoconfig: true
// But since we don't know what data in the DB might confuse the autodetection, we'll specify:
columns: [
// http://docs.webix.com/api__ui.datatable_columns_config.html
{ id: 'title', header: 'Title', editor: 'text', sort: 'string', fillspace: true }, // fill remaining width in the table
{ id: 'year', header: 'Year', editor: 'text', sort: 'string', adjust: true }, // automatically adjust to content size
{ id: 'rating', header: 'Rating', editor: 'text', sort: 'string', adjust: true }
],
select: true,
editable: true, // redundant, but see http://forum.webix.com/discussion/4328/editable-true-doesn-t-do-anything-if-columns-don-t-have-editor-specified
editaction: 'dblclick',
resizeColumn: true,
// validation
rules: {
'year': function (value) {
return value > 1890 && value < 2030
}
},
url: webix.proxy('meteor', Movies), // <-- this is it!
save: webix.proxy('meteor', Movies) // Mongo.Collection
};
// http://docs.webix.com/desktop__list.html
var list = {
view: 'list',
template: '#title# (#year#) is rated #rating#',
scroll: 'xy', // enable both scrollbars
drag: 'order', // for item order to be saved, we must add some code; otherwise, how would Meteor/Webix know in what Mongo record field to store the order?
url: webix.proxy('meteor', Movies.find({title: /e/})) // Cursor
};
var toolbar = {
view: 'toolbar',
elements: [
{ view: 'label', label: 'Double-click a row to edit. Click on columns to sort.' },
{ view: 'button', value: 'Add', width: 100,
click: function () {
var row = $$('datatable').add({});
$$('datatable').editCell(row, 'title');
}
},
{ view: 'button', value: 'Remove', width: 100,
click: function () {
var id = $$('datatable').getSelectedId();
if (id)
$$('datatable').remove(id);
else
webix.message('Please select a row to delete');
}}
]
};
var detailForm = {
view: 'form',
id: 'detail-form',
elements: [
{ view: 'text', name: 'title', label: 'Movie title' },
{ view: 'text', name: 'year', label: 'Year'},
{ view: 'text', name: 'rating', label: 'Rating'},
{
view: 'button', label: 'Save',
type: 'form', // a Submit button; 'form' is an odd type name for buttons - http://docs.webix.com/api__ui.button_type_config.html#comment-1863007844
click: function () {
this.getFormView().save();
this.getFormView().clear();
}
}
]
};
Meteor.startup(function () {
var webixContainer = webix.ui({
container: 'webix-playground',
view: 'layout',
rows: [
{
// view: 'layout', -- inferred automatically when the keys are 'rows' and/or 'cols'
cols: [
{
// the first column is the table
rows: [
toolbar,
dataTable
],
gravity: 2 // make this column 2x the width of the other one
},
{
// the second column is the filtered list, and it has two rows:
rows: [
{
view: 'template', type: 'header', template: 'Movies containing "e" (drag them!)'
},
list
]
}
]
},
{ view: 'resizer' },
detailForm
]
});
// The problem with mixing Webix components and non-Webix HTML markup is that Webix UI components won't resize
// automatically if you place them in an HTML container. You have to resize them manually, like below.
// Read more at http://forum.webix.com/discussion/comment/3650/#Comment_3650.
webix.event(window, 'resize', function(){
webixContainer.resize();
});
// http://docs.webix.com/desktop__data_binding.html
$$('detail-form').bind($$('datatable'));
console.log('The DataTable is reactive. Try `Movies.insert({title: "Star Wars"})`');
});
|
import { inject, NewInstance } from 'aurelia-framework';
import { DialogController } from 'aurelia-dialog';
@inject(DialogController)
export class RestoreSelection {
dialogController = null;
jbselection = {};
constructor(dialogController, validationControllerFactory, title) {
this.dialogController = dialogController;
this.title = title;
}
save() {
this.dialogController.ok({ delete: false, save: true, jbselection: this.jbselection });
}
cancel() {
this.dialogController.cancel();
}
activate(data) {
this.jbselection.Id = data.jbselection.Id;
this.jbselection.A1Song = data.jbselection.A1Song;
this.jbselection.A2Song = data.jbselection.A2Song;
this.jbselection.B1Song = data.jbselection.B1Song;
this.jbselection.B2Song = data.jbselection.B2Song;
this.jbselection.Artist1 = data.jbselection.Artist1;
this.jbselection.Artist2 = data.jbselection.Artist2;
this.jbselection.ImageStripName = data.jbselection.ImageStripName;
this.jbselection.MusicCategory = data.jbselection.MusicCategory;
this.jbselection.Archived = 0;
this.jbselection.ImageStripTemplate = data.jbselection.ImageStripTemplate;
this.jbselection.jbselectioncol = data.jbselection.jbselectioncol;
this.title = data.title;
}
}
|
var spawn = require('child_process').spawn
var versions = process.argv.slice(2)
var npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'
function command (arg) {
const args = arg.split(' ')
return new Promise((resolve, reject) => {
spawn(args.shift(), args, { stdio: 'inherit' })
.on('close', (code) => {
code && reject(code)
resolve()
})
})
}
function run (a, ...b) {
return a.reduce((commands, c, i) => {
commands.push(c, b[i])
return commands
}, [])
.join('').trim().split('\n')
.reduce((acc, c) => {
return acc.then(() => command(c.trim()))
}, Promise.resolve())
}
function bump (i) {
i = i || 0
if (i === versions.length) {
return Promise.resolve(0)
}
const v = versions[i]
return run`
${npm} install @angular/core@${v} --save-dev --save-exact
${npm} test
${npm} version ${v} --force --no-git-tag-version
git commit -am v${v}
git tag v${v}`.then(() => bump(++i))
}
const exit = process.exit.bind(process)
bump().then(exit, exit) |
$(document).ready(function() {
$(".resPage").hide();
$(".calPage").hide();
console.log("JS");
pages();
});
function pages() {
$("#cLink").click(function() {
$("#container").fadeOut(250);
$(".calPage").fadeIn(500);
});
$("#rLink").click(function() {
$("#container").fadeOut(250);
$(".resPage").fadeIn(500);
console.log("resume");
});
$(".closeCal").click(function() {
$(".calPage").fadeOut(250);
$("#container").fadeIn(500);
});
$(".closeRes").click(function() {
$(".resPage").fadeOut(250);
$("#container").fadeIn(500);
});
var calendar = $("#calendar");
var width = $("#divBox").width();
var height = $("#divBox").height();
calendar.attr("width", width);
calendar.attr("height", height);
}
|
jQuery(function($) {
$('#simple-colorpicker-1').ace_colorpicker({pull_right:true}).on('change', function(){
var color_class = $(this).find('option:selected').data('class');
var new_class = 'widget-box';
if(color_class != 'default') new_class += ' widget-color-'+color_class;
$(this).closest('.widget-box').attr('class', new_class);
});
// scrollables
$('.scrollable').each(function () {
var $this = $(this);
$(this).ace_scroll({
size: $this.data('size') || 100,
//styleClass: 'scroll-left scroll-margin scroll-thin scroll-dark scroll-light no-track scroll-visible'
});
});
$('.scrollable-horizontal').each(function () {
var $this = $(this);
$(this).ace_scroll(
{
horizontal: true,
styleClass: 'scroll-top',//show the scrollbars on top(default is bottom)
size: $this.data('size') || 500,
mouseWheelLock: true
}
).css({'padding-top': 12});
});
$(window).on('resize.scroll_reset', function() {
$('.scrollable-horizontal').ace_scroll('reset');
});
/**
//or use slimScroll plugin
$('.slim-scrollable').each(function () {
var $this = $(this);
$this.slimScroll({
height: $this.data('height') || 100,
railVisible:true
});
});
*/
/**$('.widget-box').on('setting.ace.widget' , function(e) {
e.preventDefault();
});*/
/**
$('.widget-box').on('show.ace.widget', function(e) {
//e.preventDefault();
//this = the widget-box
});
$('.widget-box').on('reload.ace.widget', function(e) {
//this = the widget-box
});
*/
//$('#my-widget-box').widget_box('hide');
// widget boxes
// widget box drag & drop example
$('.widget-container-col').sortable({
connectWith: '.widget-container-col',
items:'> .widget-box',
handle: ace.vars['touch'] ? '.widget-header' : false,
cancel: '.fullscreen',
opacity:0.8,
revert:true,
forceHelperSize:true,
placeholder: 'widget-placeholder',
forcePlaceholderSize:true,
tolerance:'pointer',
start: function(event, ui) {
//when an element is moved, it's parent becomes empty with almost zero height.
//we set a min-height for it to be large enough so that later we can easily drop elements back onto it
ui.item.parent().css({'min-height':ui.item.height()})
//ui.sender.css({'min-height':ui.item.height() , 'background-color' : '#F5F5F5'})
},
update: function(event, ui) {
ui.item.parent({'min-height':''})
//p.style.removeProperty('background-color');
}
});
}); |
const ws = require('ws')
const crypto = require('crypto')
const MapSet = require('./map_set')
const WebSocketServer = ws.Server
const log = (message) => {
if (GroupServer.log) console.log(message)
}
// Connecting clients are assigned randomly generated public IDs to identify
// them to their peers. We want to clients to reclaim their ids in the future,
// but only to be able to claim ids that they have been assigned. At the same
// time, we want to avoid storing ids for users to which we are no longer
// connected. To achieve this, when first connecting to a client, we generate a
// 32 byte random string as a secret, and then take its sha256 hash. The hash is
// sent to peers as a public ID identifying the client, and the secret is sent
// to and stored by the connecting client. When reconnecting, the client can
// then provide the hash for the server to securely regenerate the public ID.
const getIdKeyPair = (cb) => {
crypto.randomBytes(32, (ex, buffer) => {
const id = crypto.createHash('sha256').update(buffer).digest('base64')
const secret = buffer.toString('base64')
cb(id, secret)
})
}
const getIdFromKey = (secret) => {
return crypto.createHash('sha256').update(secret, 'base64').digest('base64')
}
class GroupServer {
constructor(options) {
this.wss = new WebSocketServer(options)
// map event type to set of handlers
this.handlers = new MapSet
// map peer id to web socket connection
this.sockets = new Map
// map group names to sets of peer ids
this.groups = new MapSet
// map peer ids to sets of group names
this.memberships = new MapSet
const setUpClientConnection = (ws, id) => {
this.sockets.set(id, ws)
ws.removeAllListeners()
ws.addEventListener('close', (e) => {
log(`closed connection to ${id}`)
tearDownClientConnection(id)
})
ws.addEventListener('message', (e) => {
const [type, payload] = JSON.parse(e.data)
this.trigger(type, id, payload)
})
}
const tearDownClientConnection = (id) => {
const memberships = this.memberships.get(id)
if (memberships != null) {
memberships.forEach((group) => {
this.groups.delete(group, id)
})
}
this.memberships.delete(id)
this.sockets.delete(id)
}
// handle incoming connections
this.wss.on('connection', (ws) => {
getIdKeyPair((id, secret) => {
log(`opened connection to ${id}`)
setUpClientConnection(ws, id)
this.send(id, 'id', {id: id, secret: secret})
})
})
// handle messages from clients
this.on('id', (id, secret) => {
const nextId = getIdFromKey(secret)
if (this.sockets.has(nextId)) {
this.send(id, 'id', {id: id})
} else {
const ws = this.sockets.get(id)
tearDownClientConnection(id)
setUpClientConnection(ws, nextId)
this.send(nextId, 'id', {id: nextId, secret: secret})
}
})
this.on('create', (id, group) => {
if (this.groups.has(group)) {
log(`client ${id} failed to create ${group}`)
this.send(id, 'create failed', group)
} else {
log(`client ${id} created ${group}`)
this.memberships.add(id, group)
this.groups.add(group, id)
this.send(id, 'create', group)
}
})
this.on('join', (id, group) => {
const peers = this.groups.get(group)
if (peers != null) {
log(`client ${id} joined ${group}`)
peers.forEach((peer) => {
log(`requsting offer from ${peer} in ${group}`)
this.send(peer, 'request offer', {group: group, from: id})
})
this.memberships.add(id, group)
this.groups.add(group, id)
this.send(id, 'join', group)
} else {
log(`client ${id} failed to join ${group}`)
this.send(id, 'join failed', group)
}
})
this.on('leave', (id, group) => {
log(`client ${id} left ${group}`)
this.memberships.delete(id, group)
this.groups.delete(group, id)
})
this.on('offer', (id, {sdp, group, to}) => {
log(`client ${id} sent offer to ${to} in ${group}`)
this.send(to, 'offer', {
sdp: sdp,
group: group,
from: id
})
})
this.on('answer', (id, {sdp, group, to}) => {
log(`client ${id} sent answer to ${to} in ${group}`)
this.send(to, 'answer', {
sdp: sdp,
group: group,
from: id
})
})
this.on('candidate', (id, {candidate, group, to}) => {
log(`client ${id} sent ice candidate to ${to} in ${group}`)
this.send(to, 'candidate', {
candidate: candidate,
group: group,
from:
id})
})
}
on(type, callback) {
this.handlers.add(type, callback)
}
off(type, callback) {
this.handlers.delete(type, callback)
}
trigger(type, ...args) {
const handlers = this.handlers.get(type)
if (handlers != null) {
handlers.forEach((handler) => handler.apply(null, args))
}
}
send(id, type, payload) {
const socket = this.sockets.get(id)
if (socket != null) {
socket.send(JSON.stringify([type, payload]))
}
}
stop() {
log('stopping ultrawave server')
this.wss.close()
}
}
GroupServer.log = true
module.exports = GroupServer
|
var curry = require('fnkit/curry');
module.exports = function(watch){
watch('todoToggled', _updateTodo({
completed: function(c){return !c;},
}));
watch('todoEdited', _updateTodo({
status:'editing'
}));
watch('todoDestroyed', onTodoDestroyed);
watch('todoSaved', _updateTodo(function(data){
return {
title: data.value,
status: 'saved'
};
}));
watch('todoCanceled', _updateTodo({
status: 'saved'
}));
watch('todoCreated', onTodoCreated);
watch('filterChanged', onFilterChanged);
watch('completedCleared', _updateTodos({
completed: false
}));
watch('allToggled', _updateTodos(function(completed){
return {
completed: completed
};
}));
};
//updates
function onTodoDestroyed(store, refs, data){
var ref = refs.todos.get(data.id),
indexes = store.get('index');
refs.todos.remove(ref);
store.unset(['todos', ref]);
store.splice('index', [indexes.indexOf(ref), 1]);
}
function onTodoCreated(store, refs, data){
var newTodo = {
title: data.val,
status: 'created'
};
var newRef = refs.todos.create(),
newId = newRef;
refs.todos.update(newRef, newId);
newTodo.id = newId;
store.set(['todos', newRef], newTodo);
store.unshift('index', newRef);
}
function onFilterChanged(store, _, filter){
store.set('filter', filter);
}
//helpers
var _updateTodo = curry(3, function _updateTodo(update, store, refs, data){
var ref = refs.todos.get(data.id),
cursor = store.select('todos');
if(typeof update === 'function'){
update = update(data);
}
Object.keys(update).forEach(function(k){
var val = update[k];
if(typeof val === 'function'){
val = val(cursor.get([ref,k]));
}
cursor.set([ref, k], val);
});
});
var _updateTodos = curry(3, function _updateTodos(update, store, _, data){
var index = store.get('index'),
cursor = store.select('todos');
if(typeof update === 'function'){
update = update(data);
}
index.forEach(function(ref){
cursor.merge(ref, update);
});
}); |
// Copyright 2021, University of Colorado Boulder
/**
* Fails with an assertion if the string is not a valid repo name. See https://github.com/phetsims/chipper/issues/1034.
*
* @author Jonathan Olson <jonathan.olson@colorado.edu>
*/
const assert = require( 'assert' );
/**
* Fails with an assertion if the string is not a valid repo name. See https://github.com/phetsims/chipper/issues/1034.
*
* @param {string} repo
*/
const assertIsValidRepoName = repo => {
assert( typeof repo === 'string' && /^[a-z]+(-[a-z]+)*$/u.test( repo ), 'repo name should be composed of lowercase a-z characters, optionally with dashes used as separators' );
};
module.exports = assertIsValidRepoName;
|
define(['lib',
'webapp/mqtt/received-data-model',
'webapp/mqtt/received-data-view',
'lang!webapp/mqtt/lang.json'],
function (lib, models, views, lang) {
var messageList = lib.common.AppSection.extend({
start: function () {
this.loadMessageList();
},
reloadMessages: function (view) {
models.loadMessages()
.done(function (model) {
var messages = model.messages.toJSON();
view.collection.reset(messages);
});
},
deleteMessage: function (view, childView) {
var path = childView.model.get("path");
if (lib.utils.confirm(lang.get('Do_you_want_to_delete_saved_message_0'), path)) {
var id = childView.model.get('id');
models.deleteMessage(id).done(this.bind('reloadMessages', view));
}
},
displayMessageList: function (model) {
var view = new views.MessageList({
model: model.info,
collection: model.messages
});
this.listenTo(view, 'reload:messages', this.bind('reloadMessages', view));
this.listenTo(view, 'childview:delete:message', this.bind('deleteMessage', view));
this.listenTo(this.application.radio, 'mqtt:message', this.bind('reloadMessages', view))
this.application.setContentView(view);
},
loadMessageList: function () {
models.loadMessages().done(this.bind('displayMessageList'));
}
});
return messageList;
}); |
const gulp = require('gulp')
const fs = require('fs')
const shell = require('shelljs')
const argv = require('yargs').argv
const configPath = `${process.cwd()}/data/config.json`
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'))
const base = '/web/bgapps/html/'
const host = 'shell.boston.com'
gulp.task('ssh-prod', (cb) => {
const username = argv.u
const files = argv.html ? 'index.html bundle.js' : '.'
const filepath = base + config.path
const configured = checkConfiguration(username)
if (configured) {
const command = `(cd dist/prod; scp -r ${files} ${username}@${host}:${filepath})`
shell.exec(command, cb)
} else {
cb()
}
})
const checkConfiguration = (username) => {
if (!config.path) {
console.log('*** setup ssh-config.js "path" to upload to apps ***')
}
if (!username) {
console.log('*** enter your username with "gulp prod -u username" ***')
}
return username && typeof username === 'string' && config.path
}
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import Joi from '@hapi/joi';
import Utils from '../utils/util';
const defaultOptions = {
stripUnknown: true,
};
const defaultWindowWidth = 1000;
const defaultWindowHeight = 700;
const minWindowWidth = 400;
const minWindowHeight = 240;
const argsSchema = Joi.object({
hidden: Joi.boolean(),
'disable-dev-mode': Joi.boolean(),
disableDevMode: Joi.boolean(),
'data-dir': Joi.string(),
dataDir: Joi.array().items(Joi.string()),
version: Joi.boolean(),
});
const boundsInfoSchema = Joi.object({
x: Joi.number().integer().default(0),
y: Joi.number().integer().default(0),
width: Joi.number().integer().min(minWindowWidth).required().default(defaultWindowWidth),
height: Joi.number().integer().min(minWindowHeight).required().default(defaultWindowHeight),
maximized: Joi.boolean().default(false),
fullscreen: Joi.boolean().default(false),
});
const appStateSchema = Joi.object({
lastAppVersion: Joi.string(),
skippedVersion: Joi.string(),
updateCheckedDate: Joi.string(),
});
const configDataSchemaV0 = Joi.object({
url: Joi.string().required(),
});
const configDataSchemaV1 = Joi.object({
version: Joi.number().min(1).default(1),
teams: Joi.array().items(Joi.object({
name: Joi.string().required(),
url: Joi.string().required(),
})).default([]),
showTrayIcon: Joi.boolean().default(false),
trayIconTheme: Joi.any().allow('').valid('light', 'dark').default('light'),
minimizeToTray: Joi.boolean().default(false),
notifications: Joi.object({
flashWindow: Joi.any().valid(0, 2).default(0),
bounceIcon: Joi.boolean().default(false),
bounceIconType: Joi.any().allow('').valid('informational', 'critical').default('informational'),
}),
showUnreadBadge: Joi.boolean().default(true),
useSpellChecker: Joi.boolean().default(true),
enableHardwareAcceleration: Joi.boolean().default(true),
autostart: Joi.boolean().default(true),
spellCheckerLocale: Joi.string().regex(/^[a-z]{2}-[A-Z]{2}$/).default('en-US'),
});
const configDataSchemaV2 = Joi.object({
version: Joi.number().min(2).default(2),
teams: Joi.array().items(Joi.object({
name: Joi.string().required(),
url: Joi.string().required(),
order: Joi.number().integer().min(0),
})).default([]),
showTrayIcon: Joi.boolean().default(false),
trayIconTheme: Joi.any().allow('').valid('light', 'dark').default('light'),
minimizeToTray: Joi.boolean().default(false),
notifications: Joi.object({
flashWindow: Joi.any().valid(0, 2).default(0),
bounceIcon: Joi.boolean().default(false),
bounceIconType: Joi.any().allow('').valid('informational', 'critical').default('informational'),
}),
showUnreadBadge: Joi.boolean().default(true),
useSpellChecker: Joi.boolean().default(true),
enableHardwareAcceleration: Joi.boolean().default(true),
autostart: Joi.boolean().default(true),
spellCheckerLocale: Joi.string().regex(/^[a-z]{2}-[A-Z]{2}$/).default('en-US'),
darkMode: Joi.boolean().default(false),
});
// eg. data['community.mattermost.com'] = { data: 'certificate data', issuerName: 'COMODO RSA Domain Validation Secure Server CA'};
const certificateStoreSchema = Joi.object().pattern(
Joi.string().uri(),
Joi.object({
data: Joi.string(),
issuerName: Joi.string(),
})
);
const allowedProtocolsSchema = Joi.array().items(Joi.string().regex(/^[a-z-]+:$/i));
// validate bounds_info.json
export function validateArgs(data) {
return validateAgainstSchema(data, argsSchema);
}
// validate bounds_info.json
export function validateBoundsInfo(data) {
return validateAgainstSchema(data, boundsInfoSchema);
}
// validate app_state.json
export function validateAppState(data) {
return validateAgainstSchema(data, appStateSchema);
}
// validate v.0 config.json
export function validateV0ConfigData(data) {
return validateAgainstSchema(data, configDataSchemaV0);
}
// validate v.1 config.json
export function validateV1ConfigData(data) {
if (Array.isArray(data.teams) && data.teams.length) {
// first replace possible backslashes with forward slashes
let teams = data.teams.map(({name, url}) => {
let updatedURL = url;
if (updatedURL.includes('\\')) {
updatedURL = updatedURL.toLowerCase().replace(/\\/gi, '/');
}
return {name, url: updatedURL};
});
// next filter out urls that are still invalid so all is not lost
teams = teams.filter(({url}) => Utils.isValidURL(url));
// replace original teams
data.teams = teams;
}
return validateAgainstSchema(data, configDataSchemaV1);
}
export function validateV2ConfigData(data) {
if (Array.isArray(data.teams) && data.teams.length) {
// first replace possible backslashes with forward slashes
let teams = data.teams.map(({name, url, order}) => {
let updatedURL = url;
if (updatedURL.includes('\\')) {
updatedURL = updatedURL.toLowerCase().replace(/\\/gi, '/');
}
return {name, url: updatedURL, order};
});
// next filter out urls that are still invalid so all is not lost
teams = teams.filter(({url}) => Utils.isValidURL(url));
// replace original teams
data.teams = teams;
}
return validateAgainstSchema(data, configDataSchemaV2);
}
// validate certificate.json
export function validateCertificateStore(data) {
return validateAgainstSchema(data, certificateStoreSchema);
}
// validate allowedProtocols.json
export function validateAllowedProtocols(data) {
return validateAgainstSchema(data, allowedProtocolsSchema);
}
function validateAgainstSchema(data, schema) {
if (typeof data !== 'object' || !schema) {
return false;
}
const {error, value} = Joi.validate(data, schema, defaultOptions);
if (error) {
return false;
}
return value;
}
|
/*
* Copyright (C) 2015 Marcel Bollmann <bollmann@linguistics.rub.de>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Class: DataTableProgressBar
Extension for DataTable implementing progress bar functionality.
*/
var DataTableProgressBar = new Class({
progressMarker: -1,
/* Function: initializeProgressBar
Adds events to the progress bar elements.
*/
initializeProgressBar: function() {
this.progressMarker = this.options.progressMarker;
this.table.addEvent(
'click:relay(div.editTableProgress)',
function(event, target) {
var checked = !(target.hasClass('editTableProgressChecked')),
id = this.getRowNumberFromElement(target);
if (!checked)
--id;
this.updateProgressBar(id);
}.bind(this)
);
},
_fillProgress: function(row, num) {
var progress = row.getElement('div.editTableProgress');
if (this.progressMarker >= Number.from(num))
progress.addClass('editTableProgressChecked');
else
progress.removeClass('editTableProgressChecked');
},
/* Function: updateProgressBar
Sets the progress marker to a specific number.
All data points with a "num" attribute lesser or equal than the progress
marker will be shown with an activated progress bar.
HACK: Progress should really be a feature of the data itself,
as this function now requires access to stuff it should have no
business accessing.
Parameters:
num - Last row number with activated progress bar
*/
updateProgressBar: function(num) {
var changes = {};
if (num == this.progressMarker)
return;
this.redrawProgressMarker(num);
this.fireEvent('updateProgress', [num, changes]);
this.dataSource.applyChanges({}, changes);
},
/* Function: redrawProgressMarker
Re-renders the progress marker for all rows.
*/
redrawProgressMarker: function(num) {
this.progressMarker = num;
var rows = this.table.getElements('tbody tr');
rows.each(function (row) {
var rownum = this.getRowNumberFromElement(row);
this._fillProgress(row, rownum);
}.bind(this));
}
});
|
export default class NotFoundError extends Error {
constructor(flowName) {
super(`Flow ${flowName} not recognised`);
}
}
|
/**
* Created by wenshao on 2017/3/13.
* 加密相关
*/
const crypto=require("crypto");
function getSoleId() {
const secret = 'token';
return crypto.createHmac('md5', secret)
.update(new Date().getTime()+" "+Math.ceil(Math.random()*100))
.digest('hex');
}
exports.getSoleId=getSoleId;
|
'use strict';
var _ = require('lodash');
var validator = require('./validator');
module.exports = function(options) {
options = _.defaults(options || {}, {
strategy : 'layout',
pjaxHeader : 'X-PJAX',
isPjaxKey : 'isPjax',
layoutKey : 'layout',
defaultLayout : 'layout.html',
pjaxViewFormat : '{name}.pjax{ext}',
renderName : 'pjax'
});
validator.validate(options);
return function(req, res, next) {
var isPjax = req[options.isPjaxKey] = req.header(options.pjaxHeader) ? true : false;
res[options.renderName] = require('./strategies/' + options.strategy)(req, res, isPjax, options);
next();
};
};
|
describe('Observerable', function(){
it('should be defined', function(){
expect(Observable).toBeDefined();
});
it('should create observables', function(){
expect(new Observable()).toBeDefined();
});
it('should register observers', function(){
var observable = new Observable();
observable.addObserver(function(){});
});
it('should notify observers', function(){
var isCalled = false;
var observable = new Observable();
observable.addObserver(function(){ isCalled = true; });
observable.notify();
expect(isCalled).toBeTruthy();
});
it('should have an id', function(){
var a = new Observable();
expect(a.observableId).toBeDefined();
});
it('should have an unique id', function(){
var a = new Observable();
var b = new Observable();
expect(a.observableId).not.toBe(b.observableId);
});
it('should pass arguments to notify', function(){
var called = false;
var a = new Observable();
a.addObserver(function(value){ called = value });
a.notify(true);
expect(called).toBeTruthy();
});
});
|
// flow-typed signature: 2a9427d70aaaa41706cc8fe369552118
// flow-typed version: <<STUB>>/@knit/read-pkg_vfile:src/packages/@knit/read-pkg/flow_v0.108.0
/**
* This is an autogenerated libdef stub for:
*
* '@knit/read-pkg'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module '@knit/read-pkg' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@knit/read-pkg/__tests__/unit.test' {
declare module.exports: any;
}
// Filename aliases
declare module '@knit/read-pkg/__tests__/unit.test.js' {
declare module.exports: $Exports<'@knit/read-pkg/__tests__/unit.test'>;
}
declare module '@knit/read-pkg/index' {
declare module.exports: $Exports<'@knit/read-pkg'>;
}
declare module '@knit/read-pkg/index.js' {
declare module.exports: $Exports<'@knit/read-pkg'>;
}
|
/**
* <TextInput>
* Kevin Lee 3 Sept 2017
**/
import React from 'react'
import { TextInput } from 'react-native'
import { Screen, Content, Bar, DataBar, DataBlock, H3, D3 } from '../rn-naive'
export default class App extends React.Component {
render() {
k = 1
return (
<Screen>
<Bar lines={0.7} style={{backgroundColor:'#222'}}
center={<H3 style={{color:'#eee'}}>{'<'}TextInput{'>'}</H3>}
/>
<DataBar lines={1} style={{borderWidth:1}}
text={(k++) + '. Original'}
input={<TextInput underlineColorAndroid='green' />}
textViewStyle={{flex:7}}
inputViewStyle={{borderWidth:1, marginBottom:4}}
/>
<DataBar lines={1} style={{borderWidth:1}}
text={(k++) + '. Production'}
input={<TextInput underlineColorAndroid='transparent' style={{margin:4, marginBottom:8, paddingBottom:0}}/>}
textViewStyle={{flex:7}}
inputViewStyle={{borderWidth:1, marginBottom:8}}
/>
<DataBar lines={1} style={{borderWidth:1}}
text={(k++) + '. Emulated defualt'}
input={<TextInput underlineColorAndroid='transparent' style={{borderBottomWidth:1.5, margin:4, marginBottom:6, paddingBottom:2}}/>}
textViewStyle={{flex:7}}
inputViewStyle={{borderWidth:1}}
/>
<DataBar lines={1} style={{borderWidth:1}}
text={(k++) + '. View and Text box'}
input={<TextInput underlineColorAndroid='transparent' style={{borderWidth:1, margin:4}}/>}
textViewStyle={{flex:7}}
inputViewStyle={{borderWidth:1, marginBottom:8}}
/>
<Bar lines={1} style={{flexDirection:'row'}}>
<DataBlock style={{flex:1, borderWidth:1}}
text={(k++) + '. Original'}
input={<TextInput underlineColorAndroid='green' />}
inputViewStyle={{borderWidth:1, marginBottom:4}}
/>
<DataBlock style={{flex:1, borderWidth:1}}
text={(k++) + '. Production'}
input={<TextInput underlineColorAndroid='transparent' style={{borderBottomWidth:1.5, margin:4, marginBottom:8, paddingBottom:0}}/>}
inputViewStyle={{borderWidth:1, marginBottom:4}}
/>
</Bar>
<Bar lines={1} style={{flexDirection:'row'}}>
<DataBlock style={{flex:1, borderWidth:1}}
text={(k++) + '. Original'}
input={<TextInput underlineColorAndroid='orange'/>}
/>
<DataBlock style={{flex:1, borderWidth:1}}
text={(k++) + '. Emulated'}
input={<TextInput underlineColorAndroid='transparent' style={{margin:4, marginBottom:8, paddingBottom:0}}/>}
/>
</Bar>
<Bar lines={1} style={{flexDirection:'row'}}>
<DataBlock style={{flex:1, borderWidth:1}}
text={(k++) + '. Emulated defualt'}
input={<TextInput underlineColorAndroid='transparent' style={{margin:4, marginBottom:8, paddingBottom:0}}/>}
/>
<DataBlock style={{flex:1, borderWidth:1}}
text={(k++) + '. View and Text box'}
input={<TextInput underlineColorAndroid='transparent' style={{borderWidth:1, margin:4}}/>}
/>
</Bar>
</Screen>
)
}
}
|
var Checker = require('../../../lib/checker');
var assert = require('assert');
describe('rules/require-padding-newline-after-variable-declaration', function() {
var checker;
beforeEach(function() {
checker = new Checker();
checker.registerDefaultRules();
checker.configure({ requirePaddingNewLineAfterVariableDeclaration: true });
});
it('should not report if an extra newline is present after var declaration', function() {
assert(checker.checkString('var a = 1;\n\nconsole.log(a);').isEmpty());
assert(checker.checkString('function a() { var a = 1;\n\nconsole.log(a); }').isEmpty());
assert(checker.checkString('var b = 2;\n\nfunction a() { var a = 1;\n\nconsole.log(a); }').isEmpty());
assert(checker.checkString(
'var b = 2;\n\nfunction a() { var a = 1;\n\nconsole.log(a); } var c = 3;'
).isEmpty());
});
it('should not report for consecutive var declarations', function() {
assert(checker.checkString('var a = 1; var b = 2; var c = 3;').isEmpty());
});
it('should not report if var is the last expression in the block', function() {
assert(checker.checkString('function a() { var x; }').isEmpty());
});
it('should report if no extra newline is present after var declaration', function() {
assert(checker.checkString('var x; console.log(x);').getErrorCount() === 1);
assert(checker.checkString('function a() { var x; console.log(x); }').getErrorCount() === 1);
assert(checker.checkString('var y; function a() { var x; console.log(x); }').getErrorCount() === 2);
});
it('should not report when variables are defined in the init part of a for loop', function() {
assert(checker.checkString('for (var i = 0, length = myArray.length; i < length; i++) {}').isEmpty());
});
it('should not report when variables are defined in the init part of a for in loop', function() {
assert(checker.checkString('for (var i in arr) {}').isEmpty());
});
it('should not report when variables are defined in the init part of a for of loop', function() {
checker.configure({ esnext: true });
assert(checker.checkString('for (var i of arr) {}').isEmpty());
});
it('should report if no extra newline is present after var declaration in the body of a for loop', function() {
assert(checker.checkString(
'for (var i = 0, length = myArray.length; i < length; i++) {' +
'var x = 1;' +
'console.log(x);' +
'}'
).getErrorCount() === 1);
});
});
|
import { meta as curiMeta } from "./api/curi";
import { meta as prepareRoutesMeta } from "./api/prepareRoutes";
import { meta as RoutePropertiesMeta } from "./api/route-objects";
export default [
{
title: "Installation",
hash: "installation"
},
{
title: "About",
hash: "about"
},
{
title: "API",
hash: "API",
children: [curiMeta, prepareRoutesMeta, RoutePropertiesMeta]
}
];
|
var should = require('chai').should(),
scapegoat = require('../index'),
escape = scapegoat.escape,
unescape = scapegoat.unescape;
describe('#escape', function() {
it('converts & into &', function() {
escape('&').should.equal('&');
});
it('converts " into "', function() {
escape('"').should.equal('"');
});
it('converts \' into '', function() {
escape('\'').should.equal(''');
});
it('converts < into <', function() {
escape('<').should.equal('<');
});
it('converts > into >', function() {
escape('>').should.equal('>');
});
}); |
var app = {};
app.init = function() {
console.log('APP INIT!!!!!');
//functions
//synchronous function
var syncFunc = function(number) {
var sum = 0;
for(var i = 0; i<number; i++){
sum +=i;
};
// console.log(sum);
// for sync function, you can return the result via 'return'
return sum;
};
//assign variable to respresent function
var result = syncFunc(2468);
console.log('the result is '+ result);
var asyncFunc = function(callback) {
setTimeout(function(){
var sum = 0;
for(var i = 0; i<10; i++) {
sum +=i;
}
callback(sum);
}, 3000); // returns 3 sec
};
// var answer;
// asyncFunc(function(result) {
// var result2 = process(result);
// console.log(result2);
});
var answer = asyncFunc();
// console.warn(answer);
//function can be a class constructor
//creating a Car blueprint (aka class)
var Car = function(color, speed, nOfDoors){
this.color = color;
this.speed = speed;
this.nOfDoors - nOfDoors;
};
var myFirstCar = new Car('blue', 100, 6);
console.log(myFirstCar);
};
//when the widown is loaded launch app.init
$(window).on('load', function() {
app.init();
}); |
"use babel";
import TargetComponent from '../../lib/views/target-component';
import Repository from '../../lib/models/repository';
import Fork from '../../lib/models/fork';
import PullRequest from '../../lib/models/pull-request';
import demoTransport from '../../lib/transport/demo';
describe("TargetComponent", () => {
let component, root;
let repository, baseFork, headFork, pullRequest;
beforeEach(() => {
repository = new Repository(".", demoTransport);
baseFork = new Fork(repository, "base/repo", "master");
headFork = new Fork(repository, "head/repo", "master");
pullRequest = new PullRequest(repository, baseFork, "base-branch", headFork, "head-branch");
component = new TargetComponent({pullRequest});
root = component.element;
});
it("shows the base fork and branch", () => {
expect(root.querySelector("span.base").innerHTML).toEqual("base:base-branch");
});
it("shows the head fork and branch", () => {
expect(root.querySelector("span.head").innerHTML).toEqual("head:head-branch");
});
it("trims refs/heads/ from branch names", () => {
pullRequest.baseBranch = "refs/heads/base/branch";
pullRequest.headBranch = "refs/heads/head/branch";
component = new TargetComponent({pullRequest});
root = component.element;
expect(root.querySelector("span.base").innerHTML).toEqual("base:base/branch");
expect(root.querySelector("span.head").innerHTML).toEqual("head:head/branch");
});
});
|
(function ($) {
/***
* A sample AJAX data store implementation.
* Modified by ANT to load CSV data from a Python script served via cherrypy
*/
function RemoteModel( tn ) {
// private
var PAGESIZE = 50;
var data = {length: 0};
var searchstr = "";
var sortcol = null;
var sortdir = 1;
var h_request = null;
var req = null; // ajax request
var table_name = tn;
// events
var onDataLoading = new Slick.Event();
var onDataLoaded = new Slick.Event();
function init() {
}
function isDataLoaded(from, to) {
for (var i = from; i <= to; i++) {
if (data[i] == undefined || data[i] == null) {
return false;
}
}
return true;
}
function clear() {
for (var key in data) {
delete data[key];
}
data.length = 0;
}
function ensureData(from, to) {
// console.log( "ensureData( ", from, ", ", to, " ) ")
if (req) {
req.abort();
for (var i = req.fromPage; i <= req.toPage; i++)
data[i * PAGESIZE] = undefined;
}
if (from < 0) {
from = 0;
}
if (data.length > 0) {
to = Math.min(to, data.length - 1);
}
var fromPage = Math.floor(from / PAGESIZE);
var toPage = Math.floor(to / PAGESIZE);
while (data[fromPage * PAGESIZE] !== undefined && fromPage < toPage)
fromPage++;
while (data[toPage * PAGESIZE] !== undefined && fromPage < toPage)
toPage--;
// console.log( " fromPage: ", fromPage, ", toPage: ", toPage );
if (fromPage > toPage || ((fromPage == toPage) && data[fromPage * PAGESIZE] !== undefined)) {
// TODO: look-ahead
onDataLoaded.notify({from: from, to: to});
return;
}
var url = "tables/" + tn
if (h_request != null) {
clearTimeout(h_request);
}
// console.log( "about to send request for [ ", from, ", ", to, " ) ");
h_request = setTimeout(function () {
for (var i = fromPage; i <= toPage; i++)
data[i * PAGESIZE] = null; // null indicates a 'requested but not available yet'
onDataLoading.notify({from: from, to: to});
reqParams = { startRow: fromPage * PAGESIZE, rowLimit: (((toPage - fromPage) * PAGESIZE) + PAGESIZE)};
if (sortcol != null )
reqParams.sortby = sortcol + ((sortdir > 0) ? "+asc" : "+desc");
req = $.get( url, reqParams, onSuccess );
req.fromPage = fromPage;
req.toPage = toPage;
}, 50);
}
function onError(fromPage, toPage) {
alert("error loading pages " + fromPage + " to " + toPage);
}
function onSuccess(resp) {
console.log( "Got ", resp.results.length, " rows ( of ", resp.totalRowCount, " ) from server, startRow: ", resp.request.startRow );
// console.log( "onSuccess!" );
// console.log( resp );
var from = resp.request.startRow, to = from + resp.results.length;
data.length = parseInt( resp.totalRowCount );
for (var i = 0; i < resp.results.length; i++) {
var item = resp.results[i];
data[from + i] = item;
data[from + i].index = from + i;
}
req = null;
onDataLoaded.notify({from: from, to: to});
}
function reloadData(from, to) {
for (var i = from; i <= to; i++)
delete data[i];
ensureData(from, to);
}
function setSort(column, dir) {
sortcol = column;
sortdir = dir;
clear();
}
init();
return {
// properties
"data": data,
// methods
"clear": clear,
"isDataLoaded": isDataLoaded,
"ensureData": ensureData,
"reloadData": reloadData,
"setSort": setSort,
// events
"onDataLoading": onDataLoading,
"onDataLoaded": onDataLoaded
};
}
// CSVView.Data.RemoteModel
$.extend(true, window, { CSVView: { Data: { RemoteModel: RemoteModel }}});
})(jQuery);
|
//CtCI 2.1
// "Implement a method to remove duplicates in an unsorted linked list"
// Cracking the Coding Interview, p77
//
// Also used this coding challenge to investigate the use of the
// so-called "JavaScript Module Pattern" (see
// http://addyosmani.com/resources/essentialjsdesignpatterns/book/#modulepatternjavascript)
// for a good description. This pattern allows for public/private variables
// and methods in JavaScript, to emulate the class pattern in other languages.
describe("Linked lists", function() {
var cList, cNode;
describe('Create Nodes', function() {
it("creates a single node", function() {
cNode = new ListNode('item 1');
expect(cNode).toBeDefined();
expect(cNode.value).toEqual('item 1');
expect(cNode.next).toBeNull;
});
it("creates mltiple nodes", function() {
var n1 = new ListNode('item1');
var n2 = new ListNode('item2');
expect(n1.value).toEqual('item1');
expect(n2.value).toEqual('item2');
});
it("links two nodes", function() {
var n1 = new ListNode('item1');
var n2 = new ListNode('item2');
n1.next = n2;
expect(n1.next.value).toEqual('item2');
});
});
describe("Create List", function() {
beforeEach(function() {
cList = new LinkedList();
});
it("is properly initialized", function() {
expect(cList.head()).toBeNull();
expect(cList.tail()).toBeNull();
expect(cList.numNodes()).toEqual(0);
});
it("adds a node", function() {
cList.addNode('item1');
expect(cList.numNodes()).toEqual(1);
expect(cList.head()).toEqual(cList.tail());
expect(cList.head().value).toEqual('item1');
expect(cList.tail().value).toEqual('item1');
});
it("adds a second node", function() {
cList.addNode('item1');
cList.addNode('item2');
console.log(cList.head().value);
console.log(cList.tail().value);
expect(cList.numNodes()).toEqual(2);
expect(cList.head().value).toEqual('item1');
expect(cList.tail().value).toEqual('item2');
});
it("keeps track of nodes", function() {
expect(cList.numNodes()).toEqual(0);
cList.addNode('item1');
expect(cList.numNodes()).toEqual(1);
cList.addNode('item2');
expect(cList.numNodes()).toEqual(2)
});
it('keeps private data private', function() {
expect(cList.listStart).not.toBeDefined();
expect(cList.listEnd).not.toBeDefined();
expect(cList.listNodes).not.toBeDefined();
});
it('adds multiple nodes', function() {
cList.addNode('item1');
expect(cList.addNode('item2').value).toEqual('item2');
expect(cList.head().value).toEqual('item1');
expect(cList.tail().value).toEqual('item2');
cList.addNode('entry4');
cList.addNode('entry0');
expect(cList.head().value).toEqual('item1');
expect(cList.tail().value).toEqual('entry0');
});
});
describe("Remove duplicates", function() {
});
});
|
import Ember from 'ember';
export default Ember.Route.extend({
init: function() {
console.log('application route...');
},
actions: {
}
}); |
import React, {PropTypes} from "react"
import App from "./components/App"
import AuthService from "./util/AuthService"
import ChatPage from "./pages/ChatPage"
import Login from "./components/Login"
import Logout from "./components/Logout"
import {Route, IndexRedirect} from "react-router"
const auth = new AuthService('5mEPvtSaOrH23TKWEebEBZZkHcE4N072', 'chickchat.auth0.com')
const requireAuth = (nextState, replace) => {
if (!auth.loggedIn()) {
replace({pathname: '/login'})
}
}
export const makeMainRoutes = () => {
return <Route path="/" component={App} auth={auth}>
<IndexRedirect to="/chat"/>
<Route path="chat" component={ChatPage} onEnter={requireAuth}/>
<Route path="login" component={Login}/>
<Route path="logout" component={Logout}/>
</Route>
}
export default makeMainRoutes |
'use strict';
/**
* @ngdoc function
* @name uixApp.controller:FormCtrl
* @description
* # FormCtrl
* Controller of the uixApp
*/
angular.module('uixApp')
.controller('FormCtrl', function ($scope, $rootScope, APP, resourceManager, exMsg, $state, $stateParams, $http, $translate, fieldService, lookupService, schemaService, authService, $uibModalStack) {
var vm = this;
$scope.vmRef = vm;
vm.model = {};
vm.modelName = null;
vm.recordId = null;
vm.record = {};
vm.action = { editMode: false, loading: true, saving: false, creating: false, updating: false, deleting: false };
vm.formly = { model: {}, fields: [], options: {formState: {readOnly: true}}, form: {} };
vm.initRoute = initRoute;
vm.loadRecord = loadRecord;
vm.sanitizeRecord = sanitizeRecord;
vm.setRecord = setRecord;
vm.lookupData = lookupData;
vm.close = close;
vm.create = create;
vm.edit = edit;
vm.isViewMode = isViewMode;
vm.isEditMode = isEditMode;
vm.cancelEdit = cancelEdit;
vm.uploads = uploads;
vm.update = update;
vm.save = save;
vm.delete = deleteRecord;
vm.error = error;
vm.hasAccess = authService.hasAccess;
vm.hasCreateAccess = function () {
return authService.hasCreateAccess(vm.model.name);
}
vm.hasShowAccess = function () {
return authService.hasShowAccess(vm.model.name);
}
vm.hasUpdateAccess = function () {
return authService.hasUpdateAccess(vm.model.name);
}
vm.hasDeleteAccess = function () {
return authService.hasDeleteAccess(vm.model.name);
}
$scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
if (!$scope.state.isShow) return;
var actionsConfig = [];
var mainActionConfig = {};
if (vm.hasCreateAccess()) {
mainActionConfig = {
icon: 'fa fa-plus',
label: 'New ' + vm.model.name,
handler: vm.new
};
}
// Add back button
actionsConfig.push({
icon: 'fa fa-chevron-left',
label: 'Back',
handler: function () { $state.go('^'); }
});
$rootScope.$broadcast('fab:load-actions', vm.model.name, actionsConfig, mainActionConfig);
});
$scope.$on('uix:reload-record', function(evt, modelName, record) {
if (modelName === vm.model.name && record.id === vm.record.id) {
vm.loadRecord(vm.record.id);
}
});
function initRoute (routeName, options) {
options = options || {};
options.loadRecord = (options.loadRecord === undefined)? true : options.loadRecord;
vm.modelName = options.name || resourceManager.getName(routeName);
window[vm.modelName + 'FormCtrl'] = vm;
vm.model = resourceManager.register(vm.modelName, APP.apiPrefix + routeName + '/:id');
vm.formly.fields = fieldService.get(vm.model.key);
lookupService.load(vm.model.key, options.lookups, true).then(function () {
vm.setRecord();
$rootScope.$broadcast('uix:form-ready', vm.model.name, vm, $scope);
});
if (options.loadRecord && $stateParams.id) {
vm.recordId = $stateParams.id;
} else if(options.recordId) {
vm.recordId = options.recordId;
} else if ($rootScope[vm.model.key + '_id']) {
vm.recordId = $rootScope[vm.model.key + '_id'];
$rootScope[vm.model.key + '_id'] = null;
}
if (vm.recordId) {
vm.loadRecord(vm.recordId);
} else {
vm.formly.options.formState.readOnly = false;
}
}
function loadRecord (recordId) {
if(!recordId) { return; }
vm.action.loading = true;
var data = { id: recordId };
resourceManager.get(vm.model.name, data)
.then(function (data) {
vm.record = data;
vm.formly.model = angular.copy(vm.record);
vm.sanitizeRecord();
$rootScope.$broadcast('uix:record-loaded', vm.model.name, vm.record, $scope);
vm.action.loading = false;
vm.formly.options.formState.readOnly = true;
})
.catch(function (error) {
vm.error(error);
vm.action.loading = false;
});
};
function sanitizeRecord () {
_.each(vm.record, function (value, key) {
if (value === null) {
vm.record[key] = '';
}
});
}
function setRecord () {
if (!vm.record.id && $stateParams.q) {
_.each(vm.splitQ($stateParams.q), function (v, k) {
vm.record[k] = v;
});
$rootScope.$broadcast('uix:record-set', vm.model.name, vm.record, $scope);
}
};
function lookupData(lookupName) {
return lookupService.get(lookupName);
}
function close () {
vm.record = {};
if ($uibModalStack.getTop()) {
$scope.$dismiss();
}
$state.go('^');
};
function create () {
vm.action.saving = true;
vm.action.creating = true;
var data = {};
data[vm.model.key] = vm.formly.model;
resourceManager.create(vm.model.name, data)
.then(function (data) {
// vm.formly.model.id = data.id;
vm.record = data;
vm.formly.model = angular.copy(vm.record);
$rootScope.$broadcast('uix:record-created', vm.model.name, data, $scope);
exMsg.success(vm.model.title + ' created successfully');
vm.close();
})
.catch(function (error) {
vm.error(error);
})
.finally(function () {
vm.action.saving = false;
vm.action.creating = false;
});
};
function edit () {
vm.formly.options.formState.readOnly = false;
vm.action.editMode = true;
};
function isViewMode () {
return vm.formly.options.formState.readOnly;
}
function isEditMode () {
return !vm.formly.options.formState.readOnly;
}
function cancelEdit () {
vm.formly.model = angular.copy(vm.record);
vm.formly.options.formState.readOnly = true;
vm.action.editMode = false;
};
function uploads () {
$state.go('^.uploads', $stateParams);
};
function update () {
if(!vm.record.id) { return; }
vm.action.saving = true;
vm.action.updating = true;
var data = { id: vm.record.id };
data[vm.model.key] = vm.formly.model;
resourceManager.update(vm.model.name, data)
.then(function (data) {
vm.record = data;
vm.formly.model = angular.copy(vm.record);
$rootScope.$broadcast('uix:record-updated', vm.model.name, data, $scope);
exMsg.success(vm.model.title + ' updated successfully');
vm.close();
})
.catch(function (error) {
vm.error(error);
})
.finally(function () {
vm.action.saving = false;
vm.action.updating = false;
});
};
function save () {
PNotify.removeAll();
vm.formly.form.$setSubmitted(true);
if (!vm.formly.form.$valid) {
return;
}
if(vm.record.id) {
vm.update();
} else {
vm.create();
}
};
function deleteRecord () {
vm.action.deleting = true;
var msg = "Are you sure you want to delete this " + vm.model.title + "?";
exMsg.confirm(msg, "Confirm Delete").then(function () {
var data = { id: vm.record.id };
data[vm.model.key] = vm.record;
resourceManager.delete(vm.model.name, data)
.then(function (data) {
$rootScope.$broadcast('uix:record-deleted', vm.model.name, vm.record, $scope);
exMsg.success(vm.model.title + " deleted successfully");
vm.close();
})
.catch(function (error) {
vm.error(error);
}).finally(function () {
vm.action.deleting = false;
});
}).catch(function () {
vm.action.deleting = false;
});
};
function error (error) {
error = error || {};
error.message && exMsg.error(error.message, error.type || 'Error');
error.messages && exMsg.errorSummary(error.messages);
}
});
|
exports.BattleFormatsData = {
bulbasaur: {
viableMoves: {"sleeppowder":1,"gigadrain":1,"hiddenpowerfire":1,"hiddenpowerice":1,"sludgebomb":1,"powerwhip":1,"leechseed":1,"synthesis":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["sweetscent","growth","solarbeam","synthesis"]},
{"generation":3,"level":10,"gender":"M","moves":["tackle","growl","leechseed","vinewhip"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tackle","growl","leechseed","vinewhip"]},
{"generation":5,"level":1,"isHidden":false,"moves":["falseswipe","block","frenzyplant","weatherball"]}
],
tier: "LC"
},
ivysaur: {
viableMoves: {"sleeppowder":1,"gigadrain":1,"hiddenpowerfire":1,"hiddenpowerice":1,"sludgebomb":1,"powerwhip":1,"leechseed":1,"synthesis":1},
tier: "NFE"
},
venusaur: {
viableMoves: {"sleeppowder":1,"gigadrain":1,"hiddenpowerfire":1,"hiddenpowerice":1,"sludgebomb":1,"swordsdance":1,"powerwhip":1,"leechseed":1,"synthesis":1,"earthquake":1},
tier: "OU"
},
venusaurmega: {
requiredItem: "Venusaurite"
},
charmander: {
viableMoves: {"flamethrower":1,"overheat":1,"dragonpulse":1,"hiddenpowergrass":1,"fireblast":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["scratch","growl","ember"]},
{"generation":4,"level":40,"gender":"M","nature":"Mild","moves":["return","hiddenpower","quickattack","howl"]},
{"generation":4,"level":40,"gender":"M","nature":"Naive","moves":["return","hiddenpower","quickattack","howl"]},
{"generation":4,"level":40,"gender":"M","nature":"Naughty","moves":["return","hiddenpower","quickattack","howl"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["scratch","growl","ember","smokescreen"]},
{"generation":4,"level":40,"gender":"M","nature":"Hardy","moves":["return","hiddenpower","quickattack","howl"],"pokeball":"cherishball"},
{"generation":5,"level":1,"isHidden":false,"moves":["falseswipe","block","blastburn","acrobatics"]}
],
tier: "LC"
},
charmeleon: {
viableMoves: {"flamethrower":1,"overheat":1,"dragonpulse":1,"hiddenpowergrass":1,"fireblast":1,"dragondance":1,"flareblitz":1,"shadowclaw":1,"dragonclaw":1},
tier: "NFE"
},
charizard: {
viableMoves: {"flamethrower":1,"fireblast":1,"substitute":1,"airslash":1,"dragonpulse":1,"hiddenpowergrass":1,"roost":1,"dragondance":1,"flareblitz":1,"dragonclaw":1,"earthquake":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["wingattack","slash","dragonrage","firespin"]}
],
tier: "OU"
},
charizardmegax: {
requiredItem: "Charizardite X"
},
charizardmegay: {
requiredItem: "Charizardite Y"
},
squirtle: {
viableMoves: {"icebeam":1,"hydropump":1,"rapidspin":1,"scald":1,"aquajet":1,"toxic":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["tackle","tailwhip","bubble","withdraw"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tackle","tailwhip","bubble","withdraw"]},
{"generation":5,"level":1,"isHidden":false,"moves":["falseswipe","block","hydrocannon","followme"]}
],
tier: "LC"
},
wartortle: {
viableMoves: {"icebeam":1,"hydropump":1,"rapidspin":1,"scald":1,"aquajet":1,"toxic":1},
tier: "Limbo"
},
blastoise: {
viableMoves: {"icebeam":1,"hydropump":1,"rapidspin":1,"scald":1,"aquajet":1,"toxic":1,"dragontail":1,"darkpulse":1,"aurasphere":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["protect","raindance","skullbash","hydropump"]}
],
tier: "Limbo A"
},
blastoisemega: {
requiredItem: "Blastoisinite"
},
caterpie: {
viableMoves: {"bugbite":1,"snore":1,"tackle":1,"electroweb":1},
tier: "LC"
},
metapod: {
viableMoves: {"snore":1,"bugbite":1,"tackle":1,"electroweb":1},
tier: "NFE"
},
butterfree: {
viableMoves: {"quiverdance":1,"roost":1,"bugbuzz":1,"substitute":1,"sleeppowder":1,"gigadrain":1,"psychic":1,"shadowball":1},
eventPokemon: [
{"generation":3,"level":30,"moves":["morningsun","psychic","sleeppowder","aerialace"]}
],
tier: "Limbo"
},
weedle: {
viableMoves: {"bugbite":1,"stringshot":1,"poisonsting":1,"electroweb":1},
tier: "LC"
},
kakuna: {
viableMoves: {"electroweb":1,"bugbite":1,"irondefense":1,"poisonsting":1},
tier: "NFE"
},
beedrill: {
viableMoves: {"toxicspikes":1,"xscissor":1,"swordsdance":1,"uturn":1,"endeavor":1,"poisonjab":1,"drillrun":1,"brickbreak":1,"knockoff":1},
eventPokemon: [
{"generation":3,"level":30,"moves":["batonpass","sludgebomb","twineedle","swordsdance"]}
],
tier: "Limbo"
},
pidgey: {
viableMoves: {"roost":1,"bravebird":1,"heatwave":1,"return":1,"workup":1,"uturn":1,"thief":1},
tier: "LC"
},
pidgeotto: {
viableMoves: {"roost":1,"bravebird":1,"heatwave":1,"return":1,"workup":1,"uturn":1,"thief":1},
eventPokemon: [
{"generation":3,"level":30,"abilities":["keeneye"],"moves":["refresh","wingattack","steelwing","featherdance"]}
],
tier: "NFE"
},
pidgeot: {
viableMoves: {"roost":1,"bravebird":1,"pursuit":1,"heatwave":1,"return":1,"uturn":1},
eventPokemon: [
{"generation":5,"level":61,"gender":"M","nature":"Naughty","isHidden":false,"abilities":["keeneye"],"moves":["whirlwind","wingattack","skyattack","mirrormove"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
rattata: {
viableMoves: {"facade":1,"flamewheel":1,"suckerpunch":1,"uturn":1,"wildcharge":1,"thunderwave":1,"crunch":1,"revenge":1},
tier: "LC"
},
raticate: {
viableMoves: {"facade":1,"flamewheel":1,"suckerpunch":1,"uturn":1,"wildcharge":1,"crunch":1,"revenge":1},
eventPokemon: [
{"generation":3,"level":34,"moves":["refresh","superfang","scaryface","hyperfang"]}
],
tier: "Limbo"
},
spearow: {
viableMoves: {"return":1,"drillpeck":1,"doubleedge":1,"uturn":1,"quickattack":1,"pursuit":1,"drillrun":1,"featherdance":1},
eventPokemon: [
{"generation":3,"level":22,"moves":["batonpass","falseswipe","leer","aerialace"]}
],
tier: "LC"
},
fearow: {
viableMoves: {"return":1,"drillpeck":1,"doubleedge":1,"uturn":1,"quickattack":1,"pursuit":1,"drillrun":1,"roost":1},
tier: "Limbo"
},
ekans: {
viableMoves: {"coil":1,"gunkshot":1,"seedbomb":1,"glare":1,"suckerpunch":1,"aquatail":1,"earthquake":1,"rest":1,"rockslide":1},
eventPokemon: [
{"generation":3,"level":14,"abilities":["shedskin"],"moves":["leer","wrap","poisonsting","bite"]},
{"generation":3,"level":10,"gender":"M","moves":["wrap","leer","poisonsting"]}
],
tier: "LC"
},
arbok: {
viableMoves: {"coil":1,"gunkshot":1,"seedbomb":1,"glare":1,"suckerpunch":1,"aquatail":1,"crunch":1,"earthquake":1,"rest":1,"rockslide":1,"icefang":1,"firefang":1,"dragontail":1,"switcheroo":1},
eventPokemon: [
{"generation":3,"level":33,"moves":["refresh","sludgebomb","glare","bite"]}
],
tier: "Limbo"
},
pichu: {
viableMoves: {"fakeout":1,"volttackle":1,"encore":1,"irontail":1,"toxic":1,"thunderbolt":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["thundershock","charm","surf"]},
{"generation":3,"level":5,"moves":["thundershock","charm","wish"]},
{"generation":3,"level":5,"moves":["thundershock","charm","teeterdance"]},
{"generation":3,"level":5,"moves":["thundershock","charm","followme"]},
{"generation":4,"level":1,"moves":["volttackle","thunderbolt","grassknot","return"]},
{"generation":4,"level":30,"shiny":true,"gender":"M","nature":"Jolly","moves":["charge","volttackle","endeavor","endure"],"pokeball":"cherishball"},
{"generation":4,"level":30,"shiny":true,"gender":"M","nature":"Jolly","moves":["volttackle","charge","endeavor","endure"],"pokeball":"cherishball"}
],
tier: "LC"
},
pichuspikyeared: {
eventPokemon: [
{"generation":4,"level":30,"gender":"F","nature":"Naughty","moves":["helpinghand","volttackle","swagger","painsplit"]}
],
tier: ""
},
pikachu: {
viableMoves: {"thunderbolt":1,"volttackle":1,"voltswitch":1,"grassknot":1,"hiddenpowerice":1,"brickbreak":1,"extremespeed":1,"encore":1,"substitute":1,"knockoff":1,"signalbeam":1},
eventPokemon: [
{"generation":3,"level":50,"moves":["thunderbolt","agility","thunder","lightscreen"]},
{"generation":3,"level":10,"moves":["thundershock","growl","tailwhip","thunderwave"]},
{"generation":3,"level":10,"moves":["fly","tailwhip","growl","thunderwave"]},
{"generation":3,"level":5,"moves":["surf","growl","tailwhip","thunderwave"]},
{"generation":3,"level":10,"moves":["fly","growl","tailwhip","thunderwave"]},
{"generation":3,"level":10,"moves":["thundershock","growl","thunderwave","surf"]},
{"generation":3,"level":70,"moves":["thunderbolt","thunder","lightscreen","fly"]},
{"generation":3,"level":70,"moves":["thunderbolt","thunder","lightscreen","surf"]},
{"generation":3,"level":70,"moves":["thunderbolt","thunder","lightscreen","agility"]},
{"generation":4,"level":10,"gender":"F","nature":"Hardy","moves":["surf","volttackle","tailwhip","thunderwave"]},
{"generation":3,"level":10,"gender":"M","moves":["thundershock","growl","tailwhip","thunderwave"]},
{"generation":4,"level":50,"gender":"M","nature":"Hardy","moves":["surf","thunderbolt","lightscreen","quickattack"],"pokeball":"cherishball"},
{"generation":4,"level":20,"gender":"F","nature":"Bashful","moves":["present","quickattack","thundershock","tailwhip"],"pokeball":"cherishball"},
{"generation":4,"level":20,"gender":"M","nature":"Jolly","moves":["grassknot","thunderbolt","flash","doubleteam"],"pokeball":"cherishball"},
{"generation":4,"level":40,"gender":"M","nature":"Modest","moves":["surf","thunder","protect"],"pokeball":"cherishball"},
{"generation":4,"level":20,"gender":"F","nature":"Bashful","moves":["quickattack","thundershock","tailwhip","present"],"pokeball":"cherishball"},
{"generation":4,"level":40,"gender":"M","nature":"Mild","moves":["surf","thunder","protect"],"pokeball":"cherishball"},
{"generation":4,"level":20,"gender":"F","nature":"Bashful","moves":["present","quickattack","thunderwave","tailwhip"],"pokeball":"cherishball"},
{"generation":4,"level":30,"gender":"M","moves":["lastresort","present","thunderbolt","quickattack"],"pokeball":"cherishball"},
{"generation":4,"level":50,"gender":"M","nature":"Relaxed","moves":["rest","sleeptalk","yawn","snore"],"pokeball":"cherishball"},
{"generation":4,"level":20,"gender":"M","nature":"Docile","moves":["present","quickattack","thundershock","tailwhip"],"pokeball":"cherishball"},
{"generation":4,"level":50,"gender":"M","nature":"Naughty","moves":["volttackle","irontail","quickattack","thunderbolt"],"pokeball":"cherishball"},
{"generation":4,"level":20,"gender":"M","nature":"Bashful","moves":["present","quickattack","thundershock","tailwhip"],"pokeball":"cherishball"},
{"generation":5,"level":30,"gender":"F","isHidden":true,"moves":["sing","teeterdance","encore","electroball"],"pokeball":"cherishball"},
{"generation":5,"level":50,"isHidden":false,"moves":["fly","irontail","electroball","quickattack"],"pokeball":"cherishball"},
{"generation":5,"level":100,"gender":"F","isHidden":false,"moves":["thunder","volttackle","grassknot","quickattack"],"pokeball":"cherishball"},
{"generation":5,"level":50,"gender":"F","isHidden":false,"moves":["extremespeed","thunderbolt","grassknot","brickbreak"],"pokeball":"cherishball"},
{"generation":5,"level":50,"gender":"F","isHidden":true,"moves":["fly","thunderbolt","grassknot","protect"],"pokeball":"cherishball"},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["thundershock","tailwhip","thunderwave","headbutt"]},
{"generation":5,"level":100,"gender":"M","isHidden":true,"moves":["volttackle","quickattack","feint","voltswitch"],"pokeball":"cherishball"},
{"generation":5,"level":50,"gender":"M","nature":"Brave","isHidden":false,"moves":["thunderbolt","quickattack","irontail","electroball"],"pokeball":"cherishball"},
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","growl","playnice","quickattack"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
raichu: {
viableMoves: {"nastyplot":1,"encore":1,"thunderbolt":1,"grassknot":1,"hiddenpowerice":1,"focusblast":1,"substitute":1,"extremespeed":1,"knockoff":1,"signalbeam":1},
tier: "Limbo"
},
sandshrew: {
viableMoves: {"earthquake":1,"rockslide":1,"swordsdance":1,"rapidspin":1,"xscissor":1,"stealthrock":1,"toxic":1,"knockoff":1,"poisonjab":1,"superfang":1},
eventPokemon: [
{"generation":3,"level":12,"moves":["scratch","defensecurl","sandattack","poisonsting"]}
],
tier: "LC"
},
sandslash: {
viableMoves: {"earthquake":1,"stoneedge":1,"swordsdance":1,"rapidspin":1,"xscissor":1,"stealthrock":1,"toxic":1,"knockoff":1,"poisonjab":1,"superfang":1},
tier: "Limbo"
},
nidoranf: {
viableMoves: {"toxicspikes":1,"crunch":1,"poisonjab":1,"honeclaws":1},
tier: "LC"
},
nidorina: {
viableMoves: {"toxicspikes":1,"crunch":1,"poisonjab":1,"honeclaws":1,"icebeam":1,"thunderbolt":1,"shadowclaw":1},
tier: "NFE"
},
nidoqueen: {
viableMoves: {"toxicspikes":1,"stealthrock":1,"fireblast":1,"thunderbolt":1,"icebeam":1,"earthpower":1,"sludgewave":1,"focusblast":1},
tier: "Limbo"
},
nidoranm: {
viableMoves: {"suckerpunch":1,"poisonjab":1,"headsmash":1,"honeclaws":1,"shadowclaw":1},
tier: "LC"
},
nidorino: {
viableMoves: {"suckerpunch":1,"poisonjab":1,"headsmash":1,"honeclaws":1,"shadowclaw":1},
tier: "NFE"
},
nidoking: {
viableMoves: {"fireblast":1,"thunderbolt":1,"icebeam":1,"earthpower":1,"sludgewave":1,"focusblast":1},
tier: "Limbo B"
},
cleffa: {
viableMoves: {"reflect":1,"thunderwave":1,"lightscreen":1,"toxic":1,"fireblast":1,"encore":1,"wish":1,"protect":1,"aromatherapy":1,"moonblast":1},
tier: "LC"
},
clefairy: {
viableMoves: {"healingwish":1,"reflect":1,"thunderwave":1,"lightscreen":1,"toxic":1,"fireblast":1,"encore":1,"wish":1,"protect":1,"aromatherapy":1,"stealthrock":1,"moonblast":1,"knockoff":1,"moonlight":1},
tier: "NFE"
},
clefable: {
viableMoves: {"calmmind":1,"softboiled":1,"fireblast":1,"thunderbolt":1,"icebeam":1,"moonblast":1},
tier: "OU"
},
vulpix: {
viableMoves: {"flamethrower":1,"fireblast":1,"willowisp":1,"energyball":1,"substitute":1,"toxic":1,"hypnosis":1,"painsplit":1,"darkpulse":1},
eventPokemon: [
{"generation":3,"level":18,"moves":["tailwhip","roar","quickattack","willowisp"]},
{"generation":3,"level":18,"moves":["charm","heatwave","ember","dig"]}
],
tier: "NFE"
},
ninetales: {
viableMoves: {"flamethrower":1,"fireblast":1,"willowisp":1,"solarbeam":1,"nastyplot":1,"substitute":1,"toxic":1,"hypnosis":1,"painsplit":1,"darkpulse":1,"extrasensory":1},
eventPokemon: [
{"generation":5,"level":50,"gender":"M","nature":"Bold","isHidden":true,"moves":["heatwave","solarbeam","psyshock","willowisp"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
igglybuff: {
viableMoves: {"wish":1,"thunderwave":1,"reflect":1,"lightscreen":1,"healbell":1,"seismictoss":1,"counter":1,"protect":1,"knockoff":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":3,"level":5,"abilities":["cutecharm"],"moves":["sing","charm","defensecurl","tickle"]}
],
tier: "LC"
},
jigglypuff: {
viableMoves: {"wish":1,"thunderwave":1,"reflect":1,"lightscreen":1,"healbell":1,"seismictoss":1,"counter":1,"stealthrock":1,"protect":1,"knockoff":1,"dazzlinggleam":1},
tier: "NFE"
},
wigglytuff: {
viableMoves: {"wish":1,"thunderwave":1,"thunderbolt":1,"healbell":1,"fireblast":1,"counter":1,"stealthrock":1,"icebeam":1,"knockoff":1,"dazzlinggleam":1,"hypervoice":1},
tier: "Limbo"
},
zubat: {
viableMoves: {"bravebird":1,"roost":1,"toxic":1,"taunt":1,"nastyplot":1,"gigadrain":1,"sludgebomb":1,"airslash":1,"uturn":1,"whirlwind":1,"heatwave":1,"superfang":1},
tier: "LC"
},
golbat: {
viableMoves: {"bravebird":1,"roost":1,"toxic":1,"taunt":1,"nastyplot":1,"gigadrain":1,"sludgebomb":1,"airslash":1,"uturn":1,"whirlwind":1,"heatwave":1,"superfang":1},
tier: "Limbo"
},
crobat: {
viableMoves: {"bravebird":1,"roost":1,"toxic":1,"taunt":1,"nastyplot":1,"gigadrain":1,"sludgebomb":1,"airslash":1,"uturn":1,"whirlwind":1,"heatwave":1,"superfang":1},
eventPokemon: [
{"generation":4,"level":30,"gender":"M","nature":"Timid","moves":["heatwave","airslash","sludgebomb","superfang"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
oddish: {
viableMoves: {"gigadrain":1,"sludgebomb":1,"synthesis":1,"sleeppowder":1,"stunspore":1,"toxic":1,"hiddenpowerfire":1,"leechseed":1,"dazzlinggleam":1,"sunnyday":1},
eventPokemon: [
{"generation":3,"level":26,"moves":["poisonpowder","stunspore","sleeppowder","acid"]},
{"generation":3,"level":5,"moves":["absorb","leechseed"]}
],
tier: "LC"
},
gloom: {
viableMoves: {"gigadrain":1,"sludgebomb":1,"synthesis":1,"sleeppowder":1,"stunspore":1,"toxic":1,"hiddenpowerfire":1,"leechseed":1,"dazzlinggleam":1,"sunnyday":1},
eventPokemon: [
{"generation":3,"level":50,"moves":["sleeppowder","acid","moonlight","petaldance"]}
],
tier: "NFE"
},
vileplume: {
viableMoves: {"gigadrain":1,"sludgebomb":1,"synthesis":1,"sleeppowder":1,"stunspore":1,"toxic":1,"hiddenpowerfire":1,"leechseed":1,"aromatherapy":1,"dazzlinggleam":1,"sunnyday":1},
tier: "Limbo"
},
bellossom: {
viableMoves: {"gigadrain":1,"sludgebomb":1,"synthesis":1,"sleeppowder":1,"stunspore":1,"toxic":1,"hiddenpowerfire":1,"leechseed":1,"leafstorm":1,"dazzlinggleam":1,"sunnyday":1},
tier: "Limbo"
},
paras: {
viableMoves: {"spore":1,"stunspore":1,"xscissor":1,"seedbomb":1,"synthesis":1,"leechseed":1,"aromatherapy":1,"knockoff":1},
eventPokemon: [
{"generation":3,"level":28,"abilities":["effectspore"],"moves":["refresh","spore","slash","falseswipe"]}
],
tier: "LC"
},
parasect: {
viableMoves: {"spore":1,"stunspore":1,"xscissor":1,"seedbomb":1,"synthesis":1,"leechseed":1,"aromatherapy":1,"knockoff":1},
tier: "Limbo"
},
venonat: {
viableMoves: {"sleeppowder":1,"morningsun":1,"toxicspikes":1,"sludgebomb":1,"signalbeam":1,"stunspore":1,"psychic":1},
tier: "LC"
},
venomoth: {
viableMoves: {"sleeppowder":1,"roost":1,"toxicspikes":1,"quiverdance":1,"batonpass":1,"bugbuzz":1,"sludgebomb":1,"gigadrain":1,"substitute":1,"psychic":1},
eventPokemon: [
{"generation":3,"level":32,"abilities":["shielddust"],"moves":["refresh","silverwind","substitute","psychic"]}
],
tier: "Limbo"
},
diglett: {
viableMoves: {"earthquake":1,"rockslide":1,"stealthrock":1,"suckerpunch":1,"reversal":1,"substitute":1,"shadowclaw":1},
tier: "LC"
},
dugtrio: {
viableMoves: {"earthquake":1,"stoneedge":1,"stealthrock":1,"suckerpunch":1,"reversal":1,"substitute":1,"shadowclaw":1},
eventPokemon: [
{"generation":3,"level":40,"moves":["charm","earthquake","sandstorm","triattack"]}
],
tier: "Limbo C"
},
meowth: {
viableMoves: {"fakeout":1,"uturn":1,"thief":1,"taunt":1,"return":1,"hypnosis":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["scratch","growl","petaldance"]},
{"generation":3,"level":5,"moves":["scratch","growl"]},
{"generation":3,"level":10,"gender":"M","moves":["scratch","growl","bite"]},
{"generation":3,"level":22,"moves":["sing","slash","payday","bite"]},
{"generation":4,"level":21,"gender":"F","nature":"Jolly","abilities":["pickup"],"moves":["bite","fakeout","furyswipes","screech"],"pokeball":"cherishball"},
{"generation":4,"level":10,"gender":"M","nature":"Jolly","abilities":["pickup"],"moves":["fakeout","payday","assist","scratch"],"pokeball":"cherishball"},
{"generation":5,"level":15,"gender":"M","isHidden":false,"abilities":["pickup"],"moves":["furyswipes","sing","nastyplot","snatch"],"pokeball":"cherishball"}
],
tier: "LC"
},
persian: {
viableMoves: {"fakeout":1,"uturn":1,"taunt":1,"return":1,"hypnosis":1,"switcheroo":1,"thief":1},
tier: "Limbo"
},
psyduck: {
viableMoves: {"hydropump":1,"scald":1,"icebeam":1,"hiddenpowergrass":1,"crosschop":1,"encore":1,"psychic":1,"signalbeam":1},
eventPokemon: [
{"generation":3,"level":27,"abilities":["damp"],"moves":["tailwhip","confusion","disable"]},
{"generation":3,"level":5,"moves":["watersport","scratch","tailwhip","mudsport"]}
],
tier: "LC"
},
golduck: {
viableMoves: {"hydropump":1,"scald":1,"icebeam":1,"hiddenpowergrass":1,"encore":1,"focusblast":1,"psychic":1,"signalbeam":1},
eventPokemon: [
{"generation":3,"level":33,"moves":["charm","waterfall","psychup","brickbreak"]}
],
tier: "Limbo"
},
mankey: {
viableMoves: {"closecombat":1,"uturn":1,"icepunch":1,"rockslide":1,"punishment":1,"earthquake":1,"poisonjab":1},
tier: "LC"
},
primeape: {
viableMoves: {"closecombat":1,"uturn":1,"icepunch":1,"stoneedge":1,"punishment":1,"encore":1,"earthquake":1,"poisonjab":1,"bulkup":1},
eventPokemon: [
{"generation":3,"level":34,"abilities":["vitalspirit"],"moves":["helpinghand","crosschop","focusenergy","reversal"]}
],
tier: "Limbo"
},
growlithe: {
viableMoves: {"flareblitz":1,"wildcharge":1,"hiddenpowergrass":1,"closecombat":1,"morningsun":1,"willowisp":1,"toxic":1,"flamethrower":1},
eventPokemon: [
{"generation":3,"level":32,"abilities":["intimidate"],"moves":["leer","odorsleuth","takedown","flamewheel"]},
{"generation":3,"level":10,"gender":"M","moves":["bite","roar","ember"]},
{"generation":3,"level":28,"moves":["charm","flamethrower","bite","takedown"]}
],
tier: "LC"
},
arcanine: {
viableMoves: {"flareblitz":1,"wildcharge":1,"hiddenpowergrass":1,"extremespeed":1,"closecombat":1,"morningsun":1,"willowisp":1,"toxic":1,"flamethrower":1},
tier: "Limbo A"
},
poliwag: {
viableMoves: {"hydropump":1,"icebeam":1,"encore":1,"bellydrum":1,"hypnosis":1,"waterfall":1,"return":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["bubble","sweetkiss"]}
],
tier: "LC"
},
poliwhirl: {
viableMoves: {"hydropump":1,"icebeam":1,"encore":1,"bellydrum":1,"hypnosis":1,"waterfall":1,"return":1,"earthquake":1},
tier: "NFE"
},
poliwrath: {
viableMoves: {"substitute":1,"poweruppunch":1,"focuspunch":1,"bulkup":1,"encore":1,"waterfall":1,"toxic":1,"rest":1,"sleeptalk":1,"icepunch":1,"poisonjab":1,"earthquake":1,"circlethrow":1},
eventPokemon: [
{"generation":3,"level":42,"moves":["helpinghand","hydropump","raindance","brickbreak"]}
],
tier: "Limbo"
},
politoed: {
viableMoves: {"scald":1,"hypnosis":1,"toxic":1,"encore":1,"perishsong":1,"protect":1,"icebeam":1,"focusblast":1,"hydropump":1,"hiddenpowergrass":1},
eventPokemon: [
{"generation":5,"level":50,"gender":"M","nature":"Calm","isHidden":true,"moves":["scald","icebeam","perishsong","protect"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
abra: {
viableMoves: {"calmmind":1,"psychic":1,"psyshock":1,"hiddenpowerfighting":1,"shadowball":1,"encore":1,"substitute":1},
tier: "LC"
},
kadabra: {
viableMoves: {"calmmind":1,"psychic":1,"psyshock":1,"hiddenpowerfighting":1,"shadowball":1,"encore":1,"substitute":1},
tier: "Limbo"
},
alakazam: {
viableMoves: {"calmmind":1,"psychic":1,"psyshock":1,"focusblast":1,"shadowball":1,"encore":1,"substitute":1,"energyball":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["futuresight","calmmind","psychic","trick"]}
],
tier: "OU"
},
alakazammega: {
requiredItem: "Alakazite"
},
machop: {
viableMoves: {"dynamicpunch":1,"payback":1,"bulkup":1,"icepunch":1,"rockslide":1,"bulletpunch":1,"knockoff":1},
tier: "LC"
},
machoke: {
viableMoves: {"dynamicpunch":1,"payback":1,"bulkup":1,"icepunch":1,"rockslide":1,"bulletpunch":1,"poweruppunch":1,"knockoff":1},
eventPokemon: [
{"generation":3,"level":38,"abilities":["guts"],"moves":["seismictoss","foresight","revenge","vitalthrow"]},
{"generation":5,"level":30,"isHidden":false,"moves":["lowsweep","foresight","seismictoss","revenge"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
machamp: {
viableMoves: {"dynamicpunch":1,"payback":1,"bulkup":1,"icepunch":1,"stoneedge":1,"bulletpunch":1,"earthquake":1,"knockoff":1},
tier: "Limbo B"
},
bellsprout: {
viableMoves: {"swordsdance":1,"sleeppowder":1,"sunnyday":1,"growth":1,"solarbeam":1,"gigadrain":1,"sludgebomb":1,"weatherball":1,"suckerpunch":1,"seedbomb":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["vinewhip","teeterdance"]},
{"generation":3,"level":10,"gender":"M","moves":["vinewhip","growth"]}
],
tier: "LC"
},
weepinbell: {
viableMoves: {"swordsdance":1,"sleeppowder":1,"sunnyday":1,"growth":1,"solarbeam":1,"gigadrain":1,"sludgebomb":1,"weatherball":1,"suckerpunch":1,"seedbomb":1,"knockoff":1},
eventPokemon: [
{"generation":3,"level":32,"moves":["morningsun","magicalleaf","sludgebomb","sweetscent"]}
],
tier: "NFE"
},
victreebel: {
viableMoves: {"swordsdance":1,"sleeppowder":1,"sunnyday":1,"growth":1,"solarbeam":1,"gigadrain":1,"sludgebomb":1,"weatherball":1,"suckerpunch":1,"powerwhip":1,"knockoff":1},
tier: "Limbo"
},
tentacool: {
viableMoves: {"toxicspikes":1,"rapidspin":1,"scald":1,"sludgebomb":1,"icebeam":1,"knockoff":1,"gigadrain":1,"toxic":1,"dazzlinggleam":1},
tier: "LC"
},
tentacruel: {
viableMoves: {"toxicspikes":1,"rapidspin":1,"scald":1,"sludgebomb":1,"icebeam":1,"knockoff":1,"gigadrain":1,"toxic":1,"dazzlinggleam":1},
tier: "OU"
},
geodude: {
viableMoves: {"stealthrock":1,"earthquake":1,"stoneedge":1,"suckerpunch":1,"hammerarm":1,"firepunch":1,"rockblast":1},
tier: "LC"
},
graveler: {
viableMoves: {"stealthrock":1,"earthquake":1,"stoneedge":1,"suckerpunch":1,"hammerarm":1,"firepunch":1,"rockblast":1},
tier: "NFE"
},
golem: {
viableMoves: {"stealthrock":1,"earthquake":1,"stoneedge":1,"suckerpunch":1,"hammerarm":1,"firepunch":1,"rockblast":1},
tier: "Limbo"
},
ponyta: {
viableMoves: {"flareblitz":1,"wildcharge":1,"morningsun":1,"hypnosis":1,"flamecharge":1},
tier: "LC"
},
rapidash: {
viableMoves: {"flareblitz":1,"wildcharge":1,"morningsun":1,"hypnosis":1,"flamecharge":1,"megahorn":1,"drillrun":1,"willowisp":1,"sunnyday":1,"solarbeam":1},
eventPokemon: [
{"generation":3,"level":40,"moves":["batonpass","solarbeam","sunnyday","flamethrower"]}
],
tier: "Limbo"
},
slowpoke: {
viableMoves: {"scald":1,"aquatail":1,"zenheadbutt":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"trick":1},
eventPokemon: [
{"generation":3,"level":31,"abilities":["oblivious"],"moves":["watergun","confusion","disable","headbutt"]},
{"generation":3,"level":10,"gender":"M","moves":["curse","yawn","tackle","growl"]},
{"generation":5,"level":30,"isHidden":false,"moves":["confusion","disable","headbutt","waterpulse"],"pokeball":"cherishball"}
],
tier: "LC"
},
slowbro: {
viableMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"calmmind":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"trick":1,"psyshock":1},
tier: "Limbo A"
},
slowking: {
viableMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"calmmind":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"trick":1,"nastyplot":1,"dragontail":1,"psyshock":1},
tier: "Limbo"
},
magnemite: {
viableMoves: {"thunderbolt":1,"thunderwave":1,"magnetrise":1,"substitute":1,"flashcannon":1,"hiddenpowerice":1,"voltswitch":1},
tier: "LC"
},
magneton: {
viableMoves: {"thunderbolt":1,"thunderwave":1,"magnetrise":1,"substitute":1,"flashcannon":1,"hiddenpowerice":1,"voltswitch":1,"chargebeam":1,"hiddenpowerfire":1},
eventPokemon: [
{"generation":3,"level":30,"moves":["refresh","doubleedge","raindance","thunder"]}
],
tier: "Limbo"
},
magnezone: {
viableMoves: {"thunderbolt":1,"thunderwave":1,"magnetrise":1,"substitute":1,"flashcannon":1,"hiddenpowerice":1,"voltswitch":1,"chargebeam":1,"hiddenpowerfire":1},
tier: "Limbo A"
},
farfetchd: {
viableMoves: {"bravebird":1,"swordsdance":1,"return":1,"leafblade":1,"roost":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["yawn","wish"]},
{"generation":3,"level":36,"moves":["batonpass","slash","swordsdance","aerialace"]}
],
tier: "Limbo"
},
doduo: {
viableMoves: {"bravebird":1,"return":1,"doubleedge":1,"roost":1,"quickattack":1,"pursuit":1},
tier: "LC"
},
dodrio: {
viableMoves: {"bravebird":1,"return":1,"doubleedge":1,"roost":1,"quickattack":1,"pursuit":1,"toxic":1},
eventPokemon: [
{"generation":3,"level":34,"moves":["batonpass","drillpeck","agility","triattack"]}
],
tier: "Limbo"
},
seel: {
viableMoves: {"surf":1,"icebeam":1,"aquajet":1,"protect":1,"rest":1,"toxic":1,"drillrun":1},
eventPokemon: [
{"generation":3,"level":23,"abilities":["thickfat"],"moves":["helpinghand","surf","safeguard","icebeam"]}
],
tier: "LC"
},
dewgong: {
viableMoves: {"surf":1,"icebeam":1,"aquajet":1,"iceshard":1,"protect":1,"rest":1,"toxic":1,"drillrun":1},
tier: "Limbo"
},
grimer: {
viableMoves: {"curse":1,"gunkshot":1,"poisonjab":1,"shadowsneak":1,"payback":1,"rest":1,"icepunch":1,"firepunch":1,"sleeptalk":1,"memento":1},
eventPokemon: [
{"generation":3,"level":23,"moves":["helpinghand","sludgebomb","shadowpunch","minimize"]}
],
tier: "LC"
},
muk: {
viableMoves: {"curse":1,"gunkshot":1,"poisonjab":1,"shadowsneak":1,"payback":1,"brickbreak":1,"rest":1,"icepunch":1,"firepunch":1,"sleeptalk":1,"memento":1},
tier: "Limbo"
},
shellder: {
viableMoves: {"shellsmash":1,"hydropump":1,"razorshell":1,"rockblast":1,"iciclespear":1,"rapidspin":1},
eventPokemon: [
{"generation":3,"level":24,"abilities":["shellarmor"],"moves":["withdraw","iciclespear","supersonic","aurorabeam"]},
{"generation":3,"level":10,"gender":"M","abilities":["shellarmor"],"moves":["tackle","withdraw","iciclespear"]},
{"generation":3,"level":29,"abilities":["shellarmor"],"moves":["refresh","takedown","surf","aurorabeam"]}
],
tier: "LC"
},
cloyster: {
viableMoves: {"shellsmash":1,"hydropump":1,"razorshell":1,"rockblast":1,"iciclespear":1,"iceshard":1,"rapidspin":1,"spikes":1,"toxicspikes":1},
eventPokemon: [
{"generation":5,"level":30,"gender":"M","nature":"Naughty","isHidden":false,"abilities":["skilllink"],"moves":["iciclespear","rockblast","hiddenpower","razorshell"]}
],
tier: "OU"
},
gastly: {
viableMoves: {"shadowball":1,"sludgebomb":1,"hiddenpowerfighting":1,"thunderbolt":1,"substitute":1,"disable":1,"painsplit":1,"hypnosis":1,"gigadrain":1,"trick":1,"dazzlinggleam":1},
tier: "LC"
},
haunter: {
viableMoves: {"shadowball":1,"sludgebomb":1,"hiddenpowerfighting":1,"thunderbolt":1,"substitute":1,"disable":1,"painsplit":1,"hypnosis":1,"gigadrain":1,"trick":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":3,"level":23,"moves":["spite","curse","nightshade","confuseray"]},
{"generation":5,"level":30,"moves":["confuseray","suckerpunch","shadowpunch","payback"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
gengar: {
viableMoves: {"shadowball":1,"sludgebomb":1,"focusblast":1,"thunderbolt":1,"substitute":1,"disable":1,"painsplit":1,"hypnosis":1,"gigadrain":1,"trick":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":6,"level":25,"nature":"Timid","moves":["psychic","confuseray","suckerpunch","shadowpunch"],"pokeball":"cherishball"}
],
tier: "OU"
},
gengarmega: {
requiredItem: "Gengarite"
},
onix: {
viableMoves: {"stealthrock":1,"earthquake":1,"stoneedge":1,"dragontail":1,"curse":1},
tier: "LC"
},
steelix: {
viableMoves: {"stealthrock":1,"earthquake":1,"ironhead":1,"curse":1,"roar":1,"toxic":1,"rockslide":1,"icefang":1,"firefang":1},
tier: "Limbo"
},
drowzee: {
viableMoves: {"psychic":1,"seismictoss":1,"thunderwave":1,"wish":1,"protect":1,"toxic":1,"shadowball":1,"trickroom":1,"calmmind":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":3,"level":5,"abilities":["insomnia"],"moves":["bellydrum","wish"]}
],
tier: "LC"
},
hypno: {
viableMoves: {"psychic":1,"seismictoss":1,"thunderwave":1,"wish":1,"protect":1,"shadowball":1,"trickroom":1,"batonpass":1,"calmmind":1,"bellydrum":1,"zenheadbutt":1,"firepunch":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":3,"level":34,"abilities":["insomnia"],"moves":["batonpass","psychic","meditate","shadowball"]}
],
tier: "Limbo"
},
krabby: {
viableMoves: {"crabhammer":1,"return":1,"swordsdance":1,"agility":1,"rockslide":1,"substitute":1,"xscissor":1,"superpower":1,"knockoff":1},
tier: "LC"
},
kingler: {
viableMoves: {"crabhammer":1,"return":1,"swordsdance":1,"agility":1,"rockslide":1,"substitute":1,"xscissor":1,"superpower":1,"knockoff":1},
tier: "Limbo"
},
voltorb: {
viableMoves: {"voltswitch":1,"thunderbolt":1,"taunt":1,"foulplay":1,"hiddenpowerice":1},
eventPokemon: [
{"generation":3,"level":19,"moves":["refresh","mirrorcoat","spark","swift"]}
],
tier: "LC"
},
electrode: {
viableMoves: {"voltswitch":1,"thunderbolt":1,"taunt":1,"foulplay":1,"hiddenpowerice":1},
tier: "Limbo"
},
exeggcute: {
viableMoves: {"substitute":1,"leechseed":1,"gigadrain":1,"psychic":1,"sleeppowder":1,"stunspore":1,"hiddenpowerfire":1,"synthesis":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["sweetscent","wish"]}
],
tier: "LC"
},
exeggutor: {
viableMoves: {"substitute":1,"leechseed":1,"gigadrain":1,"leafstorm":1,"psychic":1,"sleeppowder":1,"stunspore":1,"hiddenpowerfire":1,"synthesis":1,"sludgebomb":1,"trickroom":1,"psyshock":1},
eventPokemon: [
{"generation":3,"level":46,"moves":["refresh","psychic","hypnosis","ancientpower"]}
],
tier: "Limbo"
},
cubone: {
viableMoves: {"substitute":1,"bonemerang":1,"doubleedge":1,"rockslide":1,"firepunch":1,"earthquake":1},
tier: "LC"
},
marowak: {
viableMoves: {"substitute":1,"bonemerang":1,"doubleedge":1,"stoneedge":1,"swordsdance":1,"firepunch":1,"earthquake":1,"poweruppunch":1,"thunderpunch":1},
eventPokemon: [
{"generation":3,"level":44,"moves":["sing","earthquake","swordsdance","rockslide"]}
],
tier: "Limbo"
},
tyrogue: {
viableMoves: {"highjumpkick":1,"rapidspin":1,"fakeout":1,"bulletpunch":1,"machpunch":1,"toxic":1,"counter":1},
tier: "LC"
},
hitmonlee: {
viableMoves: {"highjumpkick":1,"suckerpunch":1,"stoneedge":1,"machpunch":1,"substitute":1,"fakeout":1,"closecombat":1,"earthquake":1,"blazekick":1},
eventPokemon: [
{"generation":3,"level":38,"abilities":["limber"],"moves":["refresh","highjumpkick","mindreader","megakick"]}
],
tier: "Limbo"
},
hitmonchan: {
viableMoves: {"bulkup":1,"drainpunch":1,"icepunch":1,"machpunch":1,"substitute":1,"earthquake":1,"stoneedge":1,"rapidspin":1},
eventPokemon: [
{"generation":3,"level":38,"abilities":["keeneye"],"moves":["helpinghand","skyuppercut","mindreader","megapunch"]}
],
tier: "Limbo"
},
hitmontop: {
viableMoves: {"suckerpunch":1,"machpunch":1,"rapidspin":1,"closecombat":1,"stoneedge":1,"toxic":1,"earthquake":1},
eventPokemon: [
{"generation":5,"level":55,"gender":"M","nature":"Adamant","isHidden":false,"abilities":["intimidate"],"moves":["fakeout","closecombat","suckerpunch","helpinghand"]}
],
tier: "Limbo C"
},
lickitung: {
viableMoves: {"wish":1,"protect":1,"dragontail":1,"curse":1,"bodyslam":1,"return":1,"powerwhip":1,"swordsdance":1,"earthquake":1,"toxic":1,"healbell":1,"earthquake":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["healbell","wish"]},
{"generation":3,"level":38,"moves":["helpinghand","doubleedge","defensecurl","rollout"]}
],
tier: "LC"
},
lickilicky: {
viableMoves: {"wish":1,"protect":1,"dragontail":1,"curse":1,"bodyslam":1,"return":1,"powerwhip":1,"swordsdance":1,"earthquake":1,"toxic":1,"healbell":1,"explosion":1,"knockoff":1},
tier: "Limbo"
},
koffing: {
viableMoves: {"painsplit":1,"sludgebomb":1,"willowisp":1,"fireblast":1,"toxic":1,"clearsmog":1,"rest":1,"sleeptalk":1,"thunderbolt":1},
tier: "LC"
},
weezing: {
viableMoves: {"painsplit":1,"sludgebomb":1,"willowisp":1,"fireblast":1,"toxic":1,"clearsmog":1,"rest":1,"sleeptalk":1,"thunderbolt":1,"explosion":1},
tier: "Limbo"
},
rhyhorn: {
viableMoves: {"stoneedge":1,"earthquake":1,"aquatail":1,"megahorn":1,"stealthrock":1,"rockblast":1,"rockpolish":1},
tier: "LC"
},
rhydon: {
viableMoves: {"stoneedge":1,"earthquake":1,"aquatail":1,"megahorn":1,"stealthrock":1,"rockblast":1,"rockpolish":1},
eventPokemon: [
{"generation":3,"level":46,"moves":["helpinghand","megahorn","scaryface","earthquake"]}
],
tier: "Limbo"
},
rhyperior: {
viableMoves: {"stoneedge":1,"earthquake":1,"aquatail":1,"megahorn":1,"stealthrock":1,"rockblast":1,"rockpolish":1,"dragontail":1},
tier: "Limbo C"
},
happiny: {
viableMoves: {"aromatherapy":1,"toxic":1,"thunderwave":1,"counter":1,"endeavor":1,"lightscreen":1,"fireblast":1},
tier: "LC"
},
chansey: {
viableMoves: {"wish":1,"softboiled":1,"protect":1,"toxic":1,"aromatherapy":1,"seismictoss":1,"counter":1,"thunderwave":1,"stealthrock":1,"fireblast":1,"icebeam":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":3,"level":5,"gender":"F","moves":["sweetscent","wish"]},
{"generation":3,"level":10,"gender":"F","moves":["pound","growl","tailwhip","refresh"]},
{"generation":3,"level":39,"gender":"F","moves":["sweetkiss","thunderbolt","softboiled","skillswap"]}
],
tier: "Limbo B"
},
blissey: {
viableMoves: {"wish":1,"softboiled":1,"protect":1,"toxic":1,"aromatherapy":1,"seismictoss":1,"counter":1,"thunderwave":1,"stealthrock":1,"flamethrower":1,"icebeam":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"F","isHidden":true,"moves":["pound","growl","tailwhip","refresh"]}
],
tier: "OU"
},
tangela: {
viableMoves: {"gigadrain":1,"sleeppowder":1,"hiddenpowerrock":1,"hiddenpowerice":1,"leechseed":1,"knockoff":1,"leafstorm":1,"stunspore":1,"synthesis":1},
eventPokemon: [
{"generation":3,"level":30,"abilities":["chlorophyll"],"moves":["morningsun","solarbeam","sunnyday","ingrain"]}
],
tier: "Limbo"
},
tangrowth: {
viableMoves: {"gigadrain":1,"sleeppowder":1,"hiddenpowerrock":1,"hiddenpowerice":1,"leechseed":1,"knockoff":1,"leafstorm":1,"stunspore":1,"focusblast":1,"synthesis":1,"powerwhip":1,"earthquake":1},
tier: "Limbo C"
},
kangaskhan: {
viableMoves: {"fakeout":1,"return":1,"suckerpunch":1,"earthquake":1,"focuspunch":1,"wish":1,"poweruppunch":1,"crunch":1},
eventPokemon: [
{"generation":3,"level":5,"gender":"F","abilities":["earlybird"],"moves":["yawn","wish"]},
{"generation":3,"level":10,"gender":"F","abilities":["earlybird"],"moves":["cometpunch","leer","bite"]},
{"generation":3,"level":36,"gender":"F","abilities":["earlybird"],"moves":["sing","earthquake","tailwhip","dizzypunch"]}
],
tier: "OU"
},
kangaskhanmega: {
requiredItem: "Kangaskhanite"
},
horsea: {
viableMoves: {"hydropump":1,"icebeam":1,"substitute":1,"hiddenpowergrass":1,"raindance":1},
eventPokemon: [
{"generation":5,"level":1,"shiny":true,"isHidden":false,"moves":["bubble"]}
],
tier: "LC"
},
seadra: {
viableMoves: {"hydropump":1,"icebeam":1,"agility":1,"substitute":1,"hiddenpowergrass":1},
eventPokemon: [
{"generation":3,"level":45,"abilities":["poisonpoint"],"moves":["leer","watergun","twister","agility"]}
],
tier: "Limbo"
},
kingdra: {
viableMoves: {"hydropump":1,"icebeam":1,"dragondance":1,"substitute":1,"outrage":1,"dracometeor":1,"waterfall":1,"rest":1,"sleeptalk":1,"dragonpulse":1},
eventPokemon: [
{"generation":3,"level":50,"abilities":["swiftswim"],"moves":["leer","watergun","twister","agility"]},
{"generation":5,"level":50,"gender":"M","nature":"Timid","isHidden":false,"abilities":["swiftswim"],"moves":["dracometeor","muddywater","dragonpulse","protect"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
goldeen: {
viableMoves: {"raindance":1,"waterfall":1,"megahorn":1,"return":1,"drillrun":1,"icebeam":1,"poisonjab":1},
tier: "LC"
},
seaking: {
viableMoves: {"raindance":1,"waterfall":1,"megahorn":1,"return":1,"drillrun":1,"icebeam":1,"poisonjab":1},
tier: "Limbo"
},
staryu: {
viableMoves: {"scald":1,"thunderbolt":1,"icebeam":1,"rapidspin":1,"recover":1,"dazzlinggleam":1,"hydropump":1},
eventPokemon: [
{"generation":3,"level":50,"moves":["minimize","lightscreen","cosmicpower","hydropump"]},
{"generation":3,"level":18,"abilities":["illuminate"],"moves":["tackle","watergun","rapidspin","recover"]}
],
tier: "LC"
},
starmie: {
viableMoves: {"surf":1,"thunderbolt":1,"icebeam":1,"rapidspin":1,"recover":1,"psychic":1,"trick":1,"psyshock":1,"scald":1,"hydropump":1},
eventPokemon: [
{"generation":3,"level":41,"moves":["refresh","waterfall","icebeam","recover"]}
],
tier: "OU"
},
mimejr: {
viableMoves: {"substitute":1,"batonpass":1,"psychic":1,"thunderwave":1,"hiddenpowerfighting":1,"healingwish":1,"nastyplot":1,"thunderbolt":1,"encore":1},
tier: "LC"
},
mrmime: {
viableMoves: {"substitute":1,"batonpass":1,"psychic":1,"hiddenpowerfighting":1,"healingwish":1,"nastyplot":1,"thunderbolt":1,"encore":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":3,"level":42,"abilities":["soundproof"],"moves":["followme","psychic","encore","thunderpunch"]}
],
tier: "Limbo"
},
scyther: {
viableMoves: {"swordsdance":1,"roost":1,"bugbite":1,"quickattack":1,"brickbreak":1,"aerialace":1,"batonpass":1,"uturn":1,"knockoff":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","abilities":["swarm"],"moves":["quickattack","leer","focusenergy"]},
{"generation":3,"level":40,"abilities":["swarm"],"moves":["morningsun","razorwind","silverwind","slash"]},
{"generation":5,"level":30,"isHidden":false,"moves":["agility","wingattack","furycutter","slash"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
scizor: {
viableMoves: {"swordsdance":1,"roost":1,"bulletpunch":1,"bugbite":1,"superpower":1,"uturn":1,"batonpass":1,"pursuit":1,"defog":1,"knockoff":1},
eventPokemon: [
{"generation":3,"level":50,"gender":"M","abilities":["swarm"],"moves":["furycutter","metalclaw","swordsdance","slash"]},
{"generation":4,"level":50,"gender":"M","nature":"Adamant","abilities":["swarm"],"moves":["xscissor","swordsdance","irondefense","agility"],"pokeball":"cherishball"},
{"generation":5,"level":100,"gender":"M","isHidden":false,"abilities":["technician"],"moves":["bulletpunch","bugbite","roost","swordsdance"],"pokeball":"cherishball"},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["leer","focusenergy","pursuit","steelwing"]},
{"generation":6,"level":50,"gender":"M","isHidden":false,"moves":["xscissor","nightslash","doublehit","ironhead"],"pokeball":"cherishball"},
{"generation":6,"level":25,"nature":"Adamant","isHidden":false,"abilities":["technician"],"moves":["aerialace","falseswipe","agility","furycutter"],"pokeball":"cherishball"}
],
tier: "OU"
},
scizormega: {
requiredItem: "Scizorite"
},
smoochum: {
viableMoves: {"icebeam":1,"psychic":1,"hiddenpowerfighting":1,"trick":1,"shadowball":1,"grassknot":1},
tier: "LC"
},
jynx: {
viableMoves: {"icebeam":1,"psychic":1,"focusblast":1,"trick":1,"shadowball":1,"nastyplot":1,"lovelykiss":1,"substitute":1,"psyshock":1},
tier: "Limbo"
},
elekid: {
viableMoves: {"thunderbolt":1,"crosschop":1,"voltswitch":1,"substitute":1,"icepunch":1,"psychic":1,"hiddenpowergrass":1},
eventPokemon: [
{"generation":3,"level":20,"moves":["icepunch","firepunch","thunderpunch","crosschop"]}
],
tier: "LC"
},
electabuzz: {
viableMoves: {"thunderbolt":1,"voltswitch":1,"substitute":1,"hiddenpowerice":1,"hiddenpowergrass":1,"focusblast":1,"psychic":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["quickattack","leer","thunderpunch"]},
{"generation":3,"level":43,"moves":["followme","crosschop","thunderwave","thunderbolt"]},
{"generation":4,"level":30,"gender":"M","nature":"Naughty","moves":["lowkick","shockwave","lightscreen","thunderpunch"]},
{"generation":5,"level":30,"isHidden":false,"moves":["lowkick","swift","shockwave","lightscreen"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
electivire: {
viableMoves: {"wildcharge":1,"crosschop":1,"icepunch":1,"substitute":1,"flamethrower":1,"earthquake":1},
eventPokemon: [
{"generation":4,"level":50,"gender":"M","nature":"Adamant","moves":["thunderpunch","icepunch","crosschop","earthquake"]},
{"generation":4,"level":50,"gender":"M","nature":"Serious","moves":["lightscreen","thunderpunch","discharge","thunderbolt"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
magby: {
viableMoves: {"flareblitz":1,"substitute":1,"fireblast":1,"hiddenpowergrass":1,"hiddenpowerice":1,"crosschop":1,"thunderpunch":1,"overheat":1},
tier: "LC"
},
magmar: {
viableMoves: {"flareblitz":1,"substitute":1,"fireblast":1,"hiddenpowergrass":1,"hiddenpowerice":1,"crosschop":1,"thunderpunch":1,"focusblast":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["leer","smog","firepunch","leer"]},
{"generation":3,"level":36,"moves":["followme","fireblast","crosschop","thunderpunch"]},
{"generation":4,"level":30,"gender":"M","nature":"Quiet","moves":["smokescreen","firespin","confuseray","firepunch"]},
{"generation":5,"level":30,"isHidden":false,"moves":["smokescreen","feintattack","firespin","confuseray"],"pokeball":"cherishball"}
],
tier: "NFE"
},
magmortar: {
viableMoves: {"fireblast":1,"substitute":1,"focusblast":1,"hiddenpowergrass":1,"hiddenpowerice":1,"thunderbolt":1,"overheat":1,"willowisp":1},
eventPokemon: [
{"generation":4,"level":50,"gender":"F","nature":"Modest","moves":["flamethrower","psychic","hyperbeam","solarbeam"]},
{"generation":4,"level":50,"gender":"M","nature":"Hardy","moves":["confuseray","firepunch","lavaplume","flamethrower"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
pinsir: {
viableMoves: {"swordsdance":1,"xscissor":1,"earthquake":1,"closecombat":1,"stealthrock":1,"substitute":1,"stoneedge":1,"quickattack":1,"return":1},
eventPokemon: [
{"generation":3,"level":35,"abilities":["hypercutter"],"moves":["helpinghand","guillotine","falseswipe","submission"]}
],
tier: "OU"
},
pinsirmega: {
requiredItem: "Pinsirite"
},
tauros: {
viableMoves: {"rockclimb":1,"earthquake":1,"zenheadbutt":1,"rockslide":1,"pursuit":1,"doubleedge":1},
eventPokemon: [
{"generation":3,"level":25,"gender":"M","abilities":["intimidate"],"moves":["rage","hornattack","scaryface","pursuit"]},
{"generation":3,"level":10,"gender":"M","abilities":["intimidate"],"moves":["tackle","tailwhip","rage","hornattack"]},
{"generation":3,"level":46,"gender":"M","abilities":["intimidate"],"moves":["refresh","earthquake","tailwhip","bodyslam"]}
],
tier: "Limbo"
},
magikarp: {
viableMoves: {"bounce":1,"flail":1,"tackle":1,"hydropump":1},
eventPokemon: [
{"generation":4,"level":5,"gender":"M","nature":"Relaxed","moves":["splash"]},
{"generation":4,"level":6,"gender":"F","nature":"Rash","moves":["splash"]},
{"generation":4,"level":7,"gender":"F","nature":"Hardy","moves":["splash"]},
{"generation":4,"level":5,"gender":"F","nature":"Lonely","moves":["splash"]},
{"generation":4,"level":4,"gender":"M","nature":"Modest","moves":["splash"]},
{"generation":5,"level":99,"shiny":true,"gender":"M","isHidden":false,"moves":["flail","hydropump","bounce","splash"],"pokeball":"cherishball"}
],
tier: "LC"
},
gyarados: {
viableMoves: {"dragondance":1,"waterfall":1,"earthquake":1,"bounce":1,"rest":1,"sleeptalk":1,"dragontail":1,"stoneedge":1,"substitute":1,"icefang":1},
tier: "OU"
},
gyaradosmega: {
requiredItem: "Gyaradosite"
},
lapras: {
viableMoves: {"icebeam":1,"thunderbolt":1,"healbell":1,"toxic":1,"surf":1,"dragondance":1,"substitute":1,"waterfall":1,"return":1,"avalanche":1,"rest":1,"sleeptalk":1,"curse":1,"iceshard":1},
eventPokemon: [
{"generation":3,"level":44,"moves":["hydropump","raindance","blizzard","healbell"]}
],
tier: "Limbo"
},
ditto: {
viableMoves: {"transform":1},
tier: "Limbo A"
},
eevee: {
viableMoves: {"quickattack":1,"return":1,"bite":1,"batonpass":1,"irontail":1,"yawn":1,"protect":1,"wish":1},
eventPokemon: [
{"generation":4,"level":10,"gender":"F","nature":"Lonely","abilities":["adaptability"],"moves":["covet","bite","helpinghand","attract"],"pokeball":"cherishball"},
{"generation":4,"level":50,"shiny":true,"gender":"M","nature":"Hardy","abilities":["adaptability"],"moves":["irontail","trumpcard","flail","quickattack"],"pokeball":"cherishball"},
{"generation":5,"level":50,"gender":"F","nature":"Hardy","isHidden":false,"abilities":["adaptability"],"moves":["sing","return","echoedvoice","attract"],"pokeball":"cherishball"},
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","sandattack","babydolleyes","swift"],"pokeball":"cherishball"}
],
tier: "LC"
},
vaporeon: {
viableMoves: {"wish":1,"protect":1,"scald":1,"roar":1,"icebeam":1,"toxic":1,"hydropump":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tailwhip","tackle","helpinghand","sandattack"]},
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","tailwhip","sandattack","watergun"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
jolteon: {
viableMoves: {"thunderbolt":1,"voltswitch":1,"hiddenpowergrass":1,"hiddenpowerice":1,"chargebeam":1,"batonpass":1,"substitute":1,"signalbeam":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tailwhip","tackle","helpinghand","sandattack"]},
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","tailwhip","sandattack","thundershock"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
flareon: {
viableMoves: {"flamecharge":1,"facade":1,"flareblitz":1,"superpower":1,"wish":1,"protect":1,"lavaplume":1,"healbell":1,"toxic":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tailwhip","tackle","helpinghand","sandattack"]},
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","tailwhip","sandattack","ember"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
espeon: {
viableMoves: {"psychic":1,"psyshock":1,"substitute":1,"wish":1,"shadowball":1,"hiddenpowerfighting":1,"calmmind":1,"morningsun":1,"storedpower":1,"batonpass":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["psybeam","psychup","psychic","morningsun"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tailwhip","tackle","helpinghand","sandattack"]},
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","tailwhip","sandattack","confusion"],"pokeball":"cherishball"}
],
tier: "OU"
},
umbreon: {
viableMoves: {"curse":1,"moonlight":1,"wish":1,"protect":1,"healbell":1,"toxic":1,"batonpass":1,"foulplay":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["feintattack","meanlook","screech","moonlight"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tailwhip","tackle","helpinghand","sandattack"]},
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","tailwhip","sandattack","pursuit"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
leafeon: {
viableMoves: {"swordsdance":1,"leafblade":1,"substitute":1,"return":1,"xscissor":1,"synthesis":1,"yawn":1,"roar":1,"healbell":1,"batonpass":1,"knockoff":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tailwhip","tackle","helpinghand","sandattack"]},
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","tailwhip","sandattack","razorleaf"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
glaceon: {
viableMoves: {"icebeam":1,"hiddenpowerground":1,"shadowball":1,"wish":1,"protect":1,"healbell":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tailwhip","tackle","helpinghand","sandattack"]},
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","tailwhip","sandattack","icywind"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
porygon: {
viableMoves: {"triattack":1,"icebeam":1,"recover":1,"toxic":1,"thunderwave":1,"discharge":1,"trick":1},
eventPokemon: [
{"generation":5,"level":10,"isHidden":true,"moves":["tackle","conversion","sharpen","psybeam"]}
],
tier: "LC"
},
porygon2: {
viableMoves: {"triattack":1,"icebeam":1,"recover":1,"toxic":1,"thunderwave":1,"discharge":1,"trick":1,"shadowball":1,"trickroom":1},
tier: "Limbo B"
},
porygonz: {
viableMoves: {"triattack":1,"darkpulse":1,"hiddenpowerfighting":1,"agility":1,"trick":1,"nastyplot":1},
tier: "Limbo C"
},
omanyte: {
viableMoves: {"shellsmash":1,"surf":1,"icebeam":1,"earthpower":1,"hiddenpowerelectric":1,"spikes":1,"toxicspikes":1,"stealthrock":1,"hydropump":1},
eventPokemon: [
{"generation":5,"level":15,"gender":"M","isHidden":false,"abilities":["swiftswim"],"moves":["bubblebeam","supersonic","withdraw","bite"],"pokeball":"cherishball"}
],
tier: "LC"
},
omastar: {
viableMoves: {"shellsmash":1,"surf":1,"icebeam":1,"earthpower":1,"hiddenpowerelectric":1,"spikes":1,"toxicspikes":1,"stealthrock":1,"hydropump":1},
tier: "Limbo"
},
kabuto: {
viableMoves: {"aquajet":1,"rockslide":1,"rapidspin":1,"stealthrock":1,"honeclaws":1,"waterfall":1,"toxic":1},
eventPokemon: [
{"generation":5,"level":15,"gender":"M","isHidden":false,"abilities":["battlearmor"],"moves":["confuseray","dig","scratch","harden"],"pokeball":"cherishball"}
],
tier: "LC"
},
kabutops: {
viableMoves: {"aquajet":1,"stoneedge":1,"rapidspin":1,"stealthrock":1,"swordsdance":1,"waterfall":1,"superpower":1},
tier: "Limbo"
},
aerodactyl: {
viableMoves: {"stealthrock":1,"taunt":1,"stoneedge":1,"rockslide":1,"earthquake":1,"aquatail":1,"roost":1,"firefang":1,"defog":1,"icefang":1},
eventPokemon: [
{"generation":5,"level":15,"gender":"M","isHidden":false,"abilities":["pressure"],"moves":["steelwing","icefang","firefang","thunderfang"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
aerodactylmega: {
requiredItem: "Aerodactylite"
},
munchlax: {
viableMoves: {"rest":1,"curse":1,"sleeptalk":1,"bodyslam":1,"earthquake":1,"return":1,"firepunch":1,"icepunch":1,"whirlwind":1,"toxic":1},
tier: "Limbo"
},
snorlax: {
viableMoves: {"rest":1,"curse":1,"sleeptalk":1,"bodyslam":1,"earthquake":1,"return":1,"firepunch":1,"icepunch":1,"crunch":1,"selfdestruct":1,"pursuit":1,"whirlwind":1},
eventPokemon: [
{"generation":3,"level":43,"moves":["refresh","fissure","curse","bodyslam"]}
],
tier: "Limbo B"
},
articuno: {
viableMoves: {"icebeam":1,"roost":1,"roar":1,"healbell":1,"toxic":1,"substitute":1,"hurricane":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["agility","mindreader","icebeam","reflect"]},
{"generation":3,"level":50,"moves":["icebeam","healbell","extrasensory","haze"]}
],
unreleasedHidden: true,
tier: "Limbo"
},
zapdos: {
viableMoves: {"thunderbolt":1,"heatwave":1,"hiddenpowergrass":1,"hiddenpowerice":1,"roost":1,"toxic":1,"substitute":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["agility","detect","drillpeck","charge"]},
{"generation":3,"level":50,"moves":["thunderbolt","extrasensory","batonpass","metalsound"]}
],
unreleasedHidden: true,
tier: "Limbo B"
},
moltres: {
viableMoves: {"fireblast":1,"hiddenpowergrass":1,"airslash":1,"roost":1,"substitute":1,"toxic":1,"uturn":1,"willowisp":1,"hurricane":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["agility","endure","flamethrower","safeguard"]},
{"generation":3,"level":50,"moves":["extrasensory","morningsun","willowisp","flamethrower"]}
],
unreleasedHidden: true,
tier: "Limbo"
},
dratini: {
viableMoves: {"dragondance":1,"outrage":1,"waterfall":1,"fireblast":1,"extremespeed":1,"dracometeor":1,"substitute":1,"aquatail":1},
tier: "LC"
},
dragonair: {
viableMoves: {"dragondance":1,"outrage":1,"waterfall":1,"fireblast":1,"extremespeed":1,"dracometeor":1,"substitute":1,"aquatail":1},
tier: "Limbo"
},
dragonite: {
viableMoves: {"dragondance":1,"outrage":1,"firepunch":1,"extremespeed":1,"dragonclaw":1,"earthquake":1,"roost":1,"waterfall":1,"substitute":1,"roost":1,"thunderwave":1,"dragontail":1,"hurricane":1,"superpower":1,"dracometeor":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["agility","safeguard","wingattack","outrage"]},
{"generation":3,"level":55,"moves":["healbell","hyperbeam","dragondance","earthquake"]},
{"generation":4,"level":50,"gender":"M","nature":"Mild","moves":["dracometeor","thunderbolt","outrage","dragondance"],"pokeball":"cherishball"},
{"generation":5,"level":100,"gender":"M","isHidden":true,"moves":["extremespeed","firepunch","dragondance","outrage"],"pokeball":"cherishball"},
{"generation":5,"level":55,"gender":"M","isHidden":true,"moves":["dragonrush","safeguard","wingattack","thunderpunch"]},
{"generation":5,"level":55,"gender":"M","isHidden":true,"moves":["dragonrush","safeguard","wingattack","extremespeed"]},
{"generation":5,"level":50,"gender":"M","nature":"Brave","isHidden":false,"abilities":["innerfocus"],"moves":["fireblast","safeguard","outrage","hyperbeam"],"pokeball":"cherishball"}
],
tier: "OU"
},
mewtwo: {
viableMoves: {"psystrike":1,"aurasphere":1,"fireblast":1,"icebeam":1,"calmmind":1,"substitute":1,"recover":1,"thunderbolt":1,"willowisp":1},
eventPokemon: [
{"generation":5,"level":70,"isHidden":false,"moves":["psystrike","shadowball","aurasphere","electroball"],"pokeball":"cherishball"},
{"generation":5,"level":100,"nature":"Timid","isHidden":true,"moves":["psystrike","icebeam","healpulse","hurricane"],"pokeball":"cherishball"}
],
tier: "Uber"
},
mewtwomegax: {
requiredItem: "Mewtwonite X"
},
mewtwomegay: {
requiredItem: "Mewtwonite Y"
},
mew: {
viableMoves: {"taunt":1,"willowisp":1,"roost":1,"psychic":1,"nastyplot":1,"aurasphere":1,"fireblast":1,"swordsdance":1,"drainpunch":1,"zenheadbutt":1,"batonpass":1,"rockpolish":1,"substitute":1,"toxic":1,"icebeam":1,"thunderbolt":1,"earthquake":1,"uturn":1,"stealthrock":1,"suckerpunch":1,"defog":1},
eventPokemon: [
{"generation":3,"level":30,"moves":["pound","transform","megapunch","metronome"]},
{"generation":3,"level":10,"moves":["pound","transform"]},
{"generation":4,"level":50,"moves":["ancientpower","metronome","teleport","aurasphere"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["barrier","metronome","teleport","aurasphere"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["megapunch","metronome","teleport","aurasphere"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["amnesia","metronome","teleport","aurasphere"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["transform","metronome","teleport","aurasphere"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["psychic","metronome","teleport","aurasphere"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["synthesis","return","hypnosis","teleport"],"pokeball":"cherishball"},
{"generation":4,"level":5,"moves":["pound"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
chikorita: {
viableMoves: {"reflect":1,"lightscreen":1,"aromatherapy":1,"grasswhistle":1,"leechseed":1,"toxic":1,"gigadrain":1,"synthesis":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["tackle","growl","razorleaf"]}
],
tier: "LC"
},
bayleef: {
viableMoves: {"reflect":1,"lightscreen":1,"aromatherapy":1,"grasswhistle":1,"leechseed":1,"toxic":1,"gigadrain":1,"synthesis":1},
tier: "NFE"
},
meganium: {
viableMoves: {"reflect":1,"lightscreen":1,"aromatherapy":1,"grasswhistle":1,"leechseed":1,"toxic":1,"gigadrain":1,"synthesis":1,"dragontail":1},
tier: "Limbo"
},
cyndaquil: {
viableMoves: {"eruption":1,"fireblast":1,"flamethrower":1,"hiddenpowergrass":1,"hiddenpowerice":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["tackle","leer","smokescreen"]}
],
tier: "LC"
},
quilava: {
viableMoves: {"eruption":1,"fireblast":1,"flamethrower":1,"hiddenpowergrass":1,"hiddenpowerice":1},
tier: "NFE"
},
typhlosion: {
viableMoves: {"eruption":1,"fireblast":1,"flamethrower":1,"hiddenpowergrass":1,"hiddenpowerice":1,"focusblast":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["quickattack","flamewheel","swift","flamethrower"]}
],
tier: "Limbo"
},
totodile: {
viableMoves: {"aquajet":1,"waterfall":1,"crunch":1,"icepunch":1,"superpower":1,"dragondance":1,"swordsdance":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["scratch","leer","rage"]}
],
tier: "LC"
},
croconaw: {
viableMoves: {"aquajet":1,"waterfall":1,"crunch":1,"icepunch":1,"superpower":1,"dragondance":1,"swordsdance":1},
tier: "NFE"
},
feraligatr: {
viableMoves: {"aquajet":1,"waterfall":1,"crunch":1,"icepunch":1,"dragondance":1,"swordsdance":1,"earthquake":1,"superpower":1},
tier: "Limbo"
},
sentret: {
viableMoves: {"superfang":1,"trick":1,"toxic":1,"uturn":1,"knockoff":1},
tier: "LC"
},
furret: {
viableMoves: {"return":1,"uturn":1,"suckerpunch":1,"trick":1,"icepunch":1,"firepunch":1,"thunderpunch":1,"knockoff":1,"doubleedge":1},
tier: "Limbo"
},
hoothoot: {
viableMoves: {"reflect":1,"toxic":1,"roost":1,"whirlwind":1,"nightshade":1,"magiccoat":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["tackle","growl","foresight"]}
],
tier: "LC"
},
noctowl: {
viableMoves: {"roost":1,"whirlwind":1,"airslash":1,"nightshade":1,"toxic":1,"reflect":1,"magiccoat":1},
tier: "Limbo"
},
ledyba: {
viableMoves: {"roost":1,"agility":1,"lightscreen":1,"encore":1,"reflect":1,"knockoff":1,"swordsdance":1,"batonpass":1,"toxic":1},
eventPokemon: [
{"generation":3,"level":10,"moves":["refresh","psybeam","aerialace","supersonic"]}
],
tier: "LC"
},
ledian: {
viableMoves: {"roost":1,"bugbuzz":1,"lightscreen":1,"encore":1,"reflect":1,"knockoff":1,"toxic":1,"batonpass":1},
tier: "Limbo"
},
spinarak: {
viableMoves: {"agility":1,"toxic":1,"xscissor":1,"toxicspikes":1,"poisonjab":1,"batonpass":1,"stickyweb":1},
eventPokemon: [
{"generation":3,"level":14,"moves":["refresh","dig","signalbeam","nightshade"]}
],
tier: "LC"
},
ariados: {
viableMoves: {"agility":1,"toxic":1,"xscissor":1,"toxicspikes":1,"poisonjab":1,"batonpass":1,"stickyweb":1},
tier: "Limbo"
},
chinchou: {
viableMoves: {"voltswitch":1,"thunderbolt":1,"hiddenpowergrass":1,"hydropump":1,"icebeam":1,"surf":1,"thunderwave":1,"scald":1,"discharge":1,"healbell":1},
tier: "LC"
},
lanturn: {
viableMoves: {"voltswitch":1,"thunderbolt":1,"hiddenpowergrass":1,"hydropump":1,"icebeam":1,"surf":1,"thunderwave":1,"scald":1,"discharge":1,"healbell":1},
tier: "Limbo"
},
togepi: {
viableMoves: {"protect":1,"fireblast":1,"toxic":1,"thunderwave":1,"softboiled":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":3,"level":20,"gender":"F","abilities":["serenegrace"],"moves":["metronome","charm","sweetkiss","yawn"]},
{"generation":3,"level":25,"moves":["triattack","followme","ancientpower","helpinghand"]}
],
tier: "LC"
},
togetic: {
viableMoves: {"nastyplot":1,"dazzlinggleam":1,"fireblast":1,"batonpass":1,"roost":1,"encore":1,"healbell":1,"thunderwave":1},
tier: "Limbo"
},
togekiss: {
viableMoves: {"wish":1,"roost":1,"thunderwave":1,"nastyplot":1,"airslash":1,"aurasphere":1,"batonpass":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["extremespeed","aurasphere","airslash","present"]}
],
tier: "OU"
},
natu: {
viableMoves: {"thunderwave":1,"roost":1,"toxic":1,"reflect":1,"lightscreen":1,"uturn":1,"wish":1,"psychic":1,"nightshade":1,"uturn":1},
eventPokemon: [
{"generation":3,"level":22,"moves":["batonpass","futuresight","nightshade","aerialace"]}
],
tier: "Limbo"
},
xatu: {
viableMoves: {"thunderwave":1,"toxic":1,"roost":1,"psychic":1,"nightshade":1,"uturn":1,"reflect":1,"lightscreen":1,"wish":1,"calmmind":1},
tier: "Limbo C"
},
mareep: {
viableMoves: {"reflect":1,"lightscreen":1,"thunderbolt":1,"discharge":1,"thunderwave":1,"toxic":1,"hiddenpowerice":1,"cottonguard":1,"powergem":1},
eventPokemon: [
{"generation":3,"level":37,"gender":"F","moves":["thunder","thundershock","thunderwave","cottonspore"]},
{"generation":3,"level":10,"gender":"M","moves":["tackle","growl","thundershock"]},
{"generation":3,"level":17,"moves":["healbell","thundershock","thunderwave","bodyslam"]}
],
tier: "LC"
},
flaaffy: {
viableMoves: {"reflect":1,"lightscreen":1,"thunderbolt":1,"discharge":1,"thunderwave":1,"toxic":1,"hiddenpowerice":1,"cottonguard":1,"powergem":1},
tier: "NFE"
},
ampharos: {
viableMoves: {"voltswitch":1,"focusblast":1,"hiddenpowerice":1,"hiddenpowergrass":1,"thunderbolt":1,"healbell":1,"dragonpulse":1,"powergem":1},
tier: "Limbo B"
},
ampharosmega: {
requiredItem: "Ampharosite"
},
azurill: {
viableMoves: {"scald":1,"return":1,"bodyslam":1,"encore":1,"toxic":1,"protect":1,"knockoff":1},
tier: "LC"
},
marill: {
viableMoves: {"waterfall":1,"return":1,"knockoff":1,"encore":1,"toxic":1,"aquajet":1,"superpower":1,"icepunch":1,"protect":1,"play rough":1,"poweruppunch":1},
tier: "NFE"
},
azumarill: {
viableMoves: {"waterfall":1,"aquajet":1,"return":1,"playrough":1,"icepunch":1,"superpower":1,"poweruppunch":1,"knockoff":1},
tier: "OU"
},
bonsly: {
viableMoves: {"rockslide":1,"brickbreak":1,"doubleedge":1,"toxic":1,"stealthrock":1,"suckerpunch":1,"explosion":1},
tier: "LC"
},
sudowoodo: {
viableMoves: {"hammerarm":1,"stoneedge":1,"earthquake":1,"suckerpunch":1,"woodhammer":1,"explosion":1,"stealthrock":1},
tier: "Limbo"
},
hoppip: {
viableMoves: {"encore":1,"sleeppowder":1,"uturn":1,"toxic":1,"leechseed":1,"substitute":1,"protect":1,"dazzlinggleam":1},
tier: "LC"
},
skiploom: {
viableMoves: {"encore":1,"sleeppowder":1,"uturn":1,"toxic":1,"leechseed":1,"substitute":1,"protect":1,"dazzlinggleam":1},
tier: "NFE"
},
jumpluff: {
viableMoves: {"encore":1,"sleeppowder":1,"uturn":1,"toxic":1,"leechseed":1,"substitute":1,"gigadrain":1,"synthesis":1,"dazzlinggleam":1},
eventPokemon: [
{"generation":5,"level":27,"gender":"M","isHidden":true,"moves":["falseswipe","sleeppowder","bulletseed","leechseed"]}
],
tier: "Limbo"
},
aipom: {
viableMoves: {"fakeout":1,"return":1,"brickbreak":1,"seedbomb":1,"knockoff":1,"uturn":1,"icepunch":1,"irontail":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["scratch","tailwhip","sandattack"]}
],
tier: "LC"
},
ambipom: {
viableMoves: {"fakeout":1,"return":1,"knockoff":1,"uturn":1,"poweruppunch":1,"switcheroo":1,"seedbomb":1,"icepunch":1},
tier: "Limbo C"
},
sunkern: {
viableMoves: {"sunnyday":1,"gigadrain":1,"solarbeam":1,"hiddenpowerfire":1,"toxic":1,"earthpower":1,"leechseed":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","abilities":["chlorophyll"],"moves":["absorb","growth"]}
],
tier: "LC"
},
sunflora: {
viableMoves: {"sunnyday":1,"leafstorm":1,"gigadrain":1,"solarbeam":1,"hiddenpowerfire":1,"earthpower":1,"leechseed":1},
tier: "Limbo"
},
yanma: {
viableMoves: {"bugbuzz":1,"airslash":1,"hiddenpowerground":1,"uturn":1,"protect":1,"gigadrain":1,"ancientpower":1},
tier: "NFE"
},
yanmega: {
viableMoves: {"bugbuzz":1,"airslash":1,"hiddenpowerground":1,"uturn":1,"protect":1,"gigadrain":1,"ancientpower":1},
tier: "Limbo"
},
wooper: {
viableMoves: {"recover":1,"earthquake":1,"scald":1,"toxic":1,"stockpile":1,"yawn":1,"protect":1},
tier: "LC"
},
quagsire: {
viableMoves: {"recover":1,"earthquake":1,"waterfall":1,"scald":1,"toxic":1,"curse":1,"stoneedge":1,"stockpile":1,"yawn":1,"icepunch":1,"sludgewave":1},
tier: "Limbo B"
},
murkrow: {
viableMoves: {"substitute":1,"suckerpunch":1,"bravebird":1,"heatwave":1,"hiddenpowergrass":1,"roost":1,"darkpulse":1,"thunderwave":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","abilities":["insomnia"],"moves":["peck","astonish"]}
],
tier: "Limbo"
},
honchkrow: {
viableMoves: {"substitute":1,"superpower":1,"suckerpunch":1,"bravebird":1,"roost":1,"heatwave":1,"pursuit":1},
tier: "Limbo C"
},
misdreavus: {
viableMoves: {"nastyplot":1,"substitute":1,"calmmind":1,"willowisp":1,"shadowball":1,"thunderbolt":1,"hiddenpowerfighting":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["growl","psywave","spite"]}
],
tier: "Limbo"
},
mismagius: {
viableMoves: {"nastyplot":1,"substitute":1,"calmmind":1,"willowisp":1,"shadowball":1,"thunderbolt":1,"hiddenpowerfighting":1,"perishsong":1,"healbell":1,"painsplit":1},
tier: "Limbo"
},
unown: {
viableMoves: {"hiddenpowerpsychic":1},
tier: "Limbo"
},
wynaut: {
viableMoves: {"destinybond":1,"counter":1,"mirrorcoat":1,"encore":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["splash","charm","encore","tickle"]}
],
tier: "LC"
},
wobbuffet: {
viableMoves: {"destinybond":1,"counter":1,"mirrorcoat":1,"encore":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["counter","mirrorcoat","safeguard","destinybond"]},
{"generation":3,"level":10,"gender":"M","moves":["counter","mirrorcoat","safeguard","destinybond"]},
{"generation":6,"level":10,"gender":"M","isHidden":false,"moves":["counter"],"pokeball":"cherishball"}
],
tier: "Limbo C"
},
girafarig: {
viableMoves: {"psychic":1,"thunderbolt":1,"calmmind":1,"batonpass":1,"agility":1,"hypervoice":1,"thunderwave":1,"dazzlinggleam":1},
tier: "Limbo"
},
pineco: {
viableMoves: {"rapidspin":1,"toxicspikes":1,"spikes":1,"bugbite":1,"stealthrock":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["tackle","protect","selfdestruct"]},
{"generation":3,"level":22,"moves":["refresh","pinmissile","spikes","counter"]}
],
tier: "LC"
},
forretress: {
viableMoves: {"rapidspin":1,"toxicspikes":1,"spikes":1,"bugbite":1,"earthquake":1,"voltswitch":1,"stealthrock":1,"gyroball":1},
tier: "OU"
},
dunsparce: {
viableMoves: {"coil":1,"rockslide":1,"bite":1,"headbutt":1,"glare":1,"thunderwave":1,"bodyslam":1,"roost":1},
tier: "Limbo"
},
gligar: {
viableMoves: {"stealthrock":1,"toxic":1,"roost":1,"taunt":1,"swordsdance":1,"earthquake":1,"uturn":1,"stoneedge":1,"knockoff":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["poisonsting","sandattack"]}
],
tier: "Limbo"
},
gliscor: {
viableMoves: {"swordsdance":1,"earthquake":1,"roost":1,"substitute":1,"taunt":1,"icefang":1,"protect":1,"toxic":1,"stealthrock":1,"knockoff":1,"batonpass":1},
tier: "OU"
},
snubbull: {
viableMoves: {"thunderwave":1,"firepunch":1,"crunch":1,"closecombat":1,"icepunch":1,"earthquake":1,"playrough":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["tackle","scaryface","tailwhip","charm"]}
],
tier: "LC"
},
granbull: {
viableMoves: {"thunderwave":1,"playrough":1,"crunch":1,"closecombat":1,"healbell":1,"icepunch":1},
tier: "Limbo"
},
qwilfish: {
viableMoves: {"toxicspikes":1,"waterfall":1,"spikes":1,"swordsdance":1,"poisonjab":1,"painsplit":1,"thunderwave":1,"taunt":1,"destinybond":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["tackle","poisonsting","harden","minimize"]}
],
tier: "Limbo"
},
shuckle: {
viableMoves: {"rollout":1,"acupressure":1,"powersplit":1,"rest":1,"stickyweb":1,"infestation":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","abilities":["sturdy"],"moves":["constrict","withdraw","wrap"]},
{"generation":3,"level":20,"abilities":["sturdy"],"moves":["substitute","toxic","sludgebomb","encore"]}
],
tier: "Limbo C"
},
heracross: {
viableMoves: {"closecombat":1,"megahorn":1,"stoneedge":1,"swordsdance":1,"facade":1,"pinmissile":1,"rockblast":1},
tier: "Limbo A"
},
heracrossmega: {
requiredItem: "Heracronite"
},
sneasel: {
viableMoves: {"iceshard":1,"icepunch":1,"lowkick":1,"pursuit":1,"swordsdance":1,"knockoff":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["scratch","leer","taunt","quickattack"]}
],
tier: "Limbo"
},
weavile: {
viableMoves: {"iceshard":1,"icepunch":1,"knockoff":1,"pursuit":1,"swordsdance":1},
eventPokemon: [
{"generation":4,"level":30,"gender":"M","nature":"Jolly","moves":["fakeout","iceshard","nightslash","brickbreak"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
teddiursa: {
viableMoves: {"swordsdance":1,"protect":1,"facade":1,"closecombat":1,"firepunch":1,"crunch":1,"playrough":1,"gunkshot":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","abilities":["pickup"],"moves":["scratch","leer","lick"]},
{"generation":3,"level":11,"abilities":["pickup"],"moves":["refresh","metalclaw","leer","return"]}
],
tier: "LC"
},
ursaring: {
viableMoves: {"swordsdance":1,"protect":1,"facade":1,"closecombat":1,"firepunch":1,"crunch":1,"playrough":1},
tier: "Limbo"
},
slugma: {
viableMoves: {"stockpile":1,"recover":1,"lavaplume":1,"willowisp":1,"toxic":1,"hiddenpowergrass":1,"earthpower":1,"memento":1},
tier: "LC"
},
magcargo: {
viableMoves: {"stockpile":1,"recover":1,"lavaplume":1,"willowisp":1,"toxic":1,"hiddenpowergrass":1,"hiddenpowerrock":1,"stealthrock":1,"shellsmash":1,"fireblast":1,"earthpower":1},
eventPokemon: [
{"generation":3,"level":38,"moves":["refresh","heatwave","earthquake","flamethrower"]}
],
tier: "Limbo"
},
swinub: {
viableMoves: {"earthquake":1,"iciclecrash":1,"iceshard":1,"superpower":1,"endeavor":1,"stealthrock":1},
eventPokemon: [
{"generation":3,"level":22,"abilities":["oblivious"],"moves":["charm","ancientpower","mist","mudshot"]}
],
tier: "LC"
},
piloswine: {
viableMoves: {"earthquake":1,"iciclecrash":1,"iceshard":1,"superpower":1,"endeavor":1,"stealthrock":1},
tier: "Limbo"
},
mamoswine: {
viableMoves: {"iceshard":1,"earthquake":1,"endeavor":1,"iciclecrash":1,"stoneedge":1,"superpower":1,"stealthrock":1},
eventPokemon: [
{"generation":5,"level":34,"gender":"M","isHidden":true,"moves":["hail","icefang","takedown","doublehit"]}
],
tier: "OU"
},
corsola: {
viableMoves: {"recover":1,"toxic":1,"powergem":1,"scald":1,"stealthrock":1,"psychic":1,"earthpower":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["tackle","mudsport"]}
],
tier: "Limbo"
},
remoraid: {
viableMoves: {"waterspout":1,"hydropump":1,"fireblast":1,"hiddenpowerground":1,"icebeam":1,"seedbomb":1,"rockblast":1},
tier: "LC"
},
octillery: {
viableMoves: {"hydropump":1,"fireblast":1,"icebeam":1,"energyball":1,"rockblast":1,"thunderwave":1},
eventPokemon: [
{"generation":4,"level":50,"gender":"F","nature":"Serious","abilities":["suctioncups"],"moves":["octazooka","icebeam","signalbeam","hyperbeam"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
delibird: {
viableMoves: {"rapidspin":1,"iceshard":1,"icepunch":1,"aerialace":1,"spikes":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["present"]}
],
tier: "Limbo"
},
mantyke: {
viableMoves: {"raindance":1,"hydropump":1,"scald":1,"airslash":1,"icebeam":1,"rest":1,"sleeptalk":1,"toxic":1},
tier: "LC"
},
mantine: {
viableMoves: {"raindance":1,"hydropump":1,"surf":1,"airslash":1,"icebeam":1,"rest":1,"sleeptalk":1,"toxic":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["tackle","bubble","supersonic"]}
],
tier: "Limbo"
},
skarmory: {
viableMoves: {"whirlwind":1,"bravebird":1,"roost":1,"spikes":1,"stealthrock":1,"ironhead":1},
tier: "OU"
},
houndour: {
viableMoves: {"pursuit":1,"suckerpunch":1,"fireblast":1,"darkpulse":1,"hiddenpowerfighting":1,"nastyplot":1,"sludgebomb":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["leer","ember","howl"]},
{"generation":3,"level":17,"moves":["charm","feintattack","ember","roar"]}
],
tier: "LC"
},
houndoom: {
viableMoves: {"nastyplot":1,"pursuit":1,"darkpulse":1,"suckerpunch":1,"fireblast":1,"hiddenpowerfighting":1,"sludgebomb":1},
tier: "Limbo C"
},
houndoommega: {
requiredItem: "Houndoominite"
},
phanpy: {
viableMoves: {"stealthrock":1,"earthquake":1,"iceshard":1,"headsmash":1,"knockoff":1,"seedbomb":1,"superpower":1,"playrough":1},
tier: "LC"
},
donphan: {
viableMoves: {"stealthrock":1,"rapidspin":1,"iceshard":1,"earthquake":1,"headsmash":1,"seedbomb":1,"superpower":1,"playrough":1},
tier: "OU"
},
stantler: {
viableMoves: {"return":1,"megahorn":1,"jumpkick":1,"earthquake":1,"thunderwave":1,"suckerpunch":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","abilities":["intimidate"],"moves":["tackle","leer"]}
],
tier: "Limbo"
},
smeargle: {
viableMoves: {"spore":1,"spikes":1,"stealthrock":1,"uturn":1,"destinybond":1,"whirlwind":1,"stickyweb":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","abilities":["owntempo"],"moves":["sketch"]},
{"generation":5,"level":50,"gender":"F","nature":"Jolly","abilities":["technician"],"moves":["falseswipe","spore","odorsleuth","meanlook"],"pokeball":"cherishball"}
],
tier: "OU"
},
miltank: {
viableMoves: {"milkdrink":1,"stealthrock":1,"bodyslam":1,"healbell":1,"curse":1,"earthquake":1,"thunderwave":1,"firepunch":1},
tier: "Limbo"
},
raikou: {
viableMoves: {"thunderbolt":1,"hiddenpowerice":1,"hiddenpowergrass":1,"aurasphere":1,"calmmind":1,"substitute":1,"voltswitch":1,"extrasensory":1,},
eventPokemon: [
{"generation":3,"level":70,"moves":["quickattack","spark","reflect","crunch"]},
{"generation":4,"level":30,"shiny":true,"nature":"Rash","moves":["zapcannon","aurasphere","extremespeed","weatherball"],"pokeball":"cherishball"}
],
unreleasedHidden: true,
tier: "Limbo"
},
entei: {
viableMoves: {"extremespeed":1,"flareblitz":1,"ironhead":1,"flamecharge":1,"stoneedge":1,"willowisp":1,"calmmind":1,"flamethrower":1,"substitute":1,"hiddenpowergrass":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["firespin","stomp","flamethrower","swagger"]},
{"generation":4,"level":30,"shiny":true,"nature":"Adamant","moves":["flareblitz","howl","extremespeed","crushclaw"],"pokeball":"cherishball"}
],
unreleasedHidden: true,
tier: "Limbo"
},
suicune: {
viableMoves: {"hydropump":1,"icebeam":1,"scald":1,"hiddenpowergrass":1,"hiddenpowerelectric":1,"rest":1,"sleeptalk":1,"roar":1,"calmmind":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["gust","aurorabeam","mist","mirrorcoat"]},
{"generation":4,"level":30,"shiny":true,"nature":"Relaxed","moves":["sheercold","airslash","extremespeed","aquaring"],"pokeball":"cherishball"}
],
unreleasedHidden: true,
tier: "Limbo C"
},
larvitar: {
viableMoves: {"earthquake":1,"stoneedge":1,"facade":1,"dragondance":1,"superpower":1,"crunch":1},
eventPokemon: [
{"generation":3,"level":20,"moves":["sandstorm","dragondance","bite","outrage"]},
{"generation":5,"level":5,"shiny":true,"gender":"M","isHidden":false,"moves":["bite","leer","sandstorm","superpower"],"pokeball":"cherishball"}
],
tier: "LC"
},
pupitar: {
viableMoves: {"earthquake":1,"stoneedge":1,"crunch":1,"dragondance":1,"superpower":1,"stealthrock":1},
tier: "NFE"
},
tyranitar: {
viableMoves: {"crunch":1,"stoneedge":1,"pursuit":1,"superpower":1,"fireblast":1,"icebeam":1,"stealthrock":1,"aquatail":1,"dragondance":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["thrash","scaryface","crunch","earthquake"]},
{"generation":5,"level":100,"gender":"M","isHidden":false,"moves":["fireblast","icebeam","stoneedge","crunch"],"pokeball":"cherishball"},
{"generation":5,"level":55,"gender":"M","isHidden":true,"moves":["payback","crunch","earthquake","seismictoss"]}
],
tier: "OU"
},
tyranitarmega: {
requiredItem: "Tyranitarite"
},
lugia: {
viableMoves: {"toxic":1,"aeroblast":1,"roost":1,"substitute":1,"whirlwind":1,"icebeam":1,"psychic":1,"calmmind":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["swift","raindance","hydropump","recover"]},
{"generation":3,"level":70,"moves":["recover","hydropump","raindance","swift"]},
{"generation":3,"level":50,"moves":["psychoboost","recover","hydropump","featherdance"]}
],
dreamWorldPokeball: 'dreamball',
tier: "Uber"
},
hooh: {
viableMoves: {"substitute":1,"sacredfire":1,"bravebird":1,"earthquake":1,"roost":1,"willowisp":1,"flamecharge":1,"tailwind":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["swift","sunnyday","fireblast","recover"]},
{"generation":3,"level":70,"moves":["recover","fireblast","sunnyday","swift"]}
],
dreamWorldPokeball: 'dreamball',
tier: "Uber"
},
celebi: {
viableMoves: {"nastyplot":1,"psychic":1,"gigadrain":1,"recover":1,"healbell":1,"batonpass":1,"stealthrock":1,"earthpower":1,"hiddenpowerfire":1,"hiddenpowerice":1,"calmmind":1,"leafstorm":1,"uturn":1,"thunderwave":1,"perishsong":1},
eventPokemon: [
{"generation":3,"level":10,"moves":["confusion","recover","healbell","safeguard"]},
{"generation":3,"level":70,"moves":["ancientpower","futuresight","batonpass","perishsong"]},
{"generation":3,"level":10,"moves":["leechseed","recover","healbell","safeguard"]},
{"generation":3,"level":30,"moves":["healbell","safeguard","ancientpower","futuresight"]},
{"generation":4,"level":50,"moves":["leafstorm","recover","nastyplot","healingwish"],"pokeball":"cherishball"},
{"generation":6,"level":10,"moves":["recover","healbell","safeguard","holdback"],"pokeball":"luxuryball"}
],
tier: "Limbo A"
},
treecko: {
viableMoves: {"substitute":1,"leechseed":1,"leafstorm":1,"hiddenpowerice":1,"hiddenpowerrock":1,"endeavor":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["pound","leer","absorb"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["pound","leer","absorb"]}
],
tier: "LC"
},
grovyle: {
viableMoves: {"substitute":1,"leechseed":1,"gigadrain":1,"leafstorm":1,"hiddenpowerice":1,"hiddenpowerrock":1,"endeavor":1},
tier: "NFE"
},
sceptile: {
viableMoves: {"substitute":1,"leechseed":1,"gigadrain":1,"leafstorm":1,"hiddenpowerice":1,"focusblast":1,"synthesis":1,"hiddenpowerrock":1,"swordsdance":1,"leafblade":1,"earthquake":1},
eventPokemon: [
{"generation":5,"level":50,"isHidden":false,"moves":["leafstorm","dragonpulse","focusblast","rockslide"],"pokeball":"cherishball"}
],
tier: "Limbo C"
},
torchic: {
viableMoves: {"protect":1,"batonpass":1,"substitute":1,"hiddenpowergrass":1,"swordsdance":1,"firepledge":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["scratch","growl","focusenergy","ember"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["scratch","growl","focusenergy","ember"]},
{"generation":6,"level":10,"gender":"M","isHidden":true,"moves":["scratch","growl","focusenergy","ember"],"pokeball":"cherishball"}
],
tier: "LC"
},
combusken: {
viableMoves: {"flareblitz":1,"skyuppercut":1,"protect":1,"swordsdance":1,"substitute":1,"batonpass":1,"shadowclaw":1},
tier: "Limbo"
},
blaziken: {
viableMoves: {"flareblitz":1,"highjumpkick":1,"protect":1,"swordsdance":1,"substitute":1,"batonpass":1,"bravebird":1},
eventPokemon: [
{"generation":3,"level":70,"moves":["blazekick","slash","mirrormove","skyuppercut"]},
{"generation":5,"level":50,"isHidden":false,"moves":["flareblitz","highjumpkick","thunderpunch","stoneedge"],"pokeball":"cherishball"}
],
tier: "Uber"
},
blazikenmega: {
requiredItem: "Blazikenite"
},
mudkip: {
viableMoves: {"waterpledge":1,"earthpower":1,"hiddenpowerelectric":1,"icebeam":1,"sludge wave":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["tackle","growl","mudslap","watergun"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tackle","growl","mudslap","watergun"]}
],
tier: "LC"
},
marshtomp: {
viableMoves: {"waterfall":1,"earthquake":1,"superpower":1,"icepunch":1,"rockslide":1,"stealthrock":1,"irontail":1},
tier: "NFE"
},
swampert: {
viableMoves: {"waterfall":1,"earthquake":1,"icebeam":1,"stealthrock":1,"roar":1,"superpower":1,"yawn":1},
eventPokemon: [
{"generation":5,"level":50,"isHidden":false,"moves":["earthquake","icebeam","hydropump","hammerarm"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
poochyena: {
viableMoves: {"superfang":1,"foulplay":1,"suckerpunch":1,"toxic":1,"crunch":1,"firefang":1,"icefang":1,"poisonfang":1},
eventPokemon: [
{"generation":3,"level":10,"abilities":["runaway"],"moves":["healbell","dig","poisonfang","growl"]}
],
tier: "LC"
},
mightyena: {
viableMoves: {"suckerpunch":1,"crunch":1,"icefang":1,"firefang":1,"superfang":1,"irontail":1},
tier: "Limbo"
},
zigzagoon: {
viableMoves: {"trick":1,"thunderwave":1,"icebeam":1,"thunderbolt":1,"gunkshot":1,"lastresort":1},
eventPokemon: [
{"generation":3,"level":5,"shiny":true,"abilities":["pickup"],"moves":["tackle","growl","tailwhip"]},
{"generation":3,"level":5,"abilities":["pickup"],"moves":["tackle","growl","extremespeed"]}
],
tier: "LC"
},
linoone: {
viableMoves: {"bellydrum":1,"extremespeed":1,"seedbomb":1,"substitute":1,"shadowclaw":1,"playrough":1,"gunkshot":1},
tier: "Limbo"
},
wurmple: {
viableMoves: {"bugbite":1,"poisonsting":1,"tackle":1,"electroweb":1},
tier: "LC"
},
silcoon: {
viableMoves: {"bugbite":1,"poisonsting":1,"tackle":1,"electroweb":1},
tier: "NFE"
},
beautifly: {
viableMoves: {"quiverdance":1,"bugbuzz":1,"gigadrain":1,"hiddenpowerfighting":1,"hiddenpowerrock":1,"substitute":1,"psychic":1,"stunspore":1},
tier: "Limbo"
},
cascoon: {
viableMoves: {"bugbite":1,"poisonsting":1,"tackle":1,"electroweb":1},
tier: "NFE"
},
dustox: {
viableMoves: {"toxic":1,"roost":1,"whirlwind":1,"bugbuzz":1,"protect":1,"sludgebomb":1,"quiverdance":1,"shadowball":1,"energyball":1},
tier: "Limbo"
},
lotad: {
viableMoves: {"gigadrain":1,"icebeam":1,"scald":1,"naturepower":1,"raindance":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["astonish","growl","absorb"]}
],
tier: "LC"
},
lombre: {
viableMoves: {"fakeout":1,"swordsdance":1,"waterfall":1,"seedbomb":1,"icepunch":1,"firepunch":1,"thunderpunch":1,"poweruppunch":1,"gigadrain":1,"icebeam":1},
tier: "NFE"
},
ludicolo: {
viableMoves: {"raindance":1,"hydropump":1,"waterfall":1,"seedbomb":1,"icepunch":1,"scald":1,"drainpunch":1,"gigadrain":1,"icebeam":1},
eventPokemon: [
{"generation":5,"level":50,"isHidden":false,"abilities":["swiftswim"],"moves":["fakeout","hydropump","icebeam","gigadrain"],"pokeball":"cherishball"},
{"generation":5,"level":30,"gender":"M","nature":"Calm","isHidden":false,"abilities":["swiftswim"],"moves":["scald","gigadrain","icebeam","sunnyday"]}
],
tier: "Limbo"
},
seedot: {
viableMoves: {"defog":1,"naturepower":1,"seedbomb":1,"explosion":1,"foulplay":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["bide","harden","growth"]},
{"generation":3,"level":17,"moves":["refresh","gigadrain","bulletseed","secretpower"]}
],
tier: "LC"
},
nuzleaf: {
viableMoves: {"suckerpunch":1,"naturepower":1,"seedbomb":1,"explosion":1,"swordsdance":1,"rockslide":1,"lowsweep":1},
tier: "NFE"
},
shiftry: {
viableMoves: {"leafstorm":1,"swordsdance":1,"seedbomb":1,"suckerpunch":1,"defog":1,"xscissor":1,"lowsweep":1,"darkpulse":1},
tier: "Limbo"
},
taillow: {
viableMoves: {"bravebird":1,"boomburst":1,"uturn":1,"hiddenpowerfighting":1,"airslash":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["peck","growl","focusenergy","featherdance"]}
],
tier: "LC"
},
swellow: {
viableMoves: {"bravebird":1,"facade":1,"quickattack":1,"uturn":1,"protect":1},
eventPokemon: [
{"generation":3,"level":43,"moves":["batonpass","skyattack","agility","facade"]}
],
tier: "Limbo"
},
wingull: {
viableMoves: {"scald":1,"icebeam":1,"tailwind":1,"uturn":1,"airslash":1,"knockoff":1},
tier: "LC"
},
pelipper: {
viableMoves: {"scald":1,"icebeam":1,"tailwind":1,"uturn":1,"airslash":1,"hurricane":1,"toxic":1,"roost":1,"knockoff":1},
tier: "Limbo"
},
ralts: {
viableMoves: {"trickroom":1,"destinybond":1,"psychic":1,"willowisp":1,"hypnosis":1,"dazzlinggleam":1,"substitute":1,"trick":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["growl","wish"]},
{"generation":3,"level":5,"moves":["growl","charm"]},
{"generation":3,"level":20,"moves":["sing","shockwave","reflect","confusion"]}
],
tier: "LC"
},
kirlia: {
viableMoves: {"trick":1,"dazzlinggleam":1,"psychic":1,"willowisp":1,"signalbeam":1,"thunderbolt":1,"destinybond":1,"substitute":1},
tier: "NFE"
},
gardevoir: {
viableMoves: {"psychic":1,"focusblast":1,"shadowball":1,"moonblast":1,"calmmind":1,"willowisp":1,"energyball":1,"thunderbolt":1,"hypervoice":1,"healingwish":1},
eventPokemon: [
{"generation":5,"level":50,"isHidden":false,"abilities":["trace"],"moves":["hypnosis","thunderbolt","focusblast","psychic"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
gardevoirmega: {
requiredItem: "Gardevoirite"
},
gallade: {
viableMoves: {"closecombat":1,"trick":1,"stoneedge":1,"shadowsneak":1,"leafblade":1,"bulkup":1,"drainpunch":1,"icepunch":1,"psychocut":1,"swordsdance":1,"knockoff":1,"thunderwave":1},
tier: "Limbo C"
},
surskit: {
viableMoves: {"hydropump":1,"signalbeam":1,"hiddenpowerfire":1,"stickyweb":1,"gigadrain":1,"powersplit":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["bubble","mudsport"]},
{"generation":3,"level":10,"gender":"M","moves":["bubble","quickattack"]}
],
tier: "LC"
},
masquerain: {
viableMoves: {"hydropump":1,"bugbuzz":1,"airslash":1,"quiverdance":1,"substitute":1,"batonpass":1,"stickyweb":1,"roost":1},
tier: "Limbo"
},
shroomish: {
viableMoves: {"spore":1,"substitute":1,"leechseed":1,"gigadrain":1,"protect":1,"toxic":1,"stunspore":1},
eventPokemon: [
{"generation":3,"level":15,"abilities":["effectspore"],"moves":["refresh","falseswipe","megadrain","stunspore"]}
],
tier: "LC"
},
breloom: {
viableMoves: {"spore":1,"substitute":1,"leechseed":1,"focuspunch":1,"machpunch":1,"lowsweep":1,"bulletseed":1,"stoneedge":1,"swordsdance":1,"fling":1,"drainpunch":1},
tier: "OU"
},
slakoth: {
viableMoves: {"doubleedge":1,"hammerarm":1,"firepunch":1,"counter":1,"retaliate":1,"toxic":1},
tier: "LC"
},
vigoroth: {
viableMoves: {"bulkup":1,"return":1,"earthquake":1,"firepunch":1,"suckerpunch":1,"slackoff":1,"icepunch":1,"lowkick":1},
tier: "Limbo"
},
slaking: {
viableMoves: {"return":1,"earthquake":1,"pursuit":1,"firepunch":1,"nightslash":1,"doubleedge":1,"retaliate":1,"gigaimpact":1,"hammerarm":1},
eventPokemon: [
{"generation":4,"level":50,"gender":"M","nature":"Adamant","moves":["gigaimpact","return","shadowclaw","aerialace"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
nincada: {
viableMoves: {"xscissor":1,"dig":1,"aerialace":1,"nightslash":1},
tier: "LC"
},
ninjask: {
viableMoves: {"batonpass":1,"swordsdance":1,"substitute":1,"protect":1,"xscissor":1,"aerialace":1},
tier: "Limbo B"
},
shedinja: {
viableMoves: {"swordsdance":1,"willowisp":1,"xscissor":1,"shadowsneak":1,"suckerpunch":1,"protect":1},
eventPokemon: [
{"generation":3,"level":50,"moves":["spite","confuseray","shadowball","grudge"]},
{"generation":3,"level":20,"moves":["doubleteam","furycutter","screech"]},
{"generation":3,"level":25,"moves":["swordsdance"]},
{"generation":3,"level":31,"moves":["slash"]},
{"generation":3,"level":38,"moves":["agility"]},
{"generation":3,"level":45,"moves":["batonpass"]},
{"generation":4,"level":52,"moves":["xscissor"]}
],
tier: "Limbo"
},
whismur: {
viableMoves: {"hypervoice":1,"fireblast":1,"shadowball":1,"icebeam":1,"extrasensory":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["pound","uproar","teeterdance"]}
],
tier: "LC"
},
loudred: {
viableMoves: {"hypervoice":1,"fireblast":1,"shadowball":1,"icebeam":1,"circlethrow":1,"bodyslam":1},
tier: "NFE"
},
exploud: {
viableMoves: {"boomburst":1,"overheat":1,"shadowball":1,"blizzard":1,"surf":1,"focusblast":1,"extrasensory":1},
eventPokemon: [
{"generation":3,"level":100,"moves":["roar","rest","sleeptalk","hypervoice"]},
{"generation":3,"level":50,"moves":["stomp","screech","hyperbeam","roar"]}
],
tier: "Limbo C"
},
makuhita: {
viableMoves: {"crosschop":1,"bulletpunch":1,"closecombat":1,"icepunch":1,"bulkup":1,"fakeout":1,"earthquake":1},
eventPokemon: [
{"generation":3,"level":18,"moves":["refresh","brickbreak","armthrust","rocktomb"]}
],
tier: "LC"
},
hariyama: {
viableMoves: {"crosschop":1,"bulletpunch":1,"closecombat":1,"icepunch":1,"stoneedge":1,"bulkup":1,"earthquake":1,"whirlwind":1},
tier: "Limbo"
},
nosepass: {
viableMoves: {"powergem":1,"thunderwave":1,"stealthrock":1,"painsplit":1,"explosion":1,"dazzlinggleam":1,"voltswitch":1},
eventPokemon: [
{"generation":3,"level":26,"moves":["helpinghand","thunderbolt","thunderwave","rockslide"]}
],
tier: "LC"
},
probopass: {
viableMoves: {"stealthrock":1,"thunderwave":1,"toxic":1,"dazzlinggleam":1,"earthpower":1,"powergem":1,"voltswitch":1,"flashcannon":1,"painsplit":1},
tier: "Limbo"
},
skitty: {
viableMoves: {"doubleedge":1,"assist":1,"zenheadbutt":1,"thunderwave":1,"fakeout":1,"playrough":1,"healbell":1},
eventPokemon: [
{"generation":3,"level":5,"abilities":["cutecharm"],"moves":["tackle","growl","tailwhip","payday"]},
{"generation":3,"level":5,"abilities":["cutecharm"],"moves":["growl","tackle","tailwhip","rollout"]},
{"generation":3,"level":10,"gender":"M","abilities":["cutecharm"],"moves":["growl","tackle","tailwhip","attract"]}
],
tier: "LC"
},
delcatty: {
viableMoves: {"return":1,"doubleedge":1,"suckerpunch":1,"playrough":1,"wildcharge":1,"zenheadbutt":1,"fakeout":1,"thunderwave":1,"wish":1,"healbell":1},
eventPokemon: [
{"generation":3,"level":18,"abilities":["cutecharm"],"moves":["sweetkiss","secretpower","attract","shockwave"]}
],
tier: "Limbo"
},
sableye: {
viableMoves: {"recover":1,"willowisp":1,"taunt":1,"trick":1,"toxic":1,"nightshade":1,"seismictoss":1,"knockoff":1,"foulplay":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","abilities":["keeneye"],"moves":["leer","scratch","foresight","nightshade"]},
{"generation":3,"level":33,"abilities":["keeneye"],"moves":["helpinghand","shadowball","feintattack","recover"]},
{"generation":5,"level":50,"gender":"M","isHidden":true,"moves":["foulplay","octazooka","tickle","trick"],"pokeball":"cherishball"}
],
tier: "OU"
},
mawile: {
viableMoves: {"swordsdance":1,"ironhead":1,"firefang":1,"substitute":1,"playrough":1,"suckerpunch":1,"knockoff":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["astonish","faketears"]},
{"generation":3,"level":22,"moves":["sing","falseswipe","vicegrip","irondefense"]}
],
tier: "OU"
},
mawilemega: {
requiredItem: "Mawilite"
},
aron: {
viableMoves: {"headsmash":1,"ironhead":1,"earthquake":1,"superpower":1,"stealthrock":1,"endeavor":1},
tier: "LC"
},
lairon: {
viableMoves: {"headsmash":1,"ironhead":1,"earthquake":1,"superpower":1,"stealthrock":1},
tier: "Limbo"
},
aggron: {
viableMoves: {"autotomize":1,"headsmash":1,"earthquake":1,"superpower":1,"heavyslam":1,"aquatail":1,"icepunch":1,"stealthrock":1,"thunderwave":1},
eventPokemon: [
{"generation":3,"level":100,"moves":["irontail","protect","metalsound","doubleedge"]},
{"generation":3,"level":50,"moves":["takedown","irontail","protect","metalsound"]}
],
tier: "Limbo A"
},
aggronmega: {
requiredItem: "Aggronite"
},
meditite: {
viableMoves: {"highjumpkick":1,"psychocut":1,"icepunch":1,"thunderpunch":1,"trick":1,"fakeout":1,"bulletpunch":1,"drainpunch":1,"zenheadbutt":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["bide","meditate","confusion"]},
{"generation":3,"level":20,"moves":["dynamicpunch","confusion","shadowball","detect"]}
],
tier: "NFE"
},
medicham: {
viableMoves: {"highjumpkick":1,"drainpunch":1,"psychocut":1,"icepunch":1,"thunderpunch":1,"trick":1,"fakeout":1,"bulletpunch":1,"zenheadbutt":1},
tier: "Limbo A"
},
medichammega: {
requiredItem: "Medichamite"
},
electrike: {
viableMoves: {"voltswitch":1,"thunderbolt":1,"hiddenpowerice":1,"switcheroo":1,"flamethrower":1,"hiddenpowergrass":1},
tier: "LC"
},
manectric: {
viableMoves: {"voltswitch":1,"thunderbolt":1,"hiddenpowerice":1,"hiddenpowergrass":1,"overheat":1,"switcheroo":1,"flamethrower":1},
eventPokemon: [
{"generation":3,"level":44,"moves":["refresh","thunder","raindance","bite"]}
],
tier: "Limbo A"
},
manectricmega: {
requiredItem: "Manectite"
},
plusle: {
viableMoves: {"nastyplot":1,"thunderbolt":1,"substitute":1,"batonpass":1,"hiddenpowerice":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["growl","thunderwave","watersport"]},
{"generation":3,"level":10,"gender":"M","moves":["growl","thunderwave","quickattack"]}
],
tier: "Limbo"
},
minun: {
viableMoves: {"nastyplot":1,"thunderbolt":1,"substitute":1,"batonpass":1,"hiddenpowerice":1,"encore":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["growl","thunderwave","mudsport"]},
{"generation":3,"level":10,"gender":"M","moves":["growl","thunderwave","quickattack"]}
],
tier: "Limbo"
},
volbeat: {
viableMoves: {"tailglow":1,"batonpass":1,"substitute":1,"bugbuzz":1,"thunderwave":1,"encore":1,"tailwind":1,"trick":1,"uturn":1},
tier: "Limbo"
},
illumise: {
viableMoves: {"substitute":1,"batonpass":1,"wish":1,"bugbuzz":1,"encore":1,"thunderbolt":1,"tailwind":1,"uturn":1},
tier: "Limbo"
},
budew: {
viableMoves: {"spikes":1,"sludgebomb":1,"sleeppowder":1,"gigadrain":1,"stunspore":1,"rest":1},
tier: "LC"
},
roselia: {
viableMoves: {"spikes":1,"toxicspikes":1,"sleeppowder":1,"gigadrain":1,"stunspore":1,"rest":1,"sludgebomb":1,"synthesis":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["absorb","growth","poisonsting"]},
{"generation":3,"level":22,"moves":["sweetkiss","magicalleaf","leechseed","grasswhistle"]}
],
tier: "Limbo"
},
roserade: {
viableMoves: {"sludgebomb":1,"gigadrain":1,"sleeppowder":1,"leafstorm":1,"spikes":1,"toxicspikes":1,"rest":1,"synthesis":1,"hiddenpowerfire":1,"extrasensory":1},
tier: "Limbo B"
},
gulpin: {
viableMoves: {"stockpile":1,"sludgebomb":1,"sludgewave":1,"icebeam":1,"toxic":1,"painsplit":1,"yawn":1,"encore":1},
eventPokemon: [
{"generation":3,"level":17,"moves":["sing","shockwave","sludge","toxic"]}
],
tier: "LC"
},
swalot: {
viableMoves: {"stockpile":1,"sludgebomb":1,"icebeam":1,"toxic":1,"yawn":1,"encore":1,"painsplit":1,"earthquake":1},
tier: "Limbo"
},
carvanha: {
viableMoves: {"protect":1,"hydropump":1,"surf":1,"icebeam":1,"waterfall":1,"crunch":1,"aquajet":1,"destinybond":1},
eventPokemon: [
{"generation":3,"level":15,"moves":["refresh","waterpulse","bite","scaryface"]}
],
tier: "NFE"
},
sharpedo: {
viableMoves: {"protect":1,"hydropump":1,"surf":1,"icebeam":1,"crunch":1,"earthquake":1,"waterfall":1,"darkpulse":1,"aquajet":1,"destinybond":1},
tier: "Limbo"
},
wailmer: {
viableMoves: {"waterspout":1,"surf":1,"hydropump":1,"icebeam":1,"hiddenpowergrass":1,"hiddenpowerelectric":1},
tier: "LC"
},
wailord: {
viableMoves: {"waterspout":1,"surf":1,"hydropump":1,"icebeam":1,"hiddenpowergrass":1,"hiddenpowerelectric":1,"hiddenpowerbug":1},
eventPokemon: [
{"generation":3,"level":100,"moves":["rest","waterspout","amnesia","hydropump"]},
{"generation":3,"level":50,"moves":["waterpulse","mist","rest","waterspout"]}
],
tier: "Limbo"
},
numel: {
viableMoves: {"curse":1,"earthquake":1,"rockslide":1,"fireblast":1,"flamecharge":1,"rest":1,"sleeptalk":1,"stockpile":1,"hiddenpowerelectric":1,"earthpower":1,"lavaplume":1},
eventPokemon: [
{"generation":3,"level":14,"abilities":["oblivious"],"moves":["charm","takedown","dig","ember"]}
],
tier: "LC"
},
camerupt: {
viableMoves: {"rockpolish":1,"fireblast":1,"earthpower":1,"stoneedge":1,"lavaplume":1,"stealthrock":1,"earthquake":1,"eruption":1,"hiddenpowergrass":1},
tier: "Limbo"
},
torkoal: {
viableMoves: {"rapidspin":1,"stealthrock":1,"yawn":1,"lavaplume":1,"earthquake":1,"toxic":1,"willowisp":1,"shellsmash":1,"fireblast":1},
tier: "Limbo"
},
spoink: {
viableMoves: {"psychic":1,"reflect":1,"lightscreen":1,"thunderwave":1,"trick":1,"healbell":1,"calmmind":1,"hiddenpowerfighting":1,"shadowball":1},
eventPokemon: [
{"generation":3,"level":5,"abilities":["owntempo"],"moves":["splash","uproar"]}
],
tier: "LC"
},
grumpig: {
viableMoves: {"calmmind":1,"psychic":1,"psyshock":1,"focusblast":1,"shadowball":1,"thunderwave":1,"trick":1,"healbell":1,"whirlwind":1},
tier: "Limbo"
},
spinda: {
viableMoves: {"doubleedge":1,"wish":1,"protect":1,"return":1,"superpower":1,"suckerpunch":1,"trickroom":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["tackle","uproar","sing"]}
],
tier: "Limbo"
},
trapinch: {
viableMoves: {"earthquake":1,"rockslide":1,"crunch":1,"quickattack":1,"superpower":1},
eventPokemon: [
{"generation":5,"level":1,"shiny":true,"isHidden":false,"moves":["bite"]}
],
tier: "LC"
},
vibrava: {
viableMoves: {"substitute":1,"earthquake":1,"outrage":1,"roost":1,"uturn":1,"superpower":1,"defog":1},
tier: "NFE"
},
flygon: {
viableMoves: {"earthquake":1,"outrage":1,"dragonclaw":1,"uturn":1,"roost":1,"substitute":1,"stoneedge":1,"firepunch":1,"superpower":1,"defog":1},
eventPokemon: [
{"generation":3,"level":45,"moves":["sandtomb","crunch","dragonbreath","screech"]},
{"generation":4,"level":50,"gender":"M","nature":"Naive","moves":["dracometeor","uturn","earthquake","dragonclaw"],"pokeball":"cherishball"}
],
tier: "Limbo C"
},
cacnea: {
viableMoves: {"swordsdance":1,"spikes":1,"suckerpunch":1,"seedbomb":1,"drainpunch":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["poisonsting","leer","absorb","encore"]}
],
tier: "LC"
},
cacturne: {
viableMoves: {"swordsdance":1,"spikes":1,"suckerpunch":1,"seedbomb":1,"drainpunch":1,"substitute":1,"focuspunch":1},
eventPokemon: [
{"generation":3,"level":45,"moves":["ingrain","feintattack","spikes","needlearm"]}
],
tier: "Limbo"
},
swablu: {
viableMoves: {"roost":1,"toxic":1,"cottonguard":1,"pluck":1,"hypervoice":1,"return":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["peck","growl","falseswipe"]},
{"generation":5,"level":1,"shiny":true,"isHidden":false,"moves":["peck","growl"]}
],
tier: "LC"
},
altaria: {
viableMoves: {"dragondance":1,"dracometeor":1,"dragonpulse":1,"outrage":1,"dragonclaw":1,"earthquake":1,"roost":1,"fireblast":1,"rest":1,"healbell":1},
eventPokemon: [
{"generation":3,"level":45,"moves":["takedown","dragonbreath","dragondance","refresh"]},
{"generation":3,"level":36,"moves":["healbell","dragonbreath","solarbeam","aerialace"]},
{"generation":5,"level":35,"gender":"M","isHidden":true,"moves":["takedown","naturalgift","dragonbreath","falseswipe"]}
],
tier: "Limbo"
},
zangoose: {
viableMoves: {"swordsdance":1,"closecombat":1,"nightslash":1,"quickattack":1,"facade":1},
eventPokemon: [
{"generation":3,"level":18,"moves":["leer","quickattack","swordsdance","furycutter"]},
{"generation":3,"level":10,"gender":"M","moves":["scratch","leer","quickattack","swordsdance"]},
{"generation":3,"level":28,"moves":["refresh","brickbreak","counter","crushclaw"]}
],
tier: "Limbo"
},
seviper: {
viableMoves: {"sludgebomb":1,"flamethrower":1,"gigadrain":1,"switcheroo":1,"earthquake":1,"suckerpunch":1,"aquatail":1,"coil":1,"glare":1,"poisonjab":1,"sludgewave":1,"hiddenpowerground":1},
eventPokemon: [
{"generation":3,"level":18,"moves":["wrap","lick","bite","poisontail"]},
{"generation":3,"level":30,"moves":["poisontail","screech","glare","crunch"]},
{"generation":3,"level":10,"gender":"M","moves":["wrap","lick","bite"]}
],
tier: "Limbo"
},
lunatone: {
viableMoves: {"psychic":1,"earthpower":1,"stealthrock":1,"rockpolish":1,"batonpass":1,"calmmind":1,"icebeam":1,"hiddenpowerrock":1,"moonlight":1,"trickroom":1,"explosion":1},
eventPokemon: [
{"generation":3,"level":10,"moves":["tackle","harden","confusion"]},
{"generation":3,"level":25,"moves":["batonpass","psychic","raindance","rocktomb"]}
],
tier: "Limbo"
},
solrock: {
viableMoves: {"stealthrock":1,"explosion":1,"stoneedge":1,"zenheadbutt":1,"earthquake":1,"batonpass":1,"willowisp":1,"rockpolish":1,"morningsun":1,"trickroom":1,},
eventPokemon: [
{"generation":3,"level":10,"moves":["tackle","harden","confusion"]},
{"generation":3,"level":41,"moves":["batonpass","psychic","sunnyday","cosmicpower"]}
],
tier: "Limbo"
},
barboach: {
viableMoves: {"dragondance":1,"waterfall":1,"earthquake":1,"return":1,"bounce":1},
tier: "LC"
},
whiscash: {
viableMoves: {"dragondance":1,"waterfall":1,"earthquake":1,"stoneedge":1,"zenheadbutt":1},
eventPokemon: [
{"generation":4,"level":51,"gender":"F","nature":"Gentle","abilities":["oblivious"],"moves":["earthquake","aquatail","zenheadbutt","gigaimpact"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
corphish: {
viableMoves: {"dragondance":1,"waterfall":1,"crunch":1,"superpower":1,"swordsdance":1,"knockoff":1,"aquajet":1,"switcheroo":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["bubble","watersport"]}
],
tier: "LC"
},
crawdaunt: {
viableMoves: {"dragondance":1,"waterfall":1,"crunch":1,"superpower":1,"swordsdance":1,"knockoff":1,"aquajet":1,"switcheroo":1},
eventPokemon: [
{"generation":3,"level":100,"moves":["taunt","crabhammer","swordsdance","guillotine"]},
{"generation":3,"level":50,"moves":["knockoff","taunt","crabhammer","swordsdance"]}
],
tier: "Limbo B"
},
baltoy: {
viableMoves: {"stealthrock":1,"earthquake":1,"toxic":1,"psychic":1,"reflect":1,"lightscreen":1,"icebeam":1,"rapidspin":1},
eventPokemon: [
{"generation":3,"level":17,"moves":["refresh","rocktomb","mudslap","psybeam"]}
],
tier: "LC"
},
claydol: {
viableMoves: {"stealthrock":1,"toxic":1,"psychic":1,"icebeam":1,"earthquake":1,"rapidspin":1,"reflect":1,"lightscreen":1},
tier: "Limbo"
},
lileep: {
viableMoves: {"stealthrock":1,"recover":1,"ancientpower":1,"hiddenpowerfire":1,"gigadrain":1,"stockpile":1},
eventPokemon: [
{"generation":5,"level":15,"gender":"M","isHidden":false,"moves":["recover","rockslide","constrict","acid"],"pokeball":"cherishball"}
],
tier: "LC"
},
cradily: {
viableMoves: {"stealthrock":1,"recover":1,"stockpile":1,"seedbomb":1,"rockslide":1,"earthquake":1,"curse":1,"swordsdance":1},
tier: "Limbo"
},
anorith: {
viableMoves: {"stealthrock":1,"brickbreak":1,"toxic":1,"xscissor":1,"rockslide":1,"swordsdance":1,"rockpolish":1},
eventPokemon: [
{"generation":5,"level":15,"gender":"M","isHidden":false,"moves":["harden","mudsport","watergun","crosspoison"],"pokeball":"cherishball"}
],
tier: "LC"
},
armaldo: {
viableMoves: {"stealthrock":1,"stoneedge":1,"toxic":1,"xscissor":1,"swordsdance":1,"earthquake":1,"superpower":1,"aquatail":1,"rapidspin":1},
tier: "Limbo"
},
feebas: {
viableMoves: {"protect":1,"confuseray":1,"hypnosis":1,"scald":1,"toxic":1},
tier: "LC"
},
milotic: {
viableMoves: {"recover":1,"scald":1,"toxic":1,"icebeam":1,"dragontail":1,"rest":1,"sleeptalk":1,"hiddenpowergrass":1,"hypnosis":1},
eventPokemon: [
{"generation":3,"level":35,"moves":["waterpulse","twister","recover","raindance"]},
{"generation":4,"level":50,"gender":"F","nature":"Bold","moves":["recover","raindance","icebeam","hydropump"],"pokeball":"cherishball"},
{"generation":4,"level":50,"shiny":true,"gender":"M","nature":"Timid","moves":["raindance","recover","hydropump","icywind"],"pokeball":"cherishball"},
{"generation":5,"level":50,"isHidden":false,"moves":["recover","hydropump","icebeam","mirrorcoat"],"pokeball":"cherishball"},
{"generation":5,"level":58,"gender":"M","nature":"Lax","isHidden":false,"moves":["recover","surf","icebeam","toxic"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
castform: {
viableMoves: {"sunnyday":1,"raindance":1,"fireblast":1,"hydropump":1,"thunder":1,"icebeam":1,"solarbeam":1,"weatherball":1},
tier: "Limbo"
},
kecleon: {
viableMoves: {"foulplay":1,"toxic":1,"stealthrock":1,"recover":1,"return":1,"thunderwave":1,"suckerpunch":1,"poweruppunch":1,"shadowsneak":1},
tier: "Limbo"
},
shuppet: {
viableMoves: {"trickroom":1,"destinybond":1,"taunt":1,"shadowsneak":1,"suckerpunch":1,"willowisp":1},
eventPokemon: [
{"generation":3,"level":45,"abilities":["insomnia"],"moves":["spite","willowisp","feintattack","shadowball"]}
],
tier: "LC"
},
banette: {
viableMoves: {"destinybond":1,"taunt":1,"shadowclaw":1,"suckerpunch":1,"willowisp":1,"shadowsneak":1},
eventPokemon: [
{"generation":3,"level":37,"abilities":["insomnia"],"moves":["helpinghand","feintattack","shadowball","curse"]},
{"generation":5,"level":37,"gender":"F","isHidden":true,"moves":["feintattack","hex","shadowball","cottonguard"]}
],
tier: "Limbo B"
},
banettemega: {
requiredItem: "Banettite"
},
duskull: {
viableMoves: {"willowisp":1,"shadowsneak":1,"icebeam":1,"painsplit":1,"substitute":1,"nightshade":1},
eventPokemon: [
{"generation":3,"level":45,"moves":["pursuit","curse","willowisp","meanlook"]},
{"generation":3,"level":19,"moves":["helpinghand","shadowball","astonish","confuseray"]}
],
tier: "LC"
},
dusclops: {
viableMoves: {"willowisp":1,"shadowsneak":1,"icebeam":1,"painsplit":1,"substitute":1,"seismictoss":1,"toxic":1,"trickroom":1},
tier: "Limbo C"
},
dusknoir: {
viableMoves: {"willowisp":1,"shadowsneak":1,"icebeam":1,"painsplit":1,"substitute":1,"earthquake":1,"focuspunch":1,"trickroom":1},
tier: "Limbo"
},
tropius: {
viableMoves: {"leechseed":1,"substitute":1,"airslash":1,"gigadrain":1,"earthquake":1,"hiddenpowerfire":1,"roost":1,"leafstorm":1,"defog":1,"growth":1},
eventPokemon: [
{"generation":4,"level":53,"gender":"F","nature":"Jolly","abilities":["chlorophyll"],"moves":["airslash","synthesis","sunnyday","solarbeam"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
chingling: {
viableMoves: {"hypnosis":1,"reflect":1,"lightscreen":1,"toxic":1,"recover":1,"psychic":1,"signalbeam":1,"healbell":1},
tier: "LC"
},
chimecho: {
viableMoves: {"hypnosis":1,"toxic":1,"wish":1,"psychic":1,"thunderwave":1,"recover":1,"calmmind":1,"shadowball":1,"hiddenpowerfighting":1,"healingwish":1,"healbell":1,"taunt":1},
eventPokemon: [
{"generation":3,"level":10,"gender":"M","moves":["wrap","growl","astonish"]}
],
tier: "Limbo"
},
absol: {
viableMoves: {"swordsdance":1,"suckerpunch":1,"nightslash":1,"psychocut":1,"superpower":1,"pursuit":1,"megahorn":1,"playrough":1},
eventPokemon: [
{"generation":3,"level":5,"abilities":["pressure"],"moves":["scratch","leer","wish"]},
{"generation":3,"level":5,"abilities":["pressure"],"moves":["scratch","leer","spite"]},
{"generation":3,"level":35,"abilities":["pressure"],"moves":["razorwind","bite","swordsdance","spite"]},
{"generation":3,"level":70,"abilities":["pressure"],"moves":["doubleteam","slash","futuresight","perishsong"]}
],
tier: "Limbo A"
},
absolmega: {
requiredItem: "Absolite"
},
snorunt: {
viableMoves: {"spikes":1,"icebeam":1,"hiddenpowerground":1,"iceshard":1,"crunch":1,"switcheroo":1},
eventPokemon: [
{"generation":3,"level":22,"abilities":["innerfocus"],"moves":["sing","waterpulse","bite","icywind"]}
],
tier: "LC"
},
glalie: {
viableMoves: {"spikes":1,"icebeam":1,"iceshard":1,"crunch":1,"earthquake":1,"switcheroo":1},
tier: "Limbo"
},
froslass: {
viableMoves: {"icebeam":1,"spikes":1,"destinybond":1,"shadowball":1,"substitute":1,"taunt":1,"thunderbolt":1,"thunderwave":1,"switcheroo":1},
tier: "Limbo C"
},
spheal: {
viableMoves: {"substitute":1,"protect":1,"toxic":1,"surf":1,"icebeam":1,"yawn":1,"superfang":1},
eventPokemon: [
{"generation":3,"level":17,"abilities":["thickfat"],"moves":["charm","aurorabeam","watergun","mudslap"]}
],
tier: "LC"
},
sealeo: {
viableMoves: {"substitute":1,"protect":1,"toxic":1,"surf":1,"icebeam":1,"yawn":1,"superfang":1},
tier: "NFE"
},
walrein: {
viableMoves: {"substitute":1,"protect":1,"toxic":1,"surf":1,"icebeam":1,"roar":1},
eventPokemon: [
{"generation":5,"level":50,"isHidden":false,"abilities":["thickfat"],"moves":["icebeam","surf","hail","sheercold"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
clamperl: {
viableMoves: {"shellsmash":1,"icebeam":1,"surf":1,"hiddenpowergrass":1,"hiddenpowerelectric":1,"substitute":1},
tier: "LC"
},
huntail: {
viableMoves: {"shellsmash":1,"return":1,"hydropump":1,"batonpass":1,"suckerpunch":1},
tier: "Limbo"
},
gorebyss: {
viableMoves: {"shellsmash":1,"batonpass":1,"hydropump":1,"icebeam":1,"hiddenpowergrass":1,"substitute":1,"aquaring":1},
tier: "Limbo"
},
relicanth: {
viableMoves: {"headsmash":1,"waterfall":1,"earthquake":1,"doubleedge":1,"stealthrock":1,"toxic":1,"zenheadbutt":1},
tier: "Limbo"
},
luvdisc: {
viableMoves: {"surf":1,"icebeam":1,"toxic":1,"sweetkiss":1,"protect":1,"bounce":1},
tier: "Limbo"
},
bagon: {
viableMoves: {"outrage":1,"dragondance":1,"firefang":1,"rockslide":1,"dragonclaw":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["rage","bite","wish"]},
{"generation":3,"level":5,"moves":["rage","bite","irondefense"]},
{"generation":5,"level":1,"shiny":true,"isHidden":false,"moves":["rage"]}
],
tier: "LC"
},
shelgon: {
viableMoves: {"outrage":1,"brickbreak":1,"dragonclaw":1,"dragondance":1,"crunch":1,"zenheadbutt":1},
tier: "Limbo"
},
salamence: {
viableMoves: {"outrage":1,"fireblast":1,"earthquake":1,"dracometeor":1,"roost":1,"dragondance":1,"dragonclaw":1,"hydropump":1,"stoneedge":1},
eventPokemon: [
{"generation":3,"level":50,"moves":["protect","dragonbreath","scaryface","fly"]},
{"generation":3,"level":50,"moves":["refresh","dragonclaw","dragondance","aerialace"]},
{"generation":4,"level":50,"gender":"M","nature":"Naughty","moves":["hydropump","stoneedge","fireblast","dragonclaw"],"pokeball":"cherishball"},
{"generation":5,"level":50,"isHidden":false,"moves":["dragondance","dragonclaw","outrage","aerialace"],"pokeball":"cherishball"}
],
tier: "OU"
},
beldum: {
viableMoves: {"ironhead":1,"zenheadbutt":1,"headbutt":1,"irondefense":1},
tier: "LC"
},
metang: {
viableMoves: {"stealthrock":1,"meteormash":1,"toxic":1,"earthquake":1,"bulletpunch":1,"zenheadbutt":1},
eventPokemon: [
{"generation":3,"level":30,"moves":["takedown","confusion","metalclaw","refresh"]}
],
tier: "Limbo"
},
metagross: {
viableMoves: {"meteormash":1,"earthquake":1,"agility":1,"stealthrock":1,"zenheadbutt":1,"bulletpunch":1,"trick":1,"thunderpunch":1,"explosion":1},
eventPokemon: [
{"generation":4,"level":62,"nature":"Brave","moves":["bulletpunch","meteormash","hammerarm","zenheadbutt"],"pokeball":"cherishball"},
{"generation":5,"level":50,"isHidden":false,"moves":["meteormash","earthquake","bulletpunch","hammerarm"],"pokeball":"cherishball"},
{"generation":5,"level":100,"isHidden":false,"moves":["bulletpunch","zenheadbutt","hammerarm","icepunch"],"pokeball":"cherishball"},
{"generation":5,"level":45,"isHidden":false,"moves":["earthquake","zenheadbutt","protect","meteormash"]},
{"generation":5,"level":45,"isHidden":true,"moves":["irondefense","agility","hammerarm","doubleedge"]},
{"generation":5,"level":45,"isHidden":true,"moves":["psychic","meteormash","hammerarm","doubleedge"]},
{"generation":5,"level":58,"nature":"Serious","isHidden":false,"moves":["earthquake","hyperbeam","psychic","meteormash"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
regirock: {
viableMoves: {"stealthrock":1,"thunderwave":1,"stoneedge":1,"earthquake":1,"curse":1,"rest":1,"sleeptalk":1,"rockslide":1,"toxic":1,"hammerarm":1},
eventPokemon: [
{"generation":3,"level":40,"moves":["curse","superpower","ancientpower","hyperbeam"]}
],
unreleasedHidden: true,
tier: "Limbo"
},
regice: {
viableMoves: {"thunderwave":1,"icebeam":1,"thunderbolt":1,"rest":1,"sleeptalk":1,"focusblast":1},
eventPokemon: [
{"generation":3,"level":40,"moves":["curse","superpower","ancientpower","hyperbeam"]}
],
unreleasedHidden: true,
tier: "Limbo"
},
registeel: {
viableMoves: {"stealthrock":1,"ironhead":1,"curse":1,"rest":1,"thunderwave":1,"toxic":1,"explosion":1},
eventPokemon: [
{"generation":3,"level":40,"moves":["curse","superpower","ancientpower","hyperbeam"]}
],
unreleasedHidden: true,
tier: "Limbo"
},
latias: {
viableMoves: {"dragonpulse":1,"surf":1,"thunderbolt":1,"roost":1,"calmmind":1,"healingwish":1,"defog":1,"psychoshift":1},
eventPokemon: [
{"generation":3,"level":50,"gender":"F","moves":["charm","recover","psychic","mistball"]},
{"generation":3,"level":70,"gender":"F","moves":["mistball","psychic","recover","charm"]},
{"generation":4,"level":40,"gender":"F","moves":["watersport","refresh","mistball","zenheadbutt"]}
],
tier: "Limbo A"
},
latios: {
viableMoves: {"dracometeor":1,"dragonpulse":1,"surf":1,"thunderbolt":1,"psyshock":1,"roost":1,"defog":1},
eventPokemon: [
{"generation":3,"level":50,"gender":"M","moves":["dragondance","recover","psychic","lusterpurge"]},
{"generation":3,"level":70,"gender":"M","moves":["lusterpurge","psychic","recover","dragondance"]},
{"generation":4,"level":40,"gender":"M","moves":["protect","refresh","lusterpurge","zenheadbutt"]}
],
tier: "OU"
},
kyogre: {
viableMoves: {"waterspout":1,"surf":1,"thunder":1,"icebeam":1,"calmmind":1,"rest":1,"sleeptalk":1},
eventPokemon: [
{"generation":5,"level":80,"moves":["icebeam","ancientpower","waterspout","thunder"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["waterspout","thunder","icebeam","sheercold"],"pokeball":"cherishball"}
],
tier: "Uber"
},
groudon: {
viableMoves: {"earthquake":1,"dragontail":1,"stealthrock":1,"stoneedge":1,"swordsdance":1,"rockpolish":1,"thunderwave":1,"fireblast":1},
eventPokemon: [
{"generation":5,"level":80,"moves":["earthquake","ancientpower","eruption","solarbeam"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["eruption","hammerarm","earthpower","solarbeam"],"pokeball":"cherishball"}
],
tier: "Uber"
},
rayquaza: {
viableMoves: {"outrage":1,"vcreate":1,"extremespeed":1,"dragondance":1,"earthquake":1,"dracometeor":1,"dragonclaw":1,"ironhead":1},
eventPokemon: [
{"generation":5,"level":70,"shiny":true,"moves":["dragonpulse","ancientpower","outrage","dragondance"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["extremespeed","hyperbeam","dragonpulse","vcreate"],"pokeball":"cherishball"}
],
tier: "Uber"
},
jirachi: {
viableMoves: {"bodyslam":1,"ironhead":1,"firepunch":1,"thunderwave":1,"stealthrock":1,"wish":1,"uturn":1,"calmmind":1,"psychic":1,"thunder":1,"icepunch":1,"flashcannon":1,"meteormash":1,"drainpunch":1,"doomdesire":1},
eventPokemon: [
{"generation":3,"level":5,"moves":["wish","confusion","rest"]},
{"generation":3,"level":30,"moves":["helpinghand","psychic","refresh","rest"]},
{"generation":4,"level":5,"moves":["wish","confusion","rest"],"pokeball":"cherishball"},
{"generation":4,"level":5,"moves":["wish","confusion","rest","dracometeor"],"pokeball":"cherishball"},
{"generation":5,"level":50,"moves":["healingwish","psychic","swift","meteormash"],"pokeball":"cherishball"},
{"generation":5,"level":50,"moves":["dracometeor","meteormash","wish","followme"],"pokeball":"cherishball"},
{"generation":5,"level":50,"moves":["wish","healingwish","cosmicpower","meteormash"],"pokeball":"cherishball"},
{"generation":5,"level":50,"moves":["wish","healingwish","swift","return"],"pokeball":"cherishball"}
],
tier: "OU"
},
deoxys: {
viableMoves: {"psychoboost":1,"superpower":1,"extremespeed":1,"icebeam":1,"thunderbolt":1,"firepunch":1,"spikes":1,"stealthrock":1},
eventPokemon: [
{"generation":3,"level":30,"moves":["snatch","psychic","spikes","knockoff"]},
{"generation":3,"level":30,"moves":["superpower","psychic","pursuit","taunt"]},
{"generation":3,"level":30,"moves":["swift","psychic","pursuit","knockoff"]},
{"generation":3,"level":70,"moves":["cosmicpower","recover","psychoboost","hyperbeam"]},
{"generation":4,"level":50,"moves":["psychoboost","zapcannon","irondefense","extremespeed"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["psychoboost","swift","doubleteam","extremespeed"]},
{"generation":4,"level":50,"moves":["psychoboost","detect","counter","mirrorcoat"]},
{"generation":4,"level":50,"moves":["psychoboost","meteormash","superpower","hyperbeam"]},
{"generation":4,"level":50,"moves":["psychoboost","leer","wrap","nightshade"]},
{"generation":5,"level":100,"moves":["nastyplot","darkpulse","recover","psychoboost"],"pokeball":"duskball"}
],
tier: "Uber"
},
deoxysattack: {
viableMoves: {"psychoboost":1,"superpower":1,"extremespeed":1,"icebeam":1,"thunderbolt":1,"firepunch":1,"spikes":1,"stealthrock":1},
eventPokemon: [
{"generation":3,"level":30,"moves":["snatch","psychic","spikes","knockoff"]},
{"generation":3,"level":30,"moves":["superpower","psychic","pursuit","taunt"]},
{"generation":3,"level":30,"moves":["swift","psychic","pursuit","knockoff"]},
{"generation":3,"level":70,"moves":["cosmicpower","recover","psychoboost","hyperbeam"]},
{"generation":4,"level":50,"moves":["psychoboost","zapcannon","irondefense","extremespeed"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["psychoboost","swift","doubleteam","extremespeed"]},
{"generation":4,"level":50,"moves":["psychoboost","detect","counter","mirrorcoat"]},
{"generation":4,"level":50,"moves":["psychoboost","meteormash","superpower","hyperbeam"]},
{"generation":4,"level":50,"moves":["psychoboost","leer","wrap","nightshade"]},
{"generation":5,"level":100,"moves":["nastyplot","darkpulse","recover","psychoboost"],"pokeball":"duskball"}
],
tier: "Uber"
},
deoxysdefense: {
viableMoves: {"spikes":1,"stealthrock":1,"recover":1,"taunt":1,"toxic":1,"seismictoss":1,"magiccoat":1},
eventPokemon: [
{"generation":3,"level":30,"moves":["snatch","psychic","spikes","knockoff"]},
{"generation":3,"level":30,"moves":["superpower","psychic","pursuit","taunt"]},
{"generation":3,"level":30,"moves":["swift","psychic","pursuit","knockoff"]},
{"generation":3,"level":70,"moves":["cosmicpower","recover","psychoboost","hyperbeam"]},
{"generation":4,"level":50,"moves":["psychoboost","zapcannon","irondefense","extremespeed"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["psychoboost","swift","doubleteam","extremespeed"]},
{"generation":4,"level":50,"moves":["psychoboost","detect","counter","mirrorcoat"]},
{"generation":4,"level":50,"moves":["psychoboost","meteormash","superpower","hyperbeam"]},
{"generation":4,"level":50,"moves":["psychoboost","leer","wrap","nightshade"]},
{"generation":5,"level":100,"moves":["nastyplot","darkpulse","recover","psychoboost"],"pokeball":"duskball"}
],
tier: "Limbo A"
},
deoxysspeed: {
viableMoves: {"spikes":1,"stealthrock":1,"superpower":1,"icebeam":1,"psychoboost":1,"taunt":1,"lightscreen":1,"reflect":1,"magiccoat":1,"trick":1,"extremespeed":1},
eventPokemon: [
{"generation":3,"level":30,"moves":["snatch","psychic","spikes","knockoff"]},
{"generation":3,"level":30,"moves":["superpower","psychic","pursuit","taunt"]},
{"generation":3,"level":30,"moves":["swift","psychic","pursuit","knockoff"]},
{"generation":3,"level":70,"moves":["cosmicpower","recover","psychoboost","hyperbeam"]},
{"generation":4,"level":50,"moves":["psychoboost","zapcannon","irondefense","extremespeed"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["psychoboost","swift","doubleteam","extremespeed"]},
{"generation":4,"level":50,"moves":["psychoboost","detect","counter","mirrorcoat"]},
{"generation":4,"level":50,"moves":["psychoboost","meteormash","superpower","hyperbeam"]},
{"generation":4,"level":50,"moves":["psychoboost","leer","wrap","nightshade"]},
{"generation":5,"level":100,"moves":["nastyplot","darkpulse","recover","psychoboost"],"pokeball":"duskball"}
],
tier: "Limbo A"
},
turtwig: {
viableMoves: {"reflect":1,"lightscreen":1,"stealthrock":1,"seedbomb":1,"substitute":1,"leechseed":1,"toxic":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tackle","withdraw","absorb"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["tackle","withdraw","absorb","stockpile"]}
],
tier: "LC"
},
grotle: {
viableMoves: {"reflect":1,"lightscreen":1,"stealthrock":1,"seedbomb":1,"substitute":1,"leechseed":1,"toxic":1},
tier: "NFE"
},
torterra: {
viableMoves: {"stealthrock":1,"earthquake":1,"woodhammer":1,"stoneedge":1,"synthesis":1,"leechseed":1,"rockpolish":1},
eventPokemon: [
{"generation":5,"level":100,"gender":"M","isHidden":false,"moves":["woodhammer","earthquake","outrage","stoneedge"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
chimchar: {
viableMoves: {"stealthrock":1,"overheat":1,"hiddenpowergrass":1,"fakeout":1,"u-turn":1,"gunkshot":1},
eventPokemon: [
{"generation":4,"level":40,"gender":"M","nature":"Mild","moves":["flamethrower","thunderpunch","grassknot","helpinghand"],"pokeball":"cherishball"},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["scratch","leer","ember","taunt"]},
{"generation":4,"level":40,"gender":"M","nature":"Hardy","moves":["flamethrower","thunderpunch","grassknot","helpinghand"],"pokeball":"cherishball"},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["leer","ember","taunt","fakeout"]}
],
tier: "LC"
},
monferno: {
viableMoves: {"stealthrock":1,"overheat":1,"hiddenpowergrass":1,"fakeout":1,"vacuumwave":1,"u-turn":1,"gunkshot":1},
tier: "Limbo"
},
infernape: {
viableMoves: {"stealthrock":1,"fireblast":1,"closecombat":1,"uturn":1,"grassknot":1,"stoneedge":1,"machpunch":1,"swordsdance":1,"nastyplot":1,"flareblitz":1,"hiddenpowerice":1,"thunderpunch":1},
eventPokemon: [
{"generation":5,"level":100,"gender":"M","isHidden":false,"moves":["fireblast","closecombat","uturn","grassknot"],"pokeball":"cherishball"}
],
tier: "OU"
},
piplup: {
viableMoves: {"stealthrock":1,"hydropump":1,"scald":1,"icebeam":1,"hiddenpowerelectric":1,"hiddenpowerfire":1,"yawn":1,"defog":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["pound","growl","bubble"]},
{"generation":5,"level":15,"isHidden":false,"moves":["hydropump","featherdance","watersport","peck"],"pokeball":"cherishball"},
{"generation":5,"level":15,"gender":"M","isHidden":false,"moves":["sing","round","featherdance","peck"],"pokeball":"cherishball"},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["pound","growl","bubble","featherdance"]}
],
tier: "LC"
},
prinplup: {
viableMoves: {"stealthrock":1,"hydropump":1,"scald":1,"icebeam":1,"hiddenpowerelectric":1,"hiddenpowerfire":1,"yawn":1,"defog":1},
tier: "NFE"
},
empoleon: {
viableMoves: {"stealthrock":1,"hydropump":1,"scald":1,"icebeam":1,"hiddenpowerelectric":1,"hiddenpowerfire":1,"roar":1,"grassknot":1,"flashcannon":1,"signalbeam":1,"defog":1},
eventPokemon: [
{"generation":5,"level":100,"gender":"M","isHidden":false,"moves":["hydropump","icebeam","aquajet","grassknot"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
starly: {
viableMoves: {"bravebird":1,"return":1,"uturn":1,"pursuit":1},
eventPokemon: [
{"generation":4,"level":1,"gender":"M","nature":"Mild","moves":["tackle","growl"]}
],
tier: "LC"
},
staravia: {
viableMoves: {"bravebird":1,"return":1,"uturn":1,"pursuit":1,"defog":1},
tier: "NFE"
},
staraptor: {
viableMoves: {"bravebird":1,"closecombat":1,"return":1,"uturn":1,"quickattack":1,"substitute":1,"roost":1,"doubleedge":1},
tier: "Limbo B"
},
bidoof: {
viableMoves: {"return":1,"aquatail":1,"curse":1,"quickattack":1,"stealthrock":1,"superfang":1},
eventPokemon: [
{"generation":4,"level":1,"gender":"M","nature":"Lonely","abilities":["simple"],"moves":["tackle"]}
],
tier: "LC"
},
bibarel: {
viableMoves: {"return":1,"waterfall":1,"curse":1,"quickattack":1,"stealthrock":1,"superfang":1},
tier: "Limbo"
},
kricketot: {
viableMoves: {"endeavor":1,"mudslap":1,"bugbite":1,"strugglebug":1},
tier: "LC"
},
kricketune: {
viableMoves: {"swordsdance":1,"bugbite":1,"aerialace":1,"brickbreak":1,"toxic":1,"stickyweb":1,"knockoff":1,"perishsong":1},
tier: "Limbo"
},
shinx: {
viableMoves: {"wildcharge":1,"icefang":1,"firefang":1,"crunch":1},
tier: "LC"
},
luxio: {
viableMoves: {"wildcharge":1,"icefang":1,"firefang":1,"crunch":1},
tier: "NFE"
},
luxray: {
viableMoves: {"wildcharge":1,"icefang":1,"firefang":1,"crunch":1,"superpower":1},
tier: "Limbo"
},
cranidos: {
viableMoves: {"headsmash":1,"rockslide":1,"earthquake":1,"zenheadbutt":1,"firepunch":1,"rockpolish":1,"crunch":1,"icebeam":1},
eventPokemon: [
{"generation":5,"level":15,"gender":"M","isHidden":false,"moves":["pursuit","takedown","crunch","headbutt"],"pokeball":"cherishball"}
],
tier: "LC"
},
rampardos: {
viableMoves: {"headsmash":1,"rockslide":1,"earthquake":1,"zenheadbutt":1,"firepunch":1,"rockpolish":1,"crunch":1,"icebeam":1},
tier: "Limbo"
},
shieldon: {
viableMoves: {"stealthrock":1,"metalburst":1,"fireblast":1,"icebeam":1,"protect":1,"toxic":1,"roar":1},
eventPokemon: [
{"generation":5,"level":15,"gender":"M","isHidden":false,"moves":["metalsound","takedown","bodyslam","protect"],"pokeball":"cherishball"}
],
tier: "LC"
},
bastiodon: {
viableMoves: {"stealthrock":1,"metalburst":1,"fireblast":1,"icebeam":1,"protect":1,"toxic":1,"roar":1},
tier: "Limbo"
},
burmy: {
viableMoves: {"bugbite":1,"hiddenpowerice":1,"electroweb":1,"protect":1},
tier: "LC"
},
wormadam: {
viableMoves: {"leafstorm":1,"gigadrain":1,"signalbeam":1,"hiddenpowerice":1,"hiddenpowerrock":1,"toxic":1,"psychic":1,"protect":1},
tier: "Limbo"
},
wormadamsandy: {
viableMoves: {"earthquake":1,"toxic":1,"rockblast":1,"protect":1,"stealthrock":1,"bulldoze":1},
tier: "Limbo"
},
wormadamtrash: {
viableMoves: {"stealthrock":1,"toxic":1,"ironhead":1,"protect":1,"swagger":1,"flashcannon":1},
tier: "Limbo"
},
mothim: {
viableMoves: {"quiverdance":1,"bugbuzz":1,"airslash":1,"gigadrain":1,"roost":1,"shadowball":1,"defog":1},
tier: "Limbo"
},
combee: {
viableMoves: {"bugbuzz":1,"aircutter":1,"endeavor":1,"ominouswind":1,"tailwind":1},
tier: "LC"
},
vespiquen: {
viableMoves: {"substitute":1,"roost":1,"toxic":1,"attackorder":1,"protect":1,"defendorder":1},
tier: "Limbo"
},
pachirisu: {
viableMoves: {"lightscreen":1,"thunderwave":1,"superfang":1,"toxic":1,"voltswitch":1,"u-turn":1},
tier: "Limbo"
},
buizel: {
viableMoves: {"waterfall":1,"aquajet":1,"switcheroo":1,"brickbreak":1,"bulkup":1,"batonpass":1,"icepunch":1},
tier: "LC"
},
floatzel: {
viableMoves: {"waterfall":1,"aquajet":1,"switcheroo":1,"brickbreak":1,"bulkup":1,"batonpass":1,"icepunch":1,"crunch":1},
tier: "Limbo"
},
cherubi: {
viableMoves: {"sunnyday":1,"solarbeam":1,"weatherball":1,"hiddenpowerice":1,"aromatherapy":1,"dazzlinggleam":1},
tier: "LC"
},
cherrim: {
viableMoves: {"sunnyday":1,"solarbeam":1,"weatherball":1,"hiddenpowerice":1},
tier: "Limbo"
},
shellos: {
viableMoves: {"scald":1,"clearsmog":1,"recover":1,"toxic":1,"icebeam":1,"stockpile":1},
tier: "LC"
},
gastrodon: {
viableMoves: {"earthpower":1,"icebeam":1,"scald":1,"toxic":1,"recover":1,"clearsmog":1,"stockpile":1},
tier: "Limbo A"
},
drifloon: {
viableMoves: {"shadowball":1,"substitute":1,"calmmind":1,"hypnosis":1,"hiddenpowerfighting":1,"thunderbolt":1,"destinybond":1,"willowisp":1,"stockpile":1,"batonpass":1,"disable":1},
tier: "LC"
},
drifblim: {
viableMoves: {"shadowball":1,"substitute":1,"calmmind":1,"hypnosis":1,"hiddenpowerfighting":1,"thunderbolt":1,"destinybond":1,"willowisp":1,"stockpile":1,"batonpass":1,"disable":1,"explosion":1},
tier: "Limbo"
},
buneary: {
viableMoves: {"fakeout":1,"return":1,"switcheroo":1,"thunderpunch":1,"jumpkick":1,"firepunch":1,"icepunch":1,"healingwish":1},
tier: "LC"
},
lopunny: {
viableMoves: {"fakeout":1,"return":1,"switcheroo":1,"thunderpunch":1,"jumpkick":1,"firepunch":1,"icepunch":1,"healingwish":1},
tier: "Limbo"
},
glameow: {
viableMoves: {"fakeout":1,"uturn":1,"suckerpunch":1,"hypnosis":1,"quickattack":1,"return":1,"foulplay":1},
tier: "LC"
},
purugly: {
viableMoves: {"fakeout":1,"uturn":1,"suckerpunch":1,"hypnosis":1,"quickattack":1,"return":1},
tier: "Limbo"
},
stunky: {
viableMoves: {"pursuit":1,"suckerpunch":1,"crunch":1,"fireblast":1,"explosion":1,"taunt":1,"poisonjab":1,"playrough":1,"defog":1},
tier: "LC"
},
skuntank: {
viableMoves: {"pursuit":1,"suckerpunch":1,"crunch":1,"fireblast":1,"explosion":1,"taunt":1,"poisonjab":1, "playrough":1,"defog":1},
tier: "Limbo"
},
bronzor: {
viableMoves: {"stealthrock":1,"psychic":1,"toxic":1,"hypnosis":1,"reflect":1,"lightscreen":1,"trickroom":1,"trick":1},
tier: "LC"
},
bronzong: {
viableMoves: {"stealthrock":1,"psychic":1,"earthquake":1,"toxic":1,"hypnosis":1,"reflect":1,"lightscreen":1,"trickroom":1,"explosion":1,"gyroball":1},
tier: "Limbo"
},
chatot: {
viableMoves: {"nastyplot":1,"boomburst":1,"heatwave":1,"encore":1,"substitute":1,"chatter":1,"uturn":1},
eventPokemon: [
{"generation":4,"level":25,"gender":"M","nature":"Jolly","abilities":["keeneye"],"moves":["mirrormove","furyattack","chatter","taunt"]}
],
tier: "Limbo"
},
spiritomb: {
viableMoves: {"shadowsneak":1,"suckerpunch":1,"pursuit":1,"willowisp":1,"calmmind":1,"darkpulse":1,"rest":1,"sleeptalk":1},
eventPokemon: [
{"generation":5,"level":61,"gender":"F","nature":"Quiet","isHidden":false,"moves":["darkpulse","psychic","silverwind","embargo"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
gible: {
viableMoves: {"outrage":1,"dragonclaw":1,"earthquake":1,"fireblast":1,"stoneedge":1,"stealthrock":1},
tier: "LC"
},
gabite: {
viableMoves: {"outrage":1,"dragonclaw":1,"earthquake":1,"fireblast":1,"stoneedge":1,"stealthrock":1},
tier: "Limbo"
},
garchomp: {
viableMoves: {"outrage":1,"dragonclaw":1,"earthquake":1,"stoneedge":1,"fireblast":1,"swordsdance":1,"stealthrock":1},
eventPokemon: [
{"generation":5,"level":100,"gender":"M","isHidden":false,"moves":["outrage","earthquake","swordsdance","stoneedge"],"pokeball":"cherishball"},
{"generation":5,"level":48,"gender":"M","isHidden":true,"moves":["dragonclaw","dig","crunch","outrage"]},
{"generation":6,"level":48,"gender":"M","isHidden":false,"moves":["dracometeor","dragonclaw","dig","crunch"],"pokeball":"cherishball"},
{"generation":6,"level":50,"gender":"M","isHidden":false,"moves":["slash","dragonclaw","dig","crunch"],"pokeball":"cherishball"}
],
tier: "OU"
},
garchompmega: {
requiredItem: "Garchompite"
},
riolu: {
viableMoves: {"crunch":1,"rockslide":1,"copycat":1,"drainpunch":1,"highjumpkick":1,"icepunch":1,"swordsdance":1},
eventPokemon: [
{"generation":4,"level":30,"gender":"M","nature":"Serious","abilities":["steadfast"],"moves":["aurasphere","shadowclaw","bulletpunch","drainpunch"]}
],
tier: "LC"
},
lucario: {
viableMoves: {"swordsdance":1,"closecombat":1,"crunch":1,"extremespeed":1,"icepunch":1,"bulletpunch":1,"nastyplot":1,"aurasphere":1,"darkpulse":1,"vacuumwave":1},
eventPokemon: [
{"generation":4,"level":50,"gender":"M","nature":"Modest","abilities":["steadfast"],"moves":["aurasphere","darkpulse","dragonpulse","waterpulse"],"pokeball":"cherishball"},
{"generation":4,"level":30,"gender":"M","nature":"Adamant","abilities":["innerfocus"],"moves":["forcepalm","bonerush","sunnyday","blazekick"],"pokeball":"cherishball"},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["detect","metalclaw","counter","bulletpunch"]},
{"generation":5,"level":50,"gender":"M","nature":"Naughty","isHidden":true,"moves":["bulletpunch","closecombat","stoneedge","shadowclaw"],"pokeball":"cherishball"}
],
tier: "OU"
},
lucariomega: {
requiredItem: "Lucarionite"
},
hippopotas: {
viableMoves: {"earthquake":1,"slackoff":1,"whirlwind":1,"stealthrock":1,"protect":1,"toxic":1,"stockpile":1},
tier: "LC"
},
hippowdon: {
viableMoves: {"earthquake":1,"slackoff":1,"whirlwind":1,"stealthrock":1,"protect":1,"toxic":1,"icefang":1,"stoneedge":1,"stockpile":1},
tier: "Limbo B"
},
skorupi: {
viableMoves: {"toxicspikes":1,"xscissor":1,"poisonjab":1,"knockoff":1,"pinmissile":1,"whirlwind":1},
tier: "LC"
},
drapion: {
viableMoves: {"crunch":1,"whirlwind":1,"toxicspikes":1,"pursuit":1,"earthquake":1,"aquatail":1,"swordsdance":1,"poisonjab":1,"knockoff":1},
tier: "Limbo C"
},
croagunk: {
viableMoves: {"fakeout":1,"vacuumwave":1,"suckerpunch":1,"drainpunch":1,"darkpulse":1,"knockoff":1,"gunkshot":1,"toxic":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["astonish","mudslap","poisonsting","taunt"]},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["mudslap","poisonsting","taunt","poisonjab"]}
],
tier: "LC"
},
toxicroak: {
viableMoves: {"fakeout":1,"suckerpunch":1,"drainpunch":1,"bulkup":1,"substitute":1,"swordsdance":1,"knockoff":1,"icepunch":1,"gunkshot":1},
tier: "Limbo B"
},
carnivine: {
viableMoves: {"swordsdance":1,"powerwhip":1,"return":1,"sleeppowder":1,"substitute":1,"leechseed":1,"knockoff":1,"sludgebomb":1},
tier: "Limbo"
},
finneon: {
viableMoves: {"surf":1,"uturn":1,"icebeam":1,"hiddenpowerelectric":1,"hiddenpowergrass":1,"raindance":1},
tier: "LC"
},
lumineon: {
viableMoves: {"surf":1,"uturn":1,"icebeam":1,"hiddenpowerelectric":1,"hiddenpowergrass":1,"raindance":1},
tier: "Limbo"
},
snover: {
viableMoves: {"blizzard":1,"iceshard":1,"gigadrain":1,"leechseed":1,"substitute":1,"woodhammer":1},
tier: "LC"
},
abomasnow: {
viableMoves: {"blizzard":1,"iceshard":1,"gigadrain":1,"leechseed":1,"substitute":1,"focusblast":1,"woodhammer":1,"earthquake":1},
tier: "Limbo C"
},
abomasnowmega: {
requiredItem: "Abomasite"
},
rotom: {
viableMoves: {"thunderbolt":1,"voltswitch":1,"shadowball":1,"substitute":1,"painsplit":1,"hiddenpowerice":1,"hiddenpowerfighting":1,"willowisp":1,"rest":1,"sleeptalk":1,"trick":1},
eventPokemon: [
{"generation":5,"level":10,"nature":"Naughty","moves":["uproar","astonish","trick","thundershock"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
rotomheat: {
viableMoves: {"thunderbolt":1,"voltswitch":1,"substitute":1,"painsplit":1,"hiddenpowerice":1,"willowisp":1,"rest":1,"sleeptalk":1,"overheat":1,"trick":1},
eventPokemon: [
{"generation":5,"level":10,"nature":"Naughty","moves":["uproar","astonish","trick","thundershock"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
rotomwash: {
viableMoves: {"thunderbolt":1,"voltswitch":1,"substitute":1,"painsplit":1,"hiddenpowerice":1,"willowisp":1,"trick":1,"hydropump":1,"signalbeam":1},
eventPokemon: [
{"generation":5,"level":10,"nature":"Naughty","moves":["uproar","astonish","trick","thundershock"],"pokeball":"cherishball"}
],
tier: "OU"
},
rotomfrost: {
viableMoves: {"thunderbolt":1,"voltswitch":1,"substitute":1,"painsplit":1,"hiddenpowerfighting":1,"willowisp":1,"trick":1,"blizzard":1},
eventPokemon: [
{"generation":5,"level":10,"nature":"Naughty","moves":["uproar","astonish","trick","thundershock"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
rotomfan: {
viableMoves: {"thunderbolt":1,"voltswitch":1,"discharge":1,"substitute":1,"painsplit":1,"hiddenpowerfighting":1,"willowisp":1,"rest":1,"sleeptalk":1,"trick":1,"airslash":1,"confuseray":1},
eventPokemon: [
{"generation":5,"level":10,"nature":"Naughty","moves":["uproar","astonish","trick","thundershock"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
rotommow: {
viableMoves: {"thunderbolt":1,"voltswitch":1,"substitute":1,"painsplit":1,"hiddenpowerfire":1,"willowisp":1,"rest":1,"sleeptalk":1,"trick":1,"leafstorm":1},
eventPokemon: [
{"generation":5,"level":10,"nature":"Naughty","moves":["uproar","astonish","trick","thundershock"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
uxie: {
viableMoves: {"reflect":1,"lightscreen":1,"uturn":1,"psychic":1,"thunderwave":1,"yawn":1,"healbell":1,"stealthrock":1,"trick":1,"toxic":1,"foulplay":1,"substitute":1,"calmmind":1,"thunderbolt":1},
tier: "Limbo"
},
mesprit: {
viableMoves: {"calmmind":1,"psychic":1,"thunderbolt":1,"icebeam":1,"substitute":1,"uturn":1,"trick":1,"stealthrock":1},
tier: "Limbo"
},
azelf: {
viableMoves: {"nastyplot":1,"psychic":1,"fireblast":1,"grassknot":1,"thunderbolt":1,"icepunch":1,"uturn":1,"trick":1,"taunt":1,"stealthrock":1,"explosion":1},
tier: "Limbo C"
},
dialga: {
viableMoves: {"stealthrock":1,"dracometeor":1,"dragonpulse":1,"roar":1,"dragontail":1,"thunderbolt":1,"outrage":1,"bulkup":1,"fireblast":1,"aurasphere":1,"rest":1,"sleeptalk":1,"dragonclaw":1},
eventPokemon: [
{"generation":5,"level":100,"shiny":true,"isHidden":false,"moves":["dragonpulse","dracometeor","aurasphere","roaroftime"],"pokeball":"cherishball"}
],
dreamWorldPokeball: 'dreamball',
tier: "Uber"
},
palkia: {
viableMoves: {"spacialrend":1,"dracometeor":1,"surf":1,"hydropump":1,"thunderbolt":1,"outrage":1,"fireblast":1},
eventPokemon: [
{"generation":5,"level":100,"shiny":true,"isHidden":false,"moves":["hydropump","dracometeor","spacialrend","aurasphere"],"pokeball":"cherishball"}
],
dreamWorldPokeball: 'dreamball',
tier: "Uber"
},
heatran: {
viableMoves: {"substitute":1,"fireblast":1,"lavaplume":1,"willowisp":1,"stealthrock":1,"earthpower":1,"hiddenpowergrass":1,"hiddenpowerice":1,"protect":1,"toxic":1,"roar":1},
eventPokemon: [
{"generation":4,"level":50,"nature":"Quiet","moves":["eruption","magmastorm","earthpower","ancientpower"]}
],
unreleasedHidden: true,
tier: "OU"
},
regigigas: {
viableMoves: {"thunderwave":1,"substitute":1,"return":1,"drainpunch":1,"earthquake":1,"firepunch":1,"toxic":1,"confuseray":1},
eventPokemon: [
{"generation":4,"level":100,"moves":["ironhead","rockslide","icywind","crushgrip"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
giratina: {
viableMoves: {"rest":1,"sleeptalk":1,"dragontail":1,"roar":1,"willowisp":1,"calmmind":1,"dragonpulse":1,"shadowball":1},
eventPokemon: [
{"generation":5,"level":100,"shiny":true,"isHidden":false,"moves":["dragonpulse","dragonclaw","aurasphere","shadowforce"],"pokeball":"cherishball"}
],
dreamWorldPokeball: 'dreamball',
tier: "Uber"
},
giratinaorigin: {
viableMoves: {"dracometeor":1,"shadowsneak":1,"dragontail":1,"hiddenpowerfire":1,"willowisp":1,"calmmind":1,"substitute":1,"dragonpulse":1,"shadowball":1,"aurasphere":1,"outrage":1},
requiredItem: "Griseous Orb",
tier: "Uber"
},
cresselia: {
viableMoves: {"moonlight":1,"psychic":1,"icebeam":1,"thunderwave":1,"toxic":1,"lunardance":1,"rest":1,"sleeptalk":1,"calmmind":1,"reflect":1,"lightscreen":1},
eventPokemon: [
{"generation":5,"level":68,"gender":"F","nature":"Modest","moves":["icebeam","psyshock","energyball","hiddenpower"]}
],
tier: "Limbo C"
},
phione: {
viableMoves: {"raindance":1,"scald":1,"uturn":1,"rest":1,"icebeam":1,"surf":1},
eventPokemon: [
{"generation":4,"level":50,"abilities":["hydration"],"moves":["grassknot","raindance","rest","surf"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
manaphy: {
viableMoves: {"tailglow":1,"surf":1,"icebeam":1,"grassknot":1},
eventPokemon: [
{"generation":4,"level":5,"moves":["tailglow","bubble","watersport"]},
{"generation":4,"level":1,"moves":["tailglow","bubble","watersport"]},
{"generation":4,"level":50,"moves":["acidarmor","whirlpool","waterpulse","heartswap"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["heartswap","waterpulse","whirlpool","acidarmor"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["heartswap","whirlpool","waterpulse","acidarmor"],"pokeball":"cherishball"},
{"generation":4,"level":50,"nature":"Impish","moves":["aquaring","waterpulse","watersport","heartswap"],"pokeball":"cherishball"}
],
tier: "BL"
},
darkrai: {
viableMoves: {"darkvoid":1,"darkpulse":1,"focusblast":1,"nastyplot":1,"substitute":1,"trick":1},
eventPokemon: [
{"generation":4,"level":50,"moves":["roaroftime","spacialrend","nightmare","hypnosis"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["darkvoid","darkpulse","shadowball","doubleteam"]},
{"generation":4,"level":50,"moves":["nightmare","hypnosis","roaroftime","spacialrend"],"pokeball":"cherishball"},
{"generation":4,"level":50,"moves":["doubleteam","nightmare","feintattack","hypnosis"]},
{"generation":5,"level":50,"moves":["darkvoid","ominouswind","feintattack","nightmare"],"pokeball":"cherishball"}
],
tier: "Uber"
},
shaymin: {
viableMoves: {"seedflare":1,"earthpower":1,"airslash":1,"hiddenpowerfire":1,"rest":1,"substitute":1,"leechseed":1},
eventPokemon: [
{"generation":4,"level":50,"moves":["seedflare","aromatherapy","substitute","energyball"],"pokeball":"cherishball"},
{"generation":4,"level":30,"moves":["synthesis","leechseed","magicalleaf","growth"]},
{"generation":4,"level":30,"moves":["growth","magicalleaf","leechseed","synthesis"]},
{"generation":5,"level":50,"moves":["seedflare","leechseed","synthesis","sweetscent"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
shayminsky: {
viableMoves: {"seedflare":1,"earthpower":1,"airslash":1,"hiddenpowerice":1,"hiddenpowerfire":1,"substitute":1,"leechseed":1},
eventPokemon: [
{"generation":4,"level":50,"moves":["seedflare","aromatherapy","substitute","energyball"],"pokeball":"cherishball"},
{"generation":4,"level":30,"moves":["synthesis","leechseed","magicalleaf","growth"]},
{"generation":4,"level":30,"moves":["growth","magicalleaf","leechseed","synthesis"]},
{"generation":5,"level":50,"moves":["seedflare","leechseed","synthesis","sweetscent"],"pokeball":"cherishball"}
],
tier: "Uber"
},
arceus: {
viableMoves: {"swordsdance":1,"extremespeed":1,"shadowclaw":1,"earthquake":1,"recover":1},
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusbug: {
viableMoves: {"swordsdance":1,"xscissor":1,"stoneedge":1,"recover":1,"calmmind":1,"judgment":1,"icebeam":1,"fireblast":1},
requiredItem: "Insect Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusdark: {
viableMoves: {"calmmind":1,"judgment":1,"recover":1,"refresh":1},
requiredItem: "Dread Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusdragon: {
viableMoves: {"swordsdance":1,"outrage":1,"extremespeed":1,"earthquake":1,"recover":1},
requiredItem: "Draco Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceuselectric: {
viableMoves: {"calmmind":1,"judgment":1,"recover":1,"icebeam":1},
requiredItem: "Zap Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusfairy: {
requiredItem: "Pixie Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
gen: 6,
tier: "Uber"
},
arceusfighting: {
viableMoves: {"calmmind":1,"judgment":1,"icebeam":1,"darkpulse":1,"recover":1,"toxic":1},
requiredItem: "Fist Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusfire: {
viableMoves: {"calmmind":1,"flamethrower":1,"fireblast":1,"thunderbolt":1,"recover":1},
requiredItem: "Flame Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusflying: {
viableMoves: {"calmmind":1,"judgment":1,"refresh":1,"recover":1},
requiredItem: "Sky Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusghost: {
viableMoves: {"calmmind":1,"judgment":1,"focusblast":1,"flamethrower":1,"recover":1,"swordsdance":1,"shadowclaw":1,"brickbreak":1,"willowisp":1,"roar":1},
requiredItem: "Spooky Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusgrass: {
viableMoves: {"calmmind":1,"icebeam":1,"judgment":1,"earthpower":1,"recover":1,"stealthrock":1,"thunderwave":1},
requiredItem: "Meadow Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusground: {
viableMoves: {"swordsdance":1,"earthquake":1,"stoneedge":1,"recover":1,"calmmind":1,"judgment":1,"icebeam":1,"stealthrock":1},
requiredItem: "Earth Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusice: {
viableMoves: {"calmmind":1,"judgment":1,"icebeam":1,"thunderbolt":1,"focusblast":1,"recover":1},
requiredItem: "Icicle Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceuspoison: {
viableMoves: {"calmmind":1,"judgment":1,"sludgebomb":1,"focusblast":1,"fireblast":1,"recover":1,"willowisp":1,"icebeam":1,"stealthrock":1},
requiredItem: "Toxic Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceuspsychic: {
viableMoves: {"calmmind":1,"psyshock":1,"focusblast":1,"recover":1,"willowisp":1,"judgment":1},
requiredItem: "Mind Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceusrock: {
viableMoves: {"calmmind":1,"judgment":1,"recover":1,"willowisp":1,"swordsdance":1,"stoneedge":1,"earthquake":1,"refresh":1},
requiredItem: "Stone Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceussteel: {
viableMoves: {"calmmind":1,"judgment":1,"recover":1,"roar":1,"willowisp":1,"swordsdance":1,"ironhead":1},
requiredItem: "Iron Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
arceuswater: {
viableMoves: {"swordsdance":1,"waterfall":1,"extremespeed":1,"dragonclaw":1,"recover":1,"calmmind":1,"judgment":1,"icebeam":1,"fireblast":1},
requiredItem: "Splash Plate",
eventPokemon: [
{"generation":4,"level":100,"moves":["judgment","roaroftime","spacialrend","shadowforce"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["recover","hyperbeam","perishsong","judgment"]}
],
tier: "Uber"
},
victini: {
viableMoves: {"vcreate":1,"boltstrike":1,"uturn":1,"psychic":1,"focusblast":1,"blueflare":1},
eventPokemon: [
{"generation":5,"level":15,"moves":["incinerate","quickattack","endure","confusion"]},
{"generation":5,"level":50,"moves":["vcreate","fusionflare","fusionbolt","searingshot"],"pokeball":"cherishball"},
{"generation":5,"level":100,"moves":["vcreate","blueflare","boltstrike","glaciate"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
snivy: {
viableMoves: {"leafstorm":1,"hiddenpowerfire":1,"substitute":1,"leechseed":1,"hiddenpowerice":1,"gigadrain":1},
eventPokemon: [
{"generation":5,"level":5,"gender":"M","nature":"Hardy","isHidden":false,"moves":["growth","synthesis","energyball","aromatherapy"],"pokeball":"cherishball"}
],
unreleasedHidden: true,
tier: "LC"
},
servine: {
viableMoves: {"leafstorm":1,"hiddenpowerfire":1,"substitute":1,"leechseed":1,"hiddenpowerice":1,"gigadrain":1},
unreleasedHidden: true,
tier: "NFE"
},
serperior: {
viableMoves: {"leafstorm":1,"hiddenpowerfire":1,"substitute":1,"leechseed":1,"dragonpulse":1,"gigadrain":1},
eventPokemon: [
{"generation":5,"level":100,"gender":"M","isHidden":false,"moves":["leafstorm","substitute","gigadrain","leechseed"],"pokeball":"cherishball"}
],
unreleasedHidden: true,
tier: "Limbo"
},
tepig: {
viableMoves: {"flamecharge":1,"flareblitz":1,"wildcharge":1,"superpower":1,"headsmash":1},
tier: "LC"
},
pignite: {
viableMoves: {"flamecharge":1,"flareblitz":1,"wildcharge":1,"superpower":1,"headsmash":1},
tier: "NFE"
},
emboar: {
viableMoves: {"flareblitz":1,"superpower":1,"flamecharge":1,"wildcharge":1,"headsmash":1,"earthquake":1,"fireblast":1},
eventPokemon: [
{"generation":5,"level":100,"gender":"M","isHidden":false,"moves":["flareblitz","hammerarm","wildcharge","headsmash"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
oshawott: {
viableMoves: {"swordsdance":1,"waterfall":1,"aquajet":1,"xscissor":1},
unreleasedHidden: true,
tier: "LC"
},
dewott: {
viableMoves: {"swordsdance":1,"waterfall":1,"aquajet":1,"xscissor":1},
unreleasedHidden: true,
tier: "NFE"
},
samurott: {
viableMoves: {"swordsdance":1,"aquajet":1,"waterfall":1,"megahorn":1,"superpower":1},
eventPokemon: [
{"generation":5,"level":100,"gender":"M","isHidden":false,"moves":["hydropump","icebeam","megahorn","superpower"],"pokeball":"cherishball"}
],
unreleasedHidden: true,
tier: "Limbo"
},
patrat: {
viableMoves: {"swordsdance":1,"batonpass":1,"substitute":1,"hypnosis":1,"return":1,"superfang":1},
tier: "LC"
},
watchog: {
viableMoves: {"swordsdance":1,"batonpass":1,"substitute":1,"hypnosis":1,"return":1,"superfang":1},
tier: "Limbo"
},
lillipup: {
viableMoves: {"return":1,"wildcharge":1,"firefang":1,"crunch":1,"icefang":1},
tier: "LC"
},
herdier: {
viableMoves: {"return":1,"wildcharge":1,"firefang":1,"crunch":1,"icefang":1},
tier: "NFE"
},
stoutland: {
viableMoves: {"return":1,"wildcharge":1,"superpower":1,"crunch":1,"icefang":1},
tier: "Limbo"
},
purrloin: {
viableMoves: {"swagger":1,"thunderwave":1,"substitute":1,"foulplay":1},
tier: "LC"
},
liepard: {
viableMoves: {"swagger":1,"thunderwave":1,"substitute":1,"foulplay":1},
eventPokemon: [
{"generation":5,"level":20,"gender":"F","nature":"Jolly","isHidden":true,"moves":["fakeout","foulplay","encore","swagger"]}
],
tier: "Limbo C"
},
pansage: {
viableMoves: {"leafstorm":1,"hiddenpowerfire":1,"hiddenpowerice":1,"gigadrain":1,"nastyplot":1,"substitute":1,"leechseed":1},
eventPokemon: [
{"generation":5,"level":1,"gender":"M","nature":"Brave","isHidden":false,"moves":["bulletseed","bite","solarbeam","dig"],"pokeball":"cherishball"},
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["leer","lick","vinewhip","leafstorm"]},
{"generation":5,"level":30,"gender":"M","nature":"Serious","isHidden":false,"moves":["seedbomb","solarbeam","rocktomb","dig"],"pokeball":"cherishball"}
],
tier: "LC"
},
simisage: {
viableMoves: {"nastyplot":1,"leafstorm":1,"hiddenpowerfire":1,"hiddenpowerice":1,"gigadrain":1,"focusblast":1,"substitute":1,"leechseed":1,"synthesis":1},
tier: "Limbo"
},
pansear: {
viableMoves: {"nastyplot":1,"fireblast":1,"hiddenpowerelectric":1,"hiddenpowerground":1,"sunnyday":1,"solarbeam":1,"overheat":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["leer","lick","incinerate","heatwave"]}
],
tier: "LC"
},
simisear: {
viableMoves: {"nastyplot":1,"fireblast":1,"focusblast":1,"grassknot":1,"hiddenpowerground":1,"substitute":1,"flamethrower":1,"overheat":1},
tier: "Limbo"
},
panpour: {
viableMoves: {"nastyplot":1,"hydropump":1,"hiddenpowergrass":1,"substitute":1,"surf":1,"icebeam":1},
eventPokemon: [
{"generation":5,"level":10,"gender":"M","isHidden":true,"moves":["leer","lick","watergun","hydropump"]}
],
tier: "LC"
},
simipour: {
viableMoves: {"nastyplot":1,"hydropump":1,"icebeam":1,"substitute":1,"grassknot":1,"surf":1},
tier: "Limbo"
},
munna: {
viableMoves: {"psychic":1,"hiddenpowerfighting":1,"hypnosis":1,"calmmind":1,"moonlight":1,"thunderwave":1,"batonpass":1,"psyshock":1,"healbell":1,"signalbeam":1},
tier: "LC"
},
musharna: {
viableMoves: {"calmmind":1,"thunderwave":1,"moonlight":1,"psychic":1,"hiddenpowerfighting":1,"batonpass":1,"psyshock":1,"healbell":1,"signalbeam":1},
eventPokemon: [
{"generation":5,"level":50,"isHidden":true,"moves":["defensecurl","luckychant","psybeam","hypnosis"]}
],
tier: "Limbo"
},
pidove: {
viableMoves: {"pluck":1,"uturn":1,"return":1,"detect":1,"roost":1,"wish":1},
eventPokemon: [
{"generation":5,"level":1,"gender":"F","nature":"Hardy","isHidden":false,"abilities":["superluck"],"moves":["gust","quickattack","aircutter"]}
],
tier: "LC"
},
tranquill: {
viableMoves: {"pluck":1,"uturn":1,"return":1,"detect":1,"roost":1,"wish":1},
tier: "NFE"
},
unfezant: {
viableMoves: {"pluck":1,"uturn":1,"return":1,"detect":1,"roost":1,"wish":1},
tier: "Limbo"
},
blitzle: {
viableMoves: {"voltswitch":1,"hiddenpowergrass":1,"wildcharge":1,"mefirst":1},
tier: "LC"
},
zebstrika: {
viableMoves: {"voltswitch":1,"hiddenpowergrass":1,"overheat":1,"wildcharge":1},
tier: "Limbo"
},
roggenrola: {
viableMoves: {"autotomize":1,"stoneedge":1,"stealthrock":1,"rockblast":1,"earthquake":1,"explosion":1},
tier: "LC"
},
boldore: {
viableMoves: {"autotomize":1,"stoneedge":1,"stealthrock":1,"rockblast":1,"earthquake":1,"explosion":1},
tier: "NFE"
},
gigalith: {
viableMoves: {"stealthrock":1,"rockblast":1,"earthquake":1,"explosion":1,"stoneedge":1,"autotomize":1,"superpower":1},
tier: "Limbo"
},
woobat: {
viableMoves: {"calmmind":1,"psychic":1,"airslash":1,"gigadrain":1,"roost":1,"heatwave":1,"storedpower":1},
tier: "LC"
},
swoobat: {
viableMoves: {"calmmind":1,"psychic":1,"airslash":1,"gigadrain":1,"roost":1,"heatwave":1,"storedpower":1},
tier: "Limbo"
},
drilbur: {
viableMoves: {"swordsdance":1,"rapidspin":1,"earthquake":1,"rockslide":1,"shadowclaw":1,"return":1,"xscissor":1},
tier: "LC"
},
excadrill: {
viableMoves: {"swordsdance":1,"rapidspin":1,"earthquake":1,"rockslide":1,"ironhead":1},
tier: "OU"
},
audino: {
viableMoves: {"wish":1,"protect":1,"healbell":1,"toxic":1,"thunderwave":1,"reflect":1,"lightscreen":1,"return":1},
eventPokemon: [
{"generation":5,"level":30,"gender":"F","nature":"Calm","isHidden":false,"abilities":["healer"],"moves":["healpulse","helpinghand","refresh","doubleslap"],"pokeball":"cherishball"},
{"generation":5,"level":30,"gender":"F","nature":"Serious","isHidden":false,"abilities":["healer"],"moves":["healpulse","helpinghand","refresh","present"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
timburr: {
viableMoves: {"machpunch":1,"bulkup":1,"drainpunch":1,"icepunch":1},
tier: "LC"
},
gurdurr: {
viableMoves: {"bulkup":1,"machpunch":1,"drainpunch":1,"icepunch":1},
tier: "Limbo"
},
conkeldurr: {
viableMoves: {"bulkup":1,"machpunch":1,"drainpunch":1,"icepunch":1},
tier: "OU"
},
tympole: {
viableMoves: {"hydropump":1,"surf":1,"sludgewave":1,"earthpower":1,"hiddenpowerelectric":1},
tier: "LC"
},
palpitoad: {
viableMoves: {"hydropump":1,"surf":1,"sludgewave":1,"earthpower":1,"hiddenpowerelectric":1,"stealthrock":1},
tier: "NFE"
},
seismitoad: {
viableMoves: {"hydropump":1,"surf":1,"sludgewave":1,"earthpower":1,"hiddenpowerelectric":1,"stealthrock":1},
tier: "Limbo"
},
throh: {
viableMoves: {"bulkup":1,"circlethrow":1,"icepunch":1,"stormthrow":1,"rest":1,"sleeptalk":1},
tier: "Limbo"
},
sawk: {
viableMoves: {"closecombat":1,"earthquake":1,"icepunch":1,"stoneedge":1,"bulkup":1},
tier: "Limbo"
},
sewaddle: {
viableMoves: {"calmmind":1,"gigadrain":1,"bugbuzz":1,"hiddenpowerfire":1,"hiddenpowerice":1,"airslash":1},
tier: "LC"
},
swadloon: {
viableMoves: {"calmmind":1,"gigadrain":1,"bugbuzz":1,"hiddenpowerfire":1,"hiddenpowerice":1,"airslash":1,"stickyweb":1},
tier: "NFE"
},
leavanny: {
viableMoves: {"swordsdance":1,"leafblade":1,"xscissor":1,"batonpass":1,"agility":1,"stickyweb":1,"shadowclaw":1,"poisonjab":1},
tier: "Limbo"
},
venipede: {
viableMoves: {"toxicspikes":1,"steamroller":1,"spikes":1,"poisonjab":1},
tier: "LC"
},
whirlipede: {
viableMoves: {"toxicspikes":1,"steamroller":1,"spikes":1,"poisonjab":1},
tier: "Limbo"
},
scolipede: {
viableMoves: {"spikes":1,"toxicspikes":1,"megahorn":1,"rockslide":1,"earthquake":1,"swordsdance":1,"batonpass":1,"aquatail":1,"superpower":1},
tier: "Limbo A"
},
cottonee: {
viableMoves: {"encore":1,"taunt":1,"substitute":1,"leechseed":1,"toxic":1,"stunspore":1},
tier: "LC"
},
whimsicott: {
viableMoves: {"encore":1,"taunt":1,"substitute":1,"leechseed":1,"uturn":1,"toxic":1,"stunspore":1,"memento":1,"tailwind":1},
eventPokemon: [
{"generation":5,"level":50,"gender":"F","nature":"Timid","isHidden":false,"abilities":["prankster"],"moves":["swagger","gigadrain","beatup","helpinghand"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
petilil: {
viableMoves: {"sunnyday":1,"sleeppowder":1,"solarbeam":1,"hiddenpowerfire":1,"hiddenpowerice":1,"healingwish":1},
tier: "LC"
},
lilligant: {
viableMoves: {"quiverdance":1,"gigadrain":1,"sleeppowder":1,"hiddenpowerice":1,"hiddenpowerfire":1,"hiddenpowerrock":1,"petaldance":1},
tier: "Limbo"
},
basculin: {
viableMoves: {"waterfall":1,"aquajet":1,"superpower":1,"crunch":1,"doubleedge":1},
tier: "Limbo"
},
basculinbluestriped: {
viableMoves: {"waterfall":1,"aquajet":1,"superpower":1,"crunch":1,"doubleedge":1},
tier: "Limbo"
},
sandile: {
viableMoves: {"earthquake":1,"stoneedge":1,"pursuit":1,"crunch":1},
tier: "LC"
},
krokorok: {
viableMoves: {"earthquake":1,"stoneedge":1,"pursuit":1,"crunch":1},
tier: "NFE"
},
krookodile: {
viableMoves: {"earthquake":1,"stoneedge":1,"pursuit":1,"crunch":1,"bulkup":1,"superpower":1},
tier: "Limbo C"
},
darumaka: {
viableMoves: {"uturn":1,"flareblitz":1,"firepunch":1,"rockslide":1,"superpower":1},
tier: "LC"
},
darmanitan: {
viableMoves: {"uturn":1,"flareblitz":1,"firepunch":1,"rockslide":1,"earthquake":1,"superpower":1},
eventPokemon: [
{"generation":5,"level":35,"isHidden":true,"moves":["thrash","bellydrum","flareblitz","hammerarm"]}
],
tier: "Limbo B"
},
maractus: {
viableMoves: {"spikes":1,"gigadrain":1,"leechseed":1,"hiddenpowerfire":1,"toxic":1,"suckerpunch":1},
tier: "Limbo"
},
dwebble: {
viableMoves: {"stealthrock":1,"spikes":1,"shellsmash":1,"earthquake":1,"rockblast":1,"xscissor":1,"stoneedge":1.},
tier: "LC"
},
crustle: {
viableMoves: {"stealthrock":1,"spikes":1,"shellsmash":1,"earthquake":1,"rockblast":1,"xscissor":1,"stoneedge":1,},
tier: "Limbo"
},
scraggy: {
viableMoves: {"dragondance":1,"icepunch":1,"highjumpkick":1,"drainpunch":1,"rest":1,"bulkup":1,"crunch":1,"knockoff":1},
eventPokemon: [
{"generation":5,"level":1,"gender":"M","nature":"Adamant","isHidden":false,"abilities":["moxie"],"moves":["headbutt","leer","highjumpkick","lowkick"],"pokeball":"cherishball"}
],
tier: "LC"
},
scrafty: {
viableMoves: {"dragondance":1,"icepunch":1,"highjumpkick":1,"drainpunch":1,"rest":1,"bulkup":1,"crunch":1,"knockoff":1},
eventPokemon: [
{"generation":5,"level":50,"gender":"M","nature":"Brave","isHidden":false,"abilities":["moxie"],"moves":["firepunch","payback","drainpunch","substitute"],"pokeball":"cherishball"}
],
tier: "Limbo C"
},
sigilyph: {
viableMoves: {"cosmicpower":1,"roost":1,"storedpower":1,"psychoshift":1},
tier: "Limbo C"
},
yamask: {
viableMoves: {"nastyplot":1,"trickroom":1,"shadowball":1,"hiddenpowerfighting":1,"willowisp":1,"haze":1,"rest":1,"sleeptalk":1,"painsplit":1},
tier: "LC"
},
cofagrigus: {
viableMoves: {"nastyplot":1,"trickroom":1,"shadowball":1,"hiddenpowerfighting":1,"willowisp":1,"haze":1,"rest":1,"sleeptalk":1,"painsplit":1},
tier: "Limbo B"
},
tirtouga: {
viableMoves: {"shellsmash":1,"aquajet":1,"waterfall":1,"stoneedge":1,"earthquake":1,"stealthrock":1},
eventPokemon: [
{"generation":5,"level":15,"gender":"M","isHidden":false,"abilities":["sturdy"],"moves":["bite","protect","aquajet","bodyslam"],"pokeball":"cherishball"}
],
tier: "LC"
},
carracosta: {
viableMoves: {"shellsmash":1,"aquajet":1,"waterfall":1,"stoneedge":1,"earthquake":1,"stealthrock":1},
tier: "Limbo"
},
archen: {
viableMoves: {"stoneedge":1,"rockslide":1,"earthquake":1,"uturn":1,"pluck":1,"headsmash":1},
eventPokemon: [
{"generation":5,"level":15,"gender":"M","moves":["headsmash","wingattack","doubleteam","scaryface"],"pokeball":"cherishball"}
],
tier: "LC"
},
archeops: {
viableMoves: {"stoneedge":1,"rockslide":1,"earthquake":1,"uturn":1,"pluck":1,"headsmash":1},
tier: "Limbo"
},
trubbish: {
viableMoves: {"clearsmog":1,"toxicspikes":1,"spikes":1,"gunkshot":1,"painsplit":1,"toxic":1},
tier: "LC"
},
garbodor: {
viableMoves: {"spikes":1,"toxicspikes":1,"gunkshot":1,"clearsmog":1,"painsplit":1,"toxic":1},
tier: "Limbo"
},
zorua: {
viableMoves: {"suckerpunch":1,"extrasensory":1,"darkpulse":1,"hiddenpowerfighting":1,"uturn":1,"knockoff":1},
tier: "LC"
},
zoroark: {
viableMoves: {"suckerpunch":1,"darkpulse":1,"focusblast":1,"flamethrower":1,"uturn":1,"nastyplot":1,"knockoff":1},
eventPokemon: [
{"generation":5,"level":50,"gender":"M","nature":"Quirky","moves":["agility","embargo","punishment","snarl"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
minccino: {
viableMoves: {"return":1,"tailslap":1,"wakeupslap":1,"uturn":1,"aquatail":1},
tier: "LC"
},
cinccino: {
viableMoves: {"return":1,"tailslap":1,"wakeupslap":1,"uturn":1,"aquatail":1,"bulletseed":1,"rockblast":1},
tier: "Limbo C"
},
gothita: {
viableMoves: {"psychic":1,"thunderbolt":1,"hiddenpowerfighting":1,"shadowball":1,"substitute":1,"calmmind":1,"reflect":1,"lightscreen":1,"trick":1,"grassknot":1,"signalbeam":1},
tier: "LC"
},
gothorita: {
viableMoves: {"psychic":1,"thunderbolt":1,"hiddenpowerfighting":1,"shadowball":1,"substitute":1,"calmmind":1,"reflect":1,"lightscreen":1,"trick":1,"grassknot":1,"signalbeam":1},
eventPokemon: [
{"generation":5,"level":32,"gender":"M","isHidden":true,"moves":["psyshock","flatter","futuresight","mirrorcoat"]},
{"generation":5,"level":32,"gender":"M","isHidden":true,"moves":["psyshock","flatter","futuresight","imprison"]}
],
tier: "NFE"
},
gothitelle: {
viableMoves: {"psychic":1,"thunderbolt":1,"hiddenpowerfighting":1,"shadowball":1,"substitute":1,"calmmind":1,"reflect":1,"lightscreen":1,"trick":1,"psyshock":1,"grassknot":1,"signalbeam":1},
tier: "Limbo"
},
solosis: {
viableMoves: {"calmmind":1,"recover":1,"psychic":1,"hiddenpowerfighting":1,"shadowball":1,"trickroom":1,"psyshock":1},
tier: "LC"
},
duosion: {
viableMoves: {"calmmind":1,"recover":1,"psychic":1,"hiddenpowerfighting":1,"shadowball":1,"trickroom":1,"psyshock":1},
tier: "NFE"
},
reuniclus: {
viableMoves: {"calmmind":1,"recover":1,"psychic":1,"focusblast":1,"shadowball":1,"trickroom":1,"psyshock":1,"hiddenpowerfire":1},
tier: "Limbo B"
},
ducklett: {
viableMoves: {"scald":1,"airslash":1,"roost":1,"hurricane":1,"icebeam":1,"hiddenpowergrass":1,"bravebird":1,"defog":1},
tier: "LC"
},
swanna: {
viableMoves: {"airslash":1,"roost":1,"hurricane":1,"surf":1,"icebeam":1,"raindance":1,"defog":1},
tier: "Limbo"
},
vanillite: {
viableMoves: {"icebeam":1,"explosion":1,"hiddenpowerelectric":1,"hiddenpowerfighting":1,"autotomize":1},
tier: "LC"
},
vanillish: {
viableMoves: {"icebeam":1,"explosion":1,"hiddenpowerelectric":1,"hiddenpowerfighting":1,"autotomize":1},
tier: "NFE"
},
vanilluxe: {
viableMoves: {"icebeam":1,"explosion":1,"hiddenpowerelectric":1,"hiddenpowerfighting":1,"autotomize":1},
tier: "Limbo"
},
deerling: {
viableMoves: {"workup":1,"agility":1,"batonpass":1,"seedbomb":1,"jumpkick":1,"naturepower":1,"synthesis":1,"return":1,"thunderwave":1},
eventPokemon: [
{"generation":5,"level":30,"gender":"F","isHidden":true,"moves":["feintattack","takedown","jumpkick","aromatherapy"]}
],
tier: "LC"
},
sawsbuck: {
viableMoves: {"swordsdance":1,"hornleech":1,"jumpkick":1,"return":1,"substitute":1,"synthesis":1,"batonpass":1},
tier: "Limbo"
},
emolga: {
viableMoves: {"agility":1,"chargebeam":1,"batonpass":1,"substitute":1,"thunderbolt":1,"airslash":1,"roost":1},
tier: "Limbo"
},
karrablast: {
viableMoves: {"swordsdance":1,"megahorn":1,"return":1,"substitute":1},
eventPokemon: [
{"generation":5,"level":30,"isHidden":false,"moves":["furyattack","headbutt","falseswipe","bugbuzz"],"pokeball":"cherishball"},
{"generation":5,"level":50,"isHidden":false,"moves":["megahorn","takedown","xscissor","flail"],"pokeball":"cherishball"}
],
tier: "LC"
},
escavalier: {
viableMoves: {"megahorn":1,"pursuit":1,"ironhead":1,"knockoff":1,"swordsdance":1,"drillrun":1},
tier: "Limbo"
},
foongus: {
viableMoves: {"spore":1,"stunspore":1,"gigadrain":1,"clearsmog":1,"hiddenpowerfire":1,"synthesis":1,"sludgebomb":1},
tier: "LC"
},
amoonguss: {
viableMoves: {"spore":1,"stunspore":1,"gigadrain":1,"clearsmog":1,"hiddenpowerfire":1,"synthesis":1,"sludgebomb":1},
tier: "Limbo"
},
frillish: {
viableMoves: {"scald":1,"willowisp":1,"recover":1,"toxic":1,"shadowball":1,"taunt":1},
tier: "LC"
},
jellicent: {
viableMoves: {"scald":1,"willowisp":1,"recover":1,"toxic":1,"shadowball":1,"icebeam":1,"gigadrain":1,"taunt":1},
eventPokemon: [
{"generation":5,"level":40,"isHidden":true,"moves":["waterpulse","ominouswind","brine","raindance"]}
],
tier: "Limbo A"
},
alomomola: {
viableMoves: {"wish":1,"protect":1,"waterfall":1,"toxic":1,"scald":1},
tier: "Limbo"
},
joltik: {
viableMoves: {"thunderbolt":1,"bugbuzz":1,"hiddenpowerice":1,"gigadrain":1,"voltswitch":1,"stickyweb":1},
tier: "LC"
},
galvantula: {
viableMoves: {"thunder":1,"hiddenpowerice":1,"gigadrain":1,"bugbuzz":1,"voltswitch":1,"stickyweb":1},
tier: "Limbo A"
},
ferroseed: {
viableMoves: {"spikes":1,"stealthrock":1,"leechseed":1,"seedbomb":1,"protect":1,"thunderwave":1,"gyroball":1},
tier: "Limbo"
},
ferrothorn: {
viableMoves: {"spikes":1,"stealthrock":1,"leechseed":1,"powerwhip":1,"thunderwave":1,"protect":1},
tier: "OU"
},
klink: {
viableMoves: {"shiftgear":1,"return":1,"geargrind":1,"wildcharge":1,"substitute":1},
tier: "LC"
},
klang: {
viableMoves: {"shiftgear":1,"return":1,"geargrind":1,"wildcharge":1,"substitute":1},
tier: "NFE"
},
klinklang: {
viableMoves: {"shiftgear":1,"return":1,"geargrind":1,"wildcharge":1},
tier: "Limbo"
},
tynamo: {
viableMoves: {"spark":1,"chargebeam":1,"thunderwave":1,"tackle":1},
tier: "LC"
},
eelektrik: {
viableMoves: {"uturn":1,"voltswitch":1,"acidspray":1,"wildcharge":1,"thunderbolt":1,"gigadrain":1,"aquatail":1,"coil":1},
tier: "NFE"
},
eelektross: {
viableMoves: {"thunderbolt":1,"flamethrower":1,"uturn":1,"voltswitch":1,"acidspray":1,"wildcharge":1,"drainpunch":1,"superpower":1,"thunderpunch":1,"gigadrain":1,"aquatail":1,"coil":1},
tier: "Limbo C"
},
elgyem: {
viableMoves: {"nastyplot":1,"psychic":1,"thunderbolt":1,"hiddenpowerfighting":1,"substitute":1,"calmmind":1,"recover":1,"trick":1, "trickroom":1, "signalbeam":1},
tier: "LC"
},
beheeyem: {
viableMoves: {"nastyplot":1,"psychic":1,"thunderbolt":1,"hiddenpowerfighting":1,"substitute":1,"calmmind":1,"recover":1,"trick":1,"trickroom":1, "signalbeam":1},
tier: "Limbo"
},
litwick: {
viableMoves: {"calmmind":1,"shadowball":1,"energyball":1,"fireblast":1,"overheat":1,"hiddenpowerfighting":1,"hiddenpowerground":1,"hiddenpowerrock":1,"trick":1,"substitute":1, "painsplit":1},
tier: "LC"
},
lampent: {
viableMoves: {"calmmind":1,"shadowball":1,"energyball":1,"fireblast":1,"overheat":1,"hiddenpowerfighting":1,"hiddenpowerground":1,"hiddenpowerrock":1,"trick":1,"substitute":1, "painsplit":1},
tier: "Limbo"
},
chandelure: {
viableMoves: {"shadowball":1,"energyball":1,"fireblast":1,"overheat":1,"hiddenpowerfighting":1,"hiddenpowerground":1,"hiddenpowerrock":1,"trick":1,"substitute":1,"painsplit":1},
eventPokemon: [
{"generation":5,"level":50,"gender":"F","nature":"Modest","isHidden":false,"abilities":["flashfire"],"moves":["heatwave","shadowball","energyball","psychic"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
axew: {
viableMoves: {"dragondance":1,"outrage":1,"dragonclaw":1,"swordsdance":1,"aquatail":1,"superpower":1,"poisonjab":1,"taunt":1, "substitute":1},
eventPokemon: [
{"generation":5,"level":1,"gender":"M","nature":"Naive","isHidden":false,"abilities":["moldbreaker"],"moves":["scratch","dragonrage"]},
{"generation":5,"level":10,"gender":"F","isHidden":false,"abilities":["moldbreaker"],"moves":["dragonrage","return","endure","dragonclaw"],"pokeball":"cherishball"},
{"generation":5,"level":30,"gender":"M","nature":"Naive","isHidden":false,"abilities":["rivalry"],"moves":["dragonrage","scratch","outrage","gigaimpact"],"pokeball":"cherishball"}
],
tier: "LC"
},
fraxure: {
viableMoves: {"dragondance":1,"swordsdance":1,"outrage":1,"dragonclaw":1,"aquatail":1,"superpower":1,"poisonjab":1,"taunt":1, "substitute":1},
tier: "Limbo"
},
haxorus: {
viableMoves: {"dragondance":1,"swordsdance":1,"outrage":1,"dragonclaw":1,"earthquake":1,"aquatail":1,"superpower":1,"poisonjab":1,"taunt":1, "substitute":1},
eventPokemon: [
{"generation":5,"level":59,"gender":"F","nature":"Naive","isHidden":false,"abilities":["moldbreaker"],"moves":["earthquake","dualchop","xscissor","dragondance"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
cubchoo: {
viableMoves: {"icebeam":1,"surf":1,"hiddenpowergrass":1,"superpower":1},
eventPokemon: [
{"generation":5,"level":15,"isHidden":false,"moves":["powdersnow","growl","bide","icywind"],"pokeball":"cherishball"}
],
tier: "LC"
},
beartic: {
viableMoves: {"iciclecrash":1,"superpower":1,"nightslash":1,"stoneedge":1,"swordsdance":1,"aquajet":1},
tier: "Limbo"
},
cryogonal: {
viableMoves: {"icebeam":1,"recover":1,"toxic":1,"rapidspin":1,"reflect":1,"freezedry":1,"hiddenpowerfire":1},
tier: "Limbo"
},
shelmet: {
viableMoves: {"spikes":1,"yawn":1,"substitute":1,"acidarmor":1,"batonpass":1,"recover":1,"toxic":1,"bugbuzz":1,"infestation":1},
eventPokemon: [
{"generation":5,"level":30,"isHidden":false,"moves":["strugglebug","megadrain","yawn","protect"],"pokeball":"cherishball"},
{"generation":5,"level":50,"isHidden":false,"moves":["encore","gigadrain","bodyslam","bugbuzz"],"pokeball":"cherishball"}
],
tier: "LC"
},
accelgor: {
viableMoves: {"spikes":1,"yawn":1,"bugbuzz":1,"focusblast":1,"gigadrain":1,"hiddenpowerrock":1,"encore":1,"sludgebomb":1},
tier: "Limbo"
},
stunfisk: {
viableMoves: {"discharge":1,"thunderbolt":1,"earthpower":1,"scald":1,"toxic":1,"rest":1,"sleeptalk":1,"stealthrock":1},
tier: "Limbo"
},
mienfoo: {
viableMoves: {"uturn":1,"drainpunch":1,"stoneedge":1,"swordsdance":1,"batonpass":1,"highjumpkick":1,"fakeout":1,"knockoff":1},
tier: "LC"
},
mienshao: {
viableMoves: {"uturn":1,"fakeout":1,"highjumpkick":1,"stoneedge":1,"drainpunch":1,"swordsdance":1,"batonpass":1,"knockoff":1},
tier: "Limbo C"
},
druddigon: {
viableMoves: {"outrage":1,"superpower":1,"earthquake":1,"suckerpunch":1,"dragonclaw":1,"dragontail":1,"substitute":1,"glare":1,"stealthrock":1,"firepunch":1,"thunderpunch":1},
eventPokemon: [
{"generation":5,"level":1,"shiny":true,"isHidden":false,"moves":["leer","scratch"]}
],
tier: "Limbo"
},
golett: {
viableMoves: {"earthquake":1,"shadowpunch":1,"dynamicpunch":1,"icepunch":1,"stealthrock":1,"rockpolish":1},
tier: "LC"
},
golurk: {
viableMoves: {"earthquake":1,"shadowpunch":1,"dynamicpunch":1,"icepunch":1,"stoneedge":1,"stealthrock":1,"rockpolish":1},
eventPokemon: [
{"generation":5,"level":70,"shiny":true,"isHidden":false,"abilities":["ironfist"],"moves":["shadowpunch","hyperbeam","gyroball","hammerarm"],"pokeball":"cherishball"}
],
tier: "Limbo"
},
pawniard: {
viableMoves: {"swordsdance":1,"substitute":1,"suckerpunch":1,"ironhead":1,"brickbreak":1,"nightslash":1},
tier: "LC"
},
bisharp: {
viableMoves: {"swordsdance":1,"substitute":1,"suckerpunch":1,"ironhead":1,"brickbreak":1,"nightslash":1},
tier: "Limbo A"
},
bouffalant: {
viableMoves: {"headcharge":1,"earthquake":1,"stoneedge":1,"megahorn":1,"swordsdance":1,"superpower":1},
tier: "Limbo"
},
rufflet: {
viableMoves: {"bravebird":1,"rockslide":1,"return":1,"uturn":1,"substitute":1,"bulkup":1,"roost":1},
tier: "LC"
},
braviary: {
viableMoves: {"bravebird":1,"superpower":1,"return":1,"uturn":1,"substitute":1,"rockslide":1,"bulkup":1,"roost":1},
eventPokemon: [
{"generation":5,"level":25,"gender":"M","isHidden":true,"moves":["wingattack","honeclaws","scaryface","aerialace"]}
],
tier: "Limbo"
},
vullaby: {
viableMoves: {"knockoff":1,"roost":1,"taunt":1,"whirlwind":1,"toxic":1,"defog":1,"uturn":1,"bravebird":1},
tier: "LC"
},
mandibuzz: {
viableMoves: {"knockoff":1,"roost":1,"taunt":1,"whirlwind":1,"toxic":1,"uturn":1,"bravebird":1,"defog":1},
eventPokemon: [
{"generation":5,"level":25,"gender":"F","isHidden":true,"moves":["pluck","nastyplot","flatter","feintattack"]}
],
tier: "OU"
},
heatmor: {
viableMoves: {"fireblast":1,"suckerpunch":1,"focusblast":1,"gigadrain":1},
tier: "Limbo"
},
durant: {
viableMoves: {"honeclaws":1,"ironhead":1,"xscissor":1,"stoneedge":1,"batonpass":1,"superpower":1},
tier: "Limbo"
},
deino: {
viableMoves: {"outrage":1,"crunch":1,"firefang":1,"dragontail":1,"thunderwave":1,"superpower":1},
eventPokemon: [
{"generation":5,"level":1,"shiny":true,"moves":["tackle","dragonrage"]}
],
tier: "LC"
},
zweilous: {
viableMoves: {"outrage":1,"crunch":1,"firefang":1,"dragontail":1,"thunderwave":1,"superpower":1},
tier: "Limbo"
},
hydreigon: {
viableMoves: {"uturn":1,"dracometeor":1,"substitute":1,"dragonpulse":1,"focusblast":1,"fireblast":1,"surf":1,"darkpulse":1,"roost":1,"flashcannon":1,"superpower":1},
eventPokemon: [
{"generation":5,"level":70,"shiny":true,"gender":"M","moves":["hypervoice","dragonbreath","flamethrower","focusblast"],"pokeball":"cherishball"}
],
tier: "Limbo A"
},
larvesta: {
viableMoves: {"flareblitz":1,"uturn":1,"wildcharge":1,"zenheadbutt":1,"morningsun":1,"willowisp":1},
tier: "LC"
},
volcarona: {
viableMoves: {"quiverdance":1,"fierydance":1,"fireblast":1,"bugbuzz":1,"roost":1,"gigadrain":1,"hiddenpowerice":1,"rest":1},
eventPokemon: [
{"generation":5,"level":35,"isHidden":false,"moves":["stringshot","leechlife","gust","firespin"]},
{"generation":5,"level":77,"gender":"M","nature":"Calm","isHidden":false,"moves":["bugbuzz","overheat","hyperbeam","quiverdance"],"pokeball":"cherishball"}
],
tier: "OU"
},
cobalion: {
viableMoves: {"closecombat":1,"ironhead":1,"swordsdance":1,"substitute":1,"stoneedge":1,"voltswitch":1,"hiddenpowerice":1,"thunderwave":1,"stealthrock":1},
tier: "Limbo"
},
terrakion: {
viableMoves: {"stoneedge":1,"closecombat":1,"swordsdance":1,"rockpolish":1,"substitute":1,"stealthrock":1,"earthquake":1},
tier: "OU"
},
virizion: {
viableMoves: {"swordsdance":1,"calmmind":1,"closecombat":1,"focusblast":1,"hiddenpowerice":1,"stoneedge":1,"leafblade":1,"gigadrain":1,"substitute":1,"synthesis":1},
tier: "Limbo"
},
tornadus: {
viableMoves: {"hurricane":1,"airslash":1,"uturn":1,"bulkup":1,"superpower":1,"focusblast":1,"taunt":1,"substitute":1,"heatwave":1,"tailwind":1},
eventPokemon: [
{"generation":5,"level":70,"gender":"M","isHidden":false,"moves":["hurricane","hammerarm","airslash","hiddenpower"],"pokeball":"cherishball"}
],
dreamWorldPokeball: 'dreamball',
tier: "Limbo"
},
tornadustherian: {
viableMoves: {"hurricane":1,"airslash":1,"focusblast":1,"uturn":1,"heatwave":1},
eventPokemon: [
{"generation":5,"level":70,"gender":"M","isHidden":false,"moves":["hurricane","hammerarm","airslash","hiddenpower"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
thundurus: {
viableMoves: {"thunderwave":1,"nastyplot":1,"thunderbolt":1,"hiddenpowerice":1,"focusblast":1,"grassknot":1,"substitute":1},
eventPokemon: [
{"generation":5,"level":70,"gender":"M","isHidden":false,"moves":["thunder","hammerarm","focusblast","wildcharge"],"pokeball":"cherishball"}
],
dreamWorldPokeball: 'dreamball',
tier: "OU"
},
thundurustherian: {
viableMoves: {"nastyplot":1,"agility":1,"thunderbolt":1,"hiddenpowerice":1,"focusblast":1,"grassknot":1,"superpower":1},
eventPokemon: [
{"generation":5,"level":70,"gender":"M","isHidden":false,"moves":["thunder","hammerarm","focusblast","wildcharge"],"pokeball":"cherishball"}
],
tier: "Limbo B"
},
reshiram: {
viableMoves: {"blueflare":1,"dracometeor":1,"dragonpulse":1,"flamethrower":1,"flamecharge":1,"roost":1},
eventPokemon: [
{"generation":5,"level":100,"moves":["blueflare","fusionflare","mist","dracometeor"],"pokeball":"cherishball"}
],
tier: "Uber"
},
zekrom: {
viableMoves: {"voltswitch":1,"outrage":1,"dragonclaw":1,"boltstrike":1,"honeclaws":1,"substitute":1,"dracometeor":1,"fusionbolt":1,"roost":1},
eventPokemon: [
{"generation":5,"level":100,"moves":["boltstrike","fusionbolt","haze","outrage"],"pokeball":"cherishball"}
],
tier: "Uber"
},
landorus: {
viableMoves: {"earthpower":1,"focusblast":1,"rockpolish":1,"hiddenpowerice":1,"psychic":1,"sludgewave":1},
dreamWorldPokeball: 'dreamball',
tier: "OU"
},
landorustherian: {
viableMoves: {"rockpolish":1,"earthquake":1,"stoneedge":1,"uturn":1,"superpower":1,"stealthrock":1},
tier: "OU"
},
kyurem: {
viableMoves: {"substitute":1,"icebeam":1,"dracometeor":1,"dragonpulse":1,"focusblast":1,"outrage":1,"earthpower":1,"roost":1},
tier: "Limbo"
},
kyuremblack: {
viableMoves: {"outrage":1,"fusionbolt":1,"icebeam":1,"roost":1,"dragontail":1,"substitute":1,"honeclaws":1,"earthpower":1,"dragonclaw":1},
tier: "BL"
},
kyuremwhite: {
viableMoves: {"dracometeor":1,"dragonpulse":1,"icebeam":1,"fusionflare":1,"earthpower":1,"focusblast":1,"roost":1},
tier: "Uber"
},
keldeo: {
viableMoves: {"hydropump":1,"secretsword":1,"calmmind":1,"hiddenpowerghost":1,"hiddenpowerelectric":1,"substitute":1,"surf":1,"hiddenpowerice":1, "icywind":1},
eventPokemon: [
{"generation":5,"level":15,"moves":["aquajet","leer","doublekick","bubblebeam"],"pokeball":"cherishball"},
{"generation":5,"level":50,"moves":["sacredsword","hydropump","aquajet","swordsdance"],"pokeball":"cherishball"}
],
dreamWorldPokeball: 'cherishball',
tier: "Limbo A"
},
keldeoresolute: {
eventPokemon: [
{"generation":5,"level":15,"moves":["aquajet","leer","doublekick","bubblebeam"],"pokeball":"cherishball"},
{"generation":5,"level":50,"moves":["sacredsword","hydropump","aquajet","swordsdance"],"pokeball":"cherishball"}
],
dreamWorldPokeball: 'cherishball',
tier: "Limbo A"
},
meloetta: {
viableMoves: {"relicsong":1,"closecombat":1,"calmmind":1,"psychic":1,"thunderbolt":1,"hypervoice":1,"uturn":1},
eventPokemon: [
{"generation":5,"level":15,"moves":["quickattack","confusion","round"],"pokeball":"cherishball"},
{"generation":5,"level":50,"moves":["round","teeterdance","psychic","closecombat"],"pokeball":"cherishball"}
],
dreamWorldPokeball: 'cherishball',
tier: "Limbo"
},
genesect: {
viableMoves: {"uturn":1,"bugbuzz":1,"icebeam":1,"flamethrower":1,"thunderbolt":1,"ironhead":1,"shiftgear":1,"extremespeed":1,"blazekick":1},
eventPokemon: [
{"generation":5,"level":50,"moves":["technoblast","magnetbomb","solarbeam","signalbeam"],"pokeball":"cherishball"},
{"generation":5,"level":15,"moves":["technoblast","magnetbomb","solarbeam","signalbeam"],"pokeball":"cherishball"},
{"generation":5,"level":100,"shiny":true,"nature":"Hasty","moves":["extremespeed","technoblast","blazekick","shiftgear"],"pokeball":"cherishball"}
],
dreamWorldPokeball: 'cherishball',
tier: "OU"
},
chespin: {
viableMoves: {"curse":1,"gyroball":1,"seedbomb":1,"stoneedge":1,"spikes":1,"synthesis":1},
tier: "LC"
},
quilladin: {
viableMoves: {"curse":1,"gyroball":1,"seedbomb":1,"stoneedge":1,"spikes":1,"synthesis":1},
tier: "NFE"
},
chesnaught: {
viableMoves: {"leechseed":1,"synthesis":1,"roar":1,"hammerarm":1,"spikyshield":1,"stoneedge:":1,"woodhammer":1},
tier: "Limbo B"
},
fennekin: {
viableMoves: {"fireblast":1,"psychic":1,"psyshock":1,"grassknot":1,"willowisp":1,"hypnosis":1,"hiddenpowerrock":1,"flamecharge":1},
tier: "LC"
},
braixen: {
viableMoves: {"fireblast":1,"flamethrower":1,"psychic":1,"psyshock":1,"grassknot":1,"willowisp":1,"hiddenpowerrock":1},
tier: "NFE"
},
delphox: {
viableMoves: {"calmmind":1,"fireblast":1,"flamethrower":1,"psychic":1,"psyshock":1, "grassknot":1, "switcheroo":1,"shadowball":1},
tier: "Limbo C"
},
froakie: {
viableMoves: {"quickattack":1,"hydropump":1,"icebeam":1,"waterfall":1,"toxicspikes":1,"poweruppunch":1,"uturn":1},
tier: "LC"
},
frogadier: {
viablemoves: {"hydropump":1,"surf":1,"icebeam":1,"uturn":1,"taunt":1,"toxicspikes":1},
tier: "NFE"
},
greninja: {
viableMoves: {"hydropump":1,"uturn":1,"surf":1,"icebeam:":1,"spikes":1,"taunt":1,"darkpulse":1,"toxicspikes":1},
tier: "OU"
},
bunnelby: {
viableMoves: {"agility":1,"earthquake":1,"return":1,"quickattack":1,"uturn":1,"stoneedge":1,"spikes":1,"bounce":1},
tier: "LC"
},
diggersby: {
viableMoves: {"earthquake":1,"uturn":1,"return":1,"wildcharge":1,"swordsdance":1,"quickattack":1,"agility":1},
tier: "Limbo A"
},
fletchling: {
viableMoves: {"roost":1,"swordsdance":1,"uturn":1,"return":1,"overheat":1,"flamecharge":1,"tailwind":1},
tier: "LC"
},
fletchinder: {
viableMoves: {"roost":1,"swordsdance":1,"uturn":1,"return":1,"overheat":1,"flamecharge":1,"tailwind":1},
tier: "NFE"
},
talonflame: {
viableMoves: {"bravebird":1,"flareblitz":1,"roost":1,"swordsdance":1,"uturn":1,"bulkup":1,"willowisp":1,"tailwind":1},
tier: "OU"
},
scatterbug: {
viableMoves: {"tackle":1,"stringshot":1,"stunspore":1,"bugbite":1,"poisonpowder":1},
tier: "LC"
},
spewpa: {
viableMoves: {"tackle":1,"stringshot":1,"stunspore":1,"bugbite":1,"poisonpowder":1},
tier: "NFE"
},
vivillon: {
viableMoves: {"sleeppowder":1,"quiverdance":1,"hurricane":1,"bugbuzz":1,"roost":1},
tier: "Limbo"
},
litleo: {
viableMoves: {"hypervoice":1,"fireblast":1,"willowisp":1,"bulldoze":1,"yawn":1},
tier: "LC"
},
pyroar: {
viableMoves: {"hypervoice":1,"fireblast":1,"willowisp":1,"bulldoze":1,"yawn":1,"snarl":1,"sunnyday":1,"solarbeam":1},
tier: "Limbo"
},
flabebe: {
viableMoves: {"moonblast":1,"energyball":1,"wish":1,"psychic":1,"aromatherapy":1,"protect":1,"calmmind":1},
tier: "LC"
},
floette: {
viableMoves: {"moonblast":1,"energyball":1,"wish":1,"psychic":1,"aromatherapy":1,"protect":1,"calmmind":1},
tier: "NFE"
},
florges: {
viableMoves: {"moonblast":1,"energyball":1,"wish":1,"psychic":1,"aromatherapy":1,"protect":1,"calmmind":1},
tier: "Limbo A"
},
skiddo: {
viableMoves: {"hornleech":1,"earthquake":1,"brickbreak":1,"bulkup":1,"leechseed":1,"milkdrink":1,"rockslide":1},
tier: "LC"
},
gogoat: {
viableMoves: {"hornleech":1,"earthquake":1,"brickbreak":1,"bulkup":1,"leechseed":1,"milkdrink":1,"rockslide":1},
tier: "Limbo"
},
pancham: {
viableMoves: {"partingshot":1,"skyuppercut":1,"crunch":1,"circlethrow":1,"stoneedge":1,"bulldoze":1,"shadowclaw":1,"bulkup":1},
tier: "LC"
},
pangoro: {
viableMoves: {"partingshot":1,"hammerarm":1,"crunch":1,"circlethrow":1,"stoneedge":1,"earthquake":1,"poisonjab":1},
tier: "Limbo C"
},
furfrou: {
viableMoves: {"return":1,"cottonguard":1,"uturn":1,"thunderwave":1,"suckerpunch":1,"roar":1,"wildcharge":1,"rest":1,"sleeptalk":1},
tier: "Limbo"
},
espurr: {
viableMoves: {"fakeout":1,"yawn":1,"thunderwave":1,"psyshock":1,"trick":1,"darkpulse":1},
tier: "LC"
},
meowstic: {
viableMoves: {"fakeout":1,"yawn":1,"thunderwave":1,"psyshock":1,"trick":1,"darkpulse":1,"reflect":1,"lightscreen":1,"thunderbolt":1},
tier: "Limbo"
},
meowsticf: {
viableMoves: {"fakeout":1,"yawn":1,"thunderwave":1,"psyshock":1,"trick":1,"darkpulse":1,"calmmind":1,"energyball":1,"signalbeam":1,"storedpower":1,"thunderbolt":1},
tier: "Limbo"
},
honedge: {
viableMoves: {"swordsdance":1,"shadowclaw":1,"shadowsneak":1,"ironhead":1,"rockslide":1,"aerialace":1,"destinybond":1},
tier: "LC"
},
doublade: {
viableMoves: {"swordsdance":1,"shadowclaw":1,"shadowsneak":1,"ironhead":1,"rockslide":1,"aerialace":1,"destinybond":1},
tier: "NFE"
},
aegislash: {
viableMoves: {"kingsshield":1,"swordsdance":1,"shadowclaw":1,"sacredsword":1,"ironhead":1,"shadowsneak":1,"autotomize":1,"flashcannon":1,"shadowball":1},
tier: "OU"
},
spritzee: {
viableMoves: {"calmmind":1,"drainingkiss":1,"moonblast":1,"psychic":1,"aromatherapy":1,"wish":1,"trickroom":1,"thunderbolt":1},
tier: "LC"
},
aromatisse: {
viableMoves:{"calmmind":1,"drainingkiss":1,"moonblast":1,"psychic":1,"aromatherapy":1,"wish":1,"trickroom":1,"thunderbolt":1},
tier: "Limbo"
},
swirlix: {
viableMoves: {"calmmind":1,"drainingkiss":1,"dazzlinggleam":1,"surf":1,"psychic":1,"flamethrower":1,"bellydrum":1,"thunderbolt":1,"return":1,"thief":1,"cottonguard":1},
tier: "LC"
},
slurpuff: {
viableMoves: {"calmmind":1,"dazzlinggleam":1,"surf":1,"psychic":1,"flamethrower":1,"thunderbolt":1},
tier: "Limbo C"
},
inkay: {
viableMoves: {"topsyturvy":1,"switcheroo":1,"superpower":1,"psychocut":1,"flamethrower":1,"rockslide":1,"trickroom":1,"swagger":1,"thief":1,"foulplay":1},
eventPokemon: [
{"generation":6,"level":10,"isHidden":false,"moves":["happyhour","foulplay","hypnosis","topsyturvy"],"pokeball":"cherishball"}
],
tier: "LC"
},
malamar: {
viableMoves: {"switcheroo":1,"superpower":1,"psychocut":1,"rockslide":1,"trickroom":1,"foulplay":1,"nightslash":1},
tier: "Limbo B"
},
binacle: {
viableMoves: {"shellsmash":1,"switcheroo":1,"razorshell":1,"stoneedge":1,"earthquake":1,"crosschop":1,"poisonjab":1,"xscissor":1,"shadowclaw":1},
tier: "LC"
},
barbaracle: {
viableMoves: {"shellsmash":1,"switcheroo":1,"razorshell":1,"stoneedge":1,"earthquake":1,"crosschop":1,"poisonjab":1,"xscissor":1,"shadowclaw":1},
tier: "Limbo C"
},
skrelp: {
viableMoves: {"scald":1,"sludgebomb":1,"thunderbolt":1,"shadowball":1,"toxicspikes":1,"venomdrench":1,"hydropump":1},
unreleasedHidden: true,
tier: "LC"
},
dragalge: {
viableMoves: {"scald":1,"sludgebomb":1,"thunderbolt":1,"toxicspikes":1,"venomdrench":1,"hydropump":1,"focusblast":1,"dracometeor":1,"dragontail":1,"substitute":1},
unreleasedHidden: true,
tier: "Limbo C"
},
clauncher: {
viableMoves: {"waterpulse":1,"sludgebomb":1,"icebeam":1,"uturn":1,"crabhammer":1,"swordsdance":1,"aquajet":1},
tier: "LC"
},
clawitzer: {
viableMoves: {"waterpulse":1,"sludgebomb":1,"icebeam":1,"uturn":1,"crabhammer":1,"swordsdance":1,"aquajet":1,"darkpulse":1,"aurasphere":1,"dragonpulse":1},
tier: "Limbo C"
},
helioptile: {
viableMoves: {"surf":1,"voltswitch":1,"thunderwave":1,"hiddenpowerice":1,"raindance":1,"thunder":1,"darkpulse":1,"thunderbolt":1},
tier: "LC"
},
heliolisk: {
viableMoves: {"surf":1,"voltswitch":1,"thunderwave":1,"hiddenpowerice":1,"raindance":1,"thunder":1,"darkpulse":1,"thunderbolt":1},
tier: "Limbo B"
},
tyrunt: {
viableMoves: {"stealthrock":1,"dragondance":1,"stoneedge":1,"dragonclaw":1,"earthquake":1,"icefang":1,"firefang":1,"poisonfang":1,"dragontail":1},
unreleasedHidden: true,
tier: "LC"
},
tyrantrum: {
viableMoves: {"stealthrock":1,"dragondance":1,"stoneedge":1,"dragonclaw":1,"earthquake":1,"icefang":1,"firefang":1,"poisonfang":1,"dragontail":1},
unreleasedHidden: true,
tier: "Limbo C"
},
amaura: {
viableMoves: {"naturepower":1,"ancientpower":1,"thunderbolt":1,"darkpulse":1,"thunderwave":1,"dragontail":1,"flashcannon":1},
unreleasedHidden: true,
tier: "LC"
},
aurorus: {
viableMoves: {"naturepower":1,"ancientpower":1,"thunderbolt":1,"darkpulse":1,"thunderwave":1,"dragontail":1,"flashcannon":1,"freezedry":1},
unreleasedHidden: true,
tier: "Limbo"
},
sylveon: {
viableMoves: {"moonblast":1,"calmmind":1,"wish":1,"protect":1,"storedpower":1,"batonpass":1,"shadowball":1,"hiddenpowerground":1},
eventPokemon: [
{"generation":6,"level":10,"isHidden":false,"moves":["celebrate","helpinghand","sandattack","fairywind"],"pokeball":"cherishball"}
],
tier: "OU"
},
hawlucha: {
viableMoves: {"swordsdance":1,"highjumpkick":1,"uturn":1,"stoneedge":1,"roost":1},
tier: "Limbo B"
},
dedenne: {
viableMoves: {"voltswitch":1,"thunderbolt":1,"thunderwave":1,"grassknot":1,"paraboliccharge":1,"hiddenpowerice":1},
tier: "Limbo"
},
carbink: {
viableMoves: {"stealthrock":1,"lightscreen":1,"reflect":1,"explosion":1,"calmmind":1,"powergem":1,"moonblast":1,"hiddenpowerfighting":1},
tier: "Limbo C"
},
goomy: {
viableMoves: {"sludgebomb":1,"thunderbolt":1,"toxic":1,"protect":1,"infestation":1},
tier: "LC"
},
sliggoo: {
viableMoves: {"sludgebomb":1,"thunderbolt":1,"toxic":1,"protect":1,"infestation":1,"icebeam":1},
tier: "NFE"
},
goodra: {
viableMoves: {"sludgebomb":1,"thunderbolt":1,"toxic":1,"protect":1,"icebeam":1,"earthquake":1,"fireblast":1,"focusblast":1},
tier: "OU"
},
klefki: {
viableMoves: {"reflect":1,"lightscreen":1,"spikes":1,"torment":1,"substitute":1,"thunderwave":1,"drainingkiss":1,"swagger":1,"foulplay":1,"flashcannon":1,"dazzlinggleam":1},
tier: "OU"
},
phantump: {
viableMoves: {"hornleech":1,"leechseed":1,"phantomforce":1,"substitute":1,"willowisp":1,"curse":1,"bulldoze":1,"rockslide":1,"poisonjab":1,"forestscurse":1},
tier: "LC"
},
trevenant: {
viableMoves: {"hornleech":1,"woodhammer":1,"leechseed":1,"shadowclaw":1,"substitute":1,"willowisp":1,"curse":1,"earthquake":1,"rockslide":1,"trickroom":1},
tier: "OU"
},
pumpkaboo: {
viableMoves: {"willowisp":1,"shadowsneak":1,"fireblast":1,"painsplit":1,"seedbomb":1},
tier: "LC"
},
pumpkaboosmall: {
viableMoves: {"willowisp":1,"shadowsneak":1,"fireblast":1,"painsplit":1,"seedbomb":1},
tier: "LC"
},
pumpkaboolarge: {
viableMoves: {"willowisp":1,"shadowsneak":1,"fireblast":1,"painsplit":1,"seedbomb":1},
tier: "LC"
},
pumpkaboosuper: {
viableMoves: {"willowisp":1,"shadowsneak":1,"fireblast":1,"painsplit":1,"seedbomb":1},
tier: "LC"
},
gourgeist: {
viableMoves: {"willowisp":1,"shadowsneak":1,"painsplit":1,"seedbomb":1,"leechseed":1,"phantomforce":1,"explosion":1},
tier: "Limbo"
},
gourgeistsmall: {
viableMoves: {"willowisp":1,"shadowsneak":1,"painsplit":1,"seedbomb":1,"leechseed":1,"phantomforce":1,"explosion":1},
tier: "Limbo"
},
gourgeistlarge: {
viableMoves: {"willowisp":1,"shadowsneak":1,"painsplit":1,"seedbomb":1,"leechseed":1,"phantomforce":1,"explosion":1},
tier: "Limbo"
},
gourgeistsuper: {
viableMoves: {"willowisp":1,"shadowsneak":1,"painsplit":1,"seedbomb":1,"leechseed":1,"phantomforce":1,"explosion":1},
tier: "Limbo B"
},
bergmite: {
viableMoves: {"avalanche":1,"recover":1,"stoneedge":1,"curse":1,"gyroball":1,"rapidspin":1},
tier: "LC"
},
avalugg: {
viableMoves: {"avalanche":1,"recover":1,"stoneedge":1,"curse":1,"gyroball":1,"rapidspin":1,"roar":1,"earthquake":1},
tier: "Limbo C"
},
noibat: {
viableMoves: {"airslash":1,"hurricane":1,"dracometeor:":1,"uturn":1,"roost":1,"switcheroo":1},
tier: "LC"
},
noivern: {
viableMoves: {"airslash":1,"hurricane":1,"dragonpulse":1,"dracometeor:":1,"focusblast":1,"flamethrower":1,"uturn":1,"roost":1,"boomburst":1,"switcheroo":1},
tier: "Limbo A"
},
xerneas: {
viableMoves: {"geomancy":1,"moonblast":1,"thunder":1,"focusblast":1,"flashcannon":1},
tier: "Uber"
},
yveltal: {
viableMoves: {"darkpulse":1,"oblivionwing":1,"taunt":1,"focusblast":1,"hurricane":1,"airslash":1,"roost":1,"suckerpunch":1},
tier: "Uber"
},
zygarde: {
viableMoves: {"dragondance":1,"earthquake":1,"extremespeed":1,"outrage":1,"coil":1,"stoneedge":1},
tier: "Limbo C"
},
missingno: {
isNonstandard: true,
tier: ""
},
tomohawk: {
viableMoves: {"aurasphere":1,"roost":1,"stealthrock":1,"rapidspin":1,"hurricane":1,"airslash":1,"taunt":1,"substitute":1,"toxic":1,"naturepower":1,"earthpower":1},
isNonstandard: true,
tier: "CAP"
},
necturna: {
viableMoves: {"powerwhip":1,"hornleech":1,"willowisp":1,"shadowsneak":1,"stoneedge":1,"sacredfire":1,"boltstrike":1,"vcreate":1,"extremespeed":1,"closecombat":1,"shellsmash":1,"spore":1,"milkdrink":1,"batonpass":1,"stickyweb":1},
isNonstandard: true,
tier: "CAP"
},
mollux: {
viableMoves: {"fireblast":1,"thunderbolt":1,"sludgebomb":1,"thunderwave":1,"willowisp":1,"recover":1,"rapidspin":1,"trick":1,"stealthrock":1,"toxicspikes":1,"lavaplume":1},
isNonstandard: true,
tier: "CAP"
},
aurumoth: {
viableMoves: {"dragondance":1,"quiverdance":1,"closecombat":1,"bugbuzz":1,"hydropump":1,"megahorn":1,"psychic":1,"blizzard":1,"thunder":1,"focusblast":1,"zenheadbutt":1},
isNonstandard: true,
tier: "CAP"
},
malaconda: {
viableMoves: {"powerwhip":1,"glare":1,"crunch":1,"toxic":1,"suckerpunch":1,"rest":1,"substitute":1,"uturn":1,"synthesis":1,"rapidspin":1,"knockoff":1},
isNonstandard: true,
tier: "CAP"
},
cawmodore: {
viableMoves: {"bellydrum":1,"bulletpunch":1,"drainpunch":1,"acrobatics":1,"drillpeck":1,"substitute":1,"ironhead":1,"quickattack":1},
isNonstandard: true,
tier: "CAP"
},
syclant: {
viableMoves: {"bugbuzz":1,"icebeam":1,"blizzard":1,"earthpower":1,"spikes":1,"superpower":1,"tailglow":1,"uturn":1,"focusblast":1},
isNonstandard: true,
tier: "CAP"
},
revenankh: {
viableMoves: {"bulkup":1,"shadowsneak":1,"drainpunch":1,"rest":1,"moonlight":1,"icepunch":1,"glare":1},
isNonstandard: true,
tier: "CAP"
},
pyroak: {
viableMoves: {"leechseed":1,"lavaplume":1,"substitute":1,"protect":1,"gigadrain":1},
isNonstandard: true,
tier: "CAP"
},
fidgit: {
viableMoves: {"spikes":1,"stealthrock":1,"toxicspikes":1,"wish":1,"rapidspin":1,"encore":1,"uturn":1,"sludgebomb":1,"earthpower":1},
isNonstandard: true,
tier: "CAP"
},
stratagem: {
viableMoves: {"paleowave":1,"earthpower":1,"fireblast":1,"gigadrain":1,"calmmind":1,"substitute":1},
isNonstandard: true,
tier: "CAP"
},
arghonaut: {
viableMoves: {"recover":1,"bulkup":1,"waterfall":1,"drainpunch":1,"crosschop":1,"stoneedge":1,"thunderpunch":1,"aquajet":1,"machpunch":1},
isNonstandard: true,
tier: "CAP"
},
kitsunoh: {
viableMoves: {"shadowstrike":1,"earthquake":1,"superpower":1,"meteormash":1,"uturn":1,"icepunch":1,"trick":1,"willowisp":1},
isNonstandard: true,
tier: "CAP"
},
cyclohm: {
viableMoves: {"slackoff":1,"dracometeor":1,"dragonpulse":1,"fireblast":1,"thunderbolt":1,"hydropump":1,"discharge":1,"healbell":1},
isNonstandard: true,
tier: "CAP"
},
colossoil: {
viableMoves: {"earthquake":1,"crunch":1,"suckerpunch":1,"uturn":1,"rapidspin":1,"encore":1,"pursuit":1,"knockoff":1},
isNonstandard: true,
tier: "CAP"
},
krilowatt: {
viableMoves: {"surf":1,"thunderbolt":1,"icebeam":1,"earthpower":1},
isNonstandard: true,
tier: "CAP"
},
voodoom: {
viableMoves: {"aurasphere":1,"darkpulse":1,"taunt":1,"painsplit":1,"substitute":1,"hiddenpowerice":1,"vacuumwave":1},
isNonstandard: true,
tier: "CAP"
}
};
|
var debug;
if (process.env.NODEFLY_DEBUG && /proxy/.test(process.env.NODEFLY_DEBUG)) {
debug = function(x) { console.error(' PROXY: %s', x); };
} else {
debug = function() { };
}
var EventEmitter = require('events').EventEmitter;
var nodefly;
exports.init = function() {
nodefly = global.nodefly;
}
function before(obj, meths, hook) {
if(!Array.isArray(meths)) meths = [meths];
meths.forEach(function(meth) {
var orig = obj[meth];
if(!orig) return;
var newFunc = function() {
try { hook(this, arguments, meth); } catch(e) { nodefly.error(e); }
var ret = orig.apply(this, arguments);
if (obj[meth].__patched__ !== true) {
before(obj,meths,hook);
}
return ret;
};
if (!obj[meth].__patched__) {
obj[meth] = newFunc;
obj[meth].__patched__ = true;
}
});
};
exports.before = before;
exports.after = function(obj, meths, hook) {
if(!Array.isArray(meths)) meths = [meths];
meths.forEach(function(meth) {
var orig = obj[meth];
if(!orig) return;
obj[meth] = function() {
var ret = orig.apply(this, arguments);
try { hook(this, arguments, ret); } catch(e) { nodefly.error(e) }
return ret;
};
});
};
exports.callback = function(args, pos, hookBefore, hookAfter, evData) {
if(args.length <= pos) return false;
if (pos === -1) {
// search backwards for last function
for (pos = args.length - 1; pos >= 0; pos--) {
if (typeof args[pos] === 'function') {
break;
}
}
}
// create closures on context vars
var extra = nodefly.extra;
var graph = nodefly.graph;
var currentNode = nodefly.currentNode;
var orig = (typeof args[pos] === 'function') ? args[pos] : undefined;
if(!orig) return;
var functionName = orig.name || 'anonymous';
args[pos] = function() {
if (extra) nodefly.extra = extra;
if (graph) nodefly.graph = graph;
if (currentNode != undefined) nodefly.currentNode = currentNode;
if(hookBefore) try { hookBefore(this, arguments, extra, graph, currentNode); } catch(e) { nodefly.error(e); }
if (evData) debug(evData.emitterName + ' \'' + evData.eventName + '\' event -> ' + functionName + '()');
var ret = orig.apply(this, arguments);
if(hookAfter) try { hookAfter(this, arguments, extra, graph, currentNode); } catch(e) { nodefly.error(e); }
if (extra) nodefly.extra = undefined;
if (graph) nodefly.graph = undefined;
if (currentNode != undefined) nodefly.currentNode = undefined;
return ret;
};
orig.__proxy__ = args[pos];
args[pos].__name__ = 'BEFORE_' + functionName;
};
exports.around = function(obj, meths, hookBefore, hookAfter) {
if(!Array.isArray(meths)) meths = [meths];
meths.forEach(function(meth) {
var orig = obj[meth];
if(!orig) return;
obj[meth] = function() {
var locals = {};
try { hookBefore(this, arguments, locals); } catch(e) { nodefly.error(e) }
var ret = orig.apply(this, arguments);
try { hookAfter(this, arguments, ret, locals); } catch(e) { nodefly.error(e) }
return ret;
};
});
};
exports.getter = function(obj, props, hook) {
if(!Array.isArray(props)) props = [props];
props.forEach(function(prop) {
var orig = obj.__lookupGetter__(prop);
if(!orig) return;
obj.__defineGetter__(prop, function() {
var ret = orig.apply(this, arguments);
try { hook(this, ret); } catch(e) { nodefly.error(e) }
return ret;
});
});
};
function remove_wrapper(obj, args)
{
if (args.length > 1 && args[1] && args[1].__proxy__) {
args[1] = args[1].__proxy__;
}
}
if(!EventEmitter.prototype.__patched__) {
/* make sure a wrapped listener can be removed */
exports.before(EventEmitter.prototype, 'removeListener', remove_wrapper);
exports.after(EventEmitter.prototype, 'removeListener', remove_wrapper);
EventEmitter.prototype.__patched__ = true;
}
|
describe("About Arrays", function() {
//We shall contemplate truth by testing reality, via spec expectations.
it("should create arrays", function() {
var emptyArray = [];
expect(typeof(emptyArray)).toBe("object"); //A mistake? - http://javascript.crockford.com/remedial.html
expect(emptyArray.length).toBe(0);
var multiTypeArray = [0, 1, "two", function () { return 3; }, {value1: 4, value2: 5}, [6, 7]];
expect(multiTypeArray[0]).toBe(0);
expect(multiTypeArray[2]).toBe("two");
expect(multiTypeArray[3]()).toBe(3);
expect(multiTypeArray[4].value1).toBe(4);
expect(multiTypeArray[4]["value2"]).toBe(5);
expect(multiTypeArray[5][0]).toBe(6);
});
it("should understand array literals", function () {
var array = [];
expect(array).toEqual([]);
array[0] = 1;
expect(array).toEqual([1]);
array[1] = 2;
expect(array).toEqual([1, 2]);
array.push(3);
expect(array).toEqual([1,2,3]);
});
it("should understand array length", function () {
var fourNumberArray = [1, 2, 3, 4];
expect(fourNumberArray.length).toBe(4);
fourNumberArray.push(5, 6);
expect(fourNumberArray.length).toBe(6);
var tenEmptyElementArray = new Array(10);
expect(tenEmptyElementArray.length).toBe(10);
tenEmptyElementArray.length = 5;
expect(tenEmptyElementArray.length).toBe(5);
});
it("should slice arrays", function () {
var array = ["peanut", "butter", "and", "jelly"];
expect(array.slice(0, 1)).toEqual(["peanut"]);
expect(array.slice(0, 2)).toEqual(["peanut", "butter"]);
expect(array.slice(2, 2)).toEqual([]); //omits "and" but then cuts it off too
expect(array.slice(2, 20)).toEqual(["and", "jelly"]); //there is no length 20 to cut off so cuts off what is left
expect(array.slice(3, 0)).toEqual([]);
expect(array.slice(3, 100)).toEqual(["jelly"]);
expect(array.slice(5, 1)).toEqual([]);
});
it("should know array references", function () {
var array = [ "zero", "one", "two", "three", "four", "five" ];
function passedByReference(refArray) {
refArray[1] = "changed in function";
}
passedByReference(array);
expect(array[1]).toBe("changed in function");
var assignedArray = array;
assignedArray[5] = "changed in assignedArray";
expect(array[5]).toBe("changed in assignedArray");
var copyOfArray = array.slice();
copyOfArray[3] = "changed in copyOfArray";
expect(array[3]).toBe("three");
});
it("should push and pop", function () {
var array = [1, 2];
array.push(3);
expect(array).toEqual([1,2,3]);
var poppedValue = array.pop();
expect(poppedValue).toBe(3);
expect(array).toEqual([1,2]);
});
it("should know about shifting arrays", function () {
var array = [1, 2];
array.unshift(3);
expect(array).toEqual([3,1,2]);
var shiftedValue = array.shift();
expect(shiftedValue).toEqual(3);
expect(array).toEqual([1,2]);
});
});
|
export default class ConfigStore {
_config = {};
_spec = {};
constructor(config, defaults = {}, spec = {}) {
const _config = Object.assign(defaults, config);
this._spec = spec;
for (let key in _config) {
this.set(key, _config[key])
}
}
get(key, _default = null) {
return this._config.hasOwnProperty(key)
? this._config[key]
: _default;
}
set(key, value) {
this.checkType(key, value);
this._config[key] = value;
}
checkType(key, value) {
if (!this._spec.hasOwnProperty(key)) {
// always true if not exists
return true;
}
let actualType = typeof value;
let expectedType = this._spec[key];
if (actualType !== expectedType) {
throw new Error('Value of ' + key + ' is not valid! Expect ' + expectedType + ' instead of ' + actualType);
}
}
}
|
"use strict";
import { DEFAULT_MAXIMUM_DEPTH } from "../constants";
export default class Context {
constructor(ruleMap, tokens, index, depth, maximumDepth) {
this.ruleMap = ruleMap;
this.tokens = tokens;
this.index = index;
this.depth = depth;
this.maximumDepth = maximumDepth;
}
getRuleMap() {
return this.ruleMap;
}
getTokens() {
return this.tokens;
}
getIndex() {
return this.index;
}
getDepth() {
return this.depth;
}
getMaximumDepth() {
return this.maximumDepth;
}
getSavedIndex() {
const savedIndex = this.index; ///
return savedIndex;
}
getNextToken() {
let nextToken = null;
const tokensLength = this.tokens.length;
if (this.index < tokensLength) {
nextToken = this.tokens[this.index++];
}
return nextToken;
}
getNextSignificantToken() {
let nextSignificantToken = null;
const tokensLength = this.tokens.length;
while (this.index < tokensLength) {
const token = this.tokens[this.index++],
tokenSignificant = token.isSignificant();
if (tokenSignificant) {
const significantToken = token; ///
nextSignificantToken = significantToken; ///
break;
}
}
return nextSignificantToken;
}
isNextTokenWhitespaceToken() {
let nextTokenWhitespaceToken = false;
const tokensLength = this.tokens.length;
if (this.index < tokensLength) {
const nextToken = this.tokens[this.index];
nextTokenWhitespaceToken = nextToken.isWhitespaceToken();
}
return nextTokenWhitespaceToken;
}
isTooDeep() {
const tooDeep = (this.depth > this.maximumDepth);
return tooDeep;
}
backtrack(savedIndex) {
this.index = savedIndex; ///
}
setIndex(index) {
this.index = index;
}
increaseDepth() {
this.depth++;
}
decreaseDepth() {
this.depth--;
}
static fromTokensAndRuleMap(tokens, ruleMap) {
const index = 0,
depth = 0,
maximumDepth = DEFAULT_MAXIMUM_DEPTH,
context = new Context(ruleMap, tokens, index, depth, maximumDepth);
return context;
}
}
|
// jQuery.equalize 1.8
function equalize(g,e){'use strict';g=g||'.group';e=e||'.equalize';$(g).each(function(){var h=0;$(e,this).css('height','auto');$(e,this).each(function(){if($(this).innerHeight()>h){h=$(this).innerHeight()}});$(e,this).innerHeight(h)})}
|
describe("Epic", function() { })
exports.create = function create({ document }) {
return document.data
}
|
'use strict'
const resolve = require('resolve-path')
const rawBody = require('raw-body')
const parse = require('deps-parse')
const mime = require('mime-types')
const spdy = require('spdy-push')
const assert = require('assert')
const path = require('path')
const etag = require('etag')
const fs = require('mz/fs')
const url = require('url')
const ms = require('ms')
module.exports = Kiss
/**
* let fn = Kiss(options)
* app.use(fn)
*
* Not a typical middleware function :D
*/
function Kiss(options, _options) {
if (typeof options === 'string') {
let root = options
options = _options || Object.create(null)
options.root = root
}
if (!(this instanceof Kiss)) return new Kiss(options)
this._folders = []
options = this.options = Object.create(options || null)
if (options.cacheControl !== undefined) this.cacheControl(options.cacheControl)
if (typeof options.etag === 'function') this.etag(options.etag)
if (options.hidden !== undefined) this.hidden(options.hidden)
if (typeof options.root === 'string') this.mount(options.root)
}
/**
* Pretend Kiss is a generator function so `app.use()` works.
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction
* Can be removed when ES7 async functions are merged in.
*/
/* istanbul ignore next */
Kiss.prototype.constructor = Object.getPrototypeOf(function* () {}).constructor
/**
* Support .call() for middleware dispatchers.
*/
Kiss.prototype.call = function* (context, next) {
yield* next
let res = context.response
// push dependencies if the response is already handled
if (res.body != null) yield* this.serveDependencies(context, next)
// return if response is already handled
if (res.body || res.status !== 404) return
// try to serve the response
yield* this.serve(context, next)
// push the dependencies if the response was served
if (res.body != null) yield* this.serveDependencies(context, next)
}
/**
* Serve a file as the response to the request.
* Note: assumes you're using your own compression middleware,
* so be sure to `app.use(require('koa-compress')())`!
* TODO: maybe handle compression here
*
* @returns {Boolean} Pushable - whether to attempt to push dependencies
*/
Kiss.prototype.serve = function* (context) {
let req = context.request
let pathname = req.path
let stats = yield* this.lookup(context, '/', pathname)
if (!stats) return
let res = context.response
switch (req.method) {
case 'HEAD':
case 'GET':
break
case 'OPTIONS':
res.set('Allow', 'OPTIONS,HEAD,GET')
res.status = 204
return
default:
res.set('Allow', 'OPTIONS,HEAD,GET')
res.status = 405
return
}
res.status = 200
if (stats.mtime instanceof Date) res.lastModified = stats.mtime
if (typeof stats.size === 'number') res.length = stats.size
res.type = stats.type || path.extname(stats.pathname)
res.etag = yield this._etag(stats)
res.set('Cache-Control', this._cacheControl)
// do we push dependencies on 304s?
let fresh = req.fresh
if (fresh) return res.status = 304
if (req.method === 'HEAD') return
assert('body' in stats || 'filename' in stats)
res.body = 'body' in stats
? stats.body
: fs.createReadStream(stats.filename)
}
/**
* Push the current request's dependencies.
* Note that if the response is currently streamed,
* which is default for files,
* the entire stream will be buffered in memory
*/
Kiss.prototype.serveDependencies = function* (context) {
// http2 push is not supported
if (!context.req.isSpdy) return
// not a supported dependency type
let req = context.request
let res = context.response
// no body, just in case
if (res.body == null) return
// supported body types
let type = res.is('html', 'css', 'js')
if (!type) return
// buffer the response
let body = res.body = yield* bodyToString(res.body)
yield* this.pushDependencies(context, req.path, type, body)
}
/**
* Push dependencies.
*/
Kiss.prototype.pushDependencies = function* (context, pathname, type, body) {
assert(typeof pathname === 'string')
assert(typeof body === 'string')
// js
if (type === 'js') {
let deps = yield parse.js(body).catch(onerror)
if (!deps || !deps.length) return
yield deps.map(function* (name) {
let stats = yield* this.lookup(context, pathname, name)
if (stats) yield* this.spdyPush(context, stats)
}, this)
return
}
// css
if (type === 'css') {
let deps = yield parse.css(body).catch(onerror)
// note: we do not push urls() because they are conditional
if (!deps || !deps.imports) return
yield deps.imports.map(function* (dep) {
// don't push dependencies with media queries as they are conditional
if (dep.media) return
let stats = yield* this.lookup(context, pathname, dep.path)
if (stats) yield* this.spdyPush(context, stats)
}, this)
return
}
// html
assert(type === 'html')
let deps = yield parse.html(body).catch(onerror)
if (!deps || !deps.length) return
yield deps.map(function* (node) {
let stats
switch (node.type) {
// TODO: parse inline module dependencies
case 'module':
case 'script':
if (node.inline) return
stats = yield* this.lookup(context, pathname, node.path)
break
// TODO: parse inline style imports
case 'style': return
case 'stylesheet':
// don't push style sheets with media queries as they are conditional
if (node.attrs.media) return
stats = yield* this.lookup(context, pathname, node.path)
break
case 'import':
stats = yield* this.lookup(context, pathname, node.path)
break
}
if (stats) yield* this.spdyPush(context, stats)
}, this)
}
/**
* Push a dependency using SPDY.
*/
Kiss.prototype.spdyPush = function* (context, stats) {
if (!context.res.isSpdy) return
let options = {
path: stats.pathname,
priority: this.priority(stats),
headers: {
'cache-control': this._cacheControl,
'etag': yield this._etag(stats),
},
}
if (stats.mtime instanceof Date)
options.headers['last-modified'] = stats.mtime.toUTCString()
if (stats.type)
options.headers['content-type'] = stats.type
let etag = yield this._etag(stats)
if (etag)
if (!/^(W\/)?"/.test(etag))
options.headers.etag = '"' + etag + '"'
if ('body' in stats) {
options.body = stats.body
} else if (stats.filename) {
options.filename = stats.filename
}
assert('body' in options || 'filename' in options)
let promises = [
spdy(context.res).push(options),
]
// push this file's dependencies
switch (stats.ext) {
case 'html':
case 'css':
case 'js':
// buffer the file in memory if necessary
if (options.filename) {
options.body = yield fs.readFile(options.filename, 'utf8')
delete options.filename
}
options.body = yield* bodyToString(options.body)
promises.push(this.pushDependencies(context, stats.pathname, stats.ext, options.body))
break
}
// push this file and its dependencies in parallel
yield promises
}
/**
* Lookup function.
*/
Kiss.prototype.lookup = function* (context, basepath, pathname) {
// if all middleware fails, use local file lookups
// it does not support absolute URLs, obviously
if (~pathname.indexOf('://') || !pathname.indexOf('//')) return
return yield* this.lookupFilename(url.resolve(basepath, pathname))
}
/**
* Lookup a web path such as `/file/index.js` based on all the support paths.
* This is the default lookup function.
*/
Kiss.prototype.lookupFilename = function* (pathname) {
// if options.hidden, leading dots anywhere in the path can not be handled
if (!this.options.hidden && pathname.split('/').filter(Boolean).some(hasLeadingDot)) return
for (let pair of this._folders) {
let prefix = pair[0]
if (pathname.indexOf(prefix) !== 0) continue
let folder = pair[1]
let suffix = pathname.replace(prefix, '')
if (suffix[0] === '/') continue
if (!suffix || /\/$/.test(suffix)) suffix += 'index.html'
let filename = resolve(folder, suffix)
// TODO: make sure symlinked folders work
let stats = yield fs.stat(filename).catch(ignoreENOENT)
if (!stats) continue
// TODO: handle directories?
if (!stats.isFile()) continue
stats.ext = mime.extension(mime.lookup(path.extname(filename)))
stats.type = mime.contentType(path.extname(filename))
stats.filename = filename
stats.pathname = pathname
return stats
}
}
/**
* Mount a path as a static server.
* Like Express's `.use()`, except `.use()` in this instance
* will be reserved for middleware.
*/
Kiss.prototype.mount = function (prefix, folder) {
if (typeof folder !== 'string') {
// no prefix
folder = prefix
prefix = '/'
}
assert(prefix[0] === '/', 'Mounted paths must begin with a `/`.')
if (!/\/$/.test(prefix)) prefix += '/'
this._folders.push([
prefix,
path.resolve(folder),
])
return this
}
/**
* Use middleware for this server.
*/
/* istanbul ignore next */
Kiss.prototype.use = function () {
throw new Error('Not implemented.')
}
/**
* Transform files.
*/
/* istanbul ignore next */
Kiss.prototype.transform = function () {
throw new Error('Not implemented.')
}
/**
* Alias a path as another path.
* Essentially a symlink.
* Should support both files and folders.
*/
/* istanbul ignore next */
Kiss.prototype.alias = function () {
throw new Error('Not implemented.')
}
/**
* Define a custom, virtual path.
* Ex. kiss.define('/polyfill.js', (context, next) -> [stats])
*/
/* istanbul ignore next */
Kiss.prototype.define = function () {
throw new Error('Not implemented.')
}
/**
* Set the etag function with caching.
* Assumes the etag function is always async.
*/
Kiss.prototype.etag = function (fn) {
assert(typeof fn === 'function')
this._etag = function (stats) {
return Promise.resolve(stats.etag || (stats.etag = fn(stats)))
}
return this
}
/**
* Set the default etag function.
* Requires `stat.mtime` and `stat.size`.
*/
Kiss.prototype.etag(function (stats) {
return etag(stats, {
weak: true,
})
})
/**
* Set the cache control.
* TODO: support actual cache control headers
*/
Kiss.prototype.cacheControl = function (age) {
// human readable string to ms
if (typeof age === 'string') age = ms(age)
// ms to seconds
age = Math.round(age / 1000)
this._cacheControl = 'public, max-age=' + age
return this
}
/**
* Set the default cache control, which is about a year.
*/
Kiss.prototype.cacheControl(31536000000)
/**
* Enable or disable hidden file support.
*/
Kiss.prototype.hidden = function (val) {
this.options.hidden = !!val
return this
}
/**
* Get the priority of a file depending on the type of file.
*/
Kiss.prototype.priority = function (stats) {
// remove the charset or anything
switch (stats.ext) {
case 'html': return 3
case 'css': return 4
case 'js': return 5
}
return 7
}
/**
* Ignore missing file errors on `.stat()`
*/
/* istanbul ignore next */
function ignoreENOENT(err) {
if (err.code !== 'ENOENT') throw err
}
/**
* Check if a string has a leading dot,
* specifically for ignoring parts of a path.
*/
function hasLeadingDot(x) {
return /^\./.test(x)
}
/**
* Convert a body to a string.
*/
function* bodyToString(body) {
if (typeof body === 'string') return body
if (Buffer.isBuffer(body)) return body.toString()
if (body._readableState) return yield rawBody(body, { encoding: 'utf8' })
/* istanbul ignore next */
throw new Error('Could not convert body to string.')
}
/* istanbul ignore next */
function onerror(err) {
console.error(err.stack)
}
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var ic_schedule = exports.ic_schedule = { "viewBox": "0 0 24 24", "children": [{ "name": "path", "attribs": { "d": "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z" } }] }; |
import _ from 'three';
export default that => {
const light = new _.DirectionalLight(0xffffff, 1);
const z = 100; // Yep, need to change that
light.position.set(100, 100, z);
light.castShadow = true;
light.shadowCameraNear = 0.01;
light.shadowCameraFar = 2 * z;
light.shadowCameraFov = 45;
light.shadowCameraLeft = -z / 2;
light.shadowCameraRight = z / 2;
light.shadowCameraTop = z / 2;
light.shadowCameraBottom = -z / 2;
// light.shadowBias = 0.001;
light.shadowDarkness = 0.2;
light.shadowMapWidth = 1024;
light.shadowMapHeight = 1024;
light.name = 'SunnyLight';
return Promise.resolve(light);
};
|
import {
distanceFromPageTop,
documentHeight,
elementOffsetHeight,
visibleDocumentHeightPercentage
} from './dom-utils';
const scrollBarState = {};
const percentageOfPageToScrollBarPixels = currentHeight => {
const percentageOfPageScrolled = currentHeight / scrollBarState.documentHeight;
return scrollBarState.scrollBarHeight * percentageOfPageScrolled;
};
const calculateScrollerMargin = () => {
return percentageOfPageToScrollBarPixels(distanceFromPageTop());
};
const calculateScrollerHeight = () => {
return scrollBarState.scrollBarHeight * visibleDocumentHeightPercentage();
};
const setScrollerHeight = (scroller, calculatedHeight) => {
scroller.style.height = calculatedHeight + 'px';
};
const setScrollerMarginTop = (scroller, calculatedMarginTop) => {
scroller.style.marginTop = calculatedMarginTop + 'px';
};
const setNewScrollerStyles = scroller => {
setScrollerHeight(scroller, calculateScrollerHeight());
setScrollerMarginTop(scroller, calculateScrollerMargin());
};
export const scrollBarInitializer = (scrollBarNode, scrollerNode) => {
scrollBarState.documentHeight = documentHeight();
scrollBarState.scrollBarHeight = elementOffsetHeight(scrollBarNode);
setNewScrollerStyles(scrollerNode);
window.addEventListener('resize', () => {
scrollBarState.documentHeight = documentHeight();
setNewScrollerStyles(scrollerNode);
});
window.addEventListener('scroll', () => {
setScrollerMarginTop(scrollerNode, calculateScrollerMargin());
});
};
|
export const ADD_MEMO = "ADD_MEMO";
export const REMOVE_MEMO = "REMOVE_MEMO";
export const SET_MEMOS = "SET_MEMOS";
export const UPDATE_MEMOS = "UPDATE_MEMOS";
export function addMemo(data) {
return { type: ADD_MEMO , data};
}
export function removeMemo(id) {
return { type: REMOVE_MEMO, id}
}
export function setMemos(data) {
return { type: SET_MEMOS, data}
}
export function updateMemos() {
return { type: UPDATE_MEMOS}
} |
import React from 'react'
import ReactDOM from 'react-dom'
import {Modal, Button, ButtonGroup, Form, FormGroup, FormControl, ControlLabel,
Col, Table, Panel, ListGroup, ListGroupItem} from 'react-bootstrap'
import StarRatingComponent from 'react-star-rating-component'
import * as constants from './constants.js'
import * as utils from './utils.js'
class Review {
constructor(user, price=0, value=0, quality=0, title='', description=''){
this.user = user
this.price = price
this.value = value
this.quality = quality
this.title = title
this.description = description
this.num_helpful = 0
this.date = new Date()
}
}
class ViewReviews extends React.Component{
constructor(props){
super(props)
this.state = {
sort: constants.SORT_OPTION_MOST_HELPFUL,
reviews: this.props.reviews,
average_rating: 0
}
this.addReview = this.addReview.bind(this)
this.handleChange = this.handleChange.bind(this)
this.incr_helpful_count = this.incr_helpful_count.bind(this)
this.decr_helpful_count = this.decr_helpful_count.bind(this)
}
addReview(review){
const _state = this.state
let average_rating = (_state.average_rating*_state.reviews.length*3 + review.price + review.value + review.quality)/((_state.reviews.length+1)*3)
this.setState({reviews: _state.reviews.concat(review), average_rating: average_rating.toFixed(2)})
}
incr_helpful_count(review){
let _state = this.state,
idx = _state.reviews.indexOf(review)
if(idx !== -1) {
_state.reviews[idx].num_helpful++
this.setState({reviews: reviews})
}
}
decr_helpful_count(review){
let _state = this.state,
idx = _state.reviews.indexOf(review)
if(idx !== -1) {
_state.reviews[idx].num_helpful--
this.setState({reviews: reviews})
}
}
handleChange(event){
if(event) event.preventDefault()
const _state = this.state
let sort_type = parseInt(event.target.value),
sorted_reviews = []
switch(sort_type){
case constants.SORT_OPTION_MOST_HELPFUL:
sorted_reviews = _state.reviews.sort((a,b) => a.num_helpful - b.num_helpful)
break;
case constants.SORT_OPTION_MOST_RECENT:
sorted_reviews = _state.reviews.sort((a,b) => a.date.getTime() - b.date.getTime())
break;
case constants.SORT_OPTION_HIGHEST_FIRST:
sorted_reviews = _state.reviews.sort((a,b) => (a.price+a.value+a.quality) - (b.price+b.value+b.quality))
break;
case constants.SORT_OPTION_LOWEST_FIRST:
sorted_reviews = _state.reviews.sort((a,b) => (b.price+b.value+b.quality) - (a.price+a.value+a.quality))
break;
default:
sorted_reviews = _state.reviews
}
this.setState({sort: sort_type, reviews: sorted_reviews})
}
componentWillMount(){
const _state = this.state
let sum_of_ratings = 0, average_rating = 0
sum_of_ratings = _state.reviews.reduce((total, review) => total + (review.price + review.value + review.quality), 0)
if(sum_of_ratings > 0) average_rating = sum_of_ratings/(_state.reviews.length*3)
this.setState({average_rating: average_rating.toFixed(2)})
}
render(){
const _props = this.props,
_state = this.state
const title = <Form inline>
<FormGroup>
<Col componentClass={ControlLabel} sm={6}>
{constants.sort_options[_state.sort].title}
</Col>
<Col sm={6}>
<ControlLabel>Sort </ControlLabel>
<FormControl componentClass="select" onChange={this.handleChange}>
{Object.keys(constants.sort_options).map(key =>
<option value={key}>{constants.sort_options[key].value}</option>)}
</FormControl>
</Col>
</FormGroup>
</Form>
return (
<div>
<Panel header={(<h1>Reviews of {_props.product.name}</h1>)}>
<Form horizontal>
<FormGroup>
<Col componentClass={ControlLabel} sm={2}>
Average Ratings
</Col>
<Col sm={1}>
<StarRatingComponent
name={'average_rating'} /* name of the radio input, it is required */
value={Math.round(_state.average_rating)} /* number of selected icon (`0` - none, `1` - first) */
starCount={5} /* number of icons in rating, default `5` */
editing={false}
/>
</Col>
<Col componentClass={ControlLabel} sm={2}>
{_state.average_rating + "(based on " + _props.reviews.length + " ratings)"}
</Col>
</FormGroup>
<FormGroup>
<Col componentClass={ControlLabel} sm={2}>
Have you used this product ? <br/> Rate it now.
</Col>
<Col sm={1}><PostReview user={_props.user} addReview={this.addReview}/></Col>
</FormGroup>
</Form>
<Panel header={(title)}>
<ListGroup>
{_props.reviews.map((review, idx) =>
<ViewReview key={idx} review={review}
incr_helpful_count={this.incr_helpful_count}
decr_helpful_count={this.decr_helpful_count}/>)}
</ListGroup>
</Panel>
</Panel>
</div>
)
}
}
class ViewReview extends React.Component {
constructor(props){
super(props)
}
render(){
const _props = this.props
return(
<ListGroupItem>
<Form horizontal>
<FormGroup>
<ControlLabel>{_props.review.title}</ControlLabel>
<FormControl.Static>{_props.review.user.name + " (Reviewed on " + utils.to_ddmmyy(_props.review.date) + ")"}</FormControl.Static>
</FormGroup>
<FormGroup>
<Col componentClass={ControlLabel} sm={1}>
<ControlLabel>Price</ControlLabel>
</Col>
<Col sm={2}>
<StarRatingComponent
name={'price'} /* name of the radio input, it is required */
value={_props.review.price} /* number of selected icon (`0` - none, `1` - first) */
starCount={5} /* number of icons in rating, default `5` */
editing={false}
/>
</Col>
</FormGroup>
<FormGroup>
<Col componentClass={ControlLabel} sm={1}>
<ControlLabel>Value</ControlLabel>
</Col>
<Col sm={2}>
<StarRatingComponent
name={'value'} /* name of the radio input, it is required */
value={_props.review.value} /* number of selected icon (`0` - none, `1` - first) */
starCount={5} /* number of icons in rating, default `5` */
editing={false}
/>
</Col>
</FormGroup>
<FormGroup>
<Col componentClass={ControlLabel} sm={1}>
<ControlLabel>Quality</ControlLabel>
</Col>
<Col sm={2}>
<StarRatingComponent
name={'quality'} /* name of the radio input, it is required */
value={_props.review.quality} /* number of selected icon (`0` - none, `1` - first) */
starCount={5} /* number of icons in rating, default `5` */
editing={false}
/>
</Col>
</FormGroup>
<FormGroup>
<FormControl.Static>{_props.review.description}</FormControl.Static>
</FormGroup>
<FormGroup>
<Col componentClass={ControlLabel} sm={2}>
<ControlLabel>Was this review helpful ? </ControlLabel>
</Col>
<Col sm={7}>
<ButtonGroup>
<Button onClick={_props.incr_helpful_count.bind(null, _props.review)}>Yes
<input ref="yes" type="radio" name="helpful_review" value='yes' standalone defaultChecked/>
</Button>
<Button onClick={_props.decr_helpful_count.bind(null, _props.review)}>No
<input ref="no" type="radio" name="helpful_review" value='no' standalone/>
</Button>
</ButtonGroup>
</Col>
</FormGroup>
</Form>
</ListGroupItem>
)
}
}
class PostReview extends React.Component {
constructor(props){
super(props)
this.state = {showModal: false, review: new Review(this.props.user)}
this.open = this.open.bind(this)
this.close = this.close.bind(this)
this.onStarClick = this.onStarClick.bind(this)
this.handleChange = this.handleChange.bind(this)
this.getValidationState = this.getValidationState.bind(this)
this.submitReview = this.submitReview.bind(this)
}
onStarClick(nextValue, prevValue, name) {
let _state = this.state
_state.review[name] = nextValue
this.setState({review: _state.review})
}
open(){
this.setState({showModal: true})
}
close(){
this.setState({showModal: false})
}
getValidationState(key){
const _state = this.state
switch(key){
case 'title':
if (_state.review.title.length > 0) return "success"
else return "error"
break
case 'description':
if (_state.review.description.length > 0) return "success"
else return "error"
break
default:
return "success"
}
}
handleChange(key, event){
if(event) event.preventDefault()
let _state = this.state
_state.review[key] = event.target.value
this.setState({review: _state.review})
}
submitReview(){
let _props = this.props,
_state = this.state
_state.review.date = new Date()
_props.addReview(_state.review);
this.close();
}
render(){
const _state = this.state
return (
<div>
<Button bsStyle="primary" onClick={this.open}>
Write Your Review
</Button>
<Modal show={this.state.showModal} onHide={this.close}>
<Modal.Header closeButton>
<Modal.Title>Your Review</Modal.Title>
</Modal.Header>
<Modal.Body>
<Form>
<FormGroup>
<Col componentClass={ControlLabel} sm={5}>
<ControlLabel>Price</ControlLabel>
</Col>
<Col sm={7}>
<StarRatingComponent
name={'price'} /* name of the radio input, it is required */
value={_state.review.price} /* number of selected icon (`0` - none, `1` - first) */
starCount={5} /* number of icons in rating, default `5` */
onStarClick={this.onStarClick} /* on icon click handler */
/>
</Col>
</FormGroup>
<FormGroup>
<Col componentClass={ControlLabel} sm={5}>
<ControlLabel>Value</ControlLabel>
</Col>
<Col sm={7}>
<StarRatingComponent
name={'value'} /* name of the radio input, it is required */
value={_state.review.value} /* number of selected icon (`0` - none, `1` - first) */
starCount={5} /* number of icons in rating, default `5` */
onStarClick={this.onStarClick} /* on icon click handler */
/>
</Col>
</FormGroup>
<FormGroup>
<Col componentClass={ControlLabel} sm={5}>
<ControlLabel>Quality</ControlLabel>
</Col>
<Col sm={7}>
<StarRatingComponent
name={'quality'} /* name of the radio input, it is required */
value={_state.review.quality} /* number of selected icon (`0` - none, `1` - first) */
starCount={5} /* number of icons in rating, default `5` */
onStarClick={this.onStarClick} /* on icon click handler */
/>
</Col>
</FormGroup>
<FormGroup validationState={this.getValidationState('title')}>
<FormControl placeholder="Title"
type="text"
value={_state.review.title}
onChange={this.handleChange.bind(this, 'title')}/>
</FormGroup>
<FormGroup validationState={this.getValidationState('description')}>
<FormControl placeholder="Description"
componentClass="textarea"
value={_state.review.description}
onChange={this.handleChange.bind(this, 'description')}/>
</FormGroup>
</Form>
</Modal.Body>
<Modal.Footer>
<Button onClick={this.close}>Close</Button>
<Button bsStyle="primary" onClick={this.submitReview}>Submit</Button>
</Modal.Footer>
</Modal>
</div>
)
}
}
/*Sample Records*/
let user = {name: 'harsh'}
let product = {name: 'XYZ jkanfjk adbfh k'}
let reviews = [
new Review(user, 3,4,5,"Some title blah blah...", "Description 1"),
new Review(user, 1,4,5,"Some title blah blah...", "Description 2"),
new Review(user, 4,4,5,"Some title blah blah...", "Description 3"),
new Review(user, 5,4,5,"Some title blah blah...", "Description 4"),
new Review(user, 3,2,5,"Some title blah blah...", "Description 5"),
new Review(user, 3,3,5,"Some title blah blah...", "Description 6"),
new Review(user, 3,4,5,"Some title blah blah...", "Description 7"),
new Review(user, 3,1,5,"Some title blah blah...", "Description 8"),
new Review(user, 3,3,5,"Some title blah blah...", "Description 9"),
new Review(user, 3,4,1,"Some title blah blah...", "Description 10"),
new Review(user, 3,4,2,"Some title blah blah...", "Description 11"),
new Review(user, 3,4,4,"Some title blah blah...", "Description 12"),
]
ReactDOM.render(
<ViewReviews user={user} reviews={reviews} product={product}/>,
document.getElementById('root')) |
// This script builds a production output of all of our bundles.
import webpack from 'webpack';
import appRootDir from 'app-root-dir';
import { resolve as pathResolve } from 'path';
import rimraf from 'rimraf';
import webpackConfigFactory from '../../webpack/configFactory';
import { exec } from '../../utils';
import config from '../../config';
process.env.NODE_ENV = 'production';
// First clear the build output dir.
rimraf.sync(pathResolve(appRootDir.get(), config.buildOutputPath));
const compilers = Object.keys(config.bundles).map((bundleName) => {
const bundleConfig = config.bundles[bundleName];
return webpack(
webpackConfigFactory({
target: bundleConfig.target,
mode: 'production',
bundleConfig,
}),
);
});
async function runCompilers() {
for (let i = 0; i < compilers.length; i += 1) {
await new Promise((accept) => {
compilers[i].run((err, stats) => {
if (err) {
console.error(err);
return;
}
// console.log(stats.toString({ colors: true }));
console.log(`Done ${i + 1}/${compilers.length}`)
accept();
});
});
}
}
runCompilers();
|
import {lookupComponent} from '../utils/lookup';
import eachView from '../utils/each-view';
var K = function(){};
export default function(appOrContainer, expectation, count, options, customMessage){
var container;
if (appOrContainer.__container__) {
container = appOrContainer.__container__;
} else {
container = appOrContainer;
}
var Component = lookupComponent(container, expectation);
var $ = Ember.$;
if (!Component) {
return {
ok: false,
message: 'No component called ' + expectation + ' was found in the container'
};
}
if (!options) { options = {}; }
var callbackFn = options.callbackFn || K;
var found = 0;
var elements = [];
eachView(container, function(view){
if (Component.detectInstance(view)) {
found++;
callbackFn(view, found);
elements.push(view.element);
}
});
var message = count ?
'Expected to find '+count+' components of type ' + expectation + '. Found: ' + found :
'Expected to find at least one component: ' + expectation;
var result = {
ok: count ? found === count : found > 0, // if count specified then we must have exactly that many, otherwise we want at least 1
message: customMessage || message
};
if (result.ok && options.contains) {
var text = $(elements).text();
if (text.indexOf(options.contains) === -1) {
result.ok = false;
result.message = 'Expected component ' + expectation + ' to contain "' + options.contains +
'" but contained: "' + text + '"';
} else {
result.ok = true;
result.message = 'Component ' + expectation + ' contains: "' + options.contains + '"';
}
}
return result;
}
|
version https://git-lfs.github.com/spec/v1
oid sha256:83405de858139df240861e5b894b4f212f49bb2493231ac4b4994a56dd46bde4
size 3594
|
import React from 'react'
import styles from './ThumbnailGrid.module.css'
const ThumbnailGrid = ({ children }) => {
return (
<ul className={styles.container}>
{children.map((el, idx) => (
<li className={styles.thumbnail} key={idx}>{el}</li>
))}
</ul>
)
}
export default ThumbnailGrid
|
var app = angular.module('redirect', ['ngRoute'])
.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/none.html',
controller: 'mainCtrl'
})
.when('/add', {
templateUrl: 'views/add.html',
controller: 'addCtrl'
})
.when('/delete/:name', {
templateUrl: 'views/delete.html',
controller: 'addCtrl'
})
.when('/:id', {
templateUrl: 'views/redirect.html',
controller: 'redirectCtrl',
resolve: {
link: function($q, $route) {
var id = $route.current.params.id
var Redirect = Parse.Object.extend("redirects");
var myLink = $q.defer();
var query = new Parse.Query(Redirect);
query.equalTo("name", id);
query.find({
success: function(results) {
if (results.length) {
var link = results[0].get('link')
myLink.resolve({
message: "You will now be redirected. If you have disabled JavaScript, please click on the following link: ",
link: link
})
} else {
myLink.resolve({
message: "There is no such link",
link: ""
})
}
},
error: function(error) {
myLink.reject("Error: " + error.code + " " + error.message);
}
});
return myLink.promise
}
}
})
// This along with .htaccess file will allow redirects to be of the form http://server/r/short_code rather than http://server/r/#/short_code. Need to check whether this works as expected for browsers that don't support html5.
$locationProvider.html5Mode(true)
})
.run(function($routeParams) {
Parse.initialize(API_KEY, JAVASCRIPT_KEY);
});
app.controller('mainCtrl', function($scope, $routeParams) {})
app.controller('redirectCtrl', function($scope, $routeParams, link) {
if (link.message) {
$scope.message = link.message
}
if (link.link) {
$scope.link = link.link;
document.location = link.link
}
})
app.controller('addCtrl', function($scope, $routeParams) {
$scope.submitFunction = function(r, l, h) {
// Probably need do this on server before save.
if (CryptoJS.SHA512(h).toString() != SECRETHASH) {
$scope.error = {
msg: "Wrong code"
}
return
}
if (!r || !l) {
$scope.error = {
msg: "Failed to save to database."
}
return
}
var RedirectObject = Parse.Object.extend("redirects");
var rObject = new RedirectObject();
rObject.save({
name: r,
link: l
}).then(function(object) {
$scope.$apply(function() {
$scope.success = {
msg: "Success! Link is now live " + l
}
})
});
}
$scope.submitDelete = function(h) {
// Probably need do this on server before save.
if (CryptoJS.SHA512(h).toString() != SECRETHASH) {
$scope.error = {
msg: "Wrong code"
}
return
}
var Redirect = Parse.Object.extend("redirects");
var query = new Parse.Query(Redirect);
query.equalTo("name", $routeParams['name']);
query.find({
success: function(results) {
if (results.length) {
var link = results[0].destroy({
success: function(myObject) {
$scope.$apply(function() {
$scope.success = {
msg: "Successfully removed link"
}
})
},
error: function(myObject, error) {
$scope.$apply(function() {
$scope.error = {
msg: error.message
}
})
}
})
} else {
$scope.$apply(function() {
$scope.error = {
msg: "Error! There is no such link"
}
})
}
},
error: function(error) {
$scope.$apply(function() {
$scope.error = {
msg: "Error: " + error.code + " " + error.message
}
})
}
});
}
}) |
7.0-alpha1:7d30a58a478ffd8c4b0341199218c50beed5a08a33eb58fa7d0aeb59622af447
7.0-alpha2:7d30a58a478ffd8c4b0341199218c50beed5a08a33eb58fa7d0aeb59622af447
7.0-alpha3:7d30a58a478ffd8c4b0341199218c50beed5a08a33eb58fa7d0aeb59622af447
7.0-alpha4:5d500270fe4bd1a0ecf0b0472e3427ca00b19afc1de6d9b4edf8fc32aeb639eb
7.0-alpha5:2f1fbf349b7d8555b7bf303e4b9be8c4110aceb6b3f8b1cf935084ce1a9f178a
7.0-alpha6:2f1fbf349b7d8555b7bf303e4b9be8c4110aceb6b3f8b1cf935084ce1a9f178a
7.0-alpha7:2f1fbf349b7d8555b7bf303e4b9be8c4110aceb6b3f8b1cf935084ce1a9f178a
7.0-beta1:2f1fbf349b7d8555b7bf303e4b9be8c4110aceb6b3f8b1cf935084ce1a9f178a
7.0-beta2:2f1fbf349b7d8555b7bf303e4b9be8c4110aceb6b3f8b1cf935084ce1a9f178a
7.0-beta3:2f1fbf349b7d8555b7bf303e4b9be8c4110aceb6b3f8b1cf935084ce1a9f178a
7.1:975922c892082ee1763f460c7819f4f16d8b3ca2b7aad30811098a295cd0f4e6
7.2:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.3:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.4:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.5:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.6:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.7:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.8:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.9:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.10:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.11:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.12:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.13:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.14:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.15:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.16:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.17:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.18:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.19:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.20:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.21:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.22:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.23:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.24:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.25:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.26:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.27:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.28:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.29:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.30:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.31:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.32:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.33:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.34:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.35:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.36:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.37:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.38:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.39:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.40:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.41:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.42:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.43:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.44:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.50:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.51:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.52:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.53:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.54:4a1ea8399fae3368ae9857eb07d73967458d36e37b760957ac1837fcc6c627f9
7.0:2f1fbf349b7d8555b7bf303e4b9be8c4110aceb6b3f8b1cf935084ce1a9f178a
|
/*
* ------------------------------------------
* 瀑布式列表模块实现文件
* @version 1.0
* @author genify(caijf@corp.netease.com)
* ------------------------------------------
*/
/** @module util/list/waterfall */
NEJ.define([
'base/global',
'base/klass',
'base/event',
'base/element',
'base/util',
'util/template/tpl',
'./module.js'
],function(NEJ,_k,_v,_e,_u,_l,_t,_p,_o,_f,_r){
var _pro;
/**
* 瀑布式列表模块
*
* 结构举例
* ```html
* <div class="mbox">
* <div class="lbox" id="list-box">
* <!-- list box -->
* </div>
* <div class="mbtn" id="more-btn"> load more button </div>
* </div>
*
* <!-- list jst template -->
* <textarea name="jst" id="jst-list">
* {list beg..end as y}
* {var x=xlist[y]}
* <div class="item">
<a data-id="${x.id|x.name}" data-action="delete">删除</a>
* <p>姓名:${x.name}</p>
* <p>联系方式:${x.mobile}</p>
* </div>
* {/list}
* </textarea>
* ```
*
* 脚本举例
* ```javascript
* NEJ.define([
* 'base/klass',
* 'base/util',
* 'util/ajax/xdr',
* 'util/cache/abstract'
* ],function(_k,_u,_j,_t,_p){
* var _pro;
* // 自定义列表缓存
* _p._$$CustomListCache = _k._$klass();
* _pro = _p._$$CustomListCache._$extend(_t._$$CacheListAbstract);
*
* // 实现数据载入逻辑
* _pro.__doLoadList = function(_options){
* var _onload = _options.onload;
* // 补全请求数据,也可在模块层通过cache参数传入
* var _data = _options.data||{};
* _u._$merge(_data,{uid:'ww',sort:'xx',order:1});
* switch(_options.key){
* case 'user-list':
* // TODO load list from server
* _j._$request('/api/user/list',{
* type:'json',
* data:_u._$object2query(_data),
* onload:function(_json){
* // _json.code
* // _json.result
* _onload(_json.code==1?_json.result:null);
* },
* onerror:_onload._$bind(null);
* });
* break;
* // TODO other list load
* }
* };
* });
* ```
*
* 脚本举例
* ```javascript
* NEJ.define([
* '/path/to/cache.js',
* 'util/list/waterfall'
* ],function(_t,_p){
* // 构建列表模块,使用JST模版
* _p._$$ListModuleWF._$allocate({
* limit:5,
* parent:'list-box',
* item:'jst-list', // 这里也可以传自己实现的item类型
* cache:{
* key:'user-list',// 此key必须是唯一的,对应了item中的值,也是删除选项的data-id
* data:{uid:'ww',sort:'xx',order:1}, // <--- 列表加载时携带数据信息,此数据也可在cache层补全
* klass:_t._$$CustomListCache
* },
* pager:{parent:'pager-box'}
* });
* });
* ```
*
* @class module:util/list/waterfall._$$ListModuleWF
* @extends module:util/list/module._$$ListModule
*
* @param {Object} config - 可选配置参数
* @property {String|Node} more - 添加更多列表项按钮节点
* @property {String|Node} sbody - 滚动条所在容器,支持onscroll事件
* @property {Number} delta - 触发自动加载更多时距离滚动容器底部的偏移量,单位px,默认30
* @property {Number} count - 指定加载多少次后出现分页器
* @property {Number} number - 初始加载次数,小于等于count数有效
*/
_p._$$ListModuleWF = _k._$klass();
_pro = _p._$$ListModuleWF._$extend(_t._$$ListModule);
/**
* 控件重置
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__reset
* @param {Object} arg0 - 配置参数
* @return {Void}
*/
_pro.__reset = function(_options){
this.__doResetMoreBtn(_options.more);
this.__sbody = _e._$get(_options.sbody);
this.__doInitDomEvent([[
this.__sbody,'scroll',
this.__onCheckScroll._$bind(this)
]]);
var _delta = _options.delta;
if (_delta==null) _delta = 30;
this.__delta = Math.max(0,_delta);
var _count = parseInt(_options.count)||0;
this.__count = Math.max(0,_count);
var _number = parseInt(_options.number)||0;
if (_number>1&&_number<=_count){
this.__number = _number;
}
this.__super(_options);
};
/**
* 控件销毁
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__destroy
* @return {Void}
*/
_pro.__destroy = function(){
this.__super();
delete this.__nmore;
delete this.__sbody;
delete this.__endskr;
delete this.__nexting;
};
/**
* 取当前偏移量的分页信息
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__getPageInfo
* @param {Number} arg0 - 偏移位置
* @param {Number} arg1 - 长度
* @return {Object} 分页信息,如:{index:1,total:4}
*/
_pro.__getPageInfo = function(_offset,_length){
var _point = this.__first+(this.__count-1)*this.__limit,
_limit = this.__count*this.__limit;
return this.__super(_point,_offset,_limit,_length);
};
/**
* 重置载入更多按钮
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__doResetMoreBtn
* @param {String|Node} arg0 - 按钮节点
* @return {Void}
*/
_pro.__doResetMoreBtn = function(_more){
this.__nmore = _e._$get(_more);
this.__doInitDomEvent([[
this.__nmore,'click',
this._$next._$bind(this)
]]);
};
/**
* 检查滚动条
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__doCheckScroll
* @return {Void}
*/
_pro.__doCheckScroll = function(_element){
if (this.__endskr||!_element||
!this.__lbox.clientHeight) return;
if (!_element.scrollHeight)
_element = _e._$getPageBox();
var _offset = _e._$offset(this.__lbox,this.__sbody),
_delta = _offset.y+this.__lbox.offsetHeight-
_element.scrollTop-_element.clientHeight,
_noscroll = _element.scrollHeight<=_element.clientHeight;
if (_delta<=this.__delta||(_noscroll&&!this.__endskr)){
// render first
window.setTimeout(this._$next._$bind(this),0);
}
};
/**
* 检查滚动情况
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__onCheckScroll
* @return {Void}
*/
_pro.__onCheckScroll = function(_event){
if (this.__endskr) return;
var _node = _v._$getElement(_event);
if (!_node){
_node = _e._$getPageBox();
}
this.__doCheckScroll(_node);
};
/**
* 页码变化处理逻辑
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__doChangePage
* @param {Object} 页码信息
* @return {Void}
*/
_pro.__doChangePage = function(_event){
this.__super(_event);
if (!_event.stopped){
this.__doClearListBox();
var _offset = 0;
if (_event.index>1){
_offset = this.__first+((
_event.index-1)*this.__count-1)*this.__limit;
}
this.__offset = _offset;
this._$next();
}
};
/**
* 生成请求对象信息
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__doGenRequestOpt
* @param {Object} arg0 - 预处理请求信息
* @return {Object} 处理后请求信息
*/
_pro.__doGenRequestOpt = function(_options){
if (!!this.__number){
var _delta = _options.offset>0?this.__limit:this.__first,
_limit = _delta+this.__limit*(this.__number-1);
this.__offset = _options.offset+_limit;
_options.data.limit = _limit;
_options.limit = _limit;
delete this.__number;
}
return _options;
};
/**
* 数据列表载入完成回调
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__cbListLoad
* @param {Object} arg0 - 请求信息
* @return {Void}
*/
_pro.__cbListLoad = function(_options){
delete this.__nexting;
if (!this.__super(_options)){
this._$resize();
}
};
/**
* 列表变化回调(删除/添加)
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__cbListChange
* @return {Void}
*/
_pro.__cbListChange = function(_event){
if (!!_event.key&&
_event.key!=this.__ropt.key){
return;
}
switch(_event.action){
case 'refresh':
case 'append':
delete this.__nexting;
break;
}
this.__super(_event);
};
/**
* 加载数据之前处理逻辑,显示数据加载中信息
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__doBeforeListLoad
* @return {Void}
*/
_pro.__doBeforeListLoad = function(){
this.__doShowMessage('onbeforelistload','列表加载中...');
_e._$setStyle(this.__nmore,'display','none');
};
/**
* 列表绘制之前处理逻辑
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__doBeforeListRender
* @return {Void}
*/
_pro.__doBeforeListRender = function(_list,_offset,_limit){
var _length = _list.length,
_ended = _list.loaded
? _offset+_limit>=_length
: _offset+_limit>_length;
this.__offset = Math.min(this.__offset,_length);
_e._$setStyle(this.__nmore,'display',_ended?'none':'');
if (_ended) this.__endskr = !0;
if (this.__count>0){
// check pager
var _info = this.__getPageInfo(_offset,_list.length);
if (this.__doSyncPager(_info.index,_info.total)) return !0;
// check scroll end
var _delta = this.__first-this.__limit,
_number = this.__count*this.__limit;
this.__endskr = (_offset+_limit-_delta)%_number==0||_ended;
// sync more button and pager
_e._$setStyle(
this.__nmore,'display',
this.__endskr?'none':''
);
this.__doSwitchPagerShow(
this.__endskr&&_info.total>1?'':'none'
);
}
};
/**
* 列表为空时处理逻辑
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__doShowEmpty
* @return {Void}
*/
_pro.__doShowEmpty = function(){
this.__offset = 0;
this.__endskr = !0;
this.__doShowMessage('onemptylist','没有列表数据!');
};
/**
* 以jst模版方式绘制列表
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__doShowListByJST
* @return {Void}
*/
_pro.__doShowListByJST = function(_html,_pos){
this.__lbox.insertAdjacentHTML(_pos||'beforeEnd',_html);
};
/**
* 以item模版方式绘制列表
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__doShowListByItem
* @return {Void}
*/
_pro.__doShowListByItem = function(_items){
this.__items = this.__items||[];
if (_u._$isArray(_items)){
_r.push.apply(this.__items,_items);
}else{
this.__items.push(_items);
}
};
/**
* 添加列表项回调
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__cbItemAdd
* @return {Void}
*/
_pro.__cbItemAdd = function(_event){
_e._$removeByEC(this.__ntip);
this.__doCheckResult(_event,'onafteradd');
var _flag = _event.flag;
if (_event.stopped||!_flag) return;
// with pager
if (this.__count>0){
this.__doRefreshByPager();
return;
}
// without pager
this.__offset += 1;
_flag==-1 ? this._$unshift(_event.data)
: this._$append(_event.data);
};
/**
* 删除列表项回调
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__cbItemDelete
* @return {Void}
*/
_pro.__cbItemDelete = function(_event){
this.__doCheckResult(_event,'onafterdelete');
if (_event.stopped) return;
// with pager
if (this.__count>0){
this.__doRefreshByPager();
return;
}
// without pager
var _id = _event.data[this.__iopt.pkey];
if (!!this.__items){
var _item = _l._$getItemById(
this.__getItemId(_id)
),
_index = _u._$indexOf(this.__items,_item);
if (_index>=0){
this.__items.splice(_index,1);
this.__offset -= 1;
}
if (!!_item) _item._$recycle();
}else{
var _node = this._$getItemBody(_id);
if (!!_node) this.__offset -= 1;
_e._$remove(_node);
}
if (this.__offset<=0) this._$next();
};
/**
* 批量添加回调
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__cbAppendList
* @param {Object} arg0 - 偏移量
* @param {Object} arg1 - 数量
* @return {Void}
*/
_pro.__cbAppendList = function(_offset,_limit){
if (_offset!=this.__offset) return;
// check list loaded
if (this._$isLoaded()){
this.__endskr = !1;
this._$resize();
}
};
/**
* 前向追加数据片段回调
*
* @protected
* @method module:util/list/waterfall._$$ListModuleWF#__cbUnshiftList
* @param {Number} arg0 - 偏移量
* @param {Number} arg1 - 数量
* @return {Void}
*/
_pro.__cbUnshiftList = function(_offset,_limit){
if (_offset!=0) return;
var _xlist = this.__cache._$getListInCache(
this.__ropt.key
);
for(var i=_limit-1;i>=0;i--){
this._$unshift(_xlist[i]);
}
};
/**
* 重置大小触发滚动条修正
*
* @method module:util/list/waterfall._$$ListModuleWF#_$resize
* @return {Void}
*/
_pro._$resize = function(){
// if not scroll check next
var _element = this.__sbody;
if (!_element||this.__endskr) return;
this.__doCheckScroll(this.__sbody);
};
/**
* 刷新模块
*
* @method module:util/list/waterfall._$$ListModuleWF#_$refresh
* @param {Number} 刷新到的页码
* @return {Void}
*/
_pro._$refresh = function(){
delete this.__endskr;
this.__super();
};
/**
* 载入更多列表
*
* @method module:util/list/waterfall._$$ListModuleWF#_$next
* @return {Void}
*/
_pro._$next = function(){
// lock loading
if (!!this.__nexting)
return;
this.__nexting = !0;
// update offset first for
// offset adjust after list loaded
var _offset = this.__offset;
this.__offset += _offset==0?
this.__first:this.__limit;
this.__doChangeOffset(_offset);
};
if (CMPT){
NEJ.copy(NEJ.P('nej.ut'),_p);
}
return _p;
});
|
// start multiple sessions
// tested with 2000 sessions apr 2014 node 0.10.26, basex 7.8.2
// was failing with around 200 sessions
var basex =require("../index");
var log = require("../debug");
basex.debug_mode = false;
var sCount=300; // max 200
var sessions=[];
//show supplied msg then basex server response
/**
* Description
* @method track
* @param {} msg
* @return FunctionExpression
*/
function track(msg) {
return function(err, reply){
sCount--;
console.log("closed: ",msg, ", remaining: ",sCount);
if(arguments.length==2) print(err, reply)
}
};
for(i=0;i<sCount;i++){
sessions.push(new basex.Session())
};
sessions.map(function(s){return s.execute("xquery 1 to 10",log.printMsg(s.tag))})
sessions.map(function(s){return s.close(track(s.tag))})
//sessions.map(function(s){s.execute("xquery 1 to 10",log.printMsg(s.tag))})
|
function gridify(self) {
var results = [];
var row = [];
Object.keys(self.productList).forEach(function (k, i) {
var item = m('div.col.centered.w25', [
m('img', {src: self.productList[k].imgUrl}),
m('p', [
m('span.title', self.productList[k].title),
m('br'),
m('div.sku', chrome.i18n.getMessage('itemlabel') + k),
m('div.sku', chrome.i18n.getMessage('modellabel') + self.productList[k].model)
])
])
if ((i > 0) && (i % 4 == 0)) {
results.push(row);
row = [item];
} else {
row.push(item);
}
})
results.push(row);
return results
}
var ResultsApp = {};
ResultsApp.oninit = function () {
var self = this;
self.productList = {};
self.listBanner = {title: '', subtitle: ''};
chrome.storage.sync.get(null, function (items) {
if ('productlist' in items) {
self.productList = items['productlist'];
}
if ('listbanner' in items) {
self.listBanner = items['listbanner'];
}
m.redraw();
});
}
ResultsApp.view = function () {
var self = this;
return m('div.container', [
m('div.header.centered.w100', [
m('div.titlelogo', m('img', {src: chrome.runtime.getURL('/assets/img/' + chrome.i18n.getMessage('stapleslogo'))})),
m('div.titles', [
m('h1.title', self.listBanner.title),
m('h2.subtitle', self.listBanner.subtitle)
])
]),
Object.keys(self.productList).length > 0 ? gridify(self).map(function (o) {
return m('div.row', o);
}) : ''
]);
}
m.mount(document.getElementById('infresults'), ResultsApp); |
describe('Test Suite for mapstats bundle', function() {
var appSetup = null,
appConf = null,
statsPlugin = null,
sandbox = null;
before(function() {
appSetup = getStartupSequence(['openlayers-default-theme', 'mapfull']);
var mapfullConf = getConfigForMapfull();
// overwrite test wide appConf
appConf = {
"mapfull": mapfullConf,
"mapstats": {
"state": {},
"conf": {}
}
};
});
function startApplication(done, setup, conf) {
if(!setup) {
// clone original settings
setup = jQuery.extend(true, {}, appSetup);
}
if(!conf) {
// clone original settings
conf = jQuery.extend(true, {}, appConf);
}
//setup HTML
jQuery("body").html(getDefaultHTML());
// startup Oskari
setupOskari(setup, conf, function() {
// Find handles to sandbox and stats plugin.
sandbox = Oskari.getSandbox();
statsPlugin = sandbox.findRegisteredModuleInstance('MainMapModuleStatsLayerPlugin');
done();
});
};
describe('initialization', function() {
before(startApplication);
after(teardown);
it('should be defined', function() {
expect(sandbox).to.be.ok();
expect(statsPlugin).to.be.ok();
expect(statsPlugin.getName()).to.be('MainMapModuleStatsLayerPlugin');
});
});
}); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.