code
stringlengths
1
2.08M
language
stringclasses
1 value
CodeMirror.defineMode('smalltalk', function(config, modeConfig) { var specialChars = /[+\-/\\*~<>=@%|&?!.:;^]/; var keywords = /true|false|nil|self|super|thisContext/; var Context = function(tokenizer, parent) { this.next = tokenizer; this.parent = parent; }; var Token = function(name, context, eos) { thi...
JavaScript
CodeMirror.defineMode("haxe", function(config, parserConfig) { var indentUnit = config.indentUnit; // Tokenizer var keywords = function(){ function kw(type) {return {type: type, style: "keyword"};} var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); var operator = kw("operator"), at...
JavaScript
// CodeMirror version 2.32 // // All functions that need access to the editor's state live inside // the CodeMirror function. Below that, at the bottom of the file, // some utilities are defined. // CodeMirror is the only global var we claim var CodeMirror = (function() { // This is the function that produces an edi...
JavaScript
CodeMirror.runMode = function(string, modespec, callback, options) { var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); var isNode = callback.nodeType == 1; var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; if (isNode) { var node = callback, accum = [], col = 0; callb...
JavaScript
(function(){ function SearchCursor(cm, query, pos, caseFold) { this.atOccurrence = false; this.cm = cm; if (caseFold == null && typeof query == "string") caseFold = false; pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0}; this.pos = {from: pos, to: pos}; // The matches method is filled in based on...
JavaScript
// Define search commands. Depends on dialog.js or another // implementation of the openDialog method. // Replace works a little oddly -- it will do the replace on the next // Ctrl-G (or whatever is bound to findNext) press. You prevent a // replace by making sure the match is no longer selected when hitting // Ctrl-G...
JavaScript
/** * Tag-closer extension for CodeMirror. * * This extension adds a "closeTag" utility function that can be used with key bindings to * insert a matching end tag after the ">" character of a start tag has been typed. It can * also complete "</" if a matching start tag is found. It will correctly ignore si...
JavaScript
// ============== Formatting extensions ============================ // A common storage for all mode-specific formatting features if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {}; // Returns the extension of the editor's current mode CodeMirror.defineExtension("getModeExt", function () { var mname = C...
JavaScript
(function () { function forEach(arr, f) { for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); } function arrayContains(arr, item) { if (!Array.prototype.indexOf) { var i = arr.length; while (i--) { if (arr[i] === item) { return true; } } return false...
JavaScript
// the tagRangeFinder function is // Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org> // released under the MIT license (../../LICENSE) like the rest of CodeMirror CodeMirror.tagRangeFinder = function(cm, line, hideEnd) { var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u0...
JavaScript
(function() { CodeMirror.simpleHint = function(editor, getHints) { // We want a single cursor position. if (editor.somethingSelected()) return; //don't show completion if the token is empty var tempToken = editor.getTokenAt(editor.getCursor()); if(!(/[\S]/gi.test(tempToken.string))) return; v...
JavaScript
(function() { if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; var loading = {}; function splitCallback(cont, n) { var countDown = n; return function() { if (--countDown == 0) cont(); } } function ensureDeps(mode, cont) { var deps = CodeMirror.modes[mode].dependencies; if (!d...
JavaScript
// Utility function that allows modes to be combined. The mode given // as the base argument takes care of most of the normal mode // functionality, but a second (typically simple) mode is used, which // can override the style of text. Both modes get to parse all of the // text, but when both assign a non-null style to...
JavaScript
 (function() { CodeMirror.xmlHints = []; CodeMirror.xmlHint = function(cm, simbol) { if(simbol.length > 0) { var cursor = cm.getCursor(); cm.replaceSelection(simbol); cursor = {line: cursor.line, ch: cursor.ch + 1}; cm.setCursor(cursor); } ...
JavaScript
// Open simple dialogs on top of an editor. Relies on dialog.css. (function() { function dialogDiv(cm, template) { var wrap = cm.getWrapperElement(); var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild); dialog.className = "CodeMirror-dialog"; dialog.innerHTML = '<div>' + te...
JavaScript
(function () { function forEach(arr, f) { for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); } function arrayContains(arr, item) { if (!Array.prototype.indexOf) { var i = arr.length; while (i--) { if (arr[i] === item) { return true; } } return false...
JavaScript
CodeMirror.multiplexingMode = function(outer /*, others */) { // Others should be {open, close, mode [, delimStyle]} objects var others = Array.prototype.slice.call(arguments, 1); var n_others = others.length; function indexOf(string, pattern, from) { if (typeof pattern == "string") return string.indexOf(p...
JavaScript
// Define match-highlighter commands. Depends on searchcursor.js // Use by attaching the following function call to the onCursorActivity event: //myCodeMirror.matchHighlight(minChars); // And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see dem...
JavaScript
// TODO number prefixes (function() { // Really primitive kill-ring implementation. var killRing = []; function addToRing(str) { killRing.push(str); if (killRing.length > 50) killRing.shift(); } function getFromRing() { return killRing[killRing.length - 1] || ""; } function popFromRing() { if (killR...
JavaScript
// Supported keybindings: // // Cursor movement: // h, j, k, l // e, E, w, W, b, B // Ctrl-f, Ctrl-b // Ctrl-n, Ctrl-p // $, ^, 0 // G // ge, gE // gg // f<char>, F<char>, t<char>, T<char> // Ctrl-o, Ctrl-i TODO (FIXME - Ctrl-O wont work in Chrome) // /, ?, n, N TODO (does not work) // #, * TODO // // Entering insert m...
JavaScript
var tests = [], runOnly = null; function Failure(why) {this.message = why;} function test(name, run) {tests.push({name: name, func: run}); return name;} function testCM(name, run, opts) { return test(name, function() { var place = document.getElementById("testground"), cm = CodeMirror(place, opts); try {run...
JavaScript
function forEach(arr, f) { for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); } function addDoc(cm, width, height) { var content = [], line = ""; for (var i = 0; i < width; ++i) line += "x"; for (var i = 0; i < height; ++i) content.push(line); cm.setValue(content.join("\n")); } function byClassName(elt,...
JavaScript
/** * Helper to test CodeMirror highlighting modes. It pretty prints output of the * highlighter and can check against expected styles. * * See test.html in the stex mode for examples. */ ModeTest = {}; ModeTest.modeOptions = {}; ModeTest.modeName = CodeMirror.defaults.mode; /* keep track of results for printSum...
JavaScript
/** * SyntaxHighlighter * http://alexgorbatchev.com/SyntaxHighlighter * * SyntaxHighlighter is donationware. If you are using it, please donate. * http://alexgorbatchev.com/SyntaxHighlighter/donate.html * * @version * 3.0.83 (July 02 2010) * * @copyright * Copyright (C) 2004-2010 Alex Gorbatchev. * * @lic...
JavaScript
var fakeElement = {}; fakeElement.constanants = 'b c d f g k l m n p q r s t v x z'.split(' '); fakeElement.vowels = 'a e i o u y'.split(' '); fakeElement.categories = 'alkali alkaline-earth lanthanoid actinoid transition post-transition'.split(' '); fakeElement.suffices = 'on ium ogen'.split(' '); fakeElement.getRan...
JavaScript
var programs = 'commercial urbanism public-space culture body-culture health education housing hotel media'.split(' '), programsLen = programs.length, statuses = 'idea in-progress under-construction completed'.split(' '), statusesLen = statuses.length; function randInt(num) { return Math.floor( Math.rand...
JavaScript
/** * Isotope v1.5.14 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * * Commercial use requires one-time license fee * http://metafizzy.co/#licenses * * Copyright 2012 David DeSandro / Metafizzy */ /*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, imm...
JavaScript
// ColorBox v1.3.15 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+ // Copyright (c) 2010 Jack Moore - jack@colorpowered.com // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php (function ($, window) { var // ColorBox Default Settings. // See http://col...
JavaScript
/* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright © 2008 George McGinley Smith * All rights reserved. * ...
JavaScript
/*! Copyright (c) 2010 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 deltaY * *...
JavaScript
/* * FancyBox - jQuery Plugin * Simple and fancy lightbox alternative * * Examples and documentation at: http://fancybox.net * * Copyright (c) 2008 - 2010 Janis Skarnelis * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support i...
JavaScript
/** * jquery.scrollFollow.js * Copyright (c) 2008 Net Perspective (http://kitchen.net-perspective.com/) * Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php) * * @author R.A. Ray * * @projectDescription jQuery plugin for allowing an element to animate down as the user scro...
JavaScript
/*! idTabs v3.0 ~ Sean Catchpole - Copyright 2010 MIT/GPL */ ;(function($){ /* Changes for 3.0 - return removed (it was depreciated) - passing arguments changed (id,s,e) - refresh of code speed and accuracy - items now object instead of id's - multiple tabs can now point to same id - removed autoloading jQuery ...
JavaScript
/* * jQuery history plugin * * Copyright (c) 2006 Taku Sano (Mikage Sawatari) * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php * * Modified by Lincoln Cooper to add Safari support and only call the callback once during initialization * for msie when no initial hash suppli...
JavaScript
/** * @author administrator */
JavaScript
function deleteById(url,id){ confirm = confirm('确认要删除该文章吗?'); if(confirm){ $.post(url,{'id':id},function(data){ alert(data); }); } } function deleteMulti(ids){ } function getIds(){ var str = ""; $("input[name='checknew']").each(function(){ if($(this).attr("checked") == true){ ...
JavaScript
function YKG(){} var ykg = new YKG(); /** *静态方法 *@use 静态实例化各个模块 *@example YKG.app('form').alert("KK"); *这样就可以调form模块下的alert()的函数组件 */ YKG.app = function(name){ var model = 'new ykg.' + name +'()'; eval('app ='+model); return app; } //显示/隐藏文本内容 YKG.prototype.showNext = fu...
JavaScript
/** * */ $(function(){ $(".new-item-action").hide().parent().hover(function(){ $(this).find(".new-item-action").fadeIn(); },function(){ $(".new-item-action").fadeOut(); }); });
JavaScript
/*! * artDialog 4.1.7 * Date: 2013-03-03 08:04 * http://code.google.com/p/artdialog/ * (c) 2009-2012 TangBin, http://www.planeArt.cn * * This is licensed under the GNU LGPL, version 2.1 or later. * For details, see: http://creativecommons.org/licenses/LGPL/2.1/ */ ;(function (window, undefined) { /...
JavaScript
/* Syntax highlighting with language autodetection. http://softwaremaniacs.org/soft/highlight/ */ var hljs = new function() { var LANGUAGES = {}; var selected_languages = {}; function escape(value) { return value.replace(/&/gm, '&amp;').replace(/</gm, '&lt;').replace(/>/gm, '&gt;'); }; funct...
JavaScript
/* Language: Javascript */ hljs.LANGUAGES.javascript = { defaultMode: { lexems: [hljs.UNDERSCORE_IDENT_RE], contains: ['string', 'comment', 'number', 'regexp_container', 'function'], keywords: { 'keyword': {'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 'var': 1, 'new': 1, 'function': 1, 'do...
JavaScript
document.title += ' ' + art.dialog.fn.version; // 运行代码 $.fn.runCode = function () { var getText = function(elems) { var ret = "", elem; for ( var i = 0; elems[i]; i++ ) { elem = elems[i]; if ( elem.nodeType === 3 || elem.nodeType === 4 ) { ret += elem.nodeValue; } else if ( elem.nodeType ...
JavaScript
/*! * artDialog 4.1.7 * Date: 2013-03-03 08:04 * http://code.google.com/p/artdialog/ * (c) 2009-2012 TangBin, http://www.planeArt.cn * * This is licensed under the GNU LGPL, version 2.1 or later. * For details, see: http://creativecommons.org/licenses/LGPL/2.1/ */ //----------------------------...
JavaScript
/*! * artDialog iframeTools * Date: 2011-11-25 13:54 * http://code.google.com/p/artdialog/ * (c) 2009-2011 TangBin, http://www.planeArt.cn * * This is licensed under the GNU LGPL, version 2.1 or later. * For details, see: http://creativecommons.org/licenses/LGPL/2.1/ */ ;(function ($, window, artDia...
JavaScript
/************************************** *添加分类 *@string parentid 分类的父ID *@int type 分类的类别编号 ****************************************/ YKG.prototype.addCategory = function(parentid, type){ $.post("/category/create.html",{Category:{ 'cate_pid':$("#"+parentid).val(), 'cate_name':$("#categoryName").val(...
JavaScript
/* * Lazy Load - jQuery plugin for lazy loading images * * Copyright (c) 2007-2013 Mika Tuupola * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * * Project home: * http://www.appelsiini.net/projects/lazyload * * Version: 1.8.4 * */ (function($, window, document...
JavaScript
/* * www.byzuo.com * ok!: MSIE 6, 7, 8, Firefox 3.6, chrome 4, Safari 4, Opera 10 * o 旋转图片ID; * p 选择旋转方向,固定值为'left'或'right'; * * <!--把下面代码加到<body>与</body>之间--> *<ul class="clearfix"> * <li> * <div class="caption"> * <input type="button" value="turn left" onclick="rotate('pic_2','left')"> * ...
JavaScript
var collapsableOpenCss = "collapsable"; var collapsableClosedCss = "hidden"; var collapsableOpenImg = "/files/images/collapsableOpen.gif"; var collapsableClosedImg = "/files/images/collapsableClosed.gif"; function toggleCollapsable(id) { var div = document.getElementById(id); var img = document.getElementById("img...
JavaScript
/** * @license * * Copyright 2011 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 l...
JavaScript
/** * Creates a new level control. * @constructor * @param {IoMap} iomap the IO map controller. * @param {Array.<string>} levels the levels to create switchers for. */ function LevelControl(iomap, levels) { var that = this; this.iomap_ = iomap; this.el_ = this.initDom_(levels); google.maps.event.addList...
JavaScript
/** * Creates a new Floor. * @constructor * @param {google.maps.Map=} opt_map */ function Floor(opt_map) { /** * @type Array.<google.maps.MVCObject> */ this.overlays_ = []; /** * @type boolean */ this.shown_ = true; if (opt_map) { this.setMap(opt_map); } } /** * @param {google.maps.M...
JavaScript
// Copyright 2011 Google /** * 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 wri...
JavaScript
/****************************************** Auto-readmore link script, version 2.0 (for blogspot) (C)2008 by Anhvo visit http://en.vietwebguide.com to get more cool hacks ********************************************/ function removeHtmlTag(strx,chop){ if(strx.indexOf("<")!=-1) { var s = strx.split("<"); for(...
JavaScript
//Script by Aneesh of www.bloggerplugins.org //Released on August 19th August 2009 var relatedTitles = new Array(); var relatedTitlesNum = 0; var relatedUrls = new Array(); var thumburl = new Array(); function related_results_labels_thumbs(json) { for (var i = 0; i < json.feed.entry.length; i++) { var entry = json.feed...
JavaScript
/********************* //* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/ //* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering //* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/ *********************/ //Specify full URL to down...
JavaScript
var mydate=new Date(); var year=mydate.getYear(); if (year < 1000); year+=1900; var day=mydate.getDay(); var month=mydate.getMonth(); var daym=mydate.getDate(); if (daym < 10); daym=''+daym; var dayarray=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); var montharray=new Array('January...
JavaScript
/* * Copyright 2013 Google Inc. All Rights Reserved. * * 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 applica...
JavaScript
$(function() { // Hide the other invitation inputs when the "Enable Invitations checkbox" // is unchecked. var checkbox = $("div.invitation-enable > input[type=\"checkbox\"]"); function updateInvitationFields() { if (checkbox.prop("checked")) { $(".invitation-data").parent().show(); } else { ...
JavaScript
$(function() { var XSRF_TOKEN = $("#invitation-div").data("xsrf-token"); // XSSI prefix. Must be kept in sync with models/transforms.py. var XSSI_PREFIX = ")]}'"; function parseJson(s) { return JSON.parse(s.replace(XSSI_PREFIX, '')); } function onSendButtonClick() { var request = JSON.stringify({ ...
JavaScript
/* Copyright 2013 Google Inc. All Rights Reserved. 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 a...
JavaScript
/* Copyright 2013 Google Inc. All Rights Reserved. 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 a...
JavaScript
/** * The definitions of the controls used by the iframed popup. * * @param frameProxy The proxy which is used to communicate with the editor in * the parent window. * @param env The shared GCB envronment variables. */ function FramedEditorControls(Y, frameProxy, env) { this._Y = Y; this._frameProxy = fra...
JavaScript
/** * Define the methods of the GCB rich text editor here. */ function getGcbRteDefs(env, Dom, Editor, Resize) { return { setOptions: function(options) { GcbRteField.superclass.setOptions.call(this, options); this.options.opts = options.opts || {}; this.options.excludedCustomTags = options.exc...
JavaScript
function ButterBar(popup, message, close) { this.popup = popup; this.message = message; this.close = close; } ButterBar.prototype.showMessage = function(text) { this.message.textContent = text; // FF, Chrome this.message.innerText = text; // IE if (! $(this.popup).hasClass("shown")) { $(this.popup)....
JavaScript
// Defer execution to jQuery ready. jQuery(function($) { // Resize child frames to the size of their contents every 75ms. setInterval(function() { $('iframe.gcb-needs-resizing').each(function(elem) { try { $(this).height($(this).contents().height()); } catch(error) { // Eat errors, w...
JavaScript
//server communications timeout var ajaxRpcTimeoutMillis = 45 * 1000; // XSSI prefix. Must be kept in sync with models/transforms.py. var xssiPrefix = ")]}'"; /** * Compare two JS objects for equality by value. */ function deepEquals(x, y) { if (typeof(x) != "object") { return x === y; } if (typeof(y) != "...
JavaScript
var tag = document.getElementsByName('tag')[0]; if (tag) { tag.onchange = function(event) { var value = cb_global.form.getValue(); value.attributes = {}; window.parent.frameProxy.setValue(value); var tagName = tag.options[tag.selectedIndex].value; window.location = getAddCustomTagUrl(cb_global, t...
JavaScript
/* * Parent frame code for Google Drive tag functionality. * * Requires child in google_tag_child_frame.js. The parent is loaded after * oeditor.js. It accepts commands from the child frame, which is rendered as an * InputEx lightbox, does work, and relays results back to the child. * * It's weird that we're usi...
JavaScript
function gcbTagHtml5TrackVideo(instanceId) { var index = 0; var video = $('#' + instanceId)[0]; var eventLogger = function(event) { var dataDict = { 'instance_id': instanceId, 'event_id': index, 'position': video.currentTime, 'rate': video.playbackRate, 'default_rate': video.defa...
JavaScript
// embed YouTube API only once if (typeof(window['gcb_tag_youtube_videos']) == "undefined"){ // send a milestone event every time this many seconds of video are watched var GCB_VIDEO_TRACKING_CHUNK_SEC = 30; // video player status var gcb_youtube_player_ready = false; // list of videos to embed var gcb_ta...
JavaScript
/* * Child frame code for Google Drive tag functionality. * * Requires parent in google_tag_child_parent.js. The child is rendered as an * InputEx lightbox. It relays commands to the parent, which does actual work * and relays results back to the child. * * It's weird that we're using postMessage here but we sti...
JavaScript
/* * Common utility methods used across clients of Google APIs. * * @param {object} JSON JSON processing module. */ window.GoogleApiClientTools = (function(JSON) { module = {}; module._typeId = 'google-drive'; // XSSI prefix must be kept in sync with models/transforms.py. module._xssiPrefix = ")]}'"; mo...
JavaScript
/* * Manages drive tag controls at tag render time. * * Open issues: * * - The structure of the preview frame is not the same as the structure of the * content frame: we write into preview directly; content loads its data via * its src. We patch over the most egregious UI differences, but it's not * possi...
JavaScript
GcbGoogleDriveTagChild.main();
JavaScript
$(function() { var notes = ( 'Note: Deleting translations will take several seconds, ' + 'and may time out. If this happens, you can try ' + 'deleting fewer languages at a time, or use the command ' + 'line tool. See .../modules/i18n_dashboard/jobs.py for ' + 'complete instructions and...
JavaScript
$(function() { var notes = ( 'Note: Downloading translation files will take several seconds, ' + 'and may time out. If this happens, you can try ' + 'exporting fewer languages at a time, or use the command ' + 'line tool. See .../modules/i18n_dashboard/jobs.py for ' + 'complete instruc...
JavaScript
var VERB_NEW = 1; var VERB_CHANGED = 2; var VERB_CURRENT = 3; var VERB_NEW_CLASS = "verb-new"; var VERB_CHANGED_CLASS = "verb-changed"; var VERB_CURRENT_CLASS = "verb-current"; var EDITED_CLASS = "edited"; var NOT_STARTED_TRANSLATION = 0; var VALID_TRANSLATION = 1; var INVALID_TRANSLATION = 2; function getVerbClassN...
JavaScript
$(function() { var notes = ( 'Note: Uploading translation files will take several seconds, ' + 'and may time out. If this happens, you can try ' + 'importing fewer languages at a time, or use the command ' + 'line tool. See .../modules/i18n_dashboard/jobs.py for ' + 'complete instructi...
JavaScript
// XSSI prefix. Must be kept in sync with models/transforms.py. var xssiPrefix = ")]}'"; var xsrfToken = $("table.i18n-progress-table").data("isTranslatableXsrfToken"); /** * Parses JSON string that starts with an XSSI prefix. */ function parseResponse(s) { return JSON.parse(s.replace(xssiPrefix, '')); } functio...
JavaScript
<!-- -*- mode: javascript; -*- --> <div id="labels_on_students_graph"></div> <script> function labels_on_students(data){ var dimension = data.labels_on_students.crossfilter.dimension( function byTitle(label){ return label.title; }); var group = dimension.group().reduceSum( function byCount...
JavaScript
function AssessmentEditorController(Y, inputExForm, xsrfToken, confirm, notify, formatError) { this.Y = Y; this.inputExForm = inputExForm; this.xsrfToken = xsrfToken; this.confirm = confirm; this.notify = notify; this.formatError = formatError; } AssessmentEditorController.prototype.exportToHTMLAssessme...
JavaScript
/** * A class which represents a button which can toggle between two states ("a" * and "b") on a click. * @param {YUI Node} divNode the node which the button will be inserted in * @param {string} aText the text which will be shown when the button is in "a" * state (the default) * @param {string} bText the tex...
JavaScript
var controller = new AssessmentEditorController( Y, cb_global.form, cb_global.xsrf_token, function(s) { return window.confirm(s); }, cbShowMsg, formatServerErrorMessage ); controller.init();
JavaScript
//XSSI prefix. Must be kept in sync with models/transforms.py. var XSSI_PREFIX = ")]}'"; var ESC_KEY = 27; /** * Parses JSON string that starts with an XSSI prefix. */ function parseJson(s) { return JSON.parse(s.replace(XSSI_PREFIX, "")); } function setDraftStatus(padlock, isDraft) { if (isDraft) { padlock....
JavaScript
function showNoPermissionsMessage() { $("#formContainer > div > form > fieldset > .inputEx-Group > fieldset") .append("There are currently no permissions assigned nor registered."); } function setUpRoleEditorForm() { var all_hidden = true; $(".permission-module").each(function() { if($(this).find(".inputEx...
JavaScript
<!-- -*- mode: javascript; -*- --> <div> <style scoped> .graph_container { float: left; text-align: center; } h4 { margin: 10px; } .graph_graph { margin: 10px; } </style> <!-- Titles and containers for graphs --> <div class="graph_container"> <h4>Counts of Answers</h4> ...
JavaScript
var SHOW_SCORES_LABEL = 'Assign scores to individual choices'; var HIDE_SCORES_LABEL = 'Return to choice picker view'; var HIDE_SCORES_WARNING_LABEL = 'Return to choice-picker (Note: scores will change)'; /* Whether to show the numeric score or a radio/checkbox. */ var setScores = false; var setScoresToggleButton...
JavaScript
var isPeerAssessmentTable; $(function() { if (cb_global.schema.properties.course) { // Only activate this functionality on the Settings > Course view init(); } }); function init() { var criterionDivs = $(".settings-list-item"); //Initial setup criterionDivs.find(".assessment-dropdown select").each...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 applicabl...
JavaScript