code stringlengths 1 2.08M | language stringclasses 1
value |
|---|---|
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
/*Copyright 2012 Google Inc. All Rights Reserved.
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 w... | JavaScript |
function Map() {"use strict";
//
this.name = "-";
//
this.cells = [];
}
// toString
Map.prototype.toString = function() {"use strict";
return this.name + ' [' + this.cells.length + 'x' + this.cells[0].length + ']';
};
| JavaScript |
function Cell() {"use strict";
//
this.name = "soil_2";
//
// height in four corners (tile corners as in the clock)
this.h0 = 0;
this.h3 = 0;
this.h6 = 0;
this.h9 = 0;
}
| JavaScript |
function MapUtils() {"use strict";
}
// Load map
MapUtils.loadMap = function(mapName) {"use strict";
var map,SIZE_X,SIZE_Y,i,j,busyCellsMap, objectBag;
//
// Dimensiones del map
//
SIZE_X = 200;
SIZE_Y = 200;
//
// Map
//
// Create map
map = new Map();
map.name = mapName;
map.cells = new Array(SIZE_X);
f... | JavaScript |
var Keys = {
NONE : 0,
BACKSPACE : 8,
TAB : 9,
ENTER : 13,
PAUSE : 19,
CAPS : 20,
ESC : 27,
SPACE : 32,
PAGE_UP : 33,
PAGE_DOWN : 34,
END : 35,
HOME : 36,
LEFT_ARROW : 37,
UP_ARROW : 38,
RIGHT_ARROW : 39,
DOWN_ARROW : 40,
INSERT : 45,
DELETE : 46,
... | JavaScript |
function InputHandler() {"use strict";
//
// Currently I dont care about handling events on the window (i.e. window.onmousedown), but on the canvas.
//window.onmousedown = myDown;
//window.onmouseup = myUp;
//
// Handle events on main input handler
this.mainMapInputHandler = new MainMapInputHandler();
//
// Ha... | JavaScript |
function MainMapInputHandler(){
"use strict";
//
// Add listeners to handle canvas mouse events: Drag and drop
var auxMainMapCanvas = document.getElementById("mainMapCanvasId");
auxMainMapCanvas.onmousedown = MainMapInputHandler.MainMapCanvas_onmousedown;
auxMainMapCanvas.onmouseup = MainMapInputHandler.MainMapCa... | JavaScript |
function EventsUtil(){
"use strict";
}
// Crossbrowser get event
// source http://www.quirksmode.org/js/events_properties.html
EventsUtil.getEvent = function (e) {
"use strict";
var event = e;
if (!event) {
event = window.event;
}
return event;
};
// Crossbrowser is right button pressed
// source http://www.... | JavaScript |
function Game(){
"use strict";
}
Game.fps = 60;
Game.updatingTime = 0;
Game.renderingTime = 0;
// Initialize and start game
Game.start = function() {
"use strict";
//
// Initialize GUI
Game.gui = new Gui();
//
// Initialize Input Handler
Game.inputHandler = new InputHandler();
//
// Initialize model
... | JavaScript |
JSLoadUtil.loadOnlyOnce("js/util/pathfinding/pathfinding-browser.js");
var matrix = [
[0, 0, 0, 1, 0],
[1, 0, 0, 0, 1],
[0, 0, 1, 0, 0],
];
var grid = new PF.Grid(5, 3, matrix);
var finder = new PF.AStarFinder();
var path = finder.findPath(1, 2, 4, 2, grid);
console.log("path:"+path);
console.log("path:"+... | JavaScript |
JSLoadUtil.loadOnlyOnce("js/Constants.js");
JSLoadUtil.loadOnlyOnce("js/util/OOUtils.js");
JSLoadUtil.loadOnlyOnce("js/util/kdtree/KDTree.js");
JSLoadUtil.loadOnlyOnce("js/renderer/CoordinatesUtil.js");
JSLoadUtil.loadOnlyOnce("js/objects/ObjectBag.js");
JSLoadUtil.loadOnlyOnce("js/input/InputHandler.js");
JSLoadUtil.l... | JavaScript |
function DebugRenderer() {"use strict";
// Initializes last update time
this.prevTime = Date.now();
// Stores canvas and context as static variables for indirection (browser independence) and performance
var container = document.createElement('div');
container.id = 'debugInfo';
container.style.cssText = 'padding... | JavaScript |
function RenderUtil() {"use strict";
}
//Renders image in context
RenderUtil.render = function(ctx, imgId, x, y, offsetTX, offsetTY) {"use strict";
var img, offsetX, offsetY;
img = document.getElementById(imgId);
offsetX = CoordinatesUtil.getX(x, y, offsetTX, offsetTY);
offsetY = CoordinatesUtil.getY(x, y, offsetT... | JavaScript |
function CoordinatesUtil(){
"use strict";
}
// Precomputed constants for rendering optimization
CoordinatesUtil.TILE_x2x = Constants.TILE_WIDTH/2;
CoordinatesUtil.TILE_y2x = Constants.TILE_HEIGHT;
CoordinatesUtil.TILE_x2y = Constants.TILE_WIDTH/2/2;
CoordinatesUtil.TILE_y2y = - Constants.TILE_HEIGHT/2;
// Precompute... | JavaScript |
/**
* @author mrdoob / http://mrdoob.com/
*/
var StatsPane = function() {
"use strict";
var startTime, prevTime, ms, msMin, msMax, fps, fpsMin, fpsMax, frames, mode, container, fpsDiv, fpsText, fpsGraph, msDiv, msText, msGraph, bar, setMode, updateGraph;
//
startTime = Date.now();
prevTime = startTime;
ms = 0... | JavaScript |
function Renderer(){
"use strict";
this.mainMapRenderer = new MainMapRenderer();
this.statsRenderer = new StatsRenderer();
this.debugRenderer = new DebugRenderer();
}
// Updates GUI
Renderer.prototype.render = function() {
"use strict";
// Update GUI components
this.mainMapRenderer.render();
this.statsRenderer... | JavaScript |
function MainMapRenderer() {
"use strict";
// Stores canvas and context as static variables for indirection (browser independence) and performance
this.mainMapCanvas = document.getElementById("mainMapCanvasId");
this.mainMapCtx = this.mainMapCanvas.getContext('2d');
//
// Initializes map objects for later renderi... | JavaScript |
function StatsRenderer(){
"use strict";
// Statistics
Game.stats = new StatsPane();
Game.stats.domElement.style.position = 'absolute';
Game.stats.domElement.style.left = '0px';
Game.stats.domElement.style.bottom = '0px';
document.body.appendChild(Game.stats.domElement);
}
// Updates GUI
StatsRend... | JavaScript |
function Cammera() {"use strict";
// Cammera position
this.x = 0;
this.y = 0;
// Cammera speed
this.speed_x = 0;
this.speed_y = 0;
}
// Handles mouse movement on main canvas
Cammera.prototype.updateCammeraCoordinates = function(newCammeraX, newCammeraY) {"use strict";
// updates position
this.x = newCammeraX;
... | JavaScript |
function Gui() {"use strict";
//
this.cammera = new Cammera();
//
// Array of selected objects
this.selectedObjects = [];
}
// Clears list of selected objects
Gui.prototype.clearSelectedObjects = function() {"use strict";
var i;
//
// Marks current objects as not selected
for ( i = this.selectedObjects.length... | JavaScript |
Scout.inherits( Paintable );
function Scout(x, y) {
"use strict";
this.inherits(Paintable, PaintableTypes.SCOUT, x, y);
this.angle = 0;
// Current target
this.path = null;
this.nextTaget = null;
}
//Speed in tiles per second
Scout.LINEAR_SPEED=3;
//Speed in radians per second
Scout.ANGULAR_SPEED=4;
// ... | JavaScript |
Tree.inherits( NonSelectable );
function Tree(paintableType, x, y) {
"use strict";
this.inherits(NonSelectable, paintableType, x, y);
}
| JavaScript |
function Paintable(paintableType, x, y) {"use strict";
//
this.paintableType = paintableType;
//
// Position
this.x = x;
this.y = y;
//
// Is Selected
this._isSelected = false;
}
// update model
Paintable.prototype.update = function() {"use strict";
};
// return x position
Paintable.prototype.getX = function... | JavaScript |
NonSelectable.inherits( Paintable );
function NonSelectable(paintableType, x, y) {
"use strict";
this.inherits(Paintable, paintableType, x, y);
}
// return true is isSelected
NonSelectable.prototype.isSelected = function() {
return false;
};
// set isSelected
NonSelectable.prototype.setSelected = function(isSelect... | JavaScript |
function ObjectBag(sizeX, sizeY) {"use strict";
var nodeDistanceFunction, nodeDimensionAttributes, i;
//
// Initialize kdtree
nodeDistanceFunction = function(obj1, obj2){"use strict";
return Math.sqrt(Math.pow(obj1.x - obj2.x, 2) + Math.pow(obj1.y - obj2.y, 2));
};
nodeDimensionAttributes=["x","y"];
this.kd... | JavaScript |
function PaintableType(name, imageName, offsetX, offsetY) {"use strict";
//
this.name = name;
//
// Default image name
this.imageName = imageName;
//
// offset x e y en tiles
this.offsetX = offsetX;
this.offsetY = offsetY;
}
// toString
PaintableType.prototype.toString = function() {"use strict";
return this... | JavaScript |
function Constants(){
"use strict";
}
// Tiles are generated using GIMP "Isometric Floor" plugin converting 64x64 bitmaps into 128x64 size tiles
// Size of the png files for rendering a tile
Constants.TILE_WIDTH = 126;
Constants.TILE_HEIGHT = 63;
| JavaScript |
// Src: https://github.com/ubilabs/kd-tree-javascript/blob/master/src/web/kdTree.js
function KDTree(objectList, distanceFunction, dimensionAttributes) {"use strict";
this.distanceFunction = distanceFunction;
this.dimensionAttributes = dimensionAttributes;
this.root = this.buildTree(objectList, 0, null);
}
KDTree.pr... | JavaScript |
function KDTree_Node(obj, dimensionNo, parent) {"use strict";
this.obj = obj;
this.dimensionNo = dimensionNo;
this.parent = parent;
this.left = null;
this.right = null;
}
KDTree_Node.prototype.toString = function() {"use strict";
return "(N o:" + //
this.obj + //
(this.left ? ", <br>l:" + this.left : "") + //
... | JavaScript |
// Binary heap implementation from:
// http://eloquentjavascript.net/appendix2.html
function BinaryHeap(scoreFunction) {"use strict";
this.content = [];
this.scoreFunction = scoreFunction;
}
//Adds new element
BinaryHeap.prototype.push = function(bhElement) {"use strict";
// Add the new element to the end of the ar... | JavaScript |
function PFUtil() {"use strict";
}
PFUtil.findPath = function(fromX, fromY, toX, toY) {"use strict";
var mapSizeX = Game.model.map.cells.length;
var mapSizeY = Game.model.map.cells[0].length;
//
fromY = Math.floor(fromY);
fromX = Math.floor(fromX);
toY=Math.floor(toY);
toX=Math.floor(toX);
//
if (toX<0 || toX... | JavaScript |
// Encapsulating inheritance
/**
For ES5 compliant browsers we must define new properties to Object class
this way, or any object in the code will have it as a new visible property,
making all the for..in loops end with a undefined behaviour
The other solution is to check, in every loop, Object.prototyp... | JavaScript |
function Model(){
"use strict";
//
// Current model update and rendering timestamp
this.currentTimestamp=Date.now();
this.deltaTimestamp=0;
//
// Ball status (TODO: Remove)
this.x=0;
this.y=0;
//
//this.map //Map
//this.objectBag //Objects
}
Model.prototype.initialize = function(mapName) {
"use strict";
... | 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, autosaver) {
console.log($rout... | 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', function() {
return {
restrict: 'E',
replace: true,
... | JavaScript |
'use strict';
google.load('picker', '1');
angular.module('app', ['app.filters', 'app.services', 'app.directives'])
.constant('saveInterval', 15000)
.constant('appId', '892677078282')
.constant('EditorState', {
CLEAN: 0,// NO CHANGES
DIRTY: 1, // UNSAVED CHANGES
SAVE: 2, // SAVE IN PROGRESS
LOAD: 3, // LOADIN... | JavaScript |
'use strict';
/* Filters */
angular.module('app.filters', [])
.filter('saveStateFormatter', function(EditorState) {
return function(state) {
if (state == EditorState.DIRTY) {
return 'You have unsaved changes';
} else if (state == EditorState.SAVE) {
return 'Saving...';
} else if (state == Ed... | JavaScript |
'use strict';
var module = angular.module('app.services', []);
module.factory('editor', function(EditorState, backend, $q, $rootScope, $log) {
var editor = null;
var EditSession = require("ace/edit_session").EditSession;
var service = {
state: EditorState.CLEAN,
deferredState: EditorState... | JavaScript |
/*!
* jQuery JavaScript Library v1.7.2
* 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 |
/**
* @license AngularJS v1.0.0
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {
'use strict';
/**
* @ngdoc overview
* @name ngResource
* @description
*/
/**
* @ngdoc object
* @name ngResource.$resource
* @requires $http
*
* @description
* A fa... | JavaScript |
/**
* @license AngularJS v1.0.0
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document, undefined) {
'use strict';
////////////////////////////////////
/**
* @ngdoc function
* @name angular.lowercase
* @function
*
* @description Converts the specified string to lowerca... | JavaScript |
/**
* @license AngularJS v1.0.0
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*
* TODO(vojta): wrap whole file into closure during build
*/
/**
* @ngdoc overview
* @name angular.mock
* @description
*
* Namespace from 'angular-mocks.js' which contains testing related code.
*/
angular.moc... | JavaScript |
/**
* @license AngularJS v1.0.0
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {
'use strict';
var directive = {};
var service = { value: {} };
var DEPENDENCIES = {
'angular.js': 'http://code.angularjs.org/angular-' + angular.version.full + '.min.js',
... | JavaScript |
/**
* @license AngularJS v1.0.0
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {
'use strict';
/**
* @ngdoc overview
* @name ngSanitize
* @description
*/
/*
* HTML Parser By Misko Hevery (misko@hevery.com)
* based on: HTML Parser By John Resig (ejo... | JavaScript |
/**
* @license AngularJS v1.0.0
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window) {
'use strict';
/**
* JSTestDriver adapter for angular scenario tests
*
* Example of jsTestDriver.conf for running scenario tests with JSTD:
<pre>
server: http://localhost:9877
load:
... | JavaScript |
/**
* @license AngularJS v1.0.0
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {
'use strict';
var directive = {};
directive.dropdownToggle =
['$document', '$location', '$window',
function ($document, $location, $window) {
var openElem... | JavaScript |
/**
* Configuration for jstd scenario adapter
*/
var jstdScenarioAdapter = {
relativeUrlPrefix: '/build/docs/'
};
| JavaScript |
/**
* @license AngularJS v1.0.0
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {
'use strict';
/**
* @ngdoc overview
* @name ngCookies
*/
angular.module('ngCookies', ['ng']).
/**
* @ngdoc object
* @name ngCookies.$cookies
* @requires $brows... | JavaScript |
/**
* @license AngularJS v1.0.0
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(
/**
* @ngdoc interface
* @name angular.Module
* @description
*
* Interface for configuring angular {@link angular.module modules}.
*/
function setupModuleLoader(window) {
function ensure(obj, name, fact... | JavaScript |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
... | JavaScript |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
... | JavaScript |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
... | JavaScript |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
... | JavaScript |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
... | JavaScript |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
... | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.