code stringlengths 1 2.08M | language stringclasses 1
value |
|---|---|
/*
* Quicktags
*
* This is the HTML editor in WordPress. It can be attached to any textarea and will
* append a toolbar above it. This script is self-contained (does not require external libraries).
*
* Run quicktags(settings) to initialize it, where settings is an object containing up to 3 properties:
* ... | JavaScript |
window.wp = window.wp || {};
(function ($) {
// Check for the utility settings.
var settings = typeof _wpUtilSettings === 'undefined' ? {} : _wpUtilSettings;
/**
* wp.template( id )
*
* Fetches a template by id.
*
* @param {string} id A string that corresponds to a DOM element with an id pr... | JavaScript |
/**
* Copyright (c) 2006, David Spurr (http://www.defusion.org.uk/)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyrig... | JavaScript |
function mycarousel_initCallback(carousel) {
jQuery('.jcarousel-control a').bind('click', function() {
carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
return false;
});
jQuery('.jcarousel-scroll select').bind('change', function() {
carousel.options.scroll = jQu... | JavaScript |
function mycarousel_initCallback(carousel) {
jQuery('.jcarousel-control a').bind('click', function() {
carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
return false;
});
jQuery('.jcarousel-scroll select').bind('change', function() {
carousel.options.scroll = jQu... | JavaScript |
//+ Carlos R. L. Rodrigues
//@ http://jsfromhell.com/forms/restrict [rev. #1]
Restrict = function(form){
this.form = form, this.field = {}, this.mask = {};
}
Restrict.field = Restrict.inst = Restrict.c = null;
Restrict.prototype.start = function(){
var $, __ = document.forms[this.form], s, x, j, c, sp... | JavaScript |
/*! SWFObject v2.0 <http://code.google.com/p/swfobject/>
Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject = function() {
var UNDEF = "undefined",
OBJECT = "obj... | JavaScript |
//Author: David Lo
//Date: 12/12/12
//References: Game_Restart.js
//Description: Starts the game when the player presses any jump button
var myLevel : String;
function Update()
{
//If player presses escape, application will quit
if (Input.GetKey ("escape"))
{
Application.Quit();
}
//If player presses jump(on c... | JavaScript |
//Author: David Lo
//Date: 11/16/12
//References: Collide_Coins.js
//Description: Collisions with coins will destroy coin object on contact,
// increments counter and updates Player Score within PlayerPrefs
static var Counter : int = 0;
function OnTriggerEnter(myCollider : Collider)
{
if( collider.gameObject.name... | JavaScript |
//Author: David Lo
//Date: 12/12/12
//References: Game_Quit.js
//Description: Starts the game when the player presses any jump button
var myLevel : String;
function Update()
{
//If player presses escape, application will quit
if (Input.GetKey ("escape"))
{
Application.Quit();
}
} | JavaScript |
//Author: David Lo
//Date: 12/12/12
//References: Display_Lives.js
//Description: Displays Lives using PlayerPrefs
function OnGUI() {
guiText.text = "Lives: "+PlayerPrefs.GetInt("Player Lives");
} | JavaScript |
//Author: David Lo
//Date: 12/12/12
//References: Player_Lose.js
//Description: Checks if the player has no lives left and loads game over screen
var GameOver : String;
function Update()
{
//Checks if the player has no lives left and loads game over screen
if (PlayerPrefs.GetInt("Player Lives") == 0)
{
... | JavaScript |
//Author: David Lo
//Date: 11/16/12
//References: Display_Score.js
//Description: Displays Score using PlayerPrefs
function OnGUI() {
guiText.text = "Score: "+PlayerPrefs.GetInt("Player Score");
} | JavaScript |
//Author: David Lo
//Date: 12/12/12
//References: Collide_Spikes.js
//Description: Collisions with spiked platforms will kill the player on contact,
// decrements Lives and updates Player Lives within PlayerPrefs
// restarts the level (retains the player score)
static var Lives : int = 3;
var myLevel : String;
functi... | JavaScript |
//Author: David Lo
//Date: 12/12/12
//References: Game_Start.js
//Description: Starts the game when the player presses any jump button
// sets the initial player lives
// sets the initial player score
var myLevel : String;
function Update()
{
//If player presses jump(on controller) or spacebar(on keyboard)
if (Inpu... | JavaScript |
//Author: David Lo
//Date: 11/16/12
//References: LoadLevel.js
//Description: Changes level when player collides with SceneChange Object
var myLevel : String;
function OnTriggerEnter (myCollider: Collider ) {
//Changes level when player collides with SceneChange Object
if(myCollider.gameObject.name == "ChangeScene... | JavaScript |
/*
This camera smoothes out rotation around the y-axis and height.
Horizontal Distance to the target is always fixed.
There are many different ways to smooth the rotation but doing it this way gives you a lot of control over how the camera behaves.
For every of those smoothed values we calculate the wanted value and ... | JavaScript |
//SmoothFollow2D - Platformer Script
//Jason Keefer, 10/31/12
//David Lo, Edited: 11/23/12
@script RequireComponent (typeof(Camera))
//private var ortho: Matrix4x4;
//private var perspective: Matrix4x4;
//public var fov: float = 60f;
//public var near: float = .3f;
//public var far: float = 1000f;
//public var o... | JavaScript |
var target : Transform;
var damping = 0.0;
var smooth = true;
@script AddComponentMenu("Camera-Control/Smooth Look At")
function LateUpdate () {
if (target) {
if (smooth)
{
// Look at and dampen the rotation
var rotation = Quaternion.LookRotation(target.position - transform.position);
transform.rotation... | JavaScript |
var target : Transform;
var distance = 10.0;
var xSpeed = 250.0;
var ySpeed = 120.0;
var yMinLimit = -20;
var yMaxLimit = 80;
private var x = 0.0;
private var y = 0.0;
@script AddComponentMenu("Camera-Control/Mouse Orbit")
function Start () {
var angles = transform.eulerAngles;
x = angles.y;
y = angles... | JavaScript |
var spring = 50.0;
var damper = 5.0;
var drag = 10.0;
var angularDrag = 5.0;
var distance = 0.2;
var attachToCenterOfMass = false;
private var springJoint : SpringJoint;
function Update ()
{
// Make sure the user pressed the mouse down
if (!Input.GetMouseButtonDown (0))
return;
var mainCamera = FindCamera();
... | JavaScript |
function OnTriggerEnter(myCollider : Collider)
{
if( collider.gameObject.name == "Coin" )
{
Destroy(collider.gameObject);
}
}
//function OnColliderEnter (collision : Collision) {
// if (collision.gameObject.tag!="Player")
// return; //Check that it's the player that collides else exit the fu... | JavaScript |
var colorStart : Color = Color.red;
var colorEnd : Color = Color.green;
var duration : float = 1.0;
function Update () {
if (Input.GetButtonUp("Fire3") || Input.GetKeyDown (KeyCode.Slash)){
var lerp : float = Mathf.PingPong (Time.time, duration) / duration;
//renderer.material.color = Color.Lerp (colorStart,... | JavaScript |
var cameraTransform : Transform;
private var _target : Transform;
// The distance in the x-z plane to the target
var distance = 7.0;
// the height we want the camera to be above the target
var height = 3.0;
var angularSmoothLag = 0.3;
var angularMaxSpeed = 15.0;
var heightSmoothLag = 0.3;
var snapSmoothLag = 0.... | JavaScript |
#pragma strict
#pragma implicit
#pragma downcast
// Does this script currently respond to input?
var canControl : boolean = true;
var useFixedUpdate : boolean = true;
// For the next variables, @System.NonSerialized tells Unity to not serialize the variable or show it in the inspector view.
// Very handy for organiz... | JavaScript |
// This makes the character turn to face the current movement speed per default.
var autoRotate : boolean = true;
var maxRotationSpeed : float = 360;
private var motor : CharacterMotor;
// Use this for initialization
function Awake () {
motor = GetComponent(CharacterMotor);
}
// Update is called once per frame
func... | JavaScript |
private var motor : CharacterMotor;
// Use this for initialization
function Awake () {
motor = GetComponent(CharacterMotor);
}
// Update is called once per frame
function Update () {
// Get the input vector from kayboard or analog stick
var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxi... | JavaScript |
// Require a character controller to be attached to the same game object
@script RequireComponent(CharacterController)
public var idleAnimation : AnimationClip;
public var walkAnimation : AnimationClip;
public var runAnimation : AnimationClip;
public var jumpPoseAnimation : AnimationClip;
public var walkMaxAnimation... | JavaScript |
function showMessage(msg, title, delay){
$('')
}
function removeMessage(id){
} | JavaScript |
function addAccount(user,pass,handler){
$.post('/bots/manager',{'action':1,'user':user,'pass':pass},handler);
} | JavaScript |
function showDialog(dlgid, modal){
var dlg = $('#'+dlgid).removeClass('hide');
var dlgbg = $('#'+dlgid+'_bg');
if(dlgbg.length==0){
dlgbg = $('<div id="'+dlgid+'_bg" class="dlgbg dlgbdr"></div>').appendTo(document.body);
}
dlgbg.removeClass('hide');
var doc = $(document);
var x = (doc.width() - dlg.wid... | 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 |
/*! 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 |
function FiftySixParser(){
this.$ = function(str){
var c1,c2,c3,c4,c5=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19... | JavaScript |
function showMessage(msg, title, delay){
$('')
}
function removeMessage(id){
} | JavaScript |
function addAccount(user,pass,handler){
$.post('/bots/manager',{'action':1,'user':user,'pass':pass},handler);
} | JavaScript |
var Dialog = new function(){
/** 在Dialog中显示一个DIV */
this.showDIV = function(title, close, divid, modal){
if(modal) { this.showLayer(true); }
var dlg = this.createDialog(title, close);
dlg.children('.dialog-content').append($('#' + divid).css({display:'block'}));
this.adjustDialog(dlg);
};
/** 在Dialo... | 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 |
/*! 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 |
function isURL(str) {
return /^http(s)?:\/\/.+$/.test(str);
}
function isEmail(str) {
return true;
} | 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 |
/*
* To Compare Passwords entered while setting/resetting
*/
function comparePassword(pass, repass)
{
if(pass != repass)
{
alert("Passwords do not match!");
document.getElementById("repass").focus();
document.getElementById("repass").value = null;
return false;
}
}
/*
* To Validate ... | JavaScript |
$(document).ready(function() {
// Expand Panel
$("#slideit").click(function(){
$("div#slidepanel").slideDown("slow");
});
// Collapse Panel
$("#closeit").click(function(){
$("div#slidepanel").slideUp("slow");
});
// Switch buttons from "Log In | Register" to "Close Panel" on click
... | JavaScript |
function comparePassword(pass, repass)
{
if(pass != repass)
{
alert("Passwords do not match!");
document.getElementById("repass").focus();
document.getElementById("repass").value = null;
return false;
}
}
/*
* To Compare Passwords entered while setting/resetting
*/
function comparePassw... | JavaScript |
/**
* jQuery.timers - Timer abstractions for jQuery
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
* Date: 2009/10/16
*
* @author Blair Mitchelmore
* @version 1.2
*
**/
jQuery.fn.extend({
everyTime: function(interva... | JavaScript |
/*
Main Javascript for jQuery Realistic Hover Effect
Created by Adrian Pelletier
http://www.adrianpelletier.com
*/
/* =Realistic Navigation
============================================================================== */
// Begin jQuery
$(document).ready(function() {
/* =Reflection Nav
---------------------... | JavaScript |
$(document).ready(function () {
$('#featured_slide').galleryView({
show_panels: true, //BOOLEAN - flag to show or hide panel portion of gallery
show_filmstrip: true, //BOOLEAN - flag to show or hide filmstrip portion of gallery
panel_width: 450, /... | JavaScript |
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights res... | JavaScript |
/**
* @fileoverview Main function src.
*/
// HTML5 Shiv. Must be in <head> to support older browsers.
document.createElement('video');
document.createElement('audio');
document.createElement('track');
/**
* Doubles as the main function for users to create a player instance and also
* the main library object.
*
... | JavaScript |
videojs.addLanguage("es",{
"Play": "Reproducción",
"Pause": "Pausa",
"Current Time": "Tiempo reproducido",
"Duration Time": "Duración total",
"Remaining Time": "Tiempo restante",
"Stream Type": "Tipo de secuencia",
"LIVE": "DIRECTO",
"Loaded": "Cargado",
"Progress": "Progreso",
"Fullscreen": "Pantalla complet... | JavaScript |
videojs.addLanguage("uk",{
"Play": "Відтворити",
"Pause": "Призупинити",
"Current Time": "Поточний час",
"Duration Time": "Тривалість",
"Remaining Time": "Час, що залишився",
"Stream Type": "Тип потоку",
"LIVE": "НАЖИВО",
"Loaded": "Завантаження",
"Progress": "Прогрес",
"Fullscreen": "Повноекранний режим",
"... | 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 |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* ... | JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* ... | JavaScript |
$(document).ready(function(){
// 回到顶部
$('#gotop').click(function(){
$('body,html').animate({scrollTop:0},1000);
});
// 检查评论
$('#comment_nick').focus(function(){
if ($('#comment_nick').val() == '邮箱或称呼…'){
$('#comment_nick').removeClass('init-comment-box');
$('#comment_nick').val('');
}
})... | JavaScript |
$(document).ready(function(){
//Sidebar Accordion Menu:
$("#main-nav li ul").hide(); // Hide all sub menus
$("#main-nav li a.current").parent().find("ul").slideToggle("slow"); // Slide down the current menu item's sub menu
$("#main-nav li a.nav-top-item").click( // When a top menu item is clicked.... | 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 [ [email protected] ]
*
* Usage:
*
* jQuery(documen... | JavaScript |
//by zhanyi
function uParse(selector,opt){
var ie = !!window.ActiveXObject,
cssRule = ie ? function(key,style,doc){
var indexList,index;
doc = doc || document;
if(doc.indexList){
indexList = doc.indexList;
}else{
indexList = do... | JavaScript |
(function(){
UEDITOR_CONFIG = window.UEDITOR_CONFIG || {};
var baidu = window.baidu || {};
window.baidu = baidu;
window.UE = baidu.editor = {};
UE.plugins = {};
UE.commands = {};
UE.instants = {};
UE.I18N = {};
UE.version = "1.2.6.1";
var dom = UE.dom = {};/**
* @file
* @name UE.browser... | JavaScript |
/**
* Created with JetBrains PhpStorm.
* User: taoqili
* Date: 12-6-12
* Time: 下午5:02
* To change this template use File | Settings | File Templates.
*/
UE.I18N['zh-cn'] = {
'labelMap':{
'anchor':'锚点', 'undo':'撤销', 'redo':'重做', 'bold':'加粗', 'indent':'首行缩进', 'snapscreen':'截图',
'italic... | JavaScript |
/**
* ueditor完整配置项
* 可以在这里配置整个编辑器的特性
*/
/**************************提示********************************
* 所有被注释的配置项均为UEditor默认值。
* 修改默认配置请首先确保已经完全明确该参数的真实用途。
* 主要有两种修改方案,一种是取消此处注释,然后修改成对应参数;另一种是在实例化编辑器时传入对应参数。
* 当升级编辑器时,可直接使用旧版配置文件替换新版配置文件,不用担心旧版配置文件中因缺少新功能所需的参数而导致脚本报错。
**************************提示*************... | JavaScript |
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 12-2-20
* Time: 上午11:19
* To change this template use File | Settings | File Templates.
*/
var video = {};
(function(){
video.init = function(){
// switchTab("videoTab");
createAlignButton( ["videoFloat"] );
addU... | JavaScript |
// Copyright (c) 2009, Baidu Inc. All rights reserved.
//
// Licensed under the BSD License
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http:// tangram.baidu.com/license.html
//
// Unless required by applicable law or agreed to in ... | JavaScript |
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 12-2-10
* Time: 下午3:50
* To change this template use File | Settings | File Templates.
*/
//文件类型图标索引
var fileTypeMaps = {
".rar":"icon_rar.gif",
".zip":"icon_rar.gif",
".doc":"icon_doc.gif",
".docx":"icon_doc.gif",
".pdf... | JavaScript |
/* Demo Note: This demo uses a FileProgress class that handles the UI for displaying the file name and percent complete.
The FileProgress class is not part of SWFUpload.
*/
/* **********************
Event Handlers
These are my custom event handlers to make my
web application behave the way I went wh... | JavaScript |
(function () {
var parent = window.parent;
//dialog对象
dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )];
//当前打开dialog的编辑器实例
editor = dialog.editor;
UE = parent.UE;
domUtils = UE.dom.domUtils;
utils = UE.utils;
browser = UE.browser;
aj... | JavaScript |
window.onload = function () {
editor.setOpt({
emotionLocalization:false
});
emotion.SmileyPath = editor.options.emotionLocalization === true ? 'images/' : "http://img.baidu.com/hi/";
emotion.SmileyBox = createTabList( emotion.tabNum );
emotion.tabExist = createArr( emotion.tabNum );
... | JavaScript |
/**
* Created with JetBrains PhpStorm.
* User: xuheng
* Date: 12-12-19
* Time: 下午4:55
* To change this template use File | Settings | File Templates.
*/
(function () {
var title = $G("J_title"),
caption = $G("J_caption"),
sorttable = $G("J_sorttable"),
autoSizeContent = $G("J_autoSizeC... | JavaScript |
function Music() {
this.init();
}
(function () {
var pages = [],
panels = [],
selectedItem = null;
Music.prototype = {
total:70,
pageSize:10,
dataUrl:"http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.search.common",
playerUrl:"http... | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.