code
stringlengths
1
2.08M
language
stringclasses
1 value
function LineMotion(x1, x2, t) { return x1.value + (x2.value - x1.value) * t; } var t2 = 0; var t3 = 0; function SplineMotion(x1, x2, r1, r2, t) { t2 = t * t; t3 = t2 * t; return x1.value * (2.0 * t3 - 3.0 * t2 + 1.0) + r1.gradient * (t3 - 2.0 * t2 + t) + x2.value * (-2.0 * t3 + 3.0 * t2) + r2.gradient...
JavaScript
/** * * 1.获得数组中不重复的项目 * * @param {Array} a 可能包含重复元素的数组 * @returns {Array} 返回一个不包含重复元素的新数组 */ function unique(a) { var temp_array = new Array(); for(var index in a){ temp_array.push(a[index]); } var return_array = new Array(); } /** * 2.同jQuery.map方法 */ function mapArray(a,f) { ...
JavaScript
/* 下面的一些函数实现都是实现和jQuery中的方法类似的功能,你可以完成后和jQuery中对应函数返回結果比较一下 1. 实现jQuery中的: addClass, removeClass, hasClass三个函数, 函数签名如下,完成下面的代码 //下面是文档注释,你可以看一下jsdoc这个项目,里面有下面注释含义的说明 @param {HTMLElement} ele @param {String|[]String} classNames */ function addClass(ele,classNames){ if(Object.prototype.toString.ca...
JavaScript
/* 1.判断一个对象是否具有指定的方法 @param {Object} obj @param {[]String} methodNames 方法名称 @returns {Boolean} 如果obj具有methodNames列出来的方法,返回true 如 isImplements({ method1:function () {} },["method1"]) 返回true isImplements({ method1:function () {} },["getName"]) 返回false */ function isImplements(obj,methodNames) { var ...
JavaScript
/** * @version $Id: k2tags.js 1919 2013-02-11 19:02:02Z joomlaworks $ * @package K2 * @author JoomlaWorks http://www.joomlaworks.net * @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved. * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */ $K2(document).ready(function() ...
JavaScript
/** * @version $Id: k2extrafields.js 1812 2013-01-14 18:45:06Z lefteris.kavadas $ * @package K2 * @author JoomlaWorks http://www.joomlaworks.net * @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved. * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */ $K2(document).ready...
JavaScript
/** * @version $Id: k2.js 1987 2013-06-27 11:51:59Z lefteris.kavadas $ * @package K2 * @author JoomlaWorks http://www.joomlaworks.net * @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved. * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */ var $K2 = jQuery.noConflict();...
JavaScript
/* Tokenizer for JavaScript code */ var tokenizeJavaScript = (function() { // Advance the stream until the given character (not preceded by a // backslash) is encountered, or the end of the line is reached. function nextUntilUnescaped(source, end) { var escaped = false; while (!source.endOfLine()) { ...
JavaScript
var SparqlParser = Editor.Parser = (function() { function wordRegexp(words) { return new RegExp("^(?:" + words.join("|") + ")$", "i"); } var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", "isblank", "isliteral", "union", "a"]); var ...
JavaScript
// Minimal framing needed to use CodeMirror-style parsers to highlight // code. Load this along with tokenize.js, stringstream.js, and your // parser. Then call highlightText, passing a string as the first // argument, and as the second argument either a callback function // that will be called with an array of SPAN no...
JavaScript
/* The Editor object manages the content of the editable frame. It * catches events, colours nodes, and indents lines. This file also * holds some functions for transforming arbitrary DOM structures into * plain sequences of <span> and <br> elements */ var internetExplorer = document.selection && window.ActiveXObj...
JavaScript
/* This file defines an XML parser, with a few kludges to make it * useable for HTML. autoSelfClosers defines a set of tag names that * are expected to not have a closing tag, and doNotIndent specifies * the tags inside of which no indentation should happen (see Config * object). These can be disabled by passing th...
JavaScript
/* String streams are the things fed to parsers (which can feed them * to a tokenizer if they want). They provide peek and next methods * for looking at the current character (next 'consumes' this * character, peek does not), and a get method for retrieving all the * text that was consumed since the last time get w...
JavaScript
/* CodeMirror main module (http://codemirror.net/) * * Implements the CodeMirror constructor and prototype, which take care * of initializing the editor frame, and providing the outside interface. */ // The CodeMirrorConfig object is used to specify a default // configuration. If you specify such an object before ...
JavaScript
/* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved. The copyrights embodied in the content of this file are licensed by Yahoo! Inc. under the BSD (revised) open source license @author Dan Vlad Dascalescu <dandv@yahoo-inc.com> Parse function for PHP. Makes use of the tokenizer from tokenizephp.js. Based on pa...
JavaScript
/* Parse function for JavaScript. Makes use of the tokenizer from * tokenizejavascript.js. Note that your parsers do not have to be * this complicated -- if you don't want to recognize local variables, * in many languages it is enough to just look for braces, semicolons, * parentheses, etc, and know when you are in...
JavaScript
/** * Storage and control for undo information within a CodeMirror * editor. 'Why on earth is such a complicated mess required for * that?', I hear you ask. The goal, in implementing this, was to make * the complexity of storing and reverting undo information depend * only on the size of the edited or restored con...
JavaScript
var DummyParser = Editor.Parser = (function() { function tokenizeDummy(source) { while (!source.endOfLine()) source.next(); return "text"; } function parseDummy(source) { function indentTo(n) {return function() {return n;}} source = tokenizer(source, tokenizeDummy); var space = 0; var ite...
JavaScript
/* A few useful utility functions. */ // Capture a method on an object. function method(obj, name) { return function() {obj[name].apply(obj, arguments);}; } // The value used to signal the end of a sequence in iterators. var StopIteration = {toString: function() {return "StopIteration"}}; // Apply a function to ea...
JavaScript
/* Functionality for finding, storing, and restoring selections * * This does not provide a generic API, just the minimal functionality * required by the CodeMirror system. */ // Namespace object. var select = {}; (function() { select.ie_selection = document.selection && document.selection.createRangeCollection...
JavaScript
/* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved. The copyrights embodied in the content of this file are licensed by Yahoo! Inc. under the BSD (revised) open source license @author Vlad Dan Dascalescu <dandv@yahoo-inc.com> Tokenizer for PHP code References: + http://php.net/manual/en/reserved.php + ...
JavaScript
/* Simple parser for CSS */ var CSSParser = Editor.Parser = (function() { var tokenizeCSS = (function() { function normal(source, setState) { var ch = source.next(); if (ch == "@") { source.nextWhileMatches(/\w/); return "css-at"; } else if (ch == "/" && source.equals("*")...
JavaScript
/* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved. The copyrights embodied in the content of this file are licensed by Yahoo! Inc. under the BSD (revised) open source license @author Dan Vlad Dascalescu <dandv@yahoo-inc.com> Based on parsehtmlmixed.js by Marijn Haverbeke. */ var PHPHTMLMixedParser = Editor....
JavaScript
// A framework for simple tokenizers. Takes care of newlines and // white-space, and of getting the text from the source stream into // the token object. A state is a function of two arguments -- a // string stream and a setState function. The second can be used to // change the tokenizer's state, and can be ignored fo...
JavaScript
var HTMLMixedParser = Editor.Parser = (function() { // tags that trigger seperate parsers var triggers = { "script": "JSParser", "style": "CSSParser" }; function checkDependencies() { var parsers = ['XMLParser']; for (var p in triggers) parsers.push(triggers[p]); for (var i in parsers) { ...
JavaScript
/* Demonstration of embedding CodeMirror in a bigger application. The * interface defined here is a mess of prompts and confirms, and * should probably not be used in a real project. */ function MirrorFrame(place, options) { this.home = document.createElement("div"); if (place.appendChild) place.appendChild...
JavaScript
/* The Editor object manages the content of the editable frame. It * catches events, colours nodes, and indents lines. This file also * holds some functions for transforming arbitrary DOM structures into * plain sequences of <span> and <br> elements */ var internetExplorer = document.selection && window.ActiveXObj...
JavaScript
/** * Tinymce template_list.js sample file * @version tinymce 3.3.9 * @package Joomla * @copyright Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * Some state variables for the overrider */ Joomla.overrider = { states : { refreshing: false, refreshed: false, counter: 0, searchst...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ var plg_quickicon_jupdatecheck_ajax_structure = {}; window.addEvent('domready', function(){ plg_quickicon_jupdatecheck_ajax_structure = { onSucc...
JavaScript
/** * @package Joomla.JavaScript * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Only define the Joomla namespace if not defined. if (typeof(Joomla) === 'undefined') { var Joomla = {}; } /** *...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ Object.append(Browser.Features, { localstorage: (function() { return ('localStorage' in window) && window.localStorage !== null; })() }); /** ...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * JCaption javascript behavior * * Used for displaying image captions * * @package Joomla * @since 1.5 * @version 1.0 */ var JCaption...
JavaScript
/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ * --------------------------------------------------------------------------- * * The DHTML Calendar * * Details and latest version at: * http://dynarch.com/mishoo/calendar.epl * * This script is distributed under the GNU Lesser General Public...
JavaScript
/** * SqueezeBox - Expandable Lightbox * * Allows to open various content as modal, * centered and animated box. * * Dependencies: MooTools 1.4 or newer * * Inspired by * ... Lokesh Dhakar - The original Lightbox v2 * * @version 1.3 * * @license MIT-style license * @author Harald Kirschner <mail [at] ...
JavaScript
/* name: Fx.ProgressBar description: Creates a progressbar with WAI-ARIA and optional HTML5 support. license: MIT-style authors: - Harald Kirschner <mail [at] digitarald [dot] de> - Rouven Weßling <me [at] rouvenwessling [dot] de> requires: [Core/Fx, Core/Class, Core/Element] provides: Fx.ProgressBar */ Fx.Progre...
JavaScript
/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo * ----------------------------------------------------------- * * The DHTML Calendar, version 1.0 "It is happening again" * * Details and latest version at: * www.dynarch.com/projects/calendar * * This script is developed by Dynarch.com. Visit us at...
JavaScript
/** * FancyUpload - Flash meets Ajax for powerful and elegant uploads. * * Updated to latest 3.0 API. Hopefully 100% compat! * * @version 3.0 * * @license MIT License * * @author Harald Kirschner <http://digitarald.de> * @copyright Authors */ var FancyUpload2 = new Class({ Extends: Swiff.Uploader, op...
JavaScript
/* --- MooTools: the javascript framework web build: - http://mootools.net/core/76bf47062d6c1983d66ce47ad66aa0e0 packager build: - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Eleme...
JavaScript
/* --- script: mooRainbow.js version: 1.3 description: MooRainbow is a ColorPicker for MooTools 1.3 license: MIT-Style authors: - Djamil Legato (w00fz) - Christopher Beloch requires: [Core/*, More/Slider, More/Drag, More/Color] provides: [mooRainbow] ... */ var MooRainbow = new Class({ options: { id: 'mooR...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * JavaScript behavior to allow shift select in administrator grids */ (function() { Joomla = Joomla || {}; Joomla.JMultiSelect = new Class(...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ Object.append(Browser.Features, { inputemail: (function() { var i = document.createElement("input"); i.setAttribute("type", "email"); return ...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * Switcher behavior * * @package Joomla * @since 1.5 */ var JSwitcher = new Class({ Implements: [Options, Events], togglers: null, el...
JavaScript
/* Script: mootree.js My Object Oriented Tree - Developed by Rasmus Schultz, <http://www.mindplay.dk> - Tested with MooTools release 1.2, under Firefox 2, Opera 9 and Internet Explorer 6 and 7. License: MIT-style license. Credits: Inspired by: - WebFX xTree, <http://webfx.eae.net/dhtml/xtree/> - Destroydrop dT...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Only define the Joomla namespace if not defined. if (typeof(Joomla) === 'undefined') { var Joomla = {}; } Joomla.editors = {}; // An object to ...
JavaScript
/** * @package Joomla.JavaScript * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Only define the Joomla namespace if not defined. if (typeof(Joomla) === 'undefined') { var Joomla = {}; } Joomla...
JavaScript
/* --- description: Form.PasswordStrength class, and basic dom methods license: MIT-style authors: - Al Kent requires: - core/1.3.1: '*' provides: - Form.PasswordStrength - Element.Events.keyupandchange - String.strength ... */ if (!this.Form) this.Form = {}; Form.PasswordStrength = new Class({ Implements...
JavaScript
/** * Swiff.Uploader - Flash FileReference Control * * @version 3.0 * * @license MIT License * * @author Harald Kirschner <http://digitarald.de> * @author Valerio Proietti, <http://mad4milk.net> * @copyright Authors */ Swiff.Uploader = new Class({ Extends: Swiff, Implements: Events, options: { pa...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * JImageManager behavior for media component * * @package Joomla.Extensions * @subpackage Media * @since 1.5 */ (function() { var Image...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * JMediaManager behavior for media component * * @package Joomla.Extensions * @subpackage Media * @since 1.5 */ (function() { var Media...
JavaScript
/** * @version $Id: k2.noconflict.js 1812 2013-01-14 18:45:06Z lefteris.kavadas $ * @package K2 * @author JoomlaWorks http://www.joomlaworks.net * @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved. * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */ var ...
JavaScript
/** * @version $Id: k2.js 1965 2013-04-29 16:01:44Z lefteris.kavadas $ * @package K2 * @author JoomlaWorks http://www.joomlaworks.net * @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved. * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */ var K2JVersion; var selectsI...
JavaScript
/** * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ window.addEvent('domready', function(){ var ajax_structure = { onSuccess: function(msg, responseXML) { try { var updateInfoList = JSON.d...
JavaScript
var Observer = new Class({ Implements: [Options, Events], options: { periodical: false, delay: 1000 }, initialize: function (el, onFired, options) { this.element = document.id(el) || $document.id(el); this.addEvent('onFired', onFired); this.setOptions(options); this.bound = this.changed.bind(this); th...
JavaScript
var FinderProgressBar = new Class({ Implements: [Events, Options], options: { container: document.body, boxID: 'progress-bar-box-id', percentageID: 'progress-bar-percentage-id', displayID: 'progress-bar-display-id', startPercentage: 0, displayText: false, speed: 10, step: 1, allowMore: false, onCo...
JavaScript
var Highlighter = new Class({ options: { autoUnhighlight: true, caseSensitive: false, startElement: false, endElement: false, elements: new Array(), className: 'highlight', onlyWords: true, tag: 'span' }, initialize: function (options) { this.setOptions(options); this.getElements(this.options.sta...
JavaScript
FinderFilter = new Class({ Extends: Fx.Elements, options: { onActive: Class.empty, onBackground: Class.empty, height: false, width: true, opacity: true, fixedHeight: false, fixedWidth: 220, wait: true }, initialize: function (togglers, elements, container, frame) { this.togglers = togglers || [...
JavaScript
window.addEvent('domready', function () { sm = document.id('system-message'); if (sm) { sm.addEvent('check', function () { open = 0; messages = this.getElements('li'); for (i = 0, n = messages.length; i < n; i++) { if (messages[i].getProperty('hidden') != 'hidden') { open++; } } if (open...
JavaScript
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* AES implementation in JavaScript (c) Chris Veness 2005-2010 */ /* - see http://csrc.nist.gov/publications/PubsFIPS.html#197 */ /* - - - - - - - ...
JavaScript
window.addEvent('domready', function () { em = document.id('extraction_method'); if (em) { em.addEvent('change', function () { if(em.value == 'direct') { document.id('row_ftp_hostname').style.display = 'none'; document.id('row_ftp_port').style.display = 'none'; document.id('row_ftp_username').style.d...
JavaScript
var joomlaupdate_error_callback = dummy_error_handler; var joomlaupdate_stat_inbytes = 0; var joomlaupdate_stat_outbytes = 0; var joomlaupdate_stat_files = 0; var joomlaupdate_stat_percent = 0; var joomlaupdate_factory = null; var joomlaupdate_progress_bar = null; /** * An extremely simple error handler, dumping erro...
JavaScript
/* * http://www.JSON.org/json2.js * 2009-09-29 * Public Domain. * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. * See http://www.JSON.org/js.html */ if(!this.JSON){this.JSON={};} (function(){function f(n){return n<10?'0'+n:n;} if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=funct...
JavaScript
// Angie Radtke 2009 // /*global window, localStorage, Cookie, altopen, altclose, big, small, rightopen, rightclose, bildauf, bildzu */ Object.append(Browser.Features, { localstorage: (function() { return ('localStorage' in window) && window.localStorage !== null; })() }); function saveIt(name) { var x = docume...
JavaScript
/*global window, localStorage, fontSizeTitle, bigger, reset, smaller, biggerTitle, resetTitle, smallerTitle, Cookie */ var prefsLoaded = false; var defaultFontSize = 100; var currentFontSize = defaultFontSize; var fontSizeTitle; var bigger; var smaller; var reset; var biggerTitle; var smallerTitle; var resetTitle; Obj...
JavaScript
/* Javscript Document */
JavaScript
// Angie Radtke 2009 // /*global window, localStorage, Cookie, altopen, altclose, big, small, rightopen, rightclose, bildauf, bildzu */ Object.append(Browser.Features, { localstorage: (function() { return ('localStorage' in window) && window.localStorage !== null; })() }); function saveIt(name) { var x = docume...
JavaScript
/*global window, localStorage, fontSizeTitle, bigger, reset, smaller, biggerTitle, resetTitle, smallerTitle, Cookie */ var prefsLoaded = false; var defaultFontSize = 100; var currentFontSize = defaultFontSize; var fontSizeTitle; var bigger; var smaller; var reset; var biggerTitle; var smallerTitle; var resetTitle; Obj...
JavaScript
/** * @package Hathor * @copyright Copyright (C) 2005 - 2009 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * Functions */ /** * Set focus to username on the login screen */ function setFocus() { if (document.id("login-page"))...
JavaScript
/** * @package Joomla.Administrator * @subpackage templates.bluestork * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ var Joomla = Joomla || {}; /** * Joomla Menu javascript behavior */ Joomla.M...
JavaScript
/** * jQuery.Rule - Css Rules manipulation, the jQuery way. * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * Dual licensed under MIT and GPL. * Date: 02/27/2008 * Compatible with jQuery 1.2.x, tested on FF 2, Opera 9, Safari 3, and IE 6, on Windows. * * @...
JavaScript
/* jQuery TextAreaResizer plugin Created on 17th January 2008 by Ryan O'Dell Version 1.0.4 Converted from Drupal -> textarea.js Found source: http://plugins.jquery.com/misc/textarea.js $Id: textarea.js,v 1.11.2.1 2007/04/18 02:41:19 drumm Exp $ 1.0.1 Updates to missing global 'var', added extra glo...
JavaScript
// TODO: Proper use of namespaces if (typeof (QP) == "undefined" || !QP) { var QP = {} }; (function() { /* Draws the lines linking nodes in query plan diagram. root - The document element in which the diagram is contained. */ QP.drawLines = function(root) { if (root === null || root...
JavaScript
/* Simple OpenID Plugin http://code.google.com/p/openid-selector/ This code is licenced under the New BSD License. */ var providers_large = { google: { name: 'Google', url: 'https://www.google.com/accounts/o8/id', x: -1, y: -1 }, yahoo: { name: 'Yahoo...
JavaScript
/* Demonstration of embedding CodeMirror in a bigger application. The * interface defined here is a mess of prompts and confirms, and * should probably not be used in a real project. */ function MirrorFrame(place, options) { this.home = document.createElement("DIV"); if (place.appendChild) place.appendChild...
JavaScript
var HTMLMixedParser = Editor.Parser = (function() { if (!(CSSParser && JSParser && XMLParser)) throw new Error("CSS, JS, and XML parsers must be loaded for HTML mixed mode to work."); XMLParser.configure({useHTMLKludges: true}); function parseMixed(stream) { var htmlParser = XMLParser.make(stream), local...
JavaScript
/* Simple parser for CSS */ var CSSParser = Editor.Parser = (function() { var tokenizeCSS = (function() { function normal(source, setState) { var ch = source.next(); if (ch == "@") { source.nextWhileMatches(/\w/); return "css-at"; } else if (ch == "/" && source.equals("*")...
JavaScript
/* Functionality for finding, storing, and restoring selections * * This does not provide a generic API, just the minimal functionality * required by the CodeMirror system. */ // Namespace object. var select = {}; (function() { select.ie_selection = document.selection && document.selection.createRangeCollection...
JavaScript
/* A few useful utility functions. */ // Capture a method on an object. function method(obj, name) { return function() {obj[name].apply(obj, arguments);}; } // The value used to signal the end of a sequence in iterators. var StopIteration = {toString: function() {return "StopIteration"}}; // Apply a function to ea...
JavaScript
var SparqlParser = Editor.Parser = (function() { function wordRegexp(words) { return new RegExp("^(?:" + words.join("|") + ")$", "i"); } var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", "isblank", "isliteral", "union", "a"]); var ...
JavaScript
var SqlParser = Editor.Parser = (function() { function wordRegexp(words) { return new RegExp("^(?:" + words.join("|") + ")$", "i"); } var functions = wordRegexp([ "abs", "acos", "adddate", "aes_encrypt", "aes_decrypt", "ascii", "asin", "atan", "atan2", "avg", "benchmark", "bin", "bit_and", "bit_...
JavaScript
/* This file defines an XML parser, with a few kludges to make it * useable for HTML. autoSelfClosers defines a set of tag names that * are expected to not have a closing tag, and doNotIndent specifies * the tags inside of which no indentation should happen (see Config * object). These can be disabled by passing th...
JavaScript
/* Tokenizer for JavaScript code */ var tokenizeJavaScript = (function() { // Advance the stream until the given character (not preceded by a // backslash) is encountered, or the end of the line is reached. function nextUntilUnescaped(source, end) { var escaped = false; while (!source.endOfLine()) { ...
JavaScript
// A framework for simple tokenizers. Takes care of newlines and // white-space, and of getting the text from the source stream into // the token object. A state is a function of two arguments -- a // string stream and a setState function. The second can be used to // change the tokenizer's state, and can be ignored fo...
JavaScript
/* CodeMirror main module * * Implements the CodeMirror constructor and prototype, which take care * of initializing the editor frame, and providing the outside interface. */ // The CodeMirrorConfig object is used to specify a default // configuration. If you specify such an object before loading this // file, the...
JavaScript
// Minimal framing needed to use CodeMirror-style parsers to highlight // code. Load this along with tokenize.js, stringstream.js, and your // parser. Then call highlightText, passing a string as the first // argument, and as the second argument either a callback function // that will be called with an array of SPAN no...
JavaScript
/* The Editor object manages the content of the editable frame. It * catches events, colours nodes, and indents lines. This file also * holds some functions for transforming arbitrary DOM structures into * plain sequences of <span> and <br> elements */ var internetExplorer = document.selection && window.ActiveXObj...
JavaScript
/* String streams are the things fed to parsers (which can feed them * to a tokenizer if they want). They provide peek and next methods * for looking at the current character (next 'consumes' this * character, peek does not), and a get method for retrieving all the * text that was consumed since the last time get w...
JavaScript
/** * Storage and control for undo information within a CodeMirror * editor. 'Why on earth is such a complicated mess required for * that?', I hear you ask. The goal, in implementing this, was to make * the complexity of storing and reverting undo information depend * only on the size of the edited or restored con...
JavaScript
/* Parse function for JavaScript. Makes use of the tokenizer from * tokenizejavascript.js. Note that your parsers do not have to be * this complicated -- if you don't want to recognize local variables, * in many languages it is enough to just look for braces, semicolons, * parentheses, etc, and know when you are in...
JavaScript
var DummyParser = Editor.Parser = (function() { function tokenizeDummy(source) { while (!source.endOfLine()) source.next(); return "text"; } function parseDummy(source) { function indentTo(n) {return function() {return n;}} source = tokenizer(source, tokenizeDummy); var space = 0; var ite...
JavaScript
$.fn.tabs = function () { $(this).delegate("a:not(.youarehere)", "click", function () { $(this.hash).show(); $(this).addClass("youarehere") .siblings(".youarehere") .removeClass("youarehere").each(function () { $(this.hash).hide(); }); }).delegate("a", ...
JavaScript
/// <reference path="third-party/jquery-1.3.2-vsdoc2.js"/> $(function() { var loader = '<img class="ajax-loader" src="http://sstatic.net/img/progress-dots.gif" title="loading..." alt="loading..." width="11" height="11" />'; var removeLoader = function() { $('.ajax-loader').fadeOut('fast'); }; ...
JavaScript
function save() { $.ajax({ url: './ajax/get_json.php', type: 'GET', data: {controller: 'MapController', method: 'saveMapToFile', fileName: 'map.txt'}, dataType: 'json', success: function(data){ console.log(data); } }); }
JavaScript
/** Socket.IO - Built with build.bat */ /** * Socket.IO client * * @author Guillermo Rauch <guillermo@learnboost.com> * @license The MIT license. * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com> */ this.io = { version: '0.6', setPath: function(path){ if (window.console && cons...
JavaScript
if(!this.JSON){JSON=function(){function f(n){return n<10?'0'+n:n;} Date.prototype.toJSON=function(){return this.getUTCFullYear()+'-'+ f(this.getUTCMonth()+1)+'-'+ f(this.getUTCDate())+'T'+ f(this.getUTCHours())+':'+ f(this.getUTCMinutes())+':'+ f(this.getUTCSeconds())+'Z';};var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':...
JavaScript
(function() { var Textbox = function(label, color, fontsize, bgsource) { this.initialize(label, color, fontsize, bgsource); }; var p = Textbox.prototype = new createjs.Container(); // inherit from Container this.text; p.label; this.bg_succ; this.bg; this.dragger; this.width; this.height; p.Container_initialize =...
JavaScript
(function() { var Button = function(label, color) { this.initialize(label, color); } var p = Button.prototype = new createjs.Container(); // inherit from Container p.label; p.background; p.count = 0; p.Container_initialize = p.initialize; p.initialize = function(label, color) { this.Container_initialize(); thi...
JavaScript
(function() { var Laptop = function(label, color) { this.initialize(label, color); }; var p = Laptop.prototype = new createjs.Container(); // inherit from Container this.bmp; p.background; p.hitScale = 0.1; p.Container_initialize = p.initialize; p.initialize = function(image...
JavaScript
(function() { var Part = function(source) { this.initialize(source); }; var p = Part.prototype = new createjs.Container(); // inherit from Container this.dragger; p.bmp; p.background; p.hitScalePixel = 100; //px this.source; this.previousX; this.previousY; ...
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 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