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,2,2,0,0,1,1,2,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0],
[0,0,0,0,2,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0],
[0,0,0,0,1,1,0,0,1,1,3,3,0,0,1,1,1,1,1,1,1,1,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,1,1,0,0,1,1,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,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,4,4,3,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0],
[2,2,... | 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,1,1,1,1,1,1,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,0,0],
[0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0],
[0,0,1,1,1,1,1,1... | 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,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,1,1,1,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,2,2,2,2,2,2,0,0,0,0],
[2,2,0,0,1,1,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,1,0,0,1,0,3,3,3,3,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,3,3,3,3,0,0,0,0,0,0],
[0,0,1,0,0,2,0,0,1,0,0,0,0,0,0,0,0,1,3,3,1,0,0,1,3,3],
[0,0,1,0,0,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,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 |
/*
son of suckerfish menu script from:
http://www.htmldog.com/articles/suckerfish/dropdowns/
*/
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
this.st... | JavaScript |
/*Gisca*/
/******** menu customization **********/
$(document).ready(function(){
$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)
$("ul.topnav li").click(function() { //When trigger is clicked...
//Following eve... | JavaScript |
/*
* Facebox (for jQuery)
* version: 1.2 (05/05/2008)
* @requires jQuery v1.2 or later
*
* Examples at http://famspam.com/facebox/
*
* Licensed under the MIT:
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
*
* Usage:
*
* jQuery(document)... | JavaScript |
/*
* jQuery Autocomplete plugin 1.1
*
* Copyright (c) 2009 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
*/
;(... | JavaScript |
/**
* Ajax Queue Plugin
*
* Homepage: http://jquery.com/plugins/project/ajaxqueue
* Documentation: http://docs.jquery.com/AjaxQueue
*/
/**
<script>
$(function(){
jQuery.ajaxQueue({
url: "test.php",
success: function(html){ jQuery("ul").append(html); }
});
jQuery.ajaxQueue({
url: "test.p... | JavaScript |
/*
* A time picker for jQuery
*
* Dual licensed under the MIT and GPL licenses.
* Copyright (c) 2009 Anders Fajerson
* @name timePicker
* @author Anders Fajerson (http://perifer.se)
* @example $("#mytime").timePicker();
* @example $("#mytime").timePicker({step:30, startTime:"15:00", endTime:"18:00"});
... | JavaScript |
window.onload = function() {
myHeight = new fx.Height('nav', {duration: 400});
myHeight.hide();
} | JavaScript |
/*
moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.
for more info (http://moofx.mad4milk.net).
10/24/2005
v(1.0.2)
*/
//base
var fx = new Object();
fx.Base = function(){};
fx.Base.prototype = {
setOptions: function(option... | JavaScript |
function create_menu(basepath)
{
var base = (basepath == 'null') ? '' : basepath;
document.write(
'<table cellpadding="0" cellspaceing="0" border="0" style="width:98%"><tr>' +
'<td class="td" valign="top">' +
'<ul>' +
'<li><a href="'+base+'index.html">User Guide Home</a></li>' +
'<li><a href="'+base+'toc.... | JavaScript |
/*
* Copyright 2011 Roman Nurik
*
* 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... | JavaScript |
/*
* Copyright 2012 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... | JavaScript |
/*
* Copyright 2012 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... | JavaScript |
/*
* Copyright 2012 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... | JavaScript |
/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject = function() {
var UNDEF = "undefined",
OBJECT = "object",
SHOCKWAVE_FLASH = "Shockwave Flash",
SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlas... | JavaScript |
BrowserHistoryUtils = {
addEvent: function(elm, evType, fn, useCapture) {
useCapture = useCapture || false;
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent... | JavaScript |
/*
Copyright (C) 2011 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, softwa... | JavaScript |
(function(window) {
var ORIGIN_ = location.protocol + '//' + location.host;
function SlideController() {
this.popup = null;
this.isPopup = window.opener;
if (this.setupDone()) {
window.addEventListener('message', this.onMessage_.bind(this), false);
// Close popups if we reload the main window.
win... | JavaScript |
/*
* Hammer.JS
* version 0.4
* author: Eight Media
* https://github.com/EightMedia/hammer.js
*/
function Hammer(element, options, undefined)
{
var self = this;
var defaults = {
// prevent the default event or not... might be buggy when false
prevent_default : false,
css_hacks ... | JavaScript |
/**
* @authors Luke Mahe
* @authors Eric Bidelman
* @fileoverview TODO
*/
document.cancelFullScreen = document.webkitCancelFullScreen ||
document.mozCancelFullScreen;
/**
* @constructor
*/
function SlideDeck(el) {
this.curSlide_ = 0;
this.prevSlide_ = 0;
this.config_ = null;
t... | JavaScript |
require(['order!../slide_config', 'order!modernizr.custom.45394',
'order!prettify/prettify', 'order!hammer', 'order!slide-controller',
'order!slide-deck'], function(someModule) {
});
| JavaScript |
var SLIDE_CONFIG = {
// Slide settings
settings: {
title: 'Title Goes Here<br>Up To Two Lines',
subtitle: 'Subtitle Goes Here',
//eventInfo: {
// title: 'Google I/O',
// date: '6/x/2013'
//},
useBuilds: true, // Default: true. False will turn off slide animation builds.
usePrettify... | JavaScript |
'use strict';
function UserCtrl($scope, backend) {
$scope.user = null;
$scope.login = function () {
backend.user().then(function (response) {
$scope.user = response.data;
});
}
$scope.login();
}
function EditorCtrl($scope, $location, $routeParams, $timeout, editor, doc, aut... | JavaScript |
'use strict';
var module = angular.module('app.directives', []);
module.directive('aceEditor',
function (editor) {
return {
retrict:'A',
link:function (scope, element) {
editor.rebind(element[0]);
}
};
});
module.directive('star',
functi... | JavaScript |
'use strict';
var EditorState = {
CLEAN:0, // NO CHANGES
DIRTY:1, // UNSAVED CHANGES
SAVE:2, // SAVE IN PROGRESS
LOAD:3, // LOADING
READONLY:4
};
google.load('picker', '1');
gapi.load('drive-share');
angular.module('app', ['app.filters', 'app.services', 'app.directives'])
.constant('saveInter... | JavaScript |
'use strict';
var module = angular.module('app.services', []);
var ONE_HOUR_IN_MS = 1000 * 60 * 60;
// Shared model for current document
module.factory('doc',
function ($rootScope) {
var service = $rootScope.$new(true);
service.dirty = false;
service.lastSave = 0;
service.timeSinc... | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.