code
stringlengths
1
2.08M
language
stringclasses
1 value
/*! * Thumbnail helper for fancyBox * version: 1.0.6 * @requires fancyBox v2.0 or later * * Usage: * $(".fancybox").fancybox({ * helpers : { * thumbs: { * width : 50, * height : 50 * } * } * }); * * Options: * width - ...
JavaScript
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) * Licensed under the MIT License (LICENSE.txt). * * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. * Thanks to: Seamus Leahy for adding deltaX and delta...
JavaScript
/* * jQuery UI Sortable * * Copyright (c) 2008 Paul Bakaus * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://docs.jquery.com/UI/Sortables * * Depends: * ui.base.js * * Revision: $Id: ui.sortable.js 5262 2008-04-17 13:13:51Z paul.bakaus $ */ ;(...
JavaScript
/* * Treeview 1.5pre - jQuery plugin to hide and show branches of a tree * * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ * http://docs.jquery.com/Plugins/Treeview * * Copyright (c) 2007 Jörn Zaefferer * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit...
JavaScript
(function($) { var CLASSES = $.treeview.classes; var proxied = $.fn.treeview; $.fn.treeview = function(settings) { settings = $.extend({}, settings); if (settings.add) { return this.trigger("add", [settings.add]); } if (settings.remove) { return this.trigger("remove", [settings.remove]); } return p...
JavaScript
/* * Async Treeview 0.1 - Lazy-loading extension for Treeview * * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ * * Copyright (c) 2007 Jörn Zaefferer * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses...
JavaScript
/** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. * * @examp...
JavaScript
/* * Easy Slider 1.7 - jQuery plugin * written by Alen Grakalic * http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding * * Copyright (c) 2009 Alen Grakalic (http://cssglobe.com) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * Built for j...
JavaScript
/* * jQuery Messi Plugin 1.2 * https://github.com/marcosesperon/jquery-messi * * Copyright 2012, Marcos Esperón * http://marcosesperon.es * * Licensed under the MIT license: * http://www.opensource.org/licenses/MIT */ // Clase principal function Messi(data, options) { var _this = this; _this.options = ...
JavaScript

JavaScript
/** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. * * @examp...
JavaScript
/* * Copyright 2011 Roman Nurik * * 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...
JavaScript
/* * Copyright 2012 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...
JavaScript
/* * Copyright 2012 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...
JavaScript
/* * Copyright 2012 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...
JavaScript
// unless otherwise stated (above a function definition) // these functions were written by myself, Greg Little, // and I release them into the public domain. function pairs(a) { var b = [] foreach(a, function (v, k) { b.push([k, v]) }) return b } function sortedPairs(a, func) { ...
JavaScript
// jQuery Context Menu Plugin // // Version 1.01 // // Cory S.N. LaViska // A Beautiful Site (http://abeautifulsite.net/) // // More info: http://abeautifulsite.net/2008/09/jquery-context-menu-plugin/ // // Terms of Use // // This plugin is dual-licensed under the GNU General Public License // and the MIT...
JavaScript
// from: http://snippets.dzone.com/posts/show/4349 function getXPath(node, path) { path = path || []; if(node.parentNode) { path = getXPath(node.parentNode, path); } if(node.previousSibling) { var count = 1; var sibling = node.previousSibling ...
JavaScript
// unless otherwise stated (above a function definition) // these functions were written by myself, Greg Little, // and I release them into the public domain. function pairs(a) { var b = [] foreach(a, function (v, k) { b.push([k, v]) }) return b } function sortedPairs(a, func) { ...
JavaScript
// the original file comes from http://ejohn.org/files/jsdiff.js, // but I have modified it /* * Javascript Diff Algorithm * By John Resig (http://ejohn.org/) * Modified by Chu Alan "sprite" * * More Info: * http://ejohn.org/projects/javascript-diff-algorithm/ */ (function () { function escape(s)...
JavaScript
// ========================================================================= // // xmlsax.js - an XML SAX parser in JavaScript. // // version 3.1 // // ========================================================================= // // Copyright (C) 2001 - 2002 David Joham (djoham@yahoo.com) and Scott Severtson // // This ...
JavaScript
// this file has been modified by Greg Little // documentation: http://xmljs.sourceforge.net/website/documentation-classicdom.html // ========================================================================= // // xmldom.js - an XML DOM parser in JavaScript. // // This is the classic DOM that has shipped with XML...
JavaScript
/* http://www.JSON.org/json2.js 2008-03-24 Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. See http://www.JSON.org/js.html This file creates a global JSON object containing three methods: stringify, parse, and quote. JSON.stringify(value, re...
JavaScript
// from: http://ajaxian.com/archives/handling-tabs-in-textareas // // use: <textarea onkeypress="checkTab(event)">hello world</textarea> // Set desired tab- defaults to four space softtab var tab = " "; function checkTab(evt) { var t = evt.target; var ss = t.selectionStart; var se = t.sel...
JavaScript
// adapted: http://snippets.dzone.com/posts/show/4349 function getXPath(node) { return "/" + getXPathHelper(node, []).join("/") } function getXPathHelper(node, path) { path = path || []; if(node.parentNode) { path = getXPathHelper(node.parentNode, path); } if(n...
JavaScript
// =================================================================== // Author: Matt Kruse <matt@mattkruse.com> // WWW: http://www.mattkruse.com/ // // NOTICE: You may use this code for any purpose, commercial or // private, without any further permission from the author. You may // remove this notice from your...
JavaScript
/* * Treeview 1.4 - jQuery plugin to hide and show branches of a tree * * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ * http://docs.jquery.com/Plugins/Treeview * * Copyright (c) 2007 Jörn Zaefferer * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-li...
JavaScript
// // Version File name Description // ------- --------- ----------- // 2004-12-03 hr$mersennetwister.js original version will stay available, // but is no longer maintained by Henk Reints // // 2005-11-02 hr$mersennetwister2.js o renamed constructor from "MersenneTwister" // to "Mersenne...
JavaScript
// from: http://ajaxian.com/archives/handling-tabs-in-textareas // // use: <textarea onkeypress="checkTab(event)">hello world</textarea> // Set desired tab- defaults to four space softtab var tab = " "; function checkTab(evt) { var t = evt.target; var ss = t.selectionStart; var se = t.sel...
JavaScript
/** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. * * @examp...
JavaScript
print("Hello World") print("Your balance is: " + mturkBase.getAccountBalance()) print("MTurk says:") print(mturk.prompt("enter a short greeting message"))
JavaScript
ensure(null, 'hits', {}) foreach(mturkBase.getReviewableHITs(), function (hit) { hits[hit] = true })
JavaScript
/** * This module contains wrappers around mturkBase functions using once. * You probably want this, so that your HITs are only created once, * even though your script will probably crash and rerun many times. * */ mturk = {} /** * Calls {@link mturkBase.createHIT} inside of {@link once}. */ mturk...
JavaScript
/** * Resets the database. */ function resetDatabase(){ print("deleting HITs created in this TurKit script...") foreach(ensure(__db, ["hits"]), function(hitRecord, hitId){ props.mode = hitRecord.mode mturkBase.deleteHIT(hitId) }) print("clearing db...") db = {} ...
JavaScript
/** * This module contains functions for creating and communicating with webpages * that will be servered from the TurKit server. */ webpageBase = {} /** Creates a publicly accessible webpage with the given contents. Returns the URL to the webpage. You can block one or more turkers from doing this ...
JavaScript
/** * This module contains wrappers around webpageBase functions using once. * You probably want this, so that your webpages are only created once, * even though your script will probably crash and rerun many times. */ webpage = {} /** Wraps {@link webpageBase.create} in a call to {@link once}. You...
JavaScript
/** * Prints s to the output buffer. */ function print(s) { __java.print(s) } /** * Prints s if props.verbose is true. */ function verbosePrint(s) { if (props.verbose) { print(s) } } /** * Makes a REST request to MTurk, and returns the result as an XML object. */ function mTurkRestRequ...
JavaScript
(function () { /** * This module contains helper functions for making REST requests to Mechanical Turk. * * Note that it uses the AWS access keys supplied in props, * as well as the mode (either "real" or "sandbox"). */ mturkBase = {} mturkBase.assertWeCanSpend = function(money, hits, callbac...
JavaScript
(function () { function initFrame(frame) { if (frame.nextFrame) frame.nextFrame = 0 if (frame.forks) frame.forks = 0 return frame } var frameStack = [] frameStack.push(initFrame(ensure(__db, ["crashAndRerun"]))) getCrashAndRerunFrame = function () { return last(frameStack) } functio...
JavaScript
var imageUrl = "/public-domain-images/trees.png" var numIterations = 3 var iterationReward = 0.02 var minVotes = 2 var text = "" var blockWorkers = new Set() for (var i = 0; i < numIterations; i++) { // improve text var newText = improveText(imageUrl, text, iterationReward, blockWorkers ) pri...
JavaScript
print("Hello World") print("Your balance is: " + mturkBase.getAccountBalance()) print("MTurk says:") print(mturk.prompt("enter a short greeting message"))
JavaScript
//<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> //<script type="text/javascript" src="JQuery/JQ.js"></script> $(document).ready(function(){ //onload $("div").click(function(){ //onclick $(this).hide().show(1000); }) }) $(document).ready(function(){ $("p").cli...
JavaScript
//<script type="text/javascript" src="AJax/AJax.js"></script> function randNumber() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } x...
JavaScript
function move(e) { setTimeout(function () {doMove(e)},2000); // calls doMove() 2000 miliseconds from now // delay(500); // pause execution for 500 msec } // var play = setTimeout(function () {doMove(e)},2000); // calls doMove() 2000 miliseconds from now // clearTimeout(play); // var refreshIntervalId = se...
JavaScript
/*! Slimbox v1.7 - The ultimate lightweight Lightbox clone (c) 2007-2009 Christophe Beyls <http://www.digitalia.be> MIT-style license. */ var Slimbox = (function() { // Global variables, accessible to Slimbox only var win = window, ie6 = Browser.Engine.trident4, options, images, activeImage = -1, activeURL, prev...
JavaScript
/** * Advance Search Box For Blogger With JSON * URL: http://www.softglad.com/2013/08/json-search-box-for-blogger.html */ // Just a shortcut for document.getElementById(); function getId(id) { return document.getElementById(id); } var config = searchFormConfig, input = getId('feed-q-input'), resultC...
JavaScript
// // JSDB // writeFile = function(filename, text) { var file; writeCounter++; try { file = new Stream(filename, 'tw+'); file.write(text); file.flush(); } catch(e) { echo('Unable to write to ' + filename + '.'); writeCounter--; } file = null; } readBinFile = function(filename) { ...
JavaScript
var Alkaline = readFile('Alkaline.g'); var mode = args[0]; function enableLang(code, lang) { return code.replace(new RegExp('\\/\\*' + lang + '\\* \\/', 'g'), '/*' + lang + '*/'); } function disableLang(code, lang) { return code.replace(new RegExp('\\/\\*' + lang + '\\*\\/', 'g'), '/*' + lang + '* /'); ...
JavaScript
// // Windows Scripting Host // writeFile = function(filename, text) { var file; writeCounter++; try { file = fso.CreateTextFile(filename, overwriteIfExist, openAsASCII); file.WriteLine(text); } catch(e) { try { if (file && typeof file.Close != 'undefined') file.Close(); file = null...
JavaScript
// load Alkaline if (args[0] == "release") eval(readFile('Alkaline.js')); else { eval(readFile('Alkaline.bootstrap.js')); var require = function(filename) { require.files.push(filename); } require.files = []; Alkaline.bootstrap(this); for (var i = 0; i < require.files.length; i++) eval(readFile(...
JavaScript
var File1 = typeof File !== 'undefined' ? File : require('fs').File; var Directory1 = typeof Directory !== 'undefined' ? Directory : require('fs').Directory; var echo = function(msg) { system.stdout(msg + '\n'); } var readFile = function(filename, silentFail) { var str = '', opened = false, f; try { ...
JavaScript
var prettyPrint = false, minify = true, optimize = true; for (var i = 0; i < args.length; i++) switch (args[i]) { case 'pp': prettyPrint = true; break; case 'nominify': minify = false; break; case 'nooptimize': optimize = false; break; } var list = []; // the input files wil...
JavaScript
var UTF8Magic = String.fromCharCode(239, 187, 191); var writeCounter = 0; var root = ''; var scriptSrc = root; var envScriptSrc = root + 'etc/'; var echo, readFile, args; if (typeof WScript != 'undefined') { // // Windows Scripting Host // var forReading = 1, forWriting = 2, forAppending = 8, ...
JavaScript
// This file will include all the files required. // Always place this file last. // If inside web page, loads files by adding a <script> to <head> for each file. // Otherwise, loads files by calling require(filename); you need to provide this function yourself. if (typeof Alkaline == 'undefined') var Alkalin...
JavaScript
Alkaline.InputSource = function(stdOut, stdErr, stdWarn) { this.stdOut = stdOut; this.stdErr = stdErr; this.stdWarn = stdWarn; this.files = []; this.input = ''; this.sourceNameHash = {}; } Alkaline.InputSource.RX = { dir: /^((?:.+\/)[^\/\.]+)(?:$|\?.*)/, html: /^(.+\.html)(?:$|\?.*)/, js: /^(....
JavaScript
Alkaline.TreeBuilder = function(compileResult, TOKEN) { this.compileResult = compileResult; this.treeAdaptor = this.compileResult.treeAdaptor; this.TOKEN = TOKEN; this._makeLists(); } Alkaline.TreeBuilder.init = function() { var proto = Alkaline.TreeBuilder.prototype; var names = Alkaline.JSInfo.token...
JavaScript
Alkaline.Module = function() { this.supportedArguments = {}; this.argumentDefaults = {}; } Alkaline.Module.prototype.initModule = function(compileResult) { this.compileResult = compileResult; var fn = function() {}; fn.prototype = this.argumentDefaults; this.arguments = new fn(); // inherit the defaul...
JavaScript
var XML, XMLList; if (!XML) { XML = function(xmlString) { if (!(this instanceof XML)) return new XML(xmlString); this.asXMLString = xmlString; } XML.settings = function() { return { ignoreComments: XML.ignoreComments, ignoreProcessingInstructions: XML.ignoreProcessingInstructions, ...
JavaScript
Alkaline.Runtime.Generator = function(){}; Alkaline.Runtime.Generator.prototype._init = function() { this._continuation = 0; this._yield_value = this.thisPropertyDoesNotExist; this._yield_exception = null; this._closing = false; } Alkaline.Runtime.Generator.prototype.next = function() { var nextValue...
JavaScript
Alkaline.Processing.ProcessingState = function(builder, tree) { this.builder = builder; var up = tree; while (up && !up.savedState) up = up.parent; if (up) { this.load(up); return; } this.globalContext = tree.globalContext = new Alkaline.Processing.LexicalContext(null, tree, this.builder); this...
JavaScript
Alkaline.Processing.ReferencedValue = function(valueType, value) { if (typeof valueType !== 'number') throw new Error('ReferencedValue: bad valueType: ' + valueType); this.valueType = valueType; this.value = value; // a new object this.inheritedPrototype = null; this.propertyDescriptors = []; } Alkal...
JavaScript
Alkaline.Processing.VariableDefinition = function(name, sourceType, declarationToken, startVal) { this.name = name; this.sourceType = sourceType; if (!startVal) if (sourceType === Alkaline.Processing.VariableDefinition.SOURCE_TYPE.DETECTED) startVal = new Alkaline.Processing.ReferencedValue(Alkaline.Proc...
JavaScript
Alkaline.Processing.ValueUndefined = function() { return Alkaline.Processing.ValueUndefined.instance; }; Alkaline.Processing.ValueUndefined.prototype = new Alkaline.Processing.ReferencedValue( Alkaline.Processing.ReferencedValue.VALUE_TYPE.UNDEFINED, null ); Alkaline.Processing.ValueUndefined.instance =...
JavaScript
Alkaline.Processing.ValueDistribution = function(initList) { this.propertyDescriptors = []; if (!initList) { this.conditions = []; this.values = []; } else if (initList instanceof Alkaline.Processing.ValueDistribution) { this.conditions = [].concat(initList.conditions); this.values = [].concat(initL...
JavaScript
Alkaline.Processing.Condition = function(inheritedCondition) { // ... not sure how to do this yet } Alkaline.Processing.Condition.prototype.and = function(condition2) { if (this === Alkaline.Processing.Condition.ALWAYS) return condition2; if (this === Alkaline.Processing.Condition.NEVER) return this; ...
JavaScript
Alkaline.Processing.FunctionInstance = function(ast, parentContext) { this.value = ast; this.argumentsTree = ast.children[ast.children.length-2]; this.bodyTree = ast.children[ast.children.length-1]; this.innerLexicalContext = new Alkaline.Processing.LexicalContext(parentContext, this.bodyTree); this.innerLe...
JavaScript
Alkaline.Processing.ValueNull = function() { return Alkaline.Processing.ValueNull.instance; }; Alkaline.Processing.ValueNull.prototype = new Alkaline.Processing.ReferencedValue( Alkaline.Processing.ReferencedValue.VALUE_TYPE.NULL, null ); Alkaline.Processing.ValueNull.instance = (function(){ // basica...
JavaScript
Alkaline.Processing.LexicalContext = function(inheritedContext, BLOCK, builder) { var constructor; if (inheritedContext) { constructor = function() {}; constructor.prototype = inheritedContext.context; this.context = new constructor(); this.context.length = 0; } else this.context = { length: 0 };...
JavaScript
Alkaline.Processing.Operation = function(operation, condition) { this.operation = operation; this.arity = arguments.length-2; this.condition = condition; this.operands = []; for (var i = 2; i < arguments.length; i++) this.operands.push(arguments[i].getValue(condition)); this.result = Alkaline.Processin...
JavaScript
Alkaline.Processing.ValueRegExp = function(text, flags) { this.text = text; this.flags = flags; } Alkaline.Processing.ValueRegExp.prototype = new Alkaline.Processing.ReferencedValue( Alkaline.Processing.ReferencedValue.VALUE_TYPE.REGEXP, null );
JavaScript
Alkaline.Processing.PropertyDescriptor = function(thisObj, propertyName, condition, startVal) { this.thisObj = thisObj; this.condition = condition; this.valueDistribution = this.startVal = startVal; this.docComment = null; this.name = propertyName; this.access = null; // private, protected, public if (t...
JavaScript
Alkaline.Runtime = {}; /** * StopIteration */ if (typeof StopIteration == 'undefined') { var StopIteration = new Error(); StopIteration.toString = function() { return '[object StopIteration]'; } }
JavaScript
Alkaline.JSInfo = { associativeOperators: ['*', '<<', '>>', '>>>', '&', '^', '|', '||', '&&'], // these can be collapsed with an assignment; e.g. a += 2 collapsibleOperators: ['+', '-', '*', '/', '%', '<<', '>>', '>>>', '&', '|', '^'], collapsibleOperatorsHash: null, // populated on init // these op...
JavaScript
Alkaline.CompileResult = function(stdOut, stdErr, stdWarn) { if (Alkaline.init) Alkaline.init(); if (Alkaline.CompileResult.prototype._setupClass) Alkaline.CompileResult.prototype._setupClass(); this.stdOut = stdOut; this.stdErr = stdErr; this.stdWarn = stdWarn; this.inputSource = new Alkaline....
JavaScript
/*@cc_on // check a basic part of the ANTLR JS runtime if (!org.antlr.env.ua.ie) throw new Error('ANTLR JS target failed to detect JScript!'); @*/ String.prototype.equals = function(otherString) { return this.valueOf() === otherString; } String.prototype.startsWith = function(otherString) { return ...
JavaScript
if (typeof Alkaline == 'undefined') var Alkaline = { Modules: {}, Processing: {} }; Alkaline.MODULE_TYPES = { OUTPUT: {} }; Alkaline.init = function() { Alkaline.JSInfo.init(); Alkaline.TreeBuilder.init(); Alkaline.Processing.PropertyDescriptor.init(); Alkaline.init = null; } Alkaline.run = fun...
JavaScript
/* Copyright (c) 2003-2008 Terence Parr. All rights reserved. Code licensed under the BSD License: http://www.antlr.org/license.html Some parts of the ANTLR class: Copyright (c) 2008, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt */ /* Some portions: C...
JavaScript
Alkaline.Modules.newModule('Analyzer', function() { var TOKEN = Alkaline.JSInfo.TOKEN; var tokenNames = Alkaline.JSInfo.tokenNames; var exampleParser = new AlkalineParser(); this.opIsAssignment = exampleParser.opIsAssignment; var precedence = exampleParser.precedence; exampleParser = null; // free the memory ...
JavaScript
Alkaline.Modules.newModule('Printer', function(){ this.moduleType = Alkaline.MODULE_TYPES.OUTPUT; this.registerSupportedArgument('output', 'o', 1, null); this.registerSupportedArgument('prettyPrint', 'pp', 0, false); var TOKEN = Alkaline.JSInfo.TOKEN; var tokenNames = Alkaline.JSInfo.tokenNames; var examp...
JavaScript
Alkaline.Modules.newModule('5to3', function() { this.requiredModules = [{ name: 'Analyzer' }]; this.registerSupportedArgument('translateArrayComprehension', 'tA', 0, true); this.registerSupportedArgument('translateConditionalCatch', 'tC', 0, true); this.registerSupportedArgument('translateForEach', 'tE', 0...
JavaScript
Alkaline.Modules.newModule('Optimize', function() { this.requiredModules = [{ name: 'Analyzer' }]; var DEF_O = 1, MAX_O = 2; this.registerSupportedArgument('O', 'O', 1, DEF_O); for (var i = 0; i < MAX_O; i++) this.registerSupportedArgument('O' + i, 'O' + i, 0, false); var TOKEN = Alkaline.JSInfo.TOKEN; ...
JavaScript
Alkaline.Modules.newModule('Minify', function() { this.requiredModules = [{ name: 'Analyzer' }]; var TOKEN = Alkaline.JSInfo.TOKEN; var tokenNames = Alkaline.JSInfo.tokenNames; /** * import classes from Analyzer module */ var LexicalContext = Alkaline.Processing.LexicalContext; var VariableDefinition ...
JavaScript
Alkaline.Modules.newModule('Documentation', function() { //this.moduleType = Alkaline.MODULE_TYPES.OUTPUT; this.requiredModules = [{ name: 'Analyzer' }]; this.registerSupportedArgument('classesMaySkipPrototype', 'cmsp', 1, false); var TOKEN = Alkaline.JSInfo.TOKEN; this.run = function(ast) { this.setup...
JavaScript
Alkaline.Modules.newModule('JSDoc', function() { this.moduleType = Alkaline.MODULE_TYPES.OUTPUT; this.requiredModules = [{ name: 'Documentation' }]; this.registerSupportedArgument('output', 'o', 1, null); var TOKEN = Alkaline.JSInfo.TOKEN; this.run = function(ast) { var DocModule = this.compileResult.m...
JavaScript
testMinify( 'function a(var1, var2) {\n\ var var3, var4;\n\ for (var3 = var1; var3 < 10; var3++);\n\ }', 'function a(c) {\n\ for (var b = c; b < 10; b++) {}\n\ }' ); testMinify( 'function a(var1, var2) {\n\ var var3, var4;\n\ for (var3 in var1);\n\ }', 'function a(b) {\n\ for (var c in b) {...
JavaScript
testMinify( '/* getter */ a = function getX() {};', 'a = function b() {};' ); testMinify( '// getter\n\ a = function getX() {};', 'a = function b() {};' ); testMinify( '/*! (c) 2010 Acme, Inc. */ a = function getX() {};', '/*! (c) 2010 Acme, Inc. */\n\ a = function b() {};' );
JavaScript
testOptions(['jsdoc'], [ [ 'Test.Button = function() {\n\ this.click = this.methods.click;\n\ }\n\ \n\ Test.Button.prototype.methods.click = function() {\n\ this.clicked = true;\n\ }', '/* begin documentation */\n\ \n\ /**\n\ * @namespace Test\n\ * @class Button\n\ * @constructor\n\ * @publ...
JavaScript
testOptions(['jsdoc'], [ [ '/**\n\ * bla bla\n\ * @module Button\n\ */\n\ /** Common Button */\n\ Test.Button = x;\n\ /**\n\ * asdf\n\ * @module Label\n\ */\n\ /** Common Label */\n\ Test.Label = x;', '/* begin documentation */\n\ \n\ /**\n\ * bla bla\n\ * @module Button\n\ */\n\ \n...
JavaScript
testOptions(['jsdoc'], [ [ '/** @module Button */\n\ /** Common Button */\n\ Test.Button = x;\n\ /** @module Label */\n\ /**\n\ * Common Label\n\ * second line\n\ */\n\ Test.Label = x;\n\ /** @module Button */\n\ Test.OtherButton = x;', '/* begin documentation */\n\ \n\ /**\n\ * Button modul...
JavaScript
testOptions(['jsdoc'], [ [ 'Test.Button = function(name) {\n\ this.myName = name;\n\ this._name = name;\n\ }\n\ Test.Button.prototype.getName = function() { this.accessed = true; return this._name; }', '/* begin documentation */\n\ \n\ /**\n\ * @namespace Test\n\ * @class Button\n\ * @construct...
JavaScript
testOptions(['jsdoc'], [ [ '/** Test object */\n\ Test = {\n\ /** A Button*/\n\ Button: {},\n\ /** A Label*/\n\ Label: {}\n\ }', '/* begin documentation */\n\ \n\ /**\n\ * Test object\n\ * @static\n\ * @public\n\ */\n\ Test = something;\n\ \n\ /**\n\ * A Button\n\ * @static\n\ * ...
JavaScript
testOptions(['jsdoc'], [ [ 'Test.PanicButton = {}\n\ \n\ Test.PanicButton.click = function() {\n\ /** bla-bla */\n\ this.clicked = true;\n\ }', '/* begin documentation */\n\ \n\ /**\n\ * @static\n\ * @namespace Test\n\ * @public\n\ */\n\ Test.PanicButton = something;\n\ \n\ /**\n\ * @st...
JavaScript
// // This file tests handling one or more sources and reporting the correct position for errors/warnings // files = { 'a.js': 'a = b', 'b.js': 'b = c', 'index.html': '<script src="a.js"></script>\n' + '<body onload="ha = null">\n' + '<script src="test/b.js"></script>\n' + '<script>a = 0</scr...
JavaScript
// // This file tests reporting of E200X errors and W200X warnings // // // E2001, W2001: Assignment to undefined variable // doTest([ 'a = 1;' ], [ [2001, 1, 1, 0] ]); doTest([ 'print(1 + (a = 1));' // inside expression ], [ [2001, 1, 12, 0] ]); doTest([ 'var a = 1;' ], []); doTes...
JavaScript
// line 6 of this test triggers semicolon insertion; this fucks up "$tree.text" syntax in ANTLR grammar. test that variable declarations are detected propertly doTest([ '({\n\ replace: function() {\n\ var programName, first, last, text;\n\ if (arguments.length===3) {\n\ programNa...
JavaScript
// // This file tests reporting of E100X errors // // // E1001: "this" is a keyword and cannot be assigned // doTest([ 'this = 3;' ], [ [1001, 1, 1, 0] ]); doTest([ 'this_ = 3;' ], [ [2001, 1, 1, 0] // this_ is undefined ]); // // E1002: Invalid destructuring to array // doTest([ 'var...
JavaScript
testOptions(['optimize', 'minify'], [ ['function a() { var c = 1, i, b; for (i = 0; i < c; ) b(); }', 'function a() { for (var c = 1, i = 0, b; i < c; b()) {} }'] ]);
JavaScript
// // This file tests reporting of W300X errors // // // W3001: Missing semicolon // doTest([ '1\n' + '2' ], [ [3001, 1, 1, 0], [3001, 2, 1, 0] ]); doTest([ '1;\n' + '2' ], [ [3001, 2, 1, 0] ]); doTest([ 'do{}while(0)1;' ], [ [3001, 1, 13, 0] ]); doTest([ '"37" - 7 // retu...
JavaScript
test5to3( 'var letters = ["a", "b"];\n\ for each (var i in letters)\n\ print(i);', 'var letters, i, a;\n\ letters = [ "a", "b" ];\n\ for (a in letters) {\n\ i = letters[a];\n\ print(i);\n\ }' ); test5to3( 'for each (var i in {}) e()', 'var i, a, b;\n\ for (a in b = {}) {\n\ i = b[a];\n\ e()...
JavaScript
test5to3( 'var numbers, list = [i for (i in numbers)];', 'var numbers, list;\n\ list = function(a) {\n\ var i;\n\ for (i in numbers)\n\ a.push(i);\n\ return a;\n\ }([ ]);' ); test5to3( 'var numbers, doubled = [i * 2 for each (i in numbers)];', 'var numbers, doubled;\n\ doubled = function(a) ...
JavaScript