code
stringlengths
1
2.08M
language
stringclasses
1 value
/* * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php * * Uses the built In easIng capabilities added In jQuery 1.1 * to offer multiple easIng options * * Copyright (c) 2007 George Smith * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ //...
JavaScript
var LAZY=(function(){ var pResizeTimer = null; var imgs={}; function addEventHandler (oTarget, sEventType, fnHandler) { if (oTarget.addEventListener) { oTarget.addEventListener(sEventType, fnHandler, false); } else if (oTarget.attachEvent) { oTarget.attachEvent("on" + sEventType, fnHandler); } el...
JavaScript
var Root = '/'; var KK = { 'js' : { 'keyword':function(){ var key = $("#wd").val(); $("#wd").focus(function(){ if($("#wd").val() == key){ $("#wd").val(""); } }); $("#wd").blur(function(){ if($("#wd").val()==''){ $("#wd").val(key); } }); //加入收藏 $("#sc").c...
JavaScript
/******************************************************************************* * Copyright (C) 2006 - 2010 FF84.COM * @author 809 <[email protected]> * @version 2.0.0 (2010-12-05) * ep: $(document).ready(function(){ $ff84.show.table(); }); **********************************************************************...
JavaScript
function pagego($url,$total){ $page = document.getElementById('page').value; if($page>0&&($page<=$total)){ $url=$url.replace('{!page!}',$page); if($url.split('index-1')){ $url=$url.split('index-1')[0]; } top.location.href = $url; } return false; }
JavaScript
/* @name: 飞飞PHP影视系统JS * @version: 2.0.beta4 * @lasttime: 2012-01-16 * FF.Home .Url; .Getchannel(sid); .Js(); FF.UpDown .Vod(ajaxurl); .News(ajaxurl); .Show(up=100:down=88,model); FF.Comment .Show(ajaxurl); .Post(); FF.Gold .Default(ajaxurl); .Show(ajaxurl); FF.Lazyload ...
JavaScript
function $Showhtml(){ player = '<embed type="application/x-shockwave-flash" src="http://player.ku6cdn.com/default/out/pV2.7.3.swf" id="mymovie" name="mymovie" quality="high" flashvars="ver=108&amp;jump=0&amp;api=1&amp;auto=1&amp;color=0&amp;deflogo=0&amp;flag=hd&amp;adss=0&amp;vid='+Player.Url+'&amp;type=v" wmode="t...
JavaScript
function $Showhtml(){ player = '<iframe border="0" src="'+Player.Root+'Public/player/gvod.html" width="100%" height="'+Player.Height+'" marginWidth="0" frameSpacing="0" marginHeight="0" frameBorder="0" scrolling="no" vspale="0" noResize></iframe>'; return player; } Player.Show();
JavaScript
function $Showhtml(){ player ='<object width="100%" height="'+Player.Height+'" classid="clsid:1DD5176B-B71E-4956-8F32-691702ACDCFE" onError="Player.Install();">'; player +='<PARAM NAME="URL" VALUE="'+Player.Url+'">'; player +='<PARAM NAME="NextWebUrl" VALUE="'+Player.NextUrl+'">'; player +='</object>'; retur...
JavaScript
function $Showhtml(){ player ='<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="100%" height="'+Player.Height+'" >'; player += '<param name="movie" value="http://www.letv.com/player/x'+Play...
JavaScript
function $Showhtml(){ player = '<embed height="'+Player.Height+'" width="100%" flashvars="vid='+Player.Url+'&amp;skin=http://imgcache.qq.com/minivideo_v1/vd/res/skins/QQPlayerSkin.swf&amp;autoplay=1&amp;gourl=http://video.qq.com/v1/videopl?v=&amp;list=1&amp;" allowfullscreen="true" wmode="Opaque" allowscriptaccess="a...
JavaScript
function $Showhtml(){ Player.Url = $BdhdUrl(Player.Url,Player.UrlName); Player.NextUrl = $BdhdUrl(Player.NextUrl,Player.UrlNextName); if(Player.Url == Player.NextUrl){ Player.NextUrl = ''; } var browser = navigator.appName; if(browser == "Netscape"){ return $PlayerNt(); }else if(browser == "Microsoft In...
JavaScript
function $Showhtml(){ player = '<embed allowNetworking="internal" allowFullScreen="true" allowscriptaccess="never" src="http://js.tudouui.com/bin/douwan/douwanPlayer_3.swf?iid='+Player.Url+'" type="application/x-shockwave-flash" width="100%" height="'+Player.Height+'"></embed>'; return player; } Player.Show(); ...
JavaScript
function $Showhtml(){ player = '<embed allowfullscreen="true" src="http://vhead.blog.sina.com.cn/player/bn_topic.swf?vid='+Player.Url+'&clip_id=&imgurl=&auto=1&vblog=1&type=0&tabad=1" quality="high" bgcolor="#000" width="100%" height="'+Player.Height+'" name="player" id="playerr" align="middle" allowScriptAccess="sa...
JavaScript
function $Showhtml(){ player = '<embed type="application/x-shockwave-flash" src="http://static.youku.com/v1.0.0242/v/swf/qplayer.swf" id="movie_player" name="movie_player" bgcolor="#FFFFFF" quality="high" allowfullscreen="true" flashvars="isShowRelatedVideo=false&showAd=0&show_pre=1&show_next=1&VideoIDS='+Player.Url...
JavaScript
function $Showhtml(){ player = '<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="100%" height="'+Player.Height+'" id="mdediaplayer">'; player += '<param name="URL" value="'+Player.Url+'">'; player += '<param name="stretchToFit" value="-1">'; player += '<embed filename="'+Player.Url+'" ShowSt...
JavaScript
function $Showhtml(){ player ='<OBJECT id=flvplayer1 classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="'+Player.Height+'" align="middle">'; player +='<PARAM NAME="Movie" VALUE="http://www.qiyi.c...
JavaScript
function $Showhtml(){ player = '<embed type="application/x-shockwave-flash" src="http://tv.sohu.com/upload/swf/20101021/Main.swf?autoplay=true&vid='+Player.Url+'" width="100%" height="'+Player.Height+'" type="application/x-shockwave-flash" allowFullScreen="true" allownetworking="internal" allowscriptaccess="never" w...
JavaScript
function $Showhtml(){ player = '<iframe border="0" src="'+Player.Root+'Public/player/baofeng.html" width="100%" height="'+Player.Height+'" marginWidth="0" frameSpacing="0" marginHeight="0" frameBorder="0" scrolling="no" vspale="0" noResize></iframe>'; return player; } Player.Show();
JavaScript
var bstartnextplay = false; function $Showhtml(){ Player.Url = $QvodUrl(Player.Url,Player.UrlName); Player.NextUrl = $QvodUrl(Player.NextUrl,Player.UrlNextName); var browser = navigator.appName; if(browser == "Netscape"){ return $PlayerNt(); }else if(browser == "Microsoft Internet Explorer"){ return $...
JavaScript
function $Showhtml(){ player ='<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="100%" height="'+Player.Height+'" >'; player += '<param name="movie" value="'+Player.Url+'">'; player += '<p...
JavaScript
function $Showhtml(){ player ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="'+Player.Height+'">'; player +='<param name="movie" value="'+ff_root+'Public/player/flv.swf"><param name=...
JavaScript
function $Showhtml(){ player ='<embed src="http://player.pptv.com/v/'+Player.Url+'.swf" quality="high" width="100%" height="'+Player.Height+'" align="middle" allowScriptAccess="always" allownetworking="all" type="application/x-shockwave-flash" wmode="window" allowFullScreen="true" play="true"></embed>'; //player =...
JavaScript
function $Showhtml(){ url = Player.Url.replace(/\+/g,' '); player = '<OBJECT name="myWebPlayer9" id="myWebPlayer9" classid="clsid:947BA55B-2113-4349-8784-FFB9D7F881C9" width="100%" height="'+Player.Height+'" align="center" onError="Player.Install();">'; player += '<param name="Mode" value="full">'; player += '<...
JavaScript
function $Showhtml(){ player ='<object width="100%" height="'+Player.Height+'" classid="clsid:A74BF134-5213-46B5-AF36-CE1888315DC7" onError="Player.Install();">'; player +='<PARAM NAME="URL" VALUE="'+Player.Url+'">'; player +='<PARAM NAME="lActiveXStyle" VALUE="1">'; player +='</object>'; return player; } ...
JavaScript
function $Showhtml(){ player = '<object id="realObj" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="100%" height="'+(Player.Height-60)+'">'; player += '<param name="CONTROLS" value="ImageWindow">'; player += '<param name="CONSOLE" value="Clip1">'; player += '<param name="AUTOSTART" value="-1">'; ...
JavaScript
/* anythingSlider v1.2 By Chris Coyier: http://css-tricks.com with major improvements by Doug Neiner: http://pixelgraphics.us/ based on work by Remy Sharp: http://jqueryfordesigners.com/ To use the navigationFormatter function, you must have a function that accepts two paramaters, and ...
JavaScript
//百度站内搜索代码 start function baidusearch() { var wd=document.getElementsByName("wd")[0].value; var link="http://www.baidu.com/s?si=www.y80s.net&cl=3&ie=utf-8&ct=2097152&tn=baidulocal&word="+wd; window.open(link); } function huiche(){ if (event.keyCode == 13) { baidusearch(); } ...
JavaScript
document.writeln("<script language='javascript' src='http://cn.yimg.com/js/jquery/jquery-1.4.2.min.js'></script>");
JavaScript
/* * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php * * Uses the built In easIng capabilities added In jQuery 1.1 * to offer multiple easIng options * * Copyright (c) 2007 George Smith * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ //...
JavaScript
/** * ueditor完整配置项 * 可以在这里配置整个编辑器的特性 */ /**************************提示******************************** * 所有被注释的配置项均为UEditor默认值。 * 修改默认配置请首先确保已经完全明确该参数的真实用途。 * 主要有两种修改方案,一种是取消此处注释,然后修改成对应参数;另一种是在实例化编辑器时传入对应参数。 * 当升级编辑器时,可直接使用旧版配置文件替换新版配置文件,不用担心旧版配置文件中因缺少新功能所需的参数而导致脚本报错。 **************************提示****...
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
/** * Created with JetBrains PhpStorm. * User: taoqili * Date: 12-6-12 * Time: 下午6:57 * To change this template use File | Settings | File Templates. */ UE.I18N['en'] = { 'labelMap':{ 'anchor':'Anchor', 'undo':'Undo', 'redo':'Redo', 'bold':'Bold', 'indent':'Indent', 'snapscreen':'SnapScreen',...
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"] ); addUrl...
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
// 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 writing,...
JavaScript
/** * Created with JetBrains PhpStorm. * User: xuheng * Date: 12-5-22 * Time: 上午11:38 * To change this template use File | Settings | File Templates. */ var scrawl = function (options) { options && this.initOptions(options); }; (function () { var canvas = $G("J_brushBoard"), context = ...
JavaScript
/** * Created with JetBrains PhpStorm. * User: xuheng * Date: 12-8-8 * Time: 下午2:09 * To change this template use File | Settings | File Templates. */ (function () { var me = editor, preview = $G( "preview" ), preitem = $G( "preitem" ), tmps = templates, ...
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
/** * 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
/** * Created by JetBrains PhpStorm. * User: taoqili * Date: 12-2-23 * Time: 上午11:32 * To change this template use File | Settings | File Templates. */ var init = function(){ addColorPickListener(); addPxChangeListener(); addFloatListener(); addBorderTypeChangeList...
JavaScript
/** * Created by JetBrains PhpStorm. * User: taoqili * Date: 12-1-30 * Time: 下午12:50 * To change this template use File | Settings | File Templates. */ //editor.execCommand("wordimage","word_img"); var wordImage = {}; //(function(){ var g = baidu.g, flashObj,flashContainer; wordImage.init = fun...
JavaScript
var me = editor, doc = me.document, bodyStyle, cp = $G( "colorPicker" ), bkbodyStyle = "", bkcolor = ""; var popup = new UE.ui.Popup( { content:new UE.ui.ColorPicker( { noColorText:me.getLang( "clearColor" ), editor:me, onpickcolor:function (...
JavaScript
/* * Jssor 18.0 * http://www.jssor.com/ * * TERMS OF USE - Jssor * * Copyright 2014 Jssor * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitat...
JavaScript
/// <reference path="Jssor.js" /> /* * Jssor.Slider 18.0 * http://www.jssor.com/ * * TERMS OF USE - Jssor.Slider * * Copyright 2014 Jssor * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software...
JavaScript
/** * jQuery Masonry v2.1.03 * A dynamic layout plugin for jQuery * The flip-side of CSS Floats * http://masonry.desandro.com * * Licensed under the MIT license. * Copyright 2011 David DeSandro */ /*jshint browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict...
JavaScript
$(document).ready(function(){ $("span").click(function(){ $(".iframe").hide("slow"); }); });
JavaScript
var JSON_URL = '../../php/file_manager_json.php'; var KE = parent.KindEditor; var id = KE.util.getParam(location.href, 'id'); var fileManagerJson = (typeof KE.g[id].fileManagerJson == 'undefined') ? JSON_URL : KE.g[id].fileManagerJson; var lang = KE.lang.plugins.file_manager; KE.event.ready(function() { var mo...
JavaScript
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 Longhao Luo * * @author Roddy <[email protected]> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php * @version 3.5.5 (2011-05...
JavaScript
/* * Thickbox 3.1 - One Box To Rule Them All. * By Cody Lindley (http://www.codylindley.com) * Copyright (c) 2007 cody lindley * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php */ /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ //on page load ...
JavaScript
/* * jQuery Checkbox Plugin * version: 1.0 (2010-4-12) * @requires jQuery v1.3.2 or later * @author:tommy * @email:[email protected] * Examples and documentation at: http://www.tommyframework.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license....
JavaScript
/* * Thickbox 3.1 - One Box To Rule Them All. * By Cody Lindley (http://www.codylindley.com) * Copyright (c) 2007 cody lindley * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php */ /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ //on page load ...
JavaScript
/* -------------------------------- Infinite Scroll -------------------------------- + https://github.com/paulirish/infinite-scroll + version 2.0b2.111027 + Copyright 2011 Paul Irish & Luke Shumard + Licensed under the MIT license + Documentation: http://infinite-scroll.com/ */ (function (window, $, undefi...
JavaScript
var $container = $('#content'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector : '.message', columnWidth : 240 }); }); $(window).scroll(function () { var clienth = document.documentElement.clientHeight; var scrollh = document.documentElement.scrollHeight; ...
JavaScript
/** water fall layout**/ (function ($) { $.fn.setwaterfall = function (options) { function findLowestIndex(Arr) { var index = 0; var i; for (i in Arr) { if(Arr[i]<Arr[index]) { index = i; } } return index; ...
JavaScript
/* * Thickbox 2.0 - One Box To Rule Them All. * By Cody Lindley (http://www.codylindley.com) * Copyright (c) 2006 cody lindley * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php * Thickbox is built on top of the very light weight jQuery library. */ //on page load c...
JavaScript
/* * jQuery Checkbox Plugin * version: 1.0 (2010-4-12) * @requires jQuery v1.3.2 or later * @author:tommy * @email:[email protected] * Examples and documentation at: http://www.tommyframework.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license....
JavaScript
/* * Thickbox 3.1 - One Box To Rule Them All. * By Cody Lindley (http://www.codylindley.com) * Copyright (c) 2007 cody lindley * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php */ /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ //on page load ...
JavaScript
//触发显示评论内容 $(function () { $('.insert_comment_button').click(function () { var mid = $(this).attr('alt'); var newThis = $(this).parent().parent().siblings('.commentbox'); if(!newThis.siblings('.retweetbox').hasClass('hide')) { newThis.siblings('.retweetbox').toggleClass('hide'); } if(newThis.at...
JavaScript
var ajaxUrl = "./modular/chuli.php"; var comment = new Array(); //*****floatbox***** //触发弹出事件 $('.float_trigger').click(function () { if($(this).siblings(".float_box").is(":visible")) { $(this).siblings(".float_box").hide(); } else { $(this).parent().siblings().children('.float_box').hid...
JavaScript
$('.comment_biaoqing_trigger').click(function () { var newThis = $(this).parent().siblings('.comment_biaoqing_floatbox'); newThis.toggleClass('hide'); }) $('.comment_biaoqing_img img').click(function () { var kkk = $(this).attr('alt'); var thisTextarea = $(this).parent().parent().parent().siblings('form').children...
JavaScript
window.fakeStorage = { _data: {}, setItem: function (id, val) { return this._data[id] = String(val); }, getItem: function (id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; }, removeItem: function (id) { return delete this._data[id]; }, clear: function () { ret...
JavaScript
// Wait till the browser is ready to render the game (avoids glitches) window.requestAnimationFrame(function () { new GameManager(4, KeyboardInputManager, HTMLActuator, LocalStorageManager); });
JavaScript
function KeyboardInputManager() { this.events = {}; if (window.navigator.msPointerEnabled) { //Internet Explorer 10 style this.eventTouchstart = "MSPointerDown"; this.eventTouchmove = "MSPointerMove"; this.eventTouchend = "MSPointerUp"; } else { this.eventTouchstart = "touchsta...
JavaScript
function Grid(size, previousState) { this.size = size; this.cells = previousState ? this.fromState(previousState) : this.empty(); } // Build a grid of the specified size Grid.prototype.empty = function () { var cells = []; for (var x = 0; x < this.size; x++) { var row = cells[x] = []; for (var y = 0;...
JavaScript
(function () { if (typeof window.Element === "undefined" || "classList" in document.documentElement) { return; } var prototype = Array.prototype, push = prototype.push, splice = prototype.splice, join = prototype.join; function DOMTokenList(el) { this.el = el; // The classN...
JavaScript
Function.prototype.bind = Function.prototype.bind || function (target) { var self = this; return function (args) { if (!(args instanceof Array)) { args = [args]; } self.apply(target, args); }; };
JavaScript
function GameManager(size, InputManager, Actuator, StorageManager) { this.size = size; // Size of the grid this.inputManager = new InputManager; this.storageManager = new StorageManager; this.actuator = new Actuator; this.checkCoor = []; this.startTiles = 2; this.inputManager....
JavaScript
(function () { var lastTime = 0; var vendors = ['webkit', 'moz']; for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || wind...
JavaScript
function HTMLActuator() { this.tileContainer = document.querySelector(".tile-container"); this.scoreContainer = document.querySelector(".score-container"); this.bestContainer = document.querySelector(".best-container"); this.messageContainer = document.querySelector(".game-message"); this.score = 0; ...
JavaScript
function Tile(position, value) { this.x = position.x; this.y = position.y; this.value = value || 2; this.previousPosition = null; this.mergedFrom = null; // Tracks tiles that merged together } Tile.prototype.savePosition = function () { this.previousPosition ...
JavaScript
window.fakeStorage = { _data: {}, setItem: function (id, val) { return this._data[id] = String(val); }, getItem: function (id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; }, removeItem: function (id) { return delete this._data[id]; }, clear: function () { ret...
JavaScript
// Wait till the browser is ready to render the game (avoids glitches) window.requestAnimationFrame(function () { new GameManager(4, KeyboardInputManager, HTMLActuator, LocalStorageManager); });
JavaScript
function KeyboardInputManager() { this.events = {}; if (window.navigator.msPointerEnabled) { //Internet Explorer 10 style this.eventTouchstart = "MSPointerDown"; this.eventTouchmove = "MSPointerMove"; this.eventTouchend = "MSPointerUp"; } else { this.eventTouchstart = "touchsta...
JavaScript
(function () { if (typeof window.Element === "undefined" || "classList" in document.documentElement) { return; } var prototype = Array.prototype, push = prototype.push, splice = prototype.splice, join = prototype.join; function DOMTokenList(el) { this.el = el; // The classN...
JavaScript
Function.prototype.bind = Function.prototype.bind || function (target) { var self = this; return function (args) { if (!(args instanceof Array)) { args = [args]; } self.apply(target, args); }; };
JavaScript
function TileToNumber(tile) { if(tile == null) return 0; value = tile.value; num = 0; while(value > 1) { value >>= 1; ++num; } return num; } function JS_MinimaxBestMove(cells) { var map = { 0: 0, 1: 2, 2: 3, 3: 1}; var args = [ 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'numb...
JavaScript
function GameManager(size, InputManager, Actuator, StorageManager) { this.size = size; // Size of the grid this.inputManager = new InputManager; this.storageManager = new StorageManager; this.actuator = new Actuator; this.timeout_ai = null; this.checkCoor = []; this.checkCoor2 ...
JavaScript
(function () { var lastTime = 0; var vendors = ['webkit', 'moz']; for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || wind...
JavaScript
function HTMLActuator() { this.tileContainer = document.querySelector(".tile-container"); this.scoreContainer = document.querySelector(".score-container"); this.bestContainer = document.querySelector(".best-container"); this.messageContainer = document.querySelector(".game-message"); this.sharingConta...
JavaScript
function Tile(position, value) { this.x = position.x; this.y = position.y; this.value = value || 2; this.previousPosition = null; this.mergedFrom = null; // Tracks tiles that merged together } Tile.prototype.savePosition = function () { this.previousPosition ...
JavaScript
// Note: For maximum-speed code, see "Optimizing Code" on the Emscripten wiki, https://github.com/kripken/emscripten/wiki/Optimizing-Code // Note: Some Emscripten settings may limit the speed of the generated code. // The Module object: Our interface to the outside world. We import // and export values on it, and do th...
JavaScript
window.fakeStorage = { _data: {}, setItem: function (id, val) { return this._data[id] = String(val); }, getItem: function (id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; }, removeItem: function (id) { return delete this._data[id]; }, clear: function () { ret...
JavaScript
// Wait till the browser is ready to render the game (avoids glitches) window.requestAnimationFrame(function () { new GameManager(4, KeyboardInputManager, HTMLActuator, LocalStorageManager); });
JavaScript
function KeyboardInputManager() { this.events = {}; if (window.navigator.msPointerEnabled) { //Internet Explorer 10 style this.eventTouchstart = "MSPointerDown"; this.eventTouchmove = "MSPointerMove"; this.eventTouchend = "MSPointerUp"; } else { this.eventTouchstart = "touchsta...
JavaScript
(function () { if (typeof window.Element === "undefined" || "classList" in document.documentElement) { return; } var prototype = Array.prototype, push = prototype.push, splice = prototype.splice, join = prototype.join; function DOMTokenList(el) { this.el = el; // The classN...
JavaScript
Function.prototype.bind = Function.prototype.bind || function (target) { var self = this; return function (args) { if (!(args instanceof Array)) { args = [args]; } self.apply(target, args); }; };
JavaScript
function TileToNumber(tile) { if(tile == null) return 0; value = tile.value; num = 0; while(value > 1) { value >>= 1; ++num; } return num; } function JS_MinimaxBestMove(cells) { var map = { 0: 0, 1: 2, 2: 3, 3: 1}; var args = [ 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'numb...
JavaScript
function GameManager(size, InputManager, Actuator, StorageManager) { this.size = size; // Size of the grid this.inputManager = new InputManager; this.storageManager = new StorageManager; this.actuator = new Actuator; this.timeout_ai = null; this.checkCoor = []; this.checkCoor2 ...
JavaScript
(function () { var lastTime = 0; var vendors = ['webkit', 'moz']; for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || wind...
JavaScript
function HTMLActuator() { this.tileContainer = document.querySelector(".tile-container"); this.scoreContainer = document.querySelector(".score-container"); this.bestContainer = document.querySelector(".best-container"); this.messageContainer = document.querySelector(".game-message"); this.sharingConta...
JavaScript
function Tile(position, value) { this.x = position.x; this.y = position.y; this.value = value || 2; this.previousPosition = null; this.mergedFrom = null; // Tracks tiles that merged together } Tile.prototype.savePosition = function () { this.previousPosition ...
JavaScript
// Note: For maximum-speed code, see "Optimizing Code" on the Emscripten wiki, https://github.com/kripken/emscripten/wiki/Optimizing-Code // Note: Some Emscripten settings may limit the speed of the generated code. // The Module object: Our interface to the outside world. We import // and export values on it, and do th...
JavaScript
window.fakeStorage = { _data: {}, setItem: function (id, val) { return this._data[id] = String(val); }, getItem: function (id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; }, removeItem: function (id) { return delete this._data[id]; }, clear: function () { ret...
JavaScript
// Wait till the browser is ready to render the game (avoids glitches) window.requestAnimationFrame(function () { new GameManager(4, KeyboardInputManager, HTMLActuator, LocalStorageManager); });
JavaScript
function KeyboardInputManager() { this.events = {}; if (window.navigator.msPointerEnabled) { //Internet Explorer 10 style this.eventTouchstart = "MSPointerDown"; this.eventTouchmove = "MSPointerMove"; this.eventTouchend = "MSPointerUp"; } else { this.eventTouchstart = "touchsta...
JavaScript
function Grid(size, previousState) { this.size = size; this.cells = previousState ? this.fromState(previousState) : this.empty(); } // Build a grid of the specified size Grid.prototype.empty = function () { var cells = []; for (var x = 0; x < this.size; x++) { var row = cells[x] = []; for (var y = 0;...
JavaScript
(function () { if (typeof window.Element === "undefined" || "classList" in document.documentElement) { return; } var prototype = Array.prototype, push = prototype.push, splice = prototype.splice, join = prototype.join; function DOMTokenList(el) { this.el = el; // The classN...
JavaScript
Function.prototype.bind = Function.prototype.bind || function (target) { var self = this; return function (args) { if (!(args instanceof Array)) { args = [args]; } self.apply(target, args); }; };
JavaScript