code stringlengths 1 2.08M | language stringclasses 1
value |
|---|---|
var SelectBox = {
cache: new Object(),
init: function(id) {
var box = document.getElementById(id);
var node;
SelectBox.cache[id] = new Array();
var cache = SelectBox.cache[id];
for (var i = 0; (node = box.options[i]); i++) {
cache.push({value: node.value, text... | JavaScript |
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S ALL JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
/*!
* JavaScript for Bootstrap's docs (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, ... | JavaScript |
/*!
* Bootstrap Customizer (http://getbootstrap.com/customize/)
* Copyright 2011-2014 Twitter, Inc.
*
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
*/
/* global JSZip, less, autoprefixer, saveAs, UglifyJS, __configBridge, _... | JavaScript |
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
/*!
* Copyright 2014 Twitter, Inc.
*
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
*/
// Intended to ... | JavaScript |
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
/*!
* Copyright 2011-2014 Twitter, Inc.
*
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
*/
// Intende... | JavaScript |
/*!
* IE10 viewport hack for Surface/desktop Windows 8 bug
* Copyright 2014 Twitter, Inc.
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
*/
// See the Getting Started docs for more information:
// http://getbootstrap.com/gett... | JavaScript |
PrimeFaces.locales['pt'] = {
closeText: 'Fechar',
prevText: 'Anterior',
nextText: 'Próximo',
currentText: 'Começo',
monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Nove... | JavaScript |
/*
Copyright 2010 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | JavaScript |
/*
Copyright 2010 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | JavaScript |
var db = null;
var isPG= false;
function getDB(){
if(db == null){
db= window.openDatabase("activist", "1.0", "Test DB", 1000000);
db.transaction(function populateDB(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS activity(id integer primary key autoincrement,name varchar(100),remoteid integer,... | JavaScript |
// 本地化命名空间
var utils = html5mobi.utils,
controllers = html5mobi.controllers,
website = html5mobi.website
// 模板
function tplCategories(item) {
return '<li data-icon="false"><a href="cate_discuz.html" data-urlcode="' + item.UrlCode + '" data-catename="' + item.Name + '" data-catedisuznum="' + item.CountDiscussi... | JavaScript |
// 全局命名空间
var html5mobi = {
author : '刚子',
version : '1.0',
website : 'http://www.html5mobi.com'
}
// 工具包
html5mobi.utils = {
setParam : function(name, value) {
localStorage.setItem(name, value)
},
getParam : function(name) {
return localStorage.getItem(name)
}
}
// 业务控制中心,需应用实现
html5mobi.con... | JavaScript |
/**
* @preserve
* FullCalendar v1.5.1
* http://arshaw.com/fullcalendar/
*
* Use fullcalendar.css for basic styling.
* For event drag & drop, requires jQuery UI draggable.
* For event resizing, requires jQuery UI resizable.
*
* Copyright (c) 2011 Adam Shaw
* Dual licensed under the MIT and GPL licenses, locate... | JavaScript |
/*
* FullCalendar v1.5.1 Google Calendar Plugin
*
* Copyright (c) 2011 Adam Shaw
* Dual licensed under the MIT and GPL licenses, located in
* MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
*
* Date: Sat Apr 9 14:09:51 2011 -0700
*
*/
(function($) {
var fc = $.fullCalendar;
var formatDate = fc.formatDate... | JavaScript |
/*
*
* TableSorter 2.0 - Client-side table sorting with ease!
* Version 2.0.5b
* @requires jQuery v1.2.3
*
* Copyright (c) 2007 Christian Bach
* Examples and docs at: http://tablesorter.com
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.... | JavaScript |
(function($) {
$.extend({
tablesorterPager: new function() {
function updatePageDisplay(c) {
var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages);
}
function setPageSize(table,size) {
var c = table.config;
c.size = size;
c.totalPages = Math... | JavaScript |
/**
*
*/
$(window).load(function (){
createMap();
drawAllEvents();
});
$(document).ready(function() {
$(".moreLink").click(function(){
if(idUsuario){
if($(this).parents(".commentLink").next(".commentForm:visible").length!=0){
$(this).parents(".commentLink").next(".commentForm:visible").slide... | JavaScript |
/**
*
*/
//Variables globales
//var servidor="http://localhost:8888/actinmap/"; //DANI
//var servidor = "http://localhost/joomla/"; //HAIZEA
//var servidor = "http://localhost:8888/joomla/"; //LIHER
var listaEventos;
var pos;
$(window).load(function (){
createMap();
drawUserEvents(idUsuario);
});
$... | JavaScript |
/**
*
*/
//Variables
var marker=null;
var mapClicked;
$(window).load(function (){
createMap();
//Cambiar el cursor
var myOptions = {
draggableCursor: "crosshair"
};
map.setOptions(myOptions);
//Add event listener to the click event
mapClicked=google.maps.event.addListener(map, 'click', mapClickedListe... | JavaScript |
$strings['zh-tw'] = {
'hello': "您好",
}; | JavaScript |
$strings['en'] = {
'hello': "您好",
}; | JavaScript |
$strings['zh-cn'] = {
'hello': "您好",
}; | JavaScript |
////////////////////////////////////////////////////////////////////////////////
// Author: Healer
// Email: healer_kx@163.com
//
var hj = hj || {};
var HJ = hj;
var $strings = {};
var $fragments = $fragments || {};
var $groupName = $config['group-name'];
// Mainly for ThinkPHP.
HJ.ACTIONS_PATH = "/index... | JavaScript |
var $config = {
'group-name': 'Aweb',
}; | JavaScript |
//function HeaderBar(){ this.constructor.apply(this, arguments); }
$class('HeaderBar', Widget, {
_login: false,
_templateFile: "thtml/headerbar.html",
constructor: function(a, b, c)
{
},
create: function(parent)
{
this.super(Widget.prototype.create, arguments);
this._domNode.appendTo(parent);
retur... | JavaScript |
$class('GoodsPhotoView', Widget, {
// Members
_templateFile: "thtml/goodsphotoview.html",
// Methods
constructor: function(widgetId, templateFile)
{
},
create: function(parent)
{
this.super(Widget.prototype.create, arguments);
// You can use this._domNode.preappend(parent);
this._domN... | JavaScript |
$class('CloudView', Widget, {
_login: false,
_templateFile: "thtml/cloudview.html",
constructor: function()
{
},
create: function(parent)
{
this.super(Widget.prototype.create, arguments);
this._domNode.appendTo(parent);
return this._domNode;
},
toString: function()
{
var s = this.super(Widget.p... | JavaScript |
$class('GoodsItem', [Widget, ActionMixin], {
_login: false,
_templateFile: "thtml/GoodsItem.html",
constructor: function()
{
console.debug("GoodsItem ctor");
},
create: function(parent, fileName)
{
// G11n is another Question...
this._templateVars = {'price': '促销价'};
this._templateFile = fileName |... | JavaScript |
$class('MetroView', Widget, {
// Members
// default templates given.
_templateFile: "thtml/metro/metroview.html",
// Methods
constructor: function()
{
},
create: function(parent)
{
this.super(Widget.prototype.create, arguments);
// You can use this._domNode.preappend(parent);
//this... | JavaScript |
$class('TabsView', Widget, {
// Members
_templateString: "<div class='tabsview'><ul></ul></div>",
_count: 0,
// Methods
constructor: function()
{
},
create: function(parent)
{
this.super(Widget.prototype.create, arguments);
// You can use this._domNode.preappend(parent);
this._dom... | JavaScript |
$class('GalleryView', Widget, {
_templateFile: "thtml/GalleryView.html",
_currentIndex:0,
_itemCount:0,
_itemArray: [],
_width: 780,
_height: 420,
_useTimer: true,
constructor: function( )
{
},
/*
constructor: function( _, _, width, height, args )
{
this._width = width || this._width;
this._... | JavaScript |
$class('GoodsDetailView', Widget, {
// Members
_templateFile: "thtml/goodsdetailview.html",
_goodsPhotoView: null,
// Methods
constructor: function(widgetId, templateFile)
{
},
create: function(parent)
{
this.super(Widget.prototype.create, arguments);
// You can use this._domNode.pre... | JavaScript |
$class('Hello', Widget, {
// Members
_templateFile: "thtml/hello.html",
// Methods
// If the arguments widgetId and templateFile would not be used
// You can delete them. But each class MUST have a contructor!
constructor: function(widgetId, templateFile)
{
},
// Instance Methods
create:... | JavaScript |
$class('CategoryView', Widget, {
// Members
_templateString: '<div class="categorys"></div>',
_itemCounter: 0,
// Methods
constructor: function()
{
console.debug(this._className)
},
create: function(parent)
{
this.super(Widget.prototype.create, arguments);
// You can use this._domNo... | JavaScript |
$class('LogoBar', Widget, {
_login: false,
_templateFile: "thtml/logobar.html",
constructor: function(a, b, c)
{
},
create: function(parent)
{
this.super(Widget.prototype.create);
this._domNode.appendTo(parent);
return this._domNode;
},
toString: function()
{
var s = this.super(Widget.prototyp... | JavaScript |
$class('CommonView', Widget, {
// Members
_templateFile: null,
// Methods
constructor: function(templateFile)
{
this._templateFile = templateFile;
},
create: function(parent)
{
this.super(Widget.prototype.create, arguments);
this._domNode.appendTo(parent);
return this._domNode;
},
... | JavaScript |
$class('AccordionView', Widget, {
// Members
_templateFile: "thtml/accordionview.html",
// Methods
constructor: function()
{
},
create: function(parent)
{
this.super(Widget.prototype.create, arguments);
// You can use this._domNode.preappend(parent);
this._domNode.appendTo(parent);
... | JavaScript |
(function ($) {
var ie = $.browser.msie,
iOS = /iphone|ipad|ipod/i.test(navigator.userAgent);
$.TE = {
version:'1.0', // 版本号
debug: 1, //调试开关
timeOut: 3000, //加载单个文件超时时间,单位为毫秒。
defaults: {
//默认参数controls,noRigths,plugins,定义加载插件
controls: "source,|... | JavaScript |
function te_upload_interface() {
//初始化参数
var _args = arguments,
_fn = _args.callee,
_data = '';
if( _args[0] == 'reg' ) {
//注册回调
_data = _args[1];
_fn.curr = _data['callid'];
_fn.data = _data;
jQuery('#temaxsize').val(_data['maxsize']);
} el... | JavaScript |
// 系统自带插件
( function ( $ ) {
//全屏
$.TE.plugin( "fullscreen", {
fullscreen:function(e){
var $btn = this.$btn,
opt = this.editor.opt;
if($btn.is("."+opt.cssname.fulled)){
//取消全屏
this.editor.$main.removeAttr("style");
this.editor.$bottom.find("div").show();
this.editor.resize(opt.width,... | JavaScript |
$.TE.plugin("bold",{
title:"标题",
cmd:"bold",
click:function(){
this.editor.pasteHTML("sdfdf");
},
bold:function(){
alert('sdfsdf');
},
noRight:function(e){
if(e.type=="click"){
alert('noright');
}
},
init:function(){
},
... | JavaScript |
/*
---
description: PillMenu
authors:
- Luca Scarpa aka luscarpa (http://www.luscarpa.com)
license:
- MIT-style license
requires:
core/1.2.4: '*'
provides:
- PillMenu
...
*/
var PillMenu = new Class({
//implements
Implements: [Options,Events],
//options
options: {
vertical: 0,
pillClass: 'pill',
s... | JavaScript |
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Version 2.1.2
*/
(function($){
$.fn.bgiframe = ($.browser.msie && /msie 6\.0/i.test(navigator.userAgent) ? function(s) {
s = $.extend({
top : 'auto', // auto == .currentStyle.borderTo... | JavaScript |
function lookup(inputString) {
if(inputString.length == 0) {
// Hide the suggestion box.
$('#suggestions').hide();
} else {
// post data to our php processing page and if there is a return greater than zero
// show the suggestions box
$.post("string_search.php", {mysearchString: ""+inputString+""}, f... | JavaScript |
// Tigra Calendar v4.0.4 (10/23/2009) American (mm/dd/yyyy)
// http://www.softcomplex.com/products/tigra_calendar/
// Public Domain Software... You're welcome.
// default settins
var A_TCALDEF = {
'months' : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'Nove... | JavaScript |
/*!
* jQuery Form Plugin
* version: 2.95 (30-JAN-2012)
* @requires jQuery v1.3.2 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;(function($... | JavaScript |
function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
m=checkTime(m);
s=checkTime(s);
document.getElementById('clockId').innerHTML=h+":"+m+":"+s;
t=setTimeout('startTime()',500);
}
function checkTime(i)... | JavaScript |
/**
* mm_menu 20MAR2002 Version 6.0
* Andy Finnell, March 2002
* Copyright (c) 2000-2002 Macromedia, Inc.
*
* based on menu.js
* by gary smith, July 1997
* Copyright (c) 1997-1999 Netscape Communications Corp.
*
* Netscape grants you a royalty free license to use or modify this
* software provided t... | JavaScript |
/*
-------------------------------------------------------------------------
JavaScript Form Validator (gen_validatorv4.js)
Version 4.0
Copyright (C) 2003-2011 JavaScript-Coder.com. All rights reserved.
You can freely use this script in your Web pages.
You may adapt this script for your ow... | JavaScript |
// Login Form
$(function() {
var button = $('#loginButton');
var box = $('#loginBox');
var form = $('#loginForm');
button.removeAttr('href');
button.mouseup(function(login) {
box.toggle();
button.toggleClass('active');
});
form.mouseup(function() {
retur... | JavaScript |
/* SpryTabbedPanels.js - Revision: Spry Preview Release 1.4 */
// Copyright (c) 2006. Adobe Systems Incorporated.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistribut... | JavaScript |
// jQuery Alert Dialogs Plugin
//
// Version 1.1
//
// Cory S.N. LaViska
// A Beautiful Site (http://abeautifulsite.net/)
// 14 May 2009
//
// Visit http://abeautifulsite.net/notebook/87 for more information
//
// Usage:
// jAlert( message, [title, callback] )
// jConfirm( message, [title, callback] )
//... | JavaScript |
/**
* @summary DataTables
* @description Paginate, search and sort HTML tables
* @version 1.9.3
* @file jquery.dataTables.js
* @author Allan Jardine (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact
*
* @copyright Copyright 2008-2012 Allan Jardine, all rights reserved.
*
* T... | JavaScript |
var express = require('express');
var path = require('path');
var app = express();
app.set('views', './views');
app.set('view engine', 'jade');
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', function(req, res) {
res.render('home', {
title: 'Welcome'
});
});
app.listen(3000);
| JavaScript |
// **********************************************************************
//
// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// ***************************************************... | JavaScript |
var API;
function connect() {
var communicator = Ice.initialize();
var hostname = "192.168.1.111";
var endpoint = "API:ws -h " + hostname + " -p 10002:wss -h " + hostname + " -p 10003";
console.log("endpoint = " + endpoint);
var proxy = communicator.stringToProxy(endpoint);
API = ARIAPI.APIPrx.... | JavaScript |
function unSpamifyEmail(user,domain)
{
locationstring = "mailto:" + user + "@" + domain;
window.location = locationstring;
}
function unSpamifySip(user,domain)
{
locationstring = "sip:" + user + "@" + domain;
window.location = locationstring;
}
function show(id,x,y)
{
thing = document.getElementB... | JavaScript |
/**
* 此游戏所有的图片资源管理和加载类
* @author zhouzhanglin
*/
ResManager = function()
{
EventDispatcher.call( this );
this._total = 0 ;
this._loaded = 0 ;
this._resArray ;
};
FLASH.extend(ResManager,EventDispatcher);
/**
* 获取实例
* @returns
*/
ResManager.getInstance = function()
{
if(!ResManager._ins... | JavaScript |
/**
* 分数事件
* @author zzhanglin
* @param type 事件类型
* @param score 变化的分数
* @returns {GlobalEvent}
*/
ScoreEvent = function( type , score )
{
Event.call( this , type );
this.score = score ;
};
ScoreEvent.prototype = new Event();
ScoreEvent.prototype.constructor = ScoreEvent ;
ScoreEvent.SCORE_CHAN... | JavaScript |
/**
* 全局事件
* @author zzhanglin
* @param type 事件类型
* @returns {GlobalEvent}
*/
GlobalEvent = function( type )
{
Event.call( this , type );
};
GlobalEvent.prototype = new Event();
GlobalEvent.prototype.constructor = GlobalEvent ;
GlobalEvent.GAME_START = "gameStart"; //游戏开始
GlobalEvent.GAME_PAUSE = ... | JavaScript |
/**
* 全局事件抛出和侦听类
* @author zzhanglin
*/
GlobalDispatcher = function()
{
EventDispatcher.call(this);
};
GlobalDispatcher.prototype = new EventDispatcher();
GlobalDispatcher.prototype.constructor = GlobalDispatcher ;
/**
* 获取此类的实例 ,单例
* @returns
*/
GlobalDispatcher.getInstance = function(){
if(!G... | JavaScript |
GameLayer = function()
{
Sprite.call(this);
this.mouseChildren = false ;
this.prevTime = 0 ;
this.apples = [];
this.hero = new Hero();
this.hero.setY( FlashCore.stage.getStageHeight()-this.hero.getHeight()-40 );
this.addChild(this.hero);
};
FLASH.extend(GameLayer,Sprite);
GameLayer.prototype.r... | JavaScript |
AppleBase = function( type )
{
Bitmap.call(this,ResManager.getInstance().getBmdByName("apple"+type));
this.type = type ;
this.score = 0 ;
this.speed = (Math.random()*5+10)>>0 ;
this.setX( (Math.random()*580 +20) ) >>0;
this.setY(-this.getHeight());
switch(this.type)
{
case 1:
this.score = ... | JavaScript |
Hero = function()
{
Bitmap.call(this,ResManager.getInstance().getBmdByName("xiong") );
this.collision = new Rectangle(40,100,50,20); //碰撞检测的矩形
};
FLASH.extend( Hero,Bitmap); | JavaScript |
AppleDrop = function()
{
Sprite.call(this);
this.gameLayer ;
this.startView ;
this.topBar ;
//添加到舞台的事件侦听
this.addEventListener(Event.ADDED_TO_STAGE , this.addedHandler);
};
FLASH.extend( AppleDrop , Sprite );
/**
* 添加到舞台上
* @param e
*/
AppleDrop.prototype.addedHandler = function( e )
{
var... | JavaScript |
StartView = function()
{
Sprite.call(this);
this.init();
};
FLASH.extend( StartView , Sprite );
/**
* 重写父类的方法
*/
StartView.prototype.init = function()
{
this.getGraphics().beginFill("#000000",0.4); //黑色
this.getGraphics().drawRect(0,0,400,300);
this.getGraphics().endFill();
var txt = new Te... | JavaScript |
TopBar = function()
{
Sprite.call(this);
this.scoreText = this.createTextField("#000000");
this.scoreText.setY(5);
this.scoreText.setX(5);
this.scoreText.text = "Score 0";
this.addChild(this.scoreText);
this.timeText = this.createTextField("blue");
this.timeText.setY(5);
this.timeText.setX(6... | JavaScript |
/**
* 工厂类
* @returns {CandyAndGiftFactory}
*/
CandyAndGiftFactory = function()
{
};
/**
* 获取本类的实例
* @returns
*/
CandyAndGiftFactory.getInstance = function()
{
if(!CandyAndGiftFactory._instance){
CandyAndGiftFactory._instance = new CandyAndGiftFactory();
}
return CandyAndGiftFactory._insta... | JavaScript |
/**
* 此游戏所有的图片资源管理和加载类
* @author zhouzhanglin
*/
ResManager = function()
{
EventDispatcher.call( this );
this._total = 0 ;
this._loaded = 0 ;
this._resArray ;
};
ResManager.prototype = new EventDispatcher(); //继承自EventDispatcher
ResManager.prototype.constructor = ResManager ;
/**
* 获取实例
* @... | JavaScript |
/**
* 分数事件
* @author zzhanglin
* @param type 事件类型
* @param score 变化的分数
* @returns {GlobalEvent}
*/
ScoreEvent = function( type , score )
{
Event.call( this , type );
this.score = score ;
};
ScoreEvent.prototype = new Event();
ScoreEvent.prototype.constructor = ScoreEvent ;
ScoreEvent.SCORE_CHAN... | JavaScript |
/**
* 全局事件
* @author zzhanglin
* @param type 事件类型
* @returns {GlobalEvent}
*/
GlobalEvent = function( type )
{
Event.call( this , type );
};
GlobalEvent.prototype = new Event();
GlobalEvent.prototype.constructor = GlobalEvent ;
GlobalEvent.GAME_START = "gameStart"; //游戏开始
GlobalEvent.GAME_PAUSE = ... | JavaScript |
/**
* 全局事件抛出和侦听类
* @author zzhanglin
*/
GlobalDispatcher = function()
{
EventDispatcher.call(this);
};
GlobalDispatcher.prototype = new EventDispatcher();
GlobalDispatcher.prototype.constructor = GlobalDispatcher ;
/**
* 获取此类的实例 ,单例
* @returns
*/
GlobalDispatcher.getInstance = function(){
if(!G... | JavaScript |
/**
* 游戏配置类
* @author zhouzhanglin
*/
GameSetting = function()
{ };
//场景的高宽
GameSetting.SCENE_WIDTH = 760 ;
GameSetting.SCENE_HEIGHT = 600 ;
GameSetting.currentLevel ; //当前关卡的数据
GameSetting.levelNum = 1 ; //当前的关卡 | JavaScript |
/**
* 第一关
* @author zhouzhanglin
* @returns {Level1}
*/
Level1 = function()
{
BaseLevel.call( this ); //调用父类的构造函数
this.level =1;
this.scrollSpeed = 10 ;
this.candyArray = [
new Candy(3,2,296,223),
new Candy(2,2,283,35),
new Candy(1,2,259,-124),
new Candy(2,1,487,-362),
new Cand... | JavaScript |
/**
* 关卡的基类
* @author zhouzhanglin
* @returns {BaseLevel}
*/
BaseLevel = function()
{
this.level = 1; //当前为第几关
this.candyArray ; //糖果的数组
this.giftArray ; //吃的东西的数组
this.scrollSpeed=0 ; //屏幕滚动速度
}; | JavaScript |
/**
* 游戏世界,包含UI
* @author zhouzhanglin
*/
GameWorld = function()
{
Sprite.call( this ) ;
this._back = new Bitmap( ResManager.getInstance().getBmdByName("back")) ;
this._scoreBg = new Bitmap( ResManager.getInstance().getBmdByName("score-control"));
this._gameLayer = new GameLayer();
this._scoreText ... | JavaScript |
/**
* 游戏运行界面
* @author zzhanglin
*/
GameLayer = function()
{
Sprite.call(this);
this.mouseChildren = false ;
this._speedX= 0 ; //X方向上的速度
this._speedY =0 ; //Y方向上的速度
this._offsetY = 0 ;//游戏屏幕的滚动位移
this._hero ;
this._road ;
this._startFlag = true ;
this._heroOnFlat=false ;
//添加到舞台上的事... | JavaScript |
/**
* 游戏场景中间的路
* @author zzhanglin
*/
Road = function()
{
Sprite.call(this);
this.mouseChildren = false ;
this.topBmp = new Bitmap(ResManager.getInstance().getBmdByName("background-tree"));
this.topBmp.setShowZone( new Rectangle(0,this.topBmp.getHeight()-GameSetting.SCENE_HEIGHT,this.topBmp.getWidth(... | JavaScript |
/**
* 糖果类
* @param size 大小,尺寸,有1,2,3种
* @param direction 方向为1和2
* @param x
* @param y
*/
Candy = function( size , direction , x , y )
{
Bitmap.call( this , CandyAndGiftFactory.getInstance().getCandy(size) );
this.size = size ;
this.direction = direction ;
this.setX(x);
this.setY(y);
};
FLASH.... | JavaScript |
/**
* 游戏场景的礼物
* @author zzhanglin
* @param x
* @param y
*/
Gift = function( x , y )
{
Bitmap.call( this , CandyAndGiftFactory.getInstance().getGift() );
this.setX(x);
this.setY(y);
};
FLASH.extend( Gift , Bitmap);
//Gift.prototype=new Bitmap(); //继承自Bitmap
//Gift.prototype.constructor = Gift ; | JavaScript |
/**
* 英雄
* @author zzhanglin
* @returns {Hero}
*/
Hero = function()
{
var bmd = ResManager.getInstance().getBmdByName("character"); //获取图片数据
var action=[ new ActionVO("left",4), new ActionVO("right",4) ]; //只有两个动作,每个动作都是4帧
Animation.call( this , bmd , 2 ,4 , action , 1); //调用父类的构造函数
this.setX(400);
... | JavaScript |
/**
* 游戏的主程序入口
* @author zhouzhanglin
*/
SmartyDeer = function()
{
Sprite.call( this ) ;
this._gameWorld ;
this._startView ;
this._passView ;
this._blankLayer ;
//添加到舞台的事件侦听
this.addEventListener(Event.ADDED_TO_STAGE , this.addedHandler);
};
FLASH.extend( SmartyDeer , Sprite);
//SmartyDe... | JavaScript |
BlankLayer = function()
{
Shape.call(this);
this.getGraphics().beginFill( "#000000",1);
this.getGraphics().drawRect(0,0,GameSetting.SCENE_WIDTH , GameSetting.SCENE_HEIGHT );
this.getGraphics().endFill();
};
FLASH.extend( BlankLayer , Shape);
//BlankLayer.prototype = new Shape();
//BlankLayer.prototype.c... | JavaScript |
/**
* 游戏过关界面
* @author zhouzhanglin
* @returns {PassView}
*/
PassView = function()
{
Sprite.call(this);
this.bg = new Bitmap( ResManager.getInstance().getBmdByName("next_level"));
this.addChild(this.bg);
this.bg.mouseEnabled = true ;
this.mouseEnabled = true ;
var _self = this ;
function c... | JavaScript |
/**
* 开始界面
* @returns {StartView}
*/
StartView = function()
{
BaseView.call( this );
this.className = "StartView";
this.playBtn ;
};
FLASH.extend( StartView , BaseView);
//StartView.prototype = new BaseView();
//StartView.prototype.constructor = StartView ;
/**
* 重写父类的方法
*/
StartView.protot... | JavaScript |
/**
* 视图界面基类
* @returns {BaseView}
*/
BaseView = function()
{
Sprite.call( this );
this._bg ;
this._logo;
this._hero;
this._hint;
this.addEventListener(Event.ADDED_TO_STAGE , this.addedToStageHandler );
};
FLASH.extend( BaseView , Sprite);
//BaseView.prototype = new Sprite();
//BaseView.prot... | JavaScript |
/**
* 3维坐标
* @author zzhanglin
*/
Vector3D = function(x,y,z)
{
this.x = x || 0 ;
this.y= y || 0 ;
this.z= z || 0 ;
} ;
/**
* 复制点
* @returns {Vector3D}
*/
Vector3D.prototype.clone = function ()
{
return new Vector3D(this.x,this.y,this.z);
};
/**
* 输出此点的信息
*/
Vector3D.protot... | JavaScript |
/**
* 矩形类,参数可选,默认都为0
* @author zhouzhanglin
* @param x 默认为0
* @param y 默认为0
* @param width 默认为0
* @param height 默认为0
* @returns {Rectangle}
*/
Rectangle = function(x , y , width , height)
{
this.x = x||0 ;
this.y = y||0 ;
this.width = width||0;
this.height= height||0;
};
/**
* 此矩形区域是否包含此点
... | JavaScript |
/**
* 3*3 矩阵
* @author zzhanglin
* @param a
* @param b
* @param c
* @param d
* @param tx
* @param ty
*/
Matrix = function(a, b, c, d, tx, ty)
{
this._a = a !== undefined ? a : 1;
this._b = b || 0 ;
this._c = c || 0 ;
this._d = d !== undefined ? d : 1;
this._tx = tx || 0 ;... | JavaScript |
/**
* 点,参数可选
* @author zhouzhanglin
* @param x 默认为0
* @param y 默认为0
* @returns {Point}
*/
Point = function( x,y)
{
this.x = x||0 ;
this.y = y||0 ;
};
/**
* 此点到圆点的距离
* @returns
*/
Point.prototype.getLength = function()
{
return Math.sqrt( this.x*this.x+this.y*this.y );
};
/**
* 计算两个点之... | JavaScript |
/* 使用说明:
//初始化引擎
var engine = new FlashCore();
engine.setCanvas( document.getElementById("cav"));
engine.setMouseEnabled(true); //是否支持鼠标事件
//对stage进行一些参数设置
var stage = FlashCore.stage;
stage.setFrameRate(60) ;
engine.start(); //引擎开始运行
//下面接着向stage中添加显示对象
....................................... | JavaScript |
/**
* 文本类
* @author zzhanglin
* @returns {TextField}
*/
TextField = function()
{
InteractiveObject.call(this);
this.className="TextField";
this.text="";
this.color ="#000";
this.font = "12px Arial";
this.align = "start";
this.baseline = "top";
this.outline = false;
};
FLASH.extend(TextField... | JavaScript |
/**
* textAlign:文字水平对齐方式。可取属性值: start, end, left,right, center。默认值:start.
* @author zzhanglin
* @returns {TextFieldAlign}
*/
TextFieldAlign = function ()
{
this.className="TextFieldAlign";
};
//常量
TextFieldAlign.START="start";
TextFieldAlign.END="end";
TextFieldAlign.LEFT="left";
TextFieldAlign.RIGH... | JavaScript |
/**
* textBaseline:文字竖直对齐方式。可取属性值:top, hanging, middle,alphabetic, ideographic, bottom。默认值:alphabet
* @author zzhanglin
* @returns {TextFieldAlign}
*/
TextBaseline = function ()
{
this.className="TextBaseline";
};
//常量
TextBaseline.TOP="top";
TextBaseline.HANGING="hanging";
TextBaseline.MIDDLE="middl... | JavaScript |
/**
* 计时器
* @author zzhanglin
* @param _delay 延迟多少毫秒触发一次
* @param _repeatCount 总共的次数,为0的话就一直循环,默认为0。
* @returns {Timer}
*/
Timer = function( delay , repeatCount )
{
EventDispatcher.call(this);
this.delay = delay? delay : 25 ; //计时器事件间的延迟(以毫秒为单位)。
this.repeatCount = repeatCount?repeatCount : 0 ;... | JavaScript |
var GlobalUtil = window.GlobalUtil || {};
/**
* 公共方法
* @author zzhanglin
*/
GlobalUtil.LTrim = function(str)
{
var i;
for(i=0;i<str.length; ++i )
{
if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break;
}
str=str.substring(i,str.length);
return str;
} ;
GlobalUtil.RTrim = fun... | JavaScript |
/**
* 显示帧频
*/
Stats = function(){
TextField.call( this );
this.align = TextFieldAlign.LEFT ;
this.font="normal 15px Arial";
this.color = "#ffffff"; //白色
var time= 0;
var date ;
var fps=0;
var interval=0;
var _self =this ;
function update(){
interval++;
date = new Date();
fps =... | JavaScript |
/**
* HashMap 键值对
* @author zhouzhanglin
*/
HashMap = function()
{
this._values = [];
this._size =0 ;
};
//========getter/setter===========================
/**
* 获取所有的键
*/
HashMap.prototype.getKeys=function(){
var keys=[];
for(var key in this._values){
keys.push( key );
}
return keys ;
... | JavaScript |
/**
* 进度
* @author zhouzhanglin
* @param type 事件类型
* @param loaded 加载完成的,默认为0
* @param total 总共的加载量,默认为 0
* @returns {FLASH.events.ProgressEvent}
*/
ProgressEvent = function(type,loaded,total)
{
Event.call(this,type);
this.className="ProgressEvent";
this._loaded = loaded?loaded:0 ;
this._total =... | JavaScript |
/**
* 事件基类
* @author zzhanglin
* @param type 事件类型
* @param bubbles 是否冒泡
*/
Event = function(type,bubbles)
{
this.className="Event";
this._type = type ; //事件类型
this._bubbles = bubbles?bubbles:false ;
this._target ; //抛出事件的对象
this._currentTarget; //事件的当前对象
this._isDefaultPrevented = false ; //... | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.