code stringlengths 1 2.08M | language stringclasses 1
value |
|---|---|
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[1,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0],
[1,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
module.exports.getMap = function()
{
return [
[0,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0],
[0,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0],
[3,3,3,3,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,3,3],
[3,3,3,3,0,0,0,0... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0],
[0,0,3,3,3,3,3,3,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,3,3,3,3,3,3,1,1,0,0,0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,4,4,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0],
[0,0,0,0,0,0,4,4,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,2,2,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0],
[0,0,1,1,4,4,4,4,0,0,2,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,2,2,0,0,0,0],
[0,0,0,0,2,2,0,0... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[2,2,2,2,0,0,0,0,2,2,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0,0],
[2,2,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0],
[0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0],
[0,0,1,1,1,1,1,1... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,5,5,5,5,5,5,5,5,5,5,0,0,5,5,5,5,5,5,5,5,5,5,0,0],
[0,0,5,5,5,5,5,5,5,5,5,5,0,0,5,5,5,5,5,5,5,5,5,5,0,0],
[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],
[5,5,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0],
[0,0,0,1,0,0,1,1... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0],
[0,0,1,1,0,0,2,2,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0],
[0,0,1,1,0,0,2,2,0,0,0,0,0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[3,3,3,3,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,3,3,3,3],
[3,3,3,3,0,0,0,0... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0],
[0,0,1,1,0,0,1,1,1,1,0,0,0,0,5,5,5,5,5,5,1,1,1,1,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,3,3,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,3,3,0,0],
[0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,2,2,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0],
[0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0],
[0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,2,2,0,0,1,1,0,0,1,1,0,0,1,1,0,0,2,2,0,0],
[0,0,0,0,0,0,2,2,0,0,1,1,0,0,1,1,0,0,1,1,0,0,2,2,0,0],
[0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0],
[0,0,1,1,0,0,1,1,0,0,1,1,0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,3,3,2,2,3,3,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,2,2,0,0,1,1,0,0,1,1,1,1,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,2,2,0,0,1,1,0,0,1,1,1,1,0,0,0,0],
[0,0,0,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0],
[0,0,0,1,1,1,1,1... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0],
[0,0,2,2,0,0,0,0,0,0,2,2,0,0,0,0,2,2,3,3,3,3,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0],
[0,0,3,3,3,3,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0],
[0,0,3,3,3,3,1,1... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0],
[0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0],
[0,0,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
module.exports.getMap = function()
{
return [
[0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0],
[0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0],
[3,3,1,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0],
[3,3,1,1,1,1,1,1... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
// 4 - water
// 5 - ice
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0],
[4,4,4,4,0,0,4,4,0,0,4,4,4,4,4,4,4,4,0,0,4,4,4,4,4,4],
[4,4,... | JavaScript |
// 1 - wall
// 2 - steel wall
// 3 - trees
module.exports.getMap = function()
{
return [
[0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0],
[0,0,1,1,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,1,0,0,1,1,0,0],
[0,0,1,1,0,0,1,1,0,0,0,0,0,0,... | JavaScript |
if (!window.availableLangs['default']) {
window.availableLangs['default'] = {};
}
window.availableLangs['default']['ru'] = {
'enter-nick': 'Введите ник:'
, 'legend-play': 'Игра'
, 'legend-learn': 'Учебник программирования'
, 'submit-play': 'Вход'
, 'submit-learn': 'Вход'
, 'he... | JavaScript |
window.availableLangs = {};
window.lang = {current: null};
function applyLang(lang, context, recursive)
{
if (!lang) {
lang = window.lang.current;
} else {
window.lang.current = lang;
}
var elements = $('.lang', context);
if (context) {
elements = elements.add(context.filt... | JavaScript |
if (!window.availableLangs['default']) {
window.availableLangs['default'] = {};
}
window.availableLangs['default']['en'] = {
'enter-nick': 'Enter nick:'
, 'legend-play': 'Game'
, 'legend-learn': 'Code tutorials'
, 'submit-play': 'Login'
, 'submit-learn': 'Login'
, 'header-play... | JavaScript |
/**
* Интерпритатор эмулирует синхронное выполнение кода оправляя команды обработчику
* и дожидаясь выполнения каждой команды.
*
* @var code массив действий для выполнения
*/
/*
Регистры (любое значение):
ax
Встроенные функции:
move (distance)
turn (direction)
fire
x - get tank x
y - get tank y
Che... | JavaScript |
PascalCompiler = function PascalCompiler(codeStr)
{
this.codeStr = codeStr;
this.cur = 0;
this.line = 1;
this.char = 1;
this.posStack = []; // stack to save cursor positions to properly show error place
this.buildInFunc = {
'write': {
'signature': 'var', // var args
... | JavaScript |
function SymbolTable()
{
this.identifiers = [];
};
SymbolTable.prototype._index = function(name, sig)
{
return name + (sig ? ':' + sig.join(',') : '');
};
SymbolTable.prototype.addVar = function(name, type)
{
if (this.look(name) == null) {
var v = {name: name, type: type};
v.offset = this... | JavaScript |
function VmRunner(client)
{
this.client = client;
this.vm = new Vm(client);
this.codeInterval = null;
var self = this;
client.socket.on('disconnect', function(){
clearInterval(self.codeInterval);
});
client.socket.on('unjoined', function(){
clearInterval(self.codeInterval);... | JavaScript |
Premade = function Premade(name, type)
{
this.name = name;
this.type = type || 'classic';
this.level = 1;
this.userCount = 0;
this.locked = false; // lock for new users
if (!isClient()) {
this.users = new TList(); // todo move to clan?
switch (this.type) {
case 'clas... | JavaScript |
/**
* public interface:
* void add(item)
* bool remove(item)
* bool move(item, newX, newY)
* object[] intersects(item)
*/
MapTiled = function MapTiled(width, height)
{
this.all = []; // for fast traversal
this.items = [];
this.maxX = Math.ceil(width/this.tileSize) - 1;
this.maxY = Math.ceil(height... | JavaScript |
/**
* this is for both, client and server.
*/
User = function User()
{
};
Eventable(User.prototype);
/**
* @todo hack for BcClient.onUserChange()
* @param data
* @return
*/
User.prototype.serialize = function()
{
var res = [];
res[1] = this.id;
res[2] = this.nick;
res[3] = this.lives;
res[... | JavaScript |
vector = function vector(x)
{
if (x) {
return x/Math.abs(x);
} else {
return 0;
}
};
isClient = function isClient()
{
return !(typeof window == 'undefined' && typeof global == 'object');
};
serializeTypeMatches = {
'Bullet' : 1,
'Tank' : 2,
'TankBot'... | JavaScript |
Game = function Game(map, premade)
{
this.running = true; // premade set this to false before game over
this.premade = premade;
this.stepableItems = [];
this.field = new Field(13*32, 13*32);
this.field.game = this;
this.field.on('add', this.onAddObject.bind(this));
this.field.on('remove', ... | JavaScript |
var path = require("path");
var fs = require("fs");
/**
* This object is an interface for "server-side" variables. All access to them
* should be done here.
*
* @param socket EventEmitter
*/
BcServerInterface = function BcServerInterface(socket)
{
this.user = null;
this.socket = socket;
socket.on('lo... | JavaScript |
Message = function Message(text)
{
this.time = Date.now();
this.text = text;
};
Eventable(Message.prototype);
Message.prototype.serialize = function()
{
return [
serializeTypeMatches[this.constructor.name] // 0
, this.id // 1
, this.time // 2
, this.user.id // 3
, this.use... | JavaScript |
// test is this node.js or browser
if (typeof require == 'function') {
EventEmitter = require('events').EventEmitter;
}
Eventable = function Eventable(object)
{
for (var i in EventEmitter.prototype) {
object[i] = EventEmitter.prototype[i];
}
};
| JavaScript |
/**
* Don't call Array methods which modify items, because they don't emit events.
*/
TList = function TList()
{
this.items = [];
};
Eventable(TList.prototype);
TList.prototype.get = function(id)
{
return this.items[id];
};
TList.prototype.add = function(item)
{
if (item.id !== undefined) {
th... | JavaScript |
/**
*
* @param context
* @param client
* @return
*/
function UiGameControls(context, client)
{
this.context = context;
this.resetState();
var self = this;
client.socket.on('gameover', this.setStateGameOver.bind(this));
client.socket.on('started', this.setStateGameRunning.bind(this));
clie... | JavaScript |
function WidgetPublic(context, client)
{
this.premades = new UiPremadeList(
client.premades,
$('.premades', context), 'premade');
this.publicChat = new WidgetPublicChat(context, client);
$('.premade', context).live('click', function(){
client.join($('.name', this).text());... | JavaScript |
function WidgetPremade(context, client)
{
this.levelSelector = new WidgetLevelSelector($('.level', context), client);
this.chat = new WidgetPremadeChat(context, client);
this.gameControls = new UiGameControls(context, client);
};
| JavaScript |
function UiList(list, container, itemClass)
{
if (arguments.length) {
this.container = container;
this.itemClass = itemClass;
list.on('add', this.onAdd.bind(this));
list.on('change', this.onChange.bind(this));
list.on('remove', this.onRemove.bind(this));
}
};
UiList.pro... | JavaScript |
//====== WidgetLevelSelector ===================================================
function WidgetLevelSelector(context, client)
{
client.currentPremade.on('change', function() {
// "this" is client.currentPremade
var levelSelect = $('select', context);
levelSelect.empty();
for (var ... | JavaScript |
function WidgetNotifier(client)
{
client.socket.on('user-message', function(data) {
alert(data.message);
});
client.socket.on('nickNotAllowed', function(){
alert('Ник занят. Выберите другой.');
});
client.socket.on('doNotFlood', function() {
alert('Слишком много сообщений за... | JavaScript |
function WidgetCreateBot(context, client)
{
this.context = context;
context.tabs({
show: function(event, ui) {
if (ui.index == 1) {
// hack to force codeMirror to show code
window.codeMirror.setValue(window.codeMirror.getValue());
window.codeM... | JavaScript |
function WidgetExercises(context, client)
{
this.courses = new UiCoursesList(client.courses, $('.courses', context), 'course', client);
this.exercises = new UiExercisesList(client.exercises, $('.exercise-list', context), 'exercise');
$('.exercise .select', context).live('click', function(){
var na... | JavaScript |
function WidgetPublicChat(context, client)
{
this.context = context;
this.client = client;
this.users = new UiUserList(
client.users,
$('.user-list', context), 'user');
this.messages = new UiMessageList(
client.messages,
$('.messages', context), 'message')... | JavaScript |
function FieldView(context, client)
{
this.field = client.field;
this.context = context;
this.c2d = $('#field', context).get(0).getContext('2d');
this.c2d.font ="bold 25px Arial";
this.step = 1;
this.animateIntervalId = null;
var self = this;
this.field.on('remove', function(object){
... | JavaScript |
function WidgetHelp(context, client)
{
client.socket.on('started', function(event){
var langfile = '/src/edu/' + event.courseName + '/ex' + event.exerciseId;
$('.lang', context).attr('langfile', langfile);
$('.content', context).attr('onlang', 'WidgetHelp.onLang');
applyLang(null, c... | JavaScript |
function WidgetGame(context, client)
{
this.controller = new TankController(client);
this.tankStack = new UiTankStack(
client.tankStack,
$('#bot-stack', context), 'bot');
this.userPoints = new UserPoint(client.premadeUsers);
this.fieldView = new FieldView(context, client);
t... | JavaScript |
function WidgetConsole(context, client)
{
client.on('compile-error', function(ex){
context.text(context.text() + ex.message + '\n');
});
client.on('write', function(data){
context.text(context.text() + data);
});
}
| JavaScript |
function UiManager(client)
{
this.client = client;
this.loginForm = new WidgetLoginForm($('#login'), client);
this.publicArea = new WidgetPublic($('#public'), client);
this.createGame = new WidgetCreateGame($('#create'), client);
this.premade = new WidgetPremade($('#premade'), client);
thi... | JavaScript |
//interface:
var self = this;
var store = {};
this.botCodeInterval = setInterval(function() {
var tank = {
getX : function()
{
return self.field.get(self.user.tankId).x;
},
getY : function()
{
return self.field.get(s... | JavaScript |
var util = require('util');
var vm = require('vm');
var fs = require("fs");
var sandbox = {
};
fs.readFile('untrusted.js', 'utf8', function(err, file) {
if(!err) {
// try {
vm.runInNewContext(file, sandbox);
// } catch (ex) {
// console.log(ex, ex.message);
// ... | JavaScript |
qwe(); | JavaScript |
var n = 0;
var id = 0;
/**
* this is also object manager, so all coordinate operations should be done here
* Ideally object should not know about x and y
*
* public interface:
* add(item)
* remove(item)
* move(item, newX, newY)
* intersects(item)
*/
function Area(x, y, hw, hh, leaf)
{
this.x = x;
thi... | JavaScript |
$(window).resize(function(){
$('#body').height($(this).height() - $('#mainmenu').height() - 1);
$('.chat-log').height($('#body').height() - 70);
$('.user-list').add('.premades').height($('#body').height() - 18 * 3);
$('#tabs-help').add('#tabs-editor').height($('#bot-editor').height() - $('#bot-editor .... | JavaScript |
// Copyright Joyent, Inc. and other Node contributors.
//
// 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, modi... | JavaScript |
CodeMirror.defineMode("pascal", function(config) {
function words(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
var keywords = words("and array begin case const div do downto else end file for forward integer " +
... | JavaScript |
// CodeMirror v2.18
// All functions that need access to the editor's state live inside
// the CodeMirror function. Below that, at the bottom of the file,
// some utilities are defined.
// CodeMirror is the only global var we claim
var CodeMirror = (function() {
// This is the function that produces an editor insta... | JavaScript |
CodeMirror.defineMode("javascript", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var jsonMode = parserConfig.json;
// Tokenizer
var keywords = function(){
function kw(type) {return {type: type, style: "keyword"};}
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"... | JavaScript |
CodeMirror.runMode = function(string, modespec, callback) {
var mode = CodeMirror.getMode({indentUnit: 2}, modespec);
var isNode = callback.nodeType == 1;
if (isNode) {
var node = callback, accum = [];
callback = function(string, style) {
if (string == "\n")
accum.push("<br>");
else if... | JavaScript |
var FaviconCollective = {
QueryInterface: function(aIID)
{
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
onLocat... | JavaScript |
pref("extensions.favicon.client-id", "");
pref("extensions.favicon.upload-uri", "http://16x16.appspot.com/send/");
pref("extensions.favicon.uri.enabled", true);
pref("extensions.favicon.https.enabled", false);
pref("extensions.favicon.client-id.enabled", false);
| JavaScript |
/*
Copyright 2010 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | JavaScript |
/*
Copyright 2010 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | JavaScript |
Object.extend(String.prototype, {
stripTags: function() {
return this.replace(/<\/?[^>]+>/gi, '');
},
stripScripts: function() {
return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
},
extractScripts: function() {
var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
... | JavaScript |
var Hash = {
_each: function(iterator) {
for (key in this) {
var value = this[key];
if (typeof value == 'function') continue;
var pair = [key, value];
pair.key = key;
pair.value = value;
iterator(pair);
}
},
keys: function() {
return this.pluck('key');
}... | JavaScript |
if (!window.Event) {
var Event = new Object();
}
Object.extend(Event, {
KEY_BACKSPACE: 8,
KEY_TAB: 9,
KEY_RETURN: 13,
KEY_ESC: 27,
KEY_LEFT: 37,
KEY_UP: 38,
KEY_RIGHT: 39,
KEY_DOWN: 40,
KEY_DELETE: 46,
element: function(event) {
return event.target || event.sr... | JavaScript |
// script.aculo.us unittest.js v1.6.5, Wed Nov 08 14:17:49 CET 2006
// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com)
// (c) 2005, 2006 Michael Schuerig (http://www.schuerig.de/michael/)
//
// script.aculo.us ... | JavaScript |
// script.aculo.us slider.js v1.6.5, Wed Nov 08 14:17:49 CET 2006
// Copyright (c) 2005, 2006 Marty Haught, Thomas Fuchs
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
if(!Control) var Control = {};
Cont... | JavaScript |
var $A = Array.from = function(iterable) {
if (!iterable) return [];
if (iterable.toArray) {
return iterable.toArray();
} else {
var results = [];
for (var i = 0; i < iterable.length; i++)
results.push(iterable[i]);
return results;
}
}
Object.extend(Array.prototype, Enumerable);
Array.pr... | JavaScript |
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
var Abstract = new Object();
Object.extend = function(destination, source) {
for (property in source) {
destination[property] = source[property];
}
return destination;
}
Object.inspect = ... | JavaScript |
var Field = {
clear: function() {
for (var i = 0; i < arguments.length; i++)
$(arguments[i]).value = '';
},
focus: function(element) {
$(element).focus();
},
present: function() {
for (var i = 0; i < arguments.length; i++)
if ($(arguments[i]).value == '') return false;
return t... | JavaScript |
// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// 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 th... | JavaScript |
// script.aculo.us builder.js v1.6.5, Wed Nov 08 14:17:49 CET 2006
// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
var... | JavaScript |
var $break = new Object();
var $continue = new Object();
var Enumerable = {
each: function(iterator) {
var index = 0;
try {
this._each(function(value) {
try {
iterator(value, index++);
} catch (e) {
if (e != $continue) throw e;
}
});
} catch (e) ... | JavaScript |
var Ajax = {
getTransport: function() {
return Try.these(
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
function() {return new ActiveXObject('Microsoft.XMLHTTP')},
function() {return new XMLHttpRequest()}
) || false;
},
activeRequestCount: 0
}
Ajax.Responders = {
respond... | JavaScript |
ObjectRange = Class.create();
Object.extend(ObjectRange.prototype, Enumerable);
Object.extend(ObjectRange.prototype, {
initialize: function(start, end, exclusive) {
this.start = start;
this.end = end;
this.exclusive = exclusive;
},
_each: function(iterator) {
var value = this.start;
do {
... | JavaScript |
var Position = {
// set to true if needed, warning: firefox performance problems
// NOT neeeded for page scrolling, only if draggable contained in
// scrollable elements
includeScrollOffsets: false,
// must be called before calling withinIncludingScrolloffset, every time the
// page is scrolled
prepare:... | JavaScript |
document.getElementsByClassName = function(className, parentElement) {
var children = ($(parentElement) || document.body).getElementsByTagName('*');
return $A(children).inject([], function(elements, child) {
if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
elements.push(child);
... | JavaScript |
/**
* Javascript Language Pack Manager
*/
var $L = {
/**
* 언어팩 배열
*/
_lang : {},
/**
* 비어있는 문자인지 판단
*/
_isEmpty : function(val) {
if (!val) return true;
if (val == null) return true;
if (val == undefined) return true;
if (val == '') return true;
... | JavaScript |
/**
* i18n - Javascript Internationalization System
*
* @author Platform Team
*/
(function() {
var $i18n = {
/**
* Messages
* @var array
* {
* 'DOMAIN NAME' : {
* 'KEY NAME' : 'value',
* 'KEY NAME(Plurals) : ['value', 'value', .... | JavaScript |
/*!
* jQuery JavaScript Library v1.6.1
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
... | JavaScript |
/*!
* jQuery JavaScript Library v1.9.1
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-2-4
*/
(function( window, undefined ) {
// Can't do t... | JavaScript |
/*!
* jQuery JavaScript Library v1.6.4
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
... | JavaScript |
/**
* Sslwrap
*
* @package jquery
* @subpackage Sslwrap
*/
var Sslwrap = {
/**
* HTML 활성화 어트리뷰트 (활성화 : 1, 비활성화 : 0)
* @var {string}
*/
_attrKey : 'fw-sslwrap',
/**
* 암호화 전송 REQUEST 키
* @var {string}
*/
_rKey : null,
/**
* 암호화 배열 데이터 접두어 키
* @var {s... | JavaScript |
/**
* @class
* DatePicker 를 호출합니다.
*
* @options
* 'pop_calendar' : '.pop_calendar' , // Calendar Html class
* 'years_between' : [2007,2013] , // 셀렉트 박스의 날짜 출력 시작년, 종료년
* 'days' : ['일', '월', '화', '수', '목', '금', '토'], // 날짜 년월
* 'format' : 'yyyy-mm-dd', // 포맷
* 'animate' : true ... | JavaScript |
/***
* yakuPaging.js pager
*
* @sinde 2010-12-03
* @author jsyang <[email protected]>
* @version 1.3
*/
;(function($){
$.fn.paging = function(opts)
{
var options = $.extend($.fn.paging.defaults, opts);
var current_page = options.current_page;
var total_record = options.total_record;
var... | JavaScript |
/**
* @class
* jquery.Popup.js Layer Popup OPEN, CLOSE
*
* @name Popup
* @author JsYang <[email protected]>
* @since 2009-10-16
* @version 2.0
*/
;(function($) {
var status = {};
var ie6 = $.browser.msie && parseInt($.browser.version) == 6 && typeof window['XMLHttpRequest'] != "object";
$.fn.Popup = f... | JavaScript |
/**
* @class
* jsTooltips Class 특정 element's 에 마우스를 오버 하였을 경우 특정 마우스 밑에 레이어가 출력
*
* 옵션 및 인스턴스가 공유 될 것인지 , 각각 해당되는 지역으로 만 존재 할 지 고민하고 개발해야 한다.
*
* @options
'delay' : 200, // 사라지는 시간.
'id' : "jsTooltip" ,
'top' : 5, 사우스에서의 위치
'left' : 5,
'fade' : false,
'opacity... | JavaScript |
/**
* jquery.12r.comma.js 키보드의 숫자를 입력시 3자리마다 콤마를 찍어 줍니다.
*
* @options
* numberCheck 키보드 입력시 문자를 체크 true, false
* msg 경고 메시지
*
* @use
* var c =jQuery.numberformat(".comma");
* $(".comma").numberformat();
*
* @auther jsyang <[email protected]>
* @since 2010년 12월 9일 목요일
* @version 1.0
*/
;(function($){
$.... | JavaScript |
/**
* jquery.12r.flash.js Flash Movie Loading
*
* @options
*
* @use
* $("#flash-movie").flash({wmode : Transparent, loop : false, paly : true});
*
*
* @auther jsyang <[email protected]>
* @since 2010년 12월 9일 목요일
* @version 1.0
*/
;(function($){
$.fn.flash = function(opts){
var $this = $(this);
... | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.