code
stringlengths
2
1.05M
repo_name
stringlengths
5
114
path
stringlengths
4
991
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
var $box = $('.box'); var F = {}; F.getMousePos = function(e, $relaveDom) { var x = 0; var y = 0; if (!e) { var e = window.event; } if (e.pageX || e.pageY) { x = e.pageX; y = e.pageY; } else if (e.clientX || e.clientY) { x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; } if($relaveDom) { var offset = $relaveDom.offset(); x -= offset.left; y -= offset.top; } return {x:x, y:y}; }; var batteryWater = function(opts){ var self = this; this.opts = $.extend({ dom: '', content: [], color: {} }, opts) this.$dom = this.opts.dom; this.content = this.opts.content; this.timeScale = this.opts.timeScale; this.color = this.opts.color; this.canvas = this.$dom.find('canvas'); this.width = this.$dom.width(); this.height = this.$dom.height(); this.ctx = this.canvas.get(0).getContext('2d'); var pi = Math.PI; var o_x = 30.5; //原点坐标 var o_y = 185.5; var scale_width = 700; var each_width = parseInt(scale_width/(2 * this.timeScale.length)); var each_height = 25; var scale_height = each_height * 6; var point_radius = 2.5; //小点半径 var o_temp = 25; //原点坐标的起始温度 var y_height = 0; //每个点在动画过程中的纵坐标 var arr_pos = []; //存储每个点的坐标 this.makeScale = function(){ var ctx = this.ctx; ctx.save(); ctx.translate(o_x, o_y); //温度数字 ctx.beginPath(); ctx.font = '10px Arial'; ctx.fillStyle = self.color.gray; ctx.textBaseline = 'middle'; ctx.textAlign = 'right'; ctx.fillText(o_temp, -10, 0); ctx.closePath(); //温度横线 ctx.beginPath(); for( var i=1; i<7; i++){ ctx.fillText(o_temp + 5 * i , -10, -i * each_height); ctx.moveTo(0, -i * each_height); ctx.lineTo(scale_width, -i * each_height); } ctx.lineWidth = 1; ctx.strokeStyle = self.color.l_gray; ctx.stroke(); ctx.closePath(); ctx.restore(); }; this.drawTemp = function(y_height){ var ctx = this.ctx; ctx.save(); ctx.translate(o_x, o_y); for(var i=0; i<self.content.length; i++){ var temp_x = i * each_width; var ny = self.content[i].values - o_temp; var temp_y = -ny * 5 * y_height; if( i != self.content.length - 1 ){ var nny = self.content[i+1].values - o_temp; var temp_ny = -nny * 5 * y_height; } if( y_height >= 1 ){ arr_pos.push({x: temp_x, y: temp_y, values: self.content[i].values}); } //温度区间块 ctx.beginPath(); ctx.moveTo( temp_x, 0); ctx.lineTo( temp_x, temp_y); ctx.lineTo( (i+1) * each_width, temp_ny); ctx.lineTo( (i+1) * each_width, 0); ctx.lineTo( temp_x, 0); ctx.fillStyle = 'rgba(89, 103, 107, 0.05)'; ctx.fill(); ctx.closePath(); //竖线 ctx.beginPath(); ctx.moveTo(temp_x, 0); ctx.lineTo(temp_x, temp_y); ctx.strokeStyle = self.color.l_gray; ctx.lineWidth = 1; ctx.stroke(); ctx.closePath(); //点与点之间的连线(除了最后一个点); if( i != self.content.length - 1 ){ ctx.beginPath(); ctx.moveTo(temp_x, temp_y); ctx.lineTo( (i+1) * each_width, temp_ny); ctx.strokeStyle = self.color.black; ctx.lineWidth = 1; ctx.stroke(); ctx.closePath(); } //温度圆点的白色底 ctx.beginPath(); ctx.arc(temp_x, temp_y, point_radius-0.5, 0, 2*pi); ctx.fillStyle = '#fff'; ctx.fill(); ctx.closePath(); //温度圆点 ctx.beginPath(); ctx.arc(temp_x, temp_y, point_radius-0.5, 0, 2*pi); ctx.strokeStyle = self.color.black; ctx.stroke(); ctx.closePath(); } ctx.restore(); }; this.makeOy = function(){ var ctx = this.ctx; ctx.save(); ctx.translate(o_x, o_y); ctx.beginPath(); ctx.moveTo(0, 0); ctx.lineTo(scale_width, 0); ctx.strokeStyle = self.color.black; ctx.stroke(); ctx.closePath(); ctx.beginPath(); for(var i=0; i<this.timeScale.length; i++){ ctx.font = '10px Arial'; ctx.textAlign = 'center'; ctx.fillStyle = self.color.black; ctx.fillText(this.timeScale[i], (2 * i + 1)* each_width, 20); } ctx.closePath(); ctx.beginPath(); for(var j=0; j<2 * this.timeScale.length + 1; j+=2){ ctx.arc(j * each_width, 0, point_radius, 0, 2*pi); ctx.fillStyle = self.color.black; } ctx.fill(); ctx.closePath(); ctx.restore(); }; //鼠标悬浮 this.makeHover = function(pos){ var ctx = this.ctx; ctx.save(); ctx.translate(o_x, o_y); ctx.beginPath(); ctx.arc(pos.x, pos.y, point_radius+0.5, 0, 2*pi); ctx.fillStyle = '#fff'; ctx.fill(); ctx.closePath(); ctx.beginPath(); ctx.arc(pos.x, pos.y, point_radius+0.5, 0, 2*pi); ctx.strokeStyle = self.color.blue; ctx.stroke(); ctx.closePath(); ctx.beginPath(); ctx.arc(pos.x, pos.y, 1.5, 0, 2*pi); ctx.fillStyle = self.color.blue; ctx.fill(); ctx.closePath(); var r = 2; //圆角半径 var r_width = 36; //正方体框宽度 var r_height = 16; //正方体框高度 var a_width = 7; //小箭头宽度 var a_height = 3; //小箭头高度 var radius = 10; //温度数字框 ctx.beginPath(); var a_x = Math.floor(pos.x) - 0.5; var a_y = Math.floor(pos.y) - 25.5; ctx.moveTo(a_x, a_y); ctx.arcTo(r_width/2 + a_x, a_y, r_width/2 + a_x, 1 - a_y, r); ctx.arcTo(r_width/2 + a_x, r_height + a_y, r_width/2 + a_x - 1, r_height + a_y, r); ctx.lineTo( a_width/2 + a_x, r_height + a_y); ctx.lineTo( a_x, r_height + a_height + a_y); ctx.lineTo( a_x - a_width/2, r_height + a_y); ctx.arcTo(a_x - r_width/2, r_height + a_y, a_x - r_width/2, r_height + a_y - 1, r); ctx.arcTo(a_x - r_width/2, a_y, a_x - r_width/2 + 1, a_y, r); ctx.lineTo(a_x, a_y); ctx.fillStyle = self.color.blue; ctx.fill(); ctx.font = '12px Arial'; //ctx.font = '12px "Helvitica Neue" lighter'; //ctx.font = '12px "Helvitica Neue", Helvitica, Arial, "Microsoft YaHei", sans-serif lighter'; ctx.textAlign = 'center'; ctx.fillStyle = '#fff'; ctx.fillText(pos.values, a_x, Math.floor(pos.y) - 13); ctx.closePath(); ctx.restore(); }; this.run = function(){ if( y_height < 100 ){ y_height += 2; self.ctx.clearRect(0, 0, self.width, self.height); self.makeScale(); self.drawTemp(y_height/100); self.makeOy(); self.animation = requestAnimationFrame(self.run); } else { cancelAnimationFrame(this.animation); } }; this.animation = requestAnimationFrame(this.run); this.canvas.on('mousemove', function(ev){ if( y_height >= 100 ){ var mouse = F.getMousePos(ev, $(this)); //相对于原点的坐标轴位置 var pos = { x: mouse.x - o_x, y: mouse.y - o_y }; var now_one = Math.ceil( (pos.x - each_width/2) / each_width); if( pos.x > 0 && pos.y < 0 ){ self.ctx.clearRect(0, 0, self.width, self.height); self.makeScale(); self.drawTemp(1); self.makeOy(); self.makeHover(arr_pos[now_one]); } } }); }; var drawWater = new batteryWater({ dom: $box, timeScale: ['网络视频', '本地视频','电子书', '微博', '拍照', '游戏', '微信', '网页', '通话', '音乐'], content: [ {name: '起始点亮', values: '29.20'}, {name: '网络视频1', values: '33.30'}, {name: '网络视频2', values: '33.60'}, {name: '本地视频1', values: '32.50'}, {name: '本地视频2', values: '31.80'}, {name: '电子书1', values: '33.30'}, {name: '电子书2', values: '32.50'}, {name: '微博1', values: '33.40'}, {name: '微博2', values: '33.70'}, {name: '拍照1', values: '37.30'}, {name: '拍照2', values: '38.30'}, {name: '游戏1', values: '38.50'}, {name: '游戏2', values: '38.00'}, {name: '微信1', values: '35.60'}, {name: '微信2', values: '40.00'}, {name: '网页1', values: '40.00'}, {name: '网页2', values: '33.20'}, {name: '通话1', values: '29.50'}, {name: '通话2', values: '29.60'}, {name: '音乐1', values: '37.00'}, {name: '音乐2', values: '37.00'}, ], color: { blue: '#0096ff', green: '#44be05', yellow: '#ffc411', red: '#f86117', black: '#59676b', gray: '#b3b3b3', l_gray: '#e2e5e7' } });
comlewod/document
pages/lab_test/xian.js
JavaScript
bsd-3-clause
8,132
/*! * jQuery JavaScript Library v2.2.4 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2016-05-20T17:23Z */ (function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { // For CommonJS and CommonJS-like environments where a proper `window` // is present, execute the factory and get jQuery. // For environments that do not have a `window` with a `document` // (such as Node.js), expose a factory as module.exports. // This accentuates the need for the creation of a real `window`. // e.g. var jQuery = require("jquery")(window); // See ticket #14549 for more info. module.exports = global.document ? factory( global, true ) : function( w ) { if ( !w.document ) { throw new Error( "jQuery requires a window with a document" ); } return factory( w ); }; } else { factory( global ); } // Pass this if window is not defined yet }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // Support: Firefox 18+ // Can't be in strict mode, several libs including ASP.NET trace // the stack via arguments.caller.callee and Firefox dies if // you try to trace through "use strict" call chains. (#13335) //"use strict"; var arr = []; var document = window.document; var slice = arr.slice; var concat = arr.concat; var push = arr.push; var indexOf = arr.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var support = {}; var version = "2.2.4", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init( selector, context ); }, // Support: Android<4.1 // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // Start with an empty selector selector: "", // The default length of a jQuery object is 0 length: 0, toArray: function() { return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num != null ? // Return just the one element from the set ( num < 0 ? this[ num + this.length ] : this[ num ] ) : // Return all the elements in a clean array slice.call( this ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. each: function( callback ) { return jQuery.each( this, callback ); }, map: function( callback ) { return this.pushStack( jQuery.map( this, function( elem, i ) { return callback.call( elem, i, elem ); } ) ); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); }, end: function() { return this.prevObject || this.constructor(); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: arr.sort, splice: arr.splice }; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[ 0 ] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; // Skip the boolean and the target target = arguments[ i ] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { target = {}; } // Extend jQuery itself if only one argument is passed if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( ( options = arguments[ i ] ) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject( copy ) || ( copyIsArray = jQuery.isArray( copy ) ) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray( src ) ? src : []; } else { clone = src && jQuery.isPlainObject( src ) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend( { // Unique for each copy of jQuery on the page expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), // Assume jQuery is ready without the ready module isReady: true, error: function( msg ) { throw new Error( msg ); }, noop: function() {}, isFunction: function( obj ) { return jQuery.type( obj ) === "function"; }, isArray: Array.isArray, isWindow: function( obj ) { return obj != null && obj === obj.window; }, isNumeric: function( obj ) { // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN // adding 1 corrects loss of precision from parseFloat (#15100) var realStringObj = obj && obj.toString(); return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; }, isPlainObject: function( obj ) { var key; // Not plain objects: // - Any object or value whose internal [[Class]] property is not "[object Object]" // - DOM nodes // - window if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } // Not own constructor property must be Object if ( obj.constructor && !hasOwn.call( obj, "constructor" ) && !hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) { return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own for ( key in obj ) {} return key === undefined || hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, type: function( obj ) { if ( obj == null ) { return obj + ""; } // Support: Android<4.0, iOS<6 (functionish RegExp) return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call( obj ) ] || "object" : typeof obj; }, // Evaluates a script in a globals context globalEval: function( code ) { var script, indirect = eval; code = jQuery.trim( code ); if ( code ) { // If the code includes a valid, prologue position // strict mode pragma, execute code by injecting a // script tag into the document. if ( code.indexOf( "use strict" ) === 1 ) { script = document.createElement( "script" ); script.text = code; document.head.appendChild( script ).parentNode.removeChild( script ); } else { // Otherwise, avoid the DOM node creation, insertion // and removal by using an indirect globals eval indirect( code ); } } }, // Convert dashed to camelCase; used by the css and data modules // Support: IE9-11+ // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, each: function( obj, callback ) { var length, i = 0; if ( isArrayLike( obj ) ) { length = obj.length; for ( ; i < length; i++ ) { if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { break; } } } else { for ( i in obj ) { if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { break; } } } return obj; }, // Support: Android<4.1 trim: function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArrayLike( Object( arr ) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, merge: function( first, second ) { var len = +second.length, j = 0, i = first.length; for ( ; j < len; j++ ) { first[ i++ ] = second[ j ]; } first.length = i; return first; }, grep: function( elems, callback, invert ) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { callbackInverse = !callback( elems[ i ], i ); if ( callbackInverse !== callbackExpect ) { matches.push( elems[ i ] ); } } return matches; }, // arg is for internal usage only map: function( elems, callback, arg ) { var length, value, i = 0, ret = []; // Go through the array, translating each of the items to their new values if ( isArrayLike( elems ) ) { length = elems.length; for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } // Go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } // Flatten any nested arrays return concat.apply( [], ret ); }, // A globals GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: Date.now, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support } ); // JSHint would error on this code due to the Symbol not being defined in ES5. // Defining this globals in .jshintrc would create a danger of using the globals // unguarded in another place, it seems safer to just disable JSHint for these // three lines. /* jshint ignore: start */ if ( typeof Symbol === "function" ) { jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; } /* jshint ignore: end */ // Populate the class2type map jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), function( i, name ) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); } ); function isArrayLike( obj ) { // Support: iOS 8.2 (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = !!obj && "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v2.2.1 * http://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2015-10-17 */ (function( window ) { var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; } return 0; }, // General-purpose constants MAX_NEGATIVE = 1 << 31, // Instance methods hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf as it's faster than native // http://jsperf.com/thor-indexof-vs-for/5 indexOf = function( list, elem ) { var i = 0, len = list.length; for ( ; i < len; i++ ) { if ( list[i] === elem ) { return i; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", // Regular expressions // http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + ")(?:\\((" + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + // 2. simple (capture 6) "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + // 3. anything else (capture 2) ".*" + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new RegExp( whitespace + "+", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + identifier + ")" ), "CLASS": new RegExp( "^\\.(" + identifier + ")" ), "TAG": new RegExp( "^(" + identifier + "|[*])" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint // Support: Firefox<24 // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, // Used for iframes // See setDocument() // Removing the function wrapper causes a "Permission Denied" // error in IE unloadHandler = function() { setDocument(); }; // Optimize for push.apply( _, NodeList ) try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); // Support: Android<4.0 // Detect silently failing push.apply arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? // Leverage slice if possible function( target, els ) { push_native.apply( target, slice.call(els) ); } : // Support: IE<9 // Otherwise append directly function( target, els ) { var j = target.length, i = 0; // Can't trust NodeList.length while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } function Sizzle( selector, context, results, seed ) { var m, i, elem, nid, nidselect, match, groups, newSelector, newContext = context && context.ownerDocument, // nodeType defaults to 9, since context defaults to document nodeType = context ? context.nodeType : 9; results = results || []; // Return early from calls with invalid selector or context if ( typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { return results; } // Try to shortcut find operations (as opposed to filters) in HTML documents if ( !seed ) { if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; if ( documentIsHTML ) { // If the selector is sufficiently simple, try using a "get*By*" DOM method // (excepting DocumentFragment context, where the methods don't exist) if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { // ID selector if ( (m = match[1]) ) { // Document context if ( nodeType === 9 ) { if ( (elem = context.getElementById( m )) ) { // Support: IE, Opera, Webkit // TODO: identify versions // getElementById can match elements by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } // Element context } else { // Support: IE, Opera, Webkit // TODO: identify versions // getElementById can match elements by name instead of ID if ( newContext && (elem = newContext.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Type selector } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; // Class selector } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // Take advantage of querySelectorAll if ( support.qsa && !compilerCache[ selector + " " ] && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { if ( nodeType !== 1 ) { newContext = context; newSelector = selector; // qSA looks outside Element context, which is not what we want // Thanks to Andrew Dupont for this workaround technique // Support: IE <=8 // Exclude object elements } else if ( context.nodeName.toLowerCase() !== "object" ) { // Capture the context ID, setting it first if necessary if ( (nid = context.getAttribute( "id" )) ) { nid = nid.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", (nid = expando) ); } // Prefix every selector in the list groups = tokenize( selector ); i = groups.length; nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; while ( i-- ) { groups[i] = nidselect + " " + toSelector( groups[i] ); } newSelector = groups.join( "," ); // Expand context for sibling selectors newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch ( qsaError ) { } finally { if ( nid === expando ) { context.removeAttribute( "id" ); } } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /** * Create key-value caches of limited size * @returns {function(string, object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var keys = []; function cache( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key + " " ] = value); } return cache; } /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /** * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // Remove from its parent by default if ( div.parentNode ) { div.parentNode.removeChild( div ); } // release memory in IE div = null; } } /** * Adds the same handler for all of the specified attrs * @param {String} attrs Pipe-separated list of attributes * @param {Function} handler The method that will be applied */ function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = arr.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } } /** * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } /** * Returns a function to use in pseudos for buttons * @param {String} type */ function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } /** * Returns a function to use in pseudos for positionals * @param {Function} fn */ function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Checks a node for validity as a Sizzle context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; } // Expose support vars for convenience support = Sizzle.support = {}; /** * Detects XML nodes * @param {Element|Object} elem An element or a document * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Update globals variables document = doc; docElem = document.documentElement; documentIsHTML = !isXML( document ); // Support: IE 9-11, Edge // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) if ( (parent = document.defaultView) && parent.top !== parent ) { // Support: IE 11 if ( parent.addEventListener ) { parent.addEventListener( "unload", unloadHandler, false ); // Support: IE 9 - 10 only } else if ( parent.attachEvent ) { parent.attachEvent( "onunload", unloadHandler ); } } /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 // Verify that getAttribute really returns attributes and not properties // (excepting IE8 booleans) support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( div ) { div.appendChild( document.createComment("") ); return !div.getElementsByTagName("*").length; }); // Support: IE<9 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); // Support: IE<10 // Check if getElementById returns elements by name // The broken getElementById methods don't pick up programatically-set names, // so use a roundabout getElementsByName test support.getById = assert(function( div ) { docElem.appendChild( div ).id = expando; return !document.getElementsByName || !document.getElementsByName( expando ).length; }); // ID find and filter if ( support.getById ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var m = context.getElementById( id ); return m ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { // Support: IE6/7 // getElementById is not reliable as a find shortcut delete Expr.find["ID"]; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; } // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( tag ); // DocumentFragment nodes don't have gEBTN } else if ( support.qsa ) { return context.querySelectorAll( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { return context.getElementsByClassName( className ); } }; /* QSA/matchesSelector ---------------------------------------------------------------------- */ // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21) // We allow this because of a bug in IE8/9 that throws an error // whenever `document.activeElement` is accessed on an iframe // So, we allow :focus to pass through QSA all the time to avoid the IE error // See http://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>"; // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= // The test attribute must be unknown in Opera but "safe" for WinRT // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section if ( div.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { rbuggyQSA.push("~="); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } // Support: Safari 8+, iOS 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 // In-page `selector#id sibing-combinator selector` fails if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { rbuggyQSA.push(".#.+[+~]"); } }); assert(function( div ) { // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = document.createElement("input"); input.setAttribute( "type", "hidden" ); div.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute if ( div.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); /* Contains ---------------------------------------------------------------------- */ hasCompare = rnative.test( docElem.compareDocumentPosition ); // Element contains another // Purposefully self-exclusive // As in, an element does not contain itself contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; /* Sorting ---------------------------------------------------------------------- */ // Document order sorting sortOrder = hasCompare ? function( a, b ) { // Flag for duplicate removal if ( a === b ) { hasDuplicate = true; return 0; } // Sort on method existence if only one input has compareDocumentPosition var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if ( compare ) { return compare; } // Calculate position if both inputs belong to the same document compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? a.compareDocumentPosition( b ) : // Otherwise we know they are disconnected 1; // Disconnected nodes if ( compare & 1 || (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { // Choose the first element that is related to our preferred document if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { return -1; } if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { return 1; } // Maintain original order return sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } : function( a, b ) { // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; } var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Parentless nodes are either documents or disconnected if ( !aup || !bup ) { return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return document; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); if ( support.matchesSelector && documentIsHTML && !compilerCache[ expr + " " ] && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch (e) {} } return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } var fn = Expr.attrHandle[ name.toLowerCase() ], // Don't get fooled by Object.prototype properties (jQuery #13807) val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute( name ) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; /** * Document sorting and removing duplicates * @param {ArrayLike} results */ Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } // Clear input after sorting to release objects // See https://github.com/jquery/sizzle/pull/225 sortInput = null; return results; }; /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (jQuery #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is if ( match[3] ) { match[2] = match[4] || match[5] || ""; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeNameSelector ) { var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? // Shortcut for :nth-*(n) function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, uniqueCache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } // Reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && useCache ) { // Seek `elem` from a previously-cached index // ...in a gzip-friendly way node = parent; outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); cache = uniqueCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex && cache[ 2 ]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } } else { // Use previously-cached element index if available if ( useCache ) { // ...in a gzip-friendly way node = elem; outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); cache = uniqueCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex; } // xml :nth-child(...) // or :nth-last-child(...) or :nth(-last)?-of-type(...) if ( diff === false ) { // Use the same loop as above to seek `elem` from the start while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { // Cache the index of each encountered element if ( useCache ) { outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); uniqueCache[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } } // Incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // Potentially complex pseudos "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); // Don't keep the element (issue #299) input[0] = null; return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { text = text.replace( runescape, funescape ); return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), // "Whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier C, // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." // http://www.w3.org/TR/selectors/#lang-pseudo "lang": markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), // Miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodeType < 6 works because attributes (2) do not appear as children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeType < 6 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && // Support: IE<8 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } // Easy API for creating new setFilters function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( (tokens = []) ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push({ value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) }); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push({ value: matched, type: type, matches: match }); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); }; function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var oldCache, uniqueCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); if ( (oldCache = uniqueCache[ dir ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements uniqueCache[ dir ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); // Avoid hanging onto element (issue #299) checkContext = null; return ret; } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( // If the preceding token was a descendant combinator, insert an implicit any-element `*` tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context === document || context || outermost; } // Add elements passing elementMatchers directly to results // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; if ( !context && elem.ownerDocument !== document ) { setDocument( elem ); xml = !documentIsHTML; } while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context || document, xml) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // `i` is now the count of elements visited above, and adding it to `matchedCount` // makes the latter nonnegative. matchedCount += i; // Apply set filters to unmatched elements // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` // equals `i`), unless we didn't visit _any_ elements in the above loop because we have // no element matchers and no seed. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that // case, which will result in a "00" `matchedCount` that differs from `i` but is also // numerically zero. if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !match ) { match = tokenize( selector ); } i = match.length; while ( i-- ) { cached = matcherFromTokens( match[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); // Save selector and tokenization cached.selector = selector; } return cached; }; /** * A low-level selection function that works with Sizzle's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled * selector function built with Sizzle.compile * @param {Element} context * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ select = Sizzle.select = function( selector, context, results, seed ) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize( (selector = compiled.selector || selector) ); results = results || []; // Try to minimize operations if there is only one selector in the list and no seed // (the latter of which guarantees us context) if ( match.length === 1 ) { // Reduce context if the leading compound selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; // Precompiled matchers will still verify ancestry, so step up a level } else if ( compiled ) { context = context.parentNode; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } // Compile and execute a filtering function if one is not provided // Provide `match` to avoid retokenization if we modified the selector above ( compiled || compile( selector, match ) )( seed, context, !documentIsHTML, results, !context || rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; }; // One-time assignments // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; // Support: Chrome 14-35+ // Always assume duplicates if they aren't passed to the comparison function support.detectDuplicates = !!hasDuplicate; // Initialize against the default document setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Detached nodes confoundingly follow *each other* support.sortDetached = assert(function( div1 ) { // Should return 1, but returns 4 (following) return div1.compareDocumentPosition( document.createElement("div") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); } }); } // Support: IE<9 // Use defaultValue in place of getAttribute("value") if ( !support.attributes || !assert(function( div ) { div.innerHTML = "<input/>"; div.firstChild.setAttribute( "value", "" ); return div.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { return elem.defaultValue; } }); } // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies if ( !assert(function( div ) { return div.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; if ( !isXML ) { return elem[ name ] === true ? name.toLowerCase() : (val = elem.getAttributeNode( name )) && val.specified ? val.value : null; } }); } return Sizzle; })( window ); jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[ ":" ] = jQuery.expr.pseudos; jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; var dir = function( elem, dir, until ) { var matched = [], truncate = until !== undefined; while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { if ( elem.nodeType === 1 ) { if ( truncate && jQuery( elem ).is( until ) ) { break; } matched.push( elem ); } } return matched; }; var siblings = function( n, elem ) { var matched = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { matched.push( n ); } } return matched; }; var rneedsContext = jQuery.expr.match.needsContext; var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); var risSimple = /^.[^:#\[\.,]*$/; // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; } ); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; } ); } if ( typeof qualifier === "string" ) { if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } qualifier = jQuery.filter( qualifier, elements ); } return jQuery.grep( elements, function( elem ) { return ( indexOf.call( qualifier, elem ) > -1 ) !== not; } ); } jQuery.filter = function( expr, elems, not ) { var elem = elems[ 0 ]; if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; } ) ); }; jQuery.fn.extend( { find: function( selector ) { var i, len = this.length, ret = [], self = this; if ( typeof selector !== "string" ) { return this.pushStack( jQuery( selector ).filter( function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } } ) ); } for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } // Needed because $( selector, context ) becomes $( context ).find( selector ) ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret.selector = this.selector ? this.selector + " " + selector : selector; return ret; }, filter: function( selector ) { return this.pushStack( winnow( this, selector || [], false ) ); }, not: function( selector ) { return this.pushStack( winnow( this, selector || [], true ) ); }, is: function( selector ) { return !!winnow( this, // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". typeof selector === "string" && rneedsContext.test( selector ) ? jQuery( selector ) : selector || [], false ).length; } } ); // Initialize a jQuery object // A central reference to the root jQuery(document) var rootjQuery, // A simple way to check for HTML strings // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function( selector, context, root ) { var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Method init() accepts an alternate rootjQuery // so migrate can support jQuery.sub (gh-2101) root = root || rootjQuery; // Handle HTML strings if ( typeof selector === "string" ) { if ( selector[ 0 ] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && ( match[ 1 ] || !context ) ) { // HANDLE: $(html) -> $(array) if ( match[ 1 ] ) { context = context instanceof jQuery ? context[ 0 ] : context; // Option to run scripts is true for back-compat // Intentionally let the error be thrown if parseHTML is not present jQuery.merge( this, jQuery.parseHTML( match[ 1 ], context && context.nodeType ? context.ownerDocument || context : document, true ) ); // HANDLE: $(html, props) if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { for ( match in context ) { // Properties of context are called as methods if possible if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes } else { this.attr( match, context[ match ] ); } } } return this; // HANDLE: $(#id) } else { elem = document.getElementById( match[ 2 ] ); // Support: Blackberry 4.6 // gEBID returns nodes no longer in the document (#6963) if ( elem && elem.parentNode ) { // Inject the element directly into the jQuery object this.length = 1; this[ 0 ] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || root ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(DOMElement) } else if ( selector.nodeType ) { this.context = this[ 0 ] = selector; this.length = 1; return this; // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return root.ready !== undefined ? root.ready( selector ) : // Execute immediately if ready is not present selector( jQuery ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }; // Give the init function the jQuery prototype for later instantiation init.prototype = jQuery.fn; // Initialize central reference rootjQuery = jQuery( document ); var rparentsprev = /^(?:parents|prev(?:Until|All))/, // Methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend( { has: function( target ) { var targets = jQuery( target, this ), l = targets.length; return this.filter( function() { var i = 0; for ( ; i < l; i++ ) { if ( jQuery.contains( this, targets[ i ] ) ) { return true; } } } ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, matched = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { // Always skip document fragments if ( cur.nodeType < 11 && ( pos ? pos.index( cur ) > -1 : // Don't pass non-elements to Sizzle cur.nodeType === 1 && jQuery.find.matchesSelector( cur, selectors ) ) ) { matched.push( cur ); break; } } } return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); }, // Determine the position of an element within the set index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; } // Index in selector if ( typeof elem === "string" ) { return indexOf.call( jQuery( elem ), this[ 0 ] ); } // Locate the position of the desired element return indexOf.call( this, // If it receives a jQuery object, the first element is used elem.jquery ? elem[ 0 ] : elem ); }, add: function( selector, context ) { return this.pushStack( jQuery.uniqueSort( jQuery.merge( this.get(), jQuery( selector, context ) ) ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter( selector ) ); } } ); function sibling( cur, dir ) { while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} return cur; } jQuery.each( { parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return siblings( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return siblings( elem.firstChild ); }, contents: function( elem ) { return elem.contentDocument || jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var matched = jQuery.map( this, fn, until ); if ( name.slice( -5 ) !== "Until" ) { selector = until; } if ( selector && typeof selector === "string" ) { matched = jQuery.filter( selector, matched ); } if ( this.length > 1 ) { // Remove duplicates if ( !guaranteedUnique[ name ] ) { jQuery.uniqueSort( matched ); } // Reverse order for parents* and prev-derivatives if ( rparentsprev.test( name ) ) { matched.reverse(); } } return this.pushStack( matched ); }; } ); var rnotwhite = ( /\S+/g ); // Convert String-formatted options into Object-formatted ones function createOptions( options ) { var object = {}; jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; } ); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? createOptions( options ) : jQuery.extend( {}, options ); var // Flag to know if list is currently firing firing, // Last fire value for non-forgettable lists memory, // Flag to know if list was already fired fired, // Flag to prevent firing locked, // Actual callback list list = [], // Queue of execution data for repeatable lists queue = [], // Index of currently firing callback (modified by add/remove as needed) firingIndex = -1, // Fire callbacks fire = function() { // Enforce single-firing locked = options.once; // Execute callbacks for all pending executions, // respecting firingIndex overrides and runtime changes fired = firing = true; for ( ; queue.length; firingIndex = -1 ) { memory = queue.shift(); while ( ++firingIndex < list.length ) { // Run callback and check for early termination if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && options.stopOnFalse ) { // Jump to end and forget the data so .add doesn't re-fire firingIndex = list.length; memory = false; } } } // Forget the data if we're done with it if ( !options.memory ) { memory = false; } firing = false; // Clean up if we're done firing for good if ( locked ) { // Keep an empty list if we have data for future add calls if ( memory ) { list = []; // Otherwise, this object is spent } else { list = ""; } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // If we have memory from a past run, we should fire after adding if ( memory && !firing ) { firingIndex = list.length - 1; queue.push( memory ); } ( function add( args ) { jQuery.each( args, function( _, arg ) { if ( jQuery.isFunction( arg ) ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { // Inspect recursively add( arg ); } } ); } )( arguments ); if ( memory && !firing ) { fire(); } } return this; }, // Remove a callback from the list remove: function() { jQuery.each( arguments, function( _, arg ) { var index; while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( index <= firingIndex ) { firingIndex--; } } } ); return this; }, // Check if a given callback is in the list. // If no argument is given, return whether or not list has callbacks attached. has: function( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : list.length > 0; }, // Remove all callbacks from the list empty: function() { if ( list ) { list = []; } return this; }, // Disable .fire and .add // Abort any current/pending executions // Clear all callbacks and values disable: function() { locked = queue = []; list = memory = ""; return this; }, disabled: function() { return !list; }, // Disable .fire // Also disable .add unless we have memory (since it would have no effect) // Abort any pending executions lock: function() { locked = queue = []; if ( !memory ) { list = memory = ""; } return this; }, locked: function() { return !!locked; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( !locked ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; queue.push( args ); if ( !firing ) { fire(); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend( { Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], [ "notify", "progress", jQuery.Callbacks( "memory" ) ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred( function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[ 1 ] ]( function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .progress( newDefer.notify ) .done( newDefer.resolve ) .fail( newDefer.reject ); } else { newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } } ); } ); fns = null; } ).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[ 1 ] ] = list.add; // Handle state if ( stateString ) { list.add( function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] deferred[ tuple[ 0 ] ] = function() { deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; deferred[ tuple[ 0 ] + "With" ] = list.fireWith; } ); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. // If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // Add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .progress( updateFunc( i, progressContexts, progressValues ) ) .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ); } else { --remaining; } } } // If we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } } ); // The deferred used on DOM ready var readyList; jQuery.fn.ready = function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }; jQuery.extend( { // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.triggerHandler ) { jQuery( document ).triggerHandler( "ready" ); jQuery( document ).off( "ready" ); } } } ); /** * The ready event handler and self cleanup method */ function completed() { document.removeEventListener( "DOMContentLoaded", completed ); window.removeEventListener( "load", completed ); jQuery.ready(); } jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called // after the browser event has already occurred. // Support: IE9-10 only // Older IE sometimes signals "interactive" too soon if ( document.readyState === "complete" || ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { // Handle it asynchronously to allow scripts the opportunity to delay ready window.setTimeout( jQuery.ready ); } else { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed ); } } return readyList.promise( obj ); }; // Kick off the DOM ready check even if the user does not jQuery.ready.promise(); // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, len = elems.length, bulk = key == null; // Sets many values if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { access( elems, fn, i, key[ i ], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !jQuery.isFunction( value ) ) { raw = true; } if ( bulk ) { // Bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < len; i++ ) { fn( elems[ i ], key, raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) ); } } } return chainable ? elems : // Gets bulk ? fn.call( elems ) : len ? fn( elems[ 0 ], key ) : emptyGet; }; var acceptData = function( owner ) { // Accepts only: // - Node // - Node.ELEMENT_NODE // - Node.DOCUMENT_NODE // - Object // - Any /* jshint -W018 */ return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); }; function Data() { this.expando = jQuery.expando + Data.uid++; } Data.uid = 1; Data.prototype = { register: function( owner, initial ) { var value = initial || {}; // If it is a node unlikely to be stringify-ed or looped over // use plain assignment if ( owner.nodeType ) { owner[ this.expando ] = value; // Otherwise secure it in a non-enumerable, non-writable property // configurability must be true to allow the property to be // deleted with the delete operator } else { Object.defineProperty( owner, this.expando, { value: value, writable: true, configurable: true } ); } return owner[ this.expando ]; }, cache: function( owner ) { // We can accept data for non-element nodes in modern browsers, // but we should not, see #8335. // Always return an empty object. if ( !acceptData( owner ) ) { return {}; } // Check if the owner object already has a cache var value = owner[ this.expando ]; // If not, create one if ( !value ) { value = {}; // We can accept data for non-element nodes in modern browsers, // but we should not, see #8335. // Always return an empty object. if ( acceptData( owner ) ) { // If it is a node unlikely to be stringify-ed or looped over // use plain assignment if ( owner.nodeType ) { owner[ this.expando ] = value; // Otherwise secure it in a non-enumerable property // configurable must be true to allow the property to be // deleted when data is removed } else { Object.defineProperty( owner, this.expando, { value: value, configurable: true } ); } } } return value; }, set: function( owner, data, value ) { var prop, cache = this.cache( owner ); // Handle: [ owner, key, value ] args if ( typeof data === "string" ) { cache[ data ] = value; // Handle: [ owner, { properties } ] args } else { // Copy the properties one-by-one to the cache object for ( prop in data ) { cache[ prop ] = data[ prop ]; } } return cache; }, get: function( owner, key ) { return key === undefined ? this.cache( owner ) : owner[ this.expando ] && owner[ this.expando ][ key ]; }, access: function( owner, key, value ) { var stored; // In cases where either: // // 1. No key was specified // 2. A string key was specified, but no value provided // // Take the "read" path and allow the get method to determine // which value to return, respectively either: // // 1. The entire cache object // 2. The data stored at the key // if ( key === undefined || ( ( key && typeof key === "string" ) && value === undefined ) ) { stored = this.get( owner, key ); return stored !== undefined ? stored : this.get( owner, jQuery.camelCase( key ) ); } // When the key is not a string, or both a key and value // are specified, set or extend (existing objects) with either: // // 1. An object of properties // 2. A key and value // this.set( owner, key, value ); // Since the "set" path can have two possible entry points // return the expected data based on which path was taken[*] return value !== undefined ? value : key; }, remove: function( owner, key ) { var i, name, camel, cache = owner[ this.expando ]; if ( cache === undefined ) { return; } if ( key === undefined ) { this.register( owner ); } else { // Support array or space separated string of keys if ( jQuery.isArray( key ) ) { // If "name" is an array of keys... // When data is initially created, via ("key", "val") signature, // keys will be converted to camelCase. // Since there is no way to tell _how_ a key was added, remove // both plain key and camelCase key. #12786 // This will only penalize the array argument path. name = key.concat( key.map( jQuery.camelCase ) ); } else { camel = jQuery.camelCase( key ); // Try the string as a key before any manipulation if ( key in cache ) { name = [ key, camel ]; } else { // If a key with the spaces exists, use it. // Otherwise, create an array by matching non-whitespace name = camel; name = name in cache ? [ name ] : ( name.match( rnotwhite ) || [] ); } } i = name.length; while ( i-- ) { delete cache[ name[ i ] ]; } } // Remove the expando if there's no more data if ( key === undefined || jQuery.isEmptyObject( cache ) ) { // Support: Chrome <= 35-45+ // Webkit & Blink performance suffers when deleting properties // from DOM nodes, so set to undefined instead // https://code.google.com/p/chromium/issues/detail?id=378607 if ( owner.nodeType ) { owner[ this.expando ] = undefined; } else { delete owner[ this.expando ]; } } }, hasData: function( owner ) { var cache = owner[ this.expando ]; return cache !== undefined && !jQuery.isEmptyObject( cache ); } }; var dataPriv = new Data(); var dataUser = new Data(); // Implementation Summary // // 1. Enforce API surface and semantic compatibility with 1.9.x branch // 2. Improve the module's maintainability by reducing the storage // paths to a single mechanism. // 3. Use the same single mechanism to support "private" and "user" data. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) // 5. Avoid exposing implementation details on user objects (eg. expando properties) // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; function dataAttr( elem, key, data ) { var name; // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch ( e ) {} // Make sure we set the data so it isn't changed later dataUser.set( elem, key, data ); } else { data = undefined; } } return data; } jQuery.extend( { hasData: function( elem ) { return dataUser.hasData( elem ) || dataPriv.hasData( elem ); }, data: function( elem, name, data ) { return dataUser.access( elem, name, data ); }, removeData: function( elem, name ) { dataUser.remove( elem, name ); }, // TODO: Now that all calls to _data and _removeData have been replaced // with direct calls to dataPriv methods, these can be deprecated. _data: function( elem, name, data ) { return dataPriv.access( elem, name, data ); }, _removeData: function( elem, name ) { dataPriv.remove( elem, name ); } } ); jQuery.fn.extend( { data: function( key, value ) { var i, name, data, elem = this[ 0 ], attrs = elem && elem.attributes; // Gets all values if ( key === undefined ) { if ( this.length ) { data = dataUser.get( elem ); if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { i = attrs.length; while ( i-- ) { // Support: IE11+ // The attrs elements can be null (#14894) if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.slice( 5 ) ); dataAttr( elem, name, data[ name ] ); } } } dataPriv.set( elem, "hasDataAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each( function() { dataUser.set( this, key ); } ); } return access( this, function( value ) { var data, camelKey; // The calling jQuery object (element matches) is not empty // (and therefore has an element appears at this[ 0 ]) and the // `value` parameter was not undefined. An empty jQuery object // will result in `undefined` for elem = this[ 0 ] which will // throw an exception if an attempt to read a data cache is made. if ( elem && value === undefined ) { // Attempt to get data from the cache // with the key as-is data = dataUser.get( elem, key ) || // Try to find dashed key if it exists (gh-2779) // This is for 2.2.x only dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() ); if ( data !== undefined ) { return data; } camelKey = jQuery.camelCase( key ); // Attempt to get data from the cache // with the key camelized data = dataUser.get( elem, camelKey ); if ( data !== undefined ) { return data; } // Attempt to "discover" the data in // HTML5 custom data-* attrs data = dataAttr( elem, camelKey, undefined ); if ( data !== undefined ) { return data; } // We tried really hard, but the data doesn't exist. return; } // Set the data... camelKey = jQuery.camelCase( key ); this.each( function() { // First, attempt to store a copy or reference of any // data that might've been store with a camelCased key. var data = dataUser.get( this, camelKey ); // For HTML5 data-* attribute interop, we have to // store property names with dashes in a camelCase form. // This might not apply to all properties...* dataUser.set( this, camelKey, value ); // *... In the case of properties that might _actually_ // have dashes, we need to also store a copy of that // unchanged property. if ( key.indexOf( "-" ) > -1 && data !== undefined ) { dataUser.set( this, key, value ); } } ); }, null, value, arguments.length > 1, null, true ); }, removeData: function( key ) { return this.each( function() { dataUser.remove( this, key ); } ); } } ); jQuery.extend( { queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = dataPriv.get( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray( data ) ) { queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // Clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // Not public - generate a queueHooks object, or return the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { empty: jQuery.Callbacks( "once memory" ).add( function() { dataPriv.remove( elem, [ type + "queue", key ] ); } ) } ); } } ); jQuery.fn.extend( { queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[ 0 ], type ); } return data === undefined ? this : this.each( function() { var queue = jQuery.queue( this, type, data ); // Ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { jQuery.dequeue( this, type ); } } ); }, dequeue: function( type ) { return this.each( function() { jQuery.dequeue( this, type ); } ); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } } ); var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; var isHidden = function( elem, el ) { // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }; function adjustCSS( elem, prop, valueParts, tween ) { var adjusted, scale = 1, maxIterations = 20, currentValue = tween ? function() { return tween.cur(); } : function() { return jQuery.css( elem, prop, "" ); }, initial = currentValue(), unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), // Starting value computation is required for potential unit mismatches initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && rcssNum.exec( jQuery.css( elem, prop ) ); if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { // Trust units reported by jQuery.css unit = unit || initialInUnit[ 3 ]; // Make sure we update the tween properties later on valueParts = valueParts || []; // Iteratively approximate from a nonzero starting point initialInUnit = +initial || 1; do { // If previous iteration zeroed out, double until we get *something*. // Use string for doubling so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply initialInUnit = initialInUnit / scale; jQuery.style( elem, prop, initialInUnit + unit ); // Update scale, tolerating zero or NaN from tween.cur() // Break the loop if scale is unchanged or perfect, or if we've just had enough. } while ( scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations ); } if ( valueParts ) { initialInUnit = +initialInUnit || +initial || 0; // Apply relative offset (+=/-=) if specified adjusted = valueParts[ 1 ] ? initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : +valueParts[ 2 ]; if ( tween ) { tween.unit = unit; tween.start = initialInUnit; tween.end = adjusted; } } return adjusted; } var rcheckableType = ( /^(?:checkbox|radio)$/i ); var rtagName = ( /<([\w:-]+)/ ); var rscriptType = ( /^$|\/(?:java|ecma)script/i ); // We have to close these tags to support XHTML (#13200) var wrapMap = { // Support: IE9 option: [ 1, "<select multiple='multiple'>", "</select>" ], // XHTML parsers do not magically insert elements in the // same way that tag soup parsers do. So we cannot shorten // this by omitting <tbody> or other required elements. thead: [ 1, "<table>", "</table>" ], col: [ 2, "<table><colgroup>", "</colgroup></table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], _default: [ 0, "", "" ] }; // Support: IE9 wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; function getAll( context, tag ) { // Support: IE9-11+ // Use typeof to avoid zero-argument method invocation on host objects (#15151) var ret = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) : typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) : []; return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], ret ) : ret; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var i = 0, l = elems.length; for ( ; i < l; i++ ) { dataPriv.set( elems[ i ], "globalEval", !refElements || dataPriv.get( refElements[ i ], "globalEval" ) ); } } var rhtml = /<|&#?\w+;/; function buildFragment( elems, context, scripts, selection, ignored ) { var elem, tmp, tag, wrap, contains, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); // Convert non-html into a text node } else if ( !rhtml.test( elem ) ) { nodes.push( context.createTextNode( elem ) ); // Convert html into DOM nodes } else { tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); // Deserialize a standard representation tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; // Descend through wrappers to the right content j = wrap[ 0 ]; while ( j-- ) { tmp = tmp.lastChild; } // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, tmp.childNodes ); // Remember the top-level container tmp = fragment.firstChild; // Ensure the created nodes are orphaned (#12392) tmp.textContent = ""; } } } // Remove wrapper from fragment fragment.textContent = ""; i = 0; while ( ( elem = nodes[ i++ ] ) ) { // Skip elements already in the context collection (trac-4087) if ( selection && jQuery.inArray( elem, selection ) > -1 ) { if ( ignored ) { ignored.push( elem ); } continue; } contains = jQuery.contains( elem.ownerDocument, elem ); // Append to fragment tmp = getAll( fragment.appendChild( elem ), "script" ); // Preserve script evaluation history if ( contains ) { setGlobalEval( tmp ); } // Capture executables if ( scripts ) { j = 0; while ( ( elem = tmp[ j++ ] ) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } return fragment; } ( function() { var fragment = document.createDocumentFragment(), div = fragment.appendChild( document.createElement( "div" ) ), input = document.createElement( "input" ); // Support: Android 4.0-4.3, Safari<=5.1 // Check state lost if the name is set (#11217) // Support: Windows Web Apps (WWA) // `name` and `type` must use .setAttribute for WWA (#14901) input.setAttribute( "type", "radio" ); input.setAttribute( "checked", "checked" ); input.setAttribute( "name", "t" ); div.appendChild( input ); // Support: Safari<=5.1, Android<4.2 // Older WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<=11+ // Make sure textarea (and checkbox) defaultValue is properly cloned div.innerHTML = "<textarea>x</textarea>"; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; } )(); var rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rtypenamespace = /^([^.]*)(?:\.(.+)|)/; function returnTrue() { return true; } function returnFalse() { return false; } // Support: IE9 // See #13393 for more info function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } function on( elem, types, selector, data, fn, one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { on( elem, type, selector, data, types[ type ], one ); } return elem; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return elem; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return elem.each( function() { jQuery.event.add( this, types, fn, data, selector ); } ); } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get( elem ); // Don't attach events to noData or text/comment nodes (but allow plain objects) if ( !elemData ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first if ( !( events = elemData.events ) ) { events = elemData.events = {}; } if ( !( eventHandle = elemData.handle ) ) { eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply( elem, arguments ) : undefined; }; } // Handle multiple events separated by a space types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; type = origType = tmp[ 1 ]; namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); // There *must* be a type, no attaching namespace-only handlers if ( !type ) { continue; } // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend( { type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join( "." ) }, handleObjIn ); // Init the event handler queue if we're the first if ( !( handlers = events[ type ] ) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } }, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); if ( !elemData || !( events = elemData.events ) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; type = origType = tmp[ 1 ]; namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[ 2 ] && new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); // Remove matching events origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove data and the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { dataPriv.remove( elem, "handle events" ); } }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event ); var i, j, ret, matched, handleObj, handlerQueue = [], args = slice.call( arguments ), handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[ 0 ] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers handlerQueue = jQuery.event.handlers.call( this, event, handlers ); // Run delegates first; they may want to stop propagation beneath us i = 0; while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( ( handleObj = matched.handlers[ j++ ] ) && !event.isImmediatePropagationStopped() ) { // Triggered event must either 1) have no namespace, or 2) have namespace(s) // a subset or equal to those in the bound event (both can have no namespace). if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || handleObj.handler ).apply( matched.elem, args ); if ( ret !== undefined ) { if ( ( event.result = ret ) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var i, matches, sel, handleObj, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Support (at least): Chrome, IE9 // Find delegate handlers // Black-hole SVG <use> instance trees (#13180) // // Support: Firefox<=42+ // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) if ( delegateCount && cur.nodeType && ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { for ( ; cur !== this; cur = cur.parentNode || this ) { // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) > -1 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push( { elem: cur, handlers: matches } ); } } } } // Add the remaining (directly-bound) handlers if ( delegateCount < handlers.length ) { handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); } return handlerQueue; }, // Includes some event props shared by KeyEvent and MouseEvent props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split( " " ), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " + "screenX screenY toElement" ).split( " " ), filter: function( event, original ) { var eventDoc, doc, body, button = original.button; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } // Support: Cordova 2.5 (WebKit) (#13255) // All events should have a target; Cordova deviceready doesn't if ( !event.target ) { event.target = document; } // Support: Safari 6.0+, Chrome<28 // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { // Fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== safeActiveElement() && this.focus ) { this.focus(); return false; } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === safeActiveElement() && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, click: { // For checkbox, fire native event so checked state will be right trigger: function() { if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { this.click(); return false; } }, // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { return jQuery.nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( event ) { // Support: Firefox 20+ // Firefox doesn't alert if the returnValue field is not set. if ( event.result !== undefined && event.originalEvent ) { event.originalEvent.returnValue = event.result; } } } } }; jQuery.removeEvent = function( elem, type, handle ) { // This "if" is needed for plain objects if ( elem.removeEventListener ) { elem.removeEventListener( type, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !( this instanceof jQuery.Event ) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && // Support: Android<4.0 src.returnValue === false ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { constructor: jQuery.Event, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, isSimulated: false, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( e && !this.isSimulated ) { e.preventDefault(); } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( e && !this.isSimulated ) { e.stopPropagation(); } }, stopImmediatePropagation: function() { var e = this.originalEvent; this.isImmediatePropagationStopped = returnTrue; if ( e && !this.isSimulated ) { e.stopImmediatePropagation(); } this.stopPropagation(); } }; // Create mouseenter/leave events using mouseover/out and event-time checks // so that event delegation works in jQuery. // Do the same for pointerenter/pointerleave and pointerover/pointerout // // Support: Safari 7 only // Safari sends mouseenter too often; see: // https://code.google.com/p/chromium/issues/detail?id=470258 // for the description of the bug (it existed in older Chrome versions as well). jQuery.each( { mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mouseenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; } ); jQuery.fn.extend( { on: function( types, selector, data, fn ) { return on( this, types, selector, data, fn ); }, one: function( types, selector, data, fn ) { return on( this, types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each( function() { jQuery.event.remove( this, types, fn, selector ); } ); } } ); var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, // Support: IE 10-11, Edge 10240+ // In IE/Edge using regex groups here causes severe slowdowns. // See https://connect.microsoft.com/IE/feedback/details/1736512/ rnoInnerhtml = /<script|<style|<link/i, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; // Manipulating tables requires a tbody function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? elem.getElementsByTagName( "tbody" )[ 0 ] || elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[ 1 ]; } else { elem.removeAttribute( "type" ); } return elem; } function cloneCopyEvent( src, dest ) { var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; if ( dest.nodeType !== 1 ) { return; } // 1. Copy private data: events, handlers, etc. if ( dataPriv.hasData( src ) ) { pdataOld = dataPriv.access( src ); pdataCur = dataPriv.set( dest, pdataOld ); events = pdataOld.events; if ( events ) { delete pdataCur.handle; pdataCur.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } } // 2. Copy user data if ( dataUser.hasData( src ) ) { udataOld = dataUser.access( src ); udataCur = jQuery.extend( {}, udataOld ); dataUser.set( dest, udataCur ); } } // Fix IE bugs, see support tests function fixInput( src, dest ) { var nodeName = dest.nodeName.toLowerCase(); // Fails to persist the checked state of a cloned checkbox or radio button. if ( nodeName === "input" && rcheckableType.test( src.type ) ) { dest.checked = src.checked; // Fails to return the selected option to the default selected state when cloning options } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } function domManip( collection, args, callback, ignored ) { // Flatten any nested arrays args = concat.apply( [], args ); var fragment, first, scripts, hasScripts, node, doc, i = 0, l = collection.length, iNoClone = l - 1, value = args[ 0 ], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return collection.each( function( index ) { var self = collection.eq( index ); if ( isFunction ) { args[ 0 ] = value.call( this, index, self.html() ); } domManip( self, args, callback, ignored ); } ); } if ( l ) { fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } // Require either new content or an interest in ignored elements to invoke the callback if ( first || ignored ) { scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; // Use the original fragment for the last item // instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); // Keep references to cloned scripts for later restoration if ( hasScripts ) { // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( collection[ i ], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; // Reenable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !dataPriv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); } } } } } } return collection; } function remove( elem, selector, keepData ) { var node, nodes = selector ? jQuery.filter( selector, elem ) : elem, i = 0; for ( ; ( node = nodes[ i ] ) != null; i++ ) { if ( !keepData && node.nodeType === 1 ) { jQuery.cleanData( getAll( node ) ); } if ( node.parentNode ) { if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { setGlobalEval( getAll( node, "script" ) ); } node.parentNode.removeChild( node ); } } return elem; } jQuery.extend( { htmlPrefilter: function( html ) { return html.replace( rxhtmlTag, "<$1></$2>" ); }, clone: function( elem, dataAndEvents, deepDataAndEvents ) { var i, l, srcElements, destElements, clone = elem.cloneNode( true ), inPage = jQuery.contains( elem.ownerDocument, elem ); // Fix IE cloning issues if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); for ( i = 0, l = srcElements.length; i < l; i++ ) { fixInput( srcElements[ i ], destElements[ i ] ); } } // Copy the events from the original to the clone if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0, l = srcElements.length; i < l; i++ ) { cloneCopyEvent( srcElements[ i ], destElements[ i ] ); } } else { cloneCopyEvent( elem, clone ); } } // Preserve script evaluation history destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } // Return the cloned set return clone; }, cleanData: function( elems ) { var data, elem, type, special = jQuery.event.special, i = 0; for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { if ( acceptData( elem ) ) { if ( ( data = elem[ dataPriv.expando ] ) ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Support: Chrome <= 35-45+ // Assign undefined instead of using delete, see Data#remove elem[ dataPriv.expando ] = undefined; } if ( elem[ dataUser.expando ] ) { // Support: Chrome <= 35-45+ // Assign undefined instead of using delete, see Data#remove elem[ dataUser.expando ] = undefined; } } } } } ); jQuery.fn.extend( { // Keep domManip exposed until 3.0 (gh-2225) domManip: domManip, detach: function( selector ) { return remove( this, selector, true ); }, remove: function( selector ) { return remove( this, selector ); }, text: function( value ) { return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().each( function() { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { this.textContent = value; } } ); }, null, value, arguments.length ); }, append: function() { return domManip( this, arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } } ); }, prepend: function() { return domManip( this, arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } } ); }, before: function() { return domManip( this, arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } } ); }, after: function() { return domManip( this, arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } } ); }, empty: function() { var elem, i = 0; for ( ; ( elem = this[ i ] ) != null; i++ ) { if ( elem.nodeType === 1 ) { // Prevent memory leaks jQuery.cleanData( getAll( elem, false ) ); // Remove any remaining nodes elem.textContent = ""; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); } ); }, html: function( value ) { return access( this, function( value ) { var elem = this[ 0 ] || {}, i = 0, l = this.length; if ( value === undefined && elem.nodeType === 1 ) { return elem.innerHTML; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { value = jQuery.htmlPrefilter( value ); try { for ( ; i < l; i++ ) { elem = this[ i ] || {}; // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch ( e ) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function() { var ignored = []; // Make the changes, replacing each non-ignored context element with the new content return domManip( this, arguments, function( elem ) { var parent = this.parentNode; if ( jQuery.inArray( this, ignored ) < 0 ) { jQuery.cleanData( getAll( this ) ); if ( parent ) { parent.replaceChild( elem, this ); } } // Force callback invocation }, ignored ); } } ); jQuery.each( { appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, ret = [], insert = jQuery( selector ), last = insert.length - 1, i = 0; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone( true ); jQuery( insert[ i ] )[ original ]( elems ); // Support: QtWebKit // .get() because push.apply(_, arraylike) throws push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; } ); var iframe, elemdisplay = { // Support: Firefox // We have to pre-define these values for FF (#10227) HTML: "block", BODY: "block" }; /** * Retrieve the actual display of a element * @param {String} name nodeName of the element * @param {Object} doc Document object */ // Called only from within defaultDisplay function actualDisplay( name, doc ) { var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), display = jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element elem.detach(); return display; } /** * Try to determine the default display value of an element * @param {String} nodeName */ function defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) ) .appendTo( doc.documentElement ); // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse doc = iframe[ 0 ].contentDocument; // Support: IE doc.write(); doc.close(); display = actualDisplay( nodeName, doc ); iframe.detach(); } // Store the correct default display elemdisplay[ nodeName ] = display; } return display; } var rmargin = ( /^margin/ ); var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); var getStyles = function( elem ) { // Support: IE<=11+, Firefox<=30+ (#15098, #14150) // IE throws on elements created in popups // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" var view = elem.ownerDocument.defaultView; if ( !view || !view.opener ) { view = window; } return view.getComputedStyle( elem ); }; var swap = function( elem, options, callback, args ) { var ret, name, old = {}; // Remember the old values, and insert the new ones for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.apply( elem, args || [] ); // Revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; }; var documentElement = document.documentElement; ( function() { var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, container = document.createElement( "div" ), div = document.createElement( "div" ); // Finish early in limited (non-browser) environments if ( !div.style ) { return; } // Support: IE9-11+ // Style of cloned element affects source element cloned (#8908) div.style.backgroundClip = "content-box"; div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + "padding:0;margin-top:1px;position:absolute"; container.appendChild( div ); // Executing both pixelPosition & boxSizingReliable tests require only one layout // so they're executed at the same time to save the second computation. function computeStyleTests() { div.style.cssText = // Support: Firefox<29, Android 2.3 // Vendor-prefix box-sizing "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" + "position:relative;display:block;" + "margin:auto;border:1px;padding:1px;" + "top:1%;width:50%"; div.innerHTML = ""; documentElement.appendChild( container ); var divStyle = window.getComputedStyle( div ); pixelPositionVal = divStyle.top !== "1%"; reliableMarginLeftVal = divStyle.marginLeft === "2px"; boxSizingReliableVal = divStyle.width === "4px"; // Support: Android 4.0 - 4.3 only // Some styles come back with percentage values, even though they shouldn't div.style.marginRight = "50%"; pixelMarginRightVal = divStyle.marginRight === "4px"; documentElement.removeChild( container ); } jQuery.extend( support, { pixelPosition: function() { // This test is executed only once but we still do memoizing // since we can use the boxSizingReliable pre-computing. // No need to check if the test was already performed, though. computeStyleTests(); return pixelPositionVal; }, boxSizingReliable: function() { if ( boxSizingReliableVal == null ) { computeStyleTests(); } return boxSizingReliableVal; }, pixelMarginRight: function() { // Support: Android 4.0-4.3 // We're checking for boxSizingReliableVal here instead of pixelMarginRightVal // since that compresses better and they're computed together anyway. if ( boxSizingReliableVal == null ) { computeStyleTests(); } return pixelMarginRightVal; }, reliableMarginLeft: function() { // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37 if ( boxSizingReliableVal == null ) { computeStyleTests(); } return reliableMarginLeftVal; }, reliableMarginRight: function() { // Support: Android 2.3 // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. (#3333) // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // This support function is only executed once so no memoizing is needed. var ret, marginDiv = div.appendChild( document.createElement( "div" ) ); // Reset CSS: box-sizing; display; margin; border; padding marginDiv.style.cssText = div.style.cssText = // Support: Android 2.3 // Vendor-prefix box-sizing "-webkit-box-sizing:content-box;box-sizing:content-box;" + "display:block;margin:0;border:0;padding:0"; marginDiv.style.marginRight = marginDiv.style.width = "0"; div.style.width = "1px"; documentElement.appendChild( container ); ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight ); documentElement.removeChild( container ); div.removeChild( marginDiv ); return ret; } } ); } )(); function curCSS( elem, name, computed ) { var width, minWidth, maxWidth, ret, style = elem.style; computed = computed || getStyles( elem ); ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; // Support: Opera 12.1x only // Fall back to style even without computed // computed is undefined for elems on document fragments if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); } // Support: IE9 // getPropertyValue is only needed for .css('filter') (#12537) if ( computed ) { // A tribute to the "awesome hack by Dean Edwards" // Android Browser returns percentage for some values, // but width seems to be reliably pixels. // This is against the CSSOM draft spec: // http://dev.w3.org/csswg/cssom/#resolved-values if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { // Remember the original values width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; // Put in the new values to get a computed value out style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; // Revert the changed values style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } return ret !== undefined ? // Support: IE9-11+ // IE returns zIndex value as an integer. ret + "" : ret; } function addGetHookIf( conditionFn, hookFn ) { // Define the hook, we'll check on the first run if it's really needed. return { get: function() { if ( conditionFn() ) { // Hook not needed (or it's not possible to use it due // to missing dependency), remove it. delete this.get; return; } // Hook needed; redefine it so that the support test is not executed again. return ( this.get = hookFn ).apply( this, arguments ); } }; } var // Swappable if display is none or starts with table // except "table", "table-cell", or "table-caption" // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: "0", fontWeight: "400" }, cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], emptyStyle = document.createElement( "div" ).style; // Return a css property mapped to a potentially vendor prefixed property function vendorPropName( name ) { // Shortcut for names that are not vendor prefixed if ( name in emptyStyle ) { return name; } // Check for vendor prefixed names var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in emptyStyle ) { return name; } } } function setPositiveNumber( elem, value, subtract ) { // Any relative (+/-) values have already been // normalized at this point var matches = rcssNum.exec( value ); return matches ? // Guard against undefined "subtract", e.g., when used as in cssHooks Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { var i = extra === ( isBorderBox ? "border" : "content" ) ? // If we already have the right measurement, avoid augmentation 4 : // Otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { // Both box models exclude margin, so add it if we want it if ( extra === "margin" ) { val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); } if ( isBorderBox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); } // At this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } else { // At this point, extra isn't content, so add padding val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); // At this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } } return val; } function getWidthOrHeight( elem, name, extra ) { // Start with offset property, which is equivalent to the border-box value var valueIsBorderBox = true, val = name === "width" ? elem.offsetWidth : elem.offsetHeight, styles = getStyles( elem ), isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; // Some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if ( val <= 0 || val == null ) { // Fall back to computed then uncomputed css if necessary val = curCSS( elem, name, styles ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } // Computed unit is not pixels. Stop here and return. if ( rnumnonpx.test( val ) ) { return val; } // Check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] ); // Normalize "", auto, and prepare for extra val = parseFloat( val ) || 0; } // Use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox, styles ) ) + "px"; } function showHide( elements, show ) { var display, elem, hidden, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = dataPriv.get( elem, "olddisplay" ); display = elem.style.display; if ( show ) { // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !values[ index ] && display === "none" ) { elem.style.display = ""; } // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if ( elem.style.display === "" && isHidden( elem ) ) { values[ index ] = dataPriv.access( elem, "olddisplay", defaultDisplay( elem.nodeName ) ); } } else { hidden = isHidden( elem ); if ( display !== "none" || !hidden ) { dataPriv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); } } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; } jQuery.extend( { // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // We should always get a number back from opacity var ret = curCSS( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, // Don't automatically add "px" to these possibly-unitless properties cssNumber: { "animationIterationCount": true, "columnCount": true, "fillOpacity": true, "flexGrow": true, "flexShrink": true, "fontWeight": true, "lineHeight": true, "opacity": true, "order": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { "float": "cssFloat" }, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } // Make sure that we're working with the right name var ret, type, hooks, origName = jQuery.camelCase( name ), style = elem.style; name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); // Gets hook for the prefixed version, then unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // Check if we're setting a value if ( value !== undefined ) { type = typeof value; // Convert "+=" or "-=" to relative numbers (#7345) if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { value = adjustCSS( elem, name, ret ); // Fixes bug #9237 type = "number"; } // Make sure that null and NaN values aren't set (#7116) if ( value == null || value !== value ) { return; } // If a number was passed in, add the unit (except for certain CSS properties) if ( type === "number" ) { value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); } // Support: IE9-11+ // background-* props affect original clone's values if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { style[ name ] = "inherit"; } // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !( "set" in hooks ) || ( value = hooks.set( elem, value, extra ) ) !== undefined ) { style[ name ] = value; } } else { // If a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { return ret; } // Otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, extra, styles ) { var val, num, hooks, origName = jQuery.camelCase( name ); // Make sure that we're working with the right name name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); // Try prefixed name followed by the unprefixed name hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // If a hook was provided get the computed value from there if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } // Otherwise, if a way to get the computed value exists, use that if ( val === undefined ) { val = curCSS( elem, name, styles ); } // Convert "normal" to computed value if ( val === "normal" && name in cssNormalTransform ) { val = cssNormalTransform[ name ]; } // Make numeric if forced or a qualifier was provided and val looks numeric if ( extra === "" || extra ) { num = parseFloat( val ); return extra === true || isFinite( num ) ? num || 0 : val; } return val; } } ); jQuery.each( [ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { if ( computed ) { // Certain elements can have dimension info if we invisibly show them // but it must have a current display style that would benefit return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? swap( elem, cssShow, function() { return getWidthOrHeight( elem, name, extra ); } ) : getWidthOrHeight( elem, name, extra ); } }, set: function( elem, value, extra ) { var matches, styles = extra && getStyles( elem ), subtract = extra && augmentWidthOrHeight( elem, name, extra, jQuery.css( elem, "boxSizing", false, styles ) === "border-box", styles ); // Convert to pixels if value adjustment is needed if ( subtract && ( matches = rcssNum.exec( value ) ) && ( matches[ 3 ] || "px" ) !== "px" ) { elem.style[ name ] = value; value = jQuery.css( elem, name ); } return setPositiveNumber( elem, value, subtract ); } }; } ); jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, function( elem, computed ) { if ( computed ) { return ( parseFloat( curCSS( elem, "marginLeft" ) ) || elem.getBoundingClientRect().left - swap( elem, { marginLeft: 0 }, function() { return elem.getBoundingClientRect().left; } ) ) + "px"; } } ); // Support: Android 2.3 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, function( elem, computed ) { if ( computed ) { return swap( elem, { "display": "inline-block" }, curCSS, [ elem, "marginRight" ] ); } } ); // These hooks are used by animate to expand properties jQuery.each( { margin: "", padding: "", border: "Width" }, function( prefix, suffix ) { jQuery.cssHooks[ prefix + suffix ] = { expand: function( value ) { var i = 0, expanded = {}, // Assumes a single number if not a string parts = typeof value === "string" ? value.split( " " ) : [ value ]; for ( ; i < 4; i++ ) { expanded[ prefix + cssExpand[ i ] + suffix ] = parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; } return expanded; } }; if ( !rmargin.test( prefix ) ) { jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; } } ); jQuery.fn.extend( { css: function( name, value ) { return access( this, function( elem, name, value ) { var styles, len, map = {}, i = 0; if ( jQuery.isArray( name ) ) { styles = getStyles( elem ); len = name.length; for ( ; i < len; i++ ) { map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); } return map; } return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }, name, value, arguments.length > 1 ); }, show: function() { return showHide( this, true ); }, hide: function() { return showHide( this ); }, toggle: function( state ) { if ( typeof state === "boolean" ) { return state ? this.show() : this.hide(); } return this.each( function() { if ( isHidden( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); } } ); } } ); function Tween( elem, options, prop, end, easing ) { return new Tween.prototype.init( elem, options, prop, end, easing ); } jQuery.Tween = Tween; Tween.prototype = { constructor: Tween, init: function( elem, options, prop, end, easing, unit ) { this.elem = elem; this.prop = prop; this.easing = easing || jQuery.easing._default; this.options = options; this.start = this.now = this.cur(); this.end = end; this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); }, cur: function() { var hooks = Tween.propHooks[ this.prop ]; return hooks && hooks.get ? hooks.get( this ) : Tween.propHooks._default.get( this ); }, run: function( percent ) { var eased, hooks = Tween.propHooks[ this.prop ]; if ( this.options.duration ) { this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration ); } else { this.pos = eased = percent; } this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); } if ( hooks && hooks.set ) { hooks.set( this ); } else { Tween.propHooks._default.set( this ); } return this; } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { _default: { get: function( tween ) { var result; // Use a property on the element directly when it is not a DOM element, // or when there is no matching style property that exists. if ( tween.elem.nodeType !== 1 || tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { return tween.elem[ tween.prop ]; } // Passing an empty string as a 3rd parameter to .css will automatically // attempt a parseFloat and fallback to a string if the parse fails. // Simple values such as "10px" are parsed to Float; // complex values such as "rotate(1rad)" are returned as-is. result = jQuery.css( tween.elem, tween.prop, "" ); // Empty strings, null, undefined and "auto" are converted to 0. return !result || result === "auto" ? 0 : result; }, set: function( tween ) { // Use step hook for back compat. // Use cssHook if its there. // Use .style if available and use plain properties where available. if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.nodeType === 1 && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { tween.elem[ tween.prop ] = tween.now; } } } }; // Support: IE9 // Panic based approach to setting things on disconnected nodes Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { set: function( tween ) { if ( tween.elem.nodeType && tween.elem.parentNode ) { tween.elem[ tween.prop ] = tween.now; } } }; jQuery.easing = { linear: function( p ) { return p; }, swing: function( p ) { return 0.5 - Math.cos( p * Math.PI ) / 2; }, _default: "swing" }; jQuery.fx = Tween.prototype.init; // Back Compat <1.8 extension point jQuery.fx.step = {}; var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/; // Animations created synchronously will run synchronously function createFxNow() { window.setTimeout( function() { fxNow = undefined; } ); return ( fxNow = jQuery.now() ); } // Generate parameters to create a standard animation function genFx( type, includeWidth ) { var which, i = 0, attrs = { height: type }; // If we include width, step value is 1 to do all cssExpand values, // otherwise step value is 2 to skip over Left and Right includeWidth = includeWidth ? 1 : 0; for ( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; } function createTween( value, prop, animation ) { var tween, collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), index = 0, length = collection.length; for ( ; index < length; index++ ) { if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { // We're done with this property return tween; } } } function defaultPrefilter( elem, props, opts ) { /* jshint validthis: true */ var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHidden( elem ), dataShow = dataPriv.get( elem, "fxshow" ); // Handle queue: false promises if ( !opts.queue ) { hooks = jQuery._queueHooks( elem, "fx" ); if ( hooks.unqueued == null ) { hooks.unqueued = 0; oldfire = hooks.empty.fire; hooks.empty.fire = function() { if ( !hooks.unqueued ) { oldfire(); } }; } hooks.unqueued++; anim.always( function() { // Ensure the complete handler is called before this completes anim.always( function() { hooks.unqueued--; if ( !jQuery.queue( elem, "fx" ).length ) { hooks.empty.fire(); } } ); } ); } // Height/width overflow pass if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { // Make sure that nothing sneaks out // Record all 3 overflow attributes because IE9-10 do not // change the overflow attribute when overflowX and // overflowY are set to the same value opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; // Set display property to inline-block for height/width // animations on inline elements that are having width/height animated display = jQuery.css( elem, "display" ); // Test default display if display is currently "none" checkDisplay = display === "none" ? dataPriv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { style.display = "inline-block"; } } if ( opts.overflow ) { style.overflow = "hidden"; anim.always( function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; } ); } // show/hide pass for ( prop in props ) { value = props[ prop ]; if ( rfxtypes.exec( value ) ) { delete props[ prop ]; toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { // If there is dataShow left over from a stopped hide or show // and we are going to proceed with show, we should pretend to be hidden if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { hidden = true; } else { continue; } } orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); // Any non-fx value stops us from restoring the original display value } else { display = undefined; } } if ( !jQuery.isEmptyObject( orig ) ) { if ( dataShow ) { if ( "hidden" in dataShow ) { hidden = dataShow.hidden; } } else { dataShow = dataPriv.access( elem, "fxshow", {} ); } // Store state if its toggle - enables .stop().toggle() to "reverse" if ( toggle ) { dataShow.hidden = !hidden; } if ( hidden ) { jQuery( elem ).show(); } else { anim.done( function() { jQuery( elem ).hide(); } ); } anim.done( function() { var prop; dataPriv.remove( elem, "fxshow" ); for ( prop in orig ) { jQuery.style( elem, prop, orig[ prop ] ); } } ); for ( prop in orig ) { tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = tween.start; if ( hidden ) { tween.end = tween.start; tween.start = prop === "width" || prop === "height" ? 1 : 0; } } } // If this is a noop like .hide().hide(), restore an overwritten display value } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) { style.display = display; } } function propFilter( props, specialEasing ) { var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass for ( index in props ) { name = jQuery.camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( jQuery.isArray( value ) ) { easing = value[ 1 ]; value = props[ index ] = value[ 0 ]; } if ( index !== name ) { props[ name ] = value; delete props[ index ]; } hooks = jQuery.cssHooks[ name ]; if ( hooks && "expand" in hooks ) { value = hooks.expand( value ); delete props[ name ]; // Not quite $.extend, this won't overwrite existing keys. // Reusing 'index' because we have the correct "name" for ( index in value ) { if ( !( index in props ) ) { props[ index ] = value[ index ]; specialEasing[ index ] = easing; } } } else { specialEasing[ name ] = easing; } } } function Animation( elem, properties, options ) { var result, stopped, index = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always( function() { // Don't match elem in the :animated selector delete tick.elem; } ), tick = function() { if ( stopped ) { return false; } var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), // Support: Android 2.3 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( percent ); } deferred.notifyWith( elem, [ animation, percent, remaining ] ); if ( percent < 1 && length ) { return remaining; } else { deferred.resolveWith( elem, [ animation ] ); return false; } }, animation = deferred.promise( { elem: elem, props: jQuery.extend( {}, properties ), opts: jQuery.extend( true, { specialEasing: {}, easing: jQuery.easing._default }, options ), originalProperties: properties, originalOptions: options, startTime: fxNow || createFxNow(), duration: options.duration, tweens: [], createTween: function( prop, end ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, stop: function( gotoEnd ) { var index = 0, // If we are going to the end, we want to run all the tweens // otherwise we skip this part length = gotoEnd ? animation.tweens.length : 0; if ( stopped ) { return this; } stopped = true; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( 1 ); } // Resolve when we played the last frame; otherwise, reject if ( gotoEnd ) { deferred.notifyWith( elem, [ animation, 1, 0 ] ); deferred.resolveWith( elem, [ animation, gotoEnd ] ); } else { deferred.rejectWith( elem, [ animation, gotoEnd ] ); } return this; } } ), props = animation.props; propFilter( props, animation.opts.specialEasing ); for ( ; index < length ; index++ ) { result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); if ( result ) { if ( jQuery.isFunction( result.stop ) ) { jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = jQuery.proxy( result.stop, result ); } return result; } } jQuery.map( props, createTween, animation ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } jQuery.fx.timer( jQuery.extend( tick, { elem: elem, anim: animation, queue: animation.opts.queue } ) ); // attach callbacks from options return animation.progress( animation.opts.progress ) .done( animation.opts.done, animation.opts.complete ) .fail( animation.opts.fail ) .always( animation.opts.always ); } jQuery.Animation = jQuery.extend( Animation, { tweeners: { "*": [ function( prop, value ) { var tween = this.createTween( prop, value ); adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); return tween; } ] }, tweener: function( props, callback ) { if ( jQuery.isFunction( props ) ) { callback = props; props = [ "*" ]; } else { props = props.match( rnotwhite ); } var prop, index = 0, length = props.length; for ( ; index < length ; index++ ) { prop = props[ index ]; Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; Animation.tweeners[ prop ].unshift( callback ); } }, prefilters: [ defaultPrefilter ], prefilter: function( callback, prepend ) { if ( prepend ) { Animation.prefilters.unshift( callback ); } else { Animation.prefilters.push( callback ); } } } ); jQuery.speed = function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; // Normalize opt.queue - true/undefined/null -> "fx" if ( opt.queue == null || opt.queue === true ) { opt.queue = "fx"; } // Queueing opt.old = opt.complete; opt.complete = function() { if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } if ( opt.queue ) { jQuery.dequeue( this, opt.queue ); } }; return opt; }; jQuery.fn.extend( { fadeTo: function( speed, to, easing, callback ) { // Show any hidden elements after setting opacity to 0 return this.filter( isHidden ).css( "opacity", 0 ).show() // Animate to the value specified .end().animate( { opacity: to }, speed, easing, callback ); }, animate: function( prop, speed, easing, callback ) { var empty = jQuery.isEmptyObject( prop ), optall = jQuery.speed( speed, easing, callback ), doAnimation = function() { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation( this, jQuery.extend( {}, prop ), optall ); // Empty animations, or finishing resolves immediately if ( empty || dataPriv.get( this, "finish" ) ) { anim.stop( true ); } }; doAnimation.finish = doAnimation; return empty || optall.queue === false ? this.each( doAnimation ) : this.queue( optall.queue, doAnimation ); }, stop: function( type, clearQueue, gotoEnd ) { var stopQueue = function( hooks ) { var stop = hooks.stop; delete hooks.stop; stop( gotoEnd ); }; if ( typeof type !== "string" ) { gotoEnd = clearQueue; clearQueue = type; type = undefined; } if ( clearQueue && type !== false ) { this.queue( type || "fx", [] ); } return this.each( function() { var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = dataPriv.get( this ); if ( index ) { if ( data[ index ] && data[ index ].stop ) { stopQueue( data[ index ] ); } } else { for ( index in data ) { if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { stopQueue( data[ index ] ); } } } for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && ( type == null || timers[ index ].queue === type ) ) { timers[ index ].anim.stop( gotoEnd ); dequeue = false; timers.splice( index, 1 ); } } // Start the next in the queue if the last step wasn't forced. // Timers currently will call their complete callbacks, which // will dequeue but only if they were gotoEnd. if ( dequeue || !gotoEnd ) { jQuery.dequeue( this, type ); } } ); }, finish: function( type ) { if ( type !== false ) { type = type || "fx"; } return this.each( function() { var index, data = dataPriv.get( this ), queue = data[ type + "queue" ], hooks = data[ type + "queueHooks" ], timers = jQuery.timers, length = queue ? queue.length : 0; // Enable finishing flag on private data data.finish = true; // Empty the queue first jQuery.queue( this, type, [] ); if ( hooks && hooks.stop ) { hooks.stop.call( this, true ); } // Look for any active animations, and finish them for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && timers[ index ].queue === type ) { timers[ index ].anim.stop( true ); timers.splice( index, 1 ); } } // Look for any animations in the old queue and finish them for ( index = 0; index < length; index++ ) { if ( queue[ index ] && queue[ index ].finish ) { queue[ index ].finish.call( this ); } } // Turn off finishing flag delete data.finish; } ); } } ); jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { return speed == null || typeof speed === "boolean" ? cssFn.apply( this, arguments ) : this.animate( genFx( name, true ), speed, easing, callback ); }; } ); // Generate shortcuts for custom animations jQuery.each( { slideDown: genFx( "show" ), slideUp: genFx( "hide" ), slideToggle: genFx( "toggle" ), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; } ); jQuery.timers = []; jQuery.fx.tick = function() { var timer, i = 0, timers = jQuery.timers; fxNow = jQuery.now(); for ( ; i < timers.length; i++ ) { timer = timers[ i ]; // Checks the timer has not already been removed if ( !timer() && timers[ i ] === timer ) { timers.splice( i--, 1 ); } } if ( !timers.length ) { jQuery.fx.stop(); } fxNow = undefined; }; jQuery.fx.timer = function( timer ) { jQuery.timers.push( timer ); if ( timer() ) { jQuery.fx.start(); } else { jQuery.timers.pop(); } }; jQuery.fx.interval = 13; jQuery.fx.start = function() { if ( !timerId ) { timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval ); } }; jQuery.fx.stop = function() { window.clearInterval( timerId ); timerId = null; }; jQuery.fx.speeds = { slow: 600, fast: 200, // Default speed _default: 400 }; // Based off of the plugin by Clint Helfers, with permission. // http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ jQuery.fn.delay = function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = window.setTimeout( next, time ); hooks.stop = function() { window.clearTimeout( timeout ); }; } ); }; ( function() { var input = document.createElement( "input" ), select = document.createElement( "select" ), opt = select.appendChild( document.createElement( "option" ) ); input.type = "checkbox"; // Support: iOS<=5.1, Android<=4.2+ // Default value for a checkbox should be "on" support.checkOn = input.value !== ""; // Support: IE<=11+ // Must access selectedIndex to make default options select support.optSelected = opt.selected; // Support: Android<=2.3 // Options inside disabled selects are incorrectly marked as disabled select.disabled = true; support.optDisabled = !opt.disabled; // Support: IE<=11+ // An input loses its value after becoming a radio input = document.createElement( "input" ); input.value = "t"; input.type = "radio"; support.radioValue = input.value === "t"; } )(); var boolHook, attrHandle = jQuery.expr.attrHandle; jQuery.fn.extend( { attr: function( name, value ) { return access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each( function() { jQuery.removeAttr( this, name ); } ); } } ); jQuery.extend( { attr: function( elem, name, value ) { var ret, hooks, nType = elem.nodeType; // Don't get/set attributes on text, comment and attribute nodes if ( nType === 3 || nType === 8 || nType === 2 ) { return; } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === "undefined" ) { return jQuery.prop( elem, name, value ); } // All attributes are lowercase // Grab necessary hook if one is defined if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); return; } if ( hooks && "set" in hooks && ( ret = hooks.set( elem, value, name ) ) !== undefined ) { return ret; } elem.setAttribute( name, value + "" ); return value; } if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { return ret; } ret = jQuery.find.attr( elem, name ); // Non-existent attributes return null, we normalize to undefined return ret == null ? undefined : ret; }, attrHooks: { type: { set: function( elem, value ) { if ( !support.radioValue && value === "radio" && jQuery.nodeName( elem, "input" ) ) { var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } } }, removeAttr: function( elem, value ) { var name, propName, i = 0, attrNames = value && value.match( rnotwhite ); if ( attrNames && elem.nodeType === 1 ) { while ( ( name = attrNames[ i++ ] ) ) { propName = jQuery.propFix[ name ] || name; // Boolean attributes get special treatment (#10870) if ( jQuery.expr.match.bool.test( name ) ) { // Set corresponding property to false elem[ propName ] = false; } elem.removeAttribute( name ); } } } } ); // Hooks for boolean attributes boolHook = { set: function( elem, value, name ) { if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else { elem.setAttribute( name, name ); } return name; } }; jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { var getter = attrHandle[ name ] || jQuery.find.attr; attrHandle[ name ] = function( elem, name, isXML ) { var ret, handle; if ( !isXML ) { // Avoid an infinite loop by temporarily removing this function from the getter handle = attrHandle[ name ]; attrHandle[ name ] = ret; ret = getter( elem, name, isXML ) != null ? name.toLowerCase() : null; attrHandle[ name ] = handle; } return ret; }; } ); var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i; jQuery.fn.extend( { prop: function( name, value ) { return access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { return this.each( function() { delete this[ jQuery.propFix[ name ] || name ]; } ); } } ); jQuery.extend( { prop: function( elem, name, value ) { var ret, hooks, nType = elem.nodeType; // Don't get/set properties on text, comment and attribute nodes if ( nType === 3 || nType === 8 || nType === 2 ) { return; } if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && ( ret = hooks.set( elem, value, name ) ) !== undefined ) { return ret; } return ( elem[ name ] = value ); } if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { return ret; } return elem[ name ]; }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the // correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ // Use proper attribute retrieval(#12072) var tabindex = jQuery.find.attr( elem, "tabindex" ); return tabindex ? parseInt( tabindex, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : -1; } } }, propFix: { "for": "htmlFor", "class": "className" } } ); // Support: IE <=11 only // Accessing the selectedIndex property // forces the browser to respect setting selected // on the option // The getter ensures a default option is selected // when in an optgroup if ( !support.optSelected ) { jQuery.propHooks.selected = { get: function( elem ) { var parent = elem.parentNode; if ( parent && parent.parentNode ) { parent.parentNode.selectedIndex; } return null; }, set: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } } }; } jQuery.each( [ "tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable" ], function() { jQuery.propFix[ this.toLowerCase() ] = this; } ); var rclass = /[\t\r\n\f]/g; function getClass( elem ) { return elem.getAttribute && elem.getAttribute( "class" ) || ""; } jQuery.fn.extend( { addClass: function( value ) { var classes, elem, cur, curValue, clazz, j, finalValue, i = 0; if ( jQuery.isFunction( value ) ) { return this.each( function( j ) { jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); } ); } if ( typeof value === "string" && value ) { classes = value.match( rnotwhite ) || []; while ( ( elem = this[ i++ ] ) ) { curValue = getClass( elem ); cur = elem.nodeType === 1 && ( " " + curValue + " " ).replace( rclass, " " ); if ( cur ) { j = 0; while ( ( clazz = classes[ j++ ] ) ) { if ( cur.indexOf( " " + clazz + " " ) < 0 ) { cur += clazz + " "; } } // Only assign if different to avoid unneeded rendering. finalValue = jQuery.trim( cur ); if ( curValue !== finalValue ) { elem.setAttribute( "class", finalValue ); } } } } return this; }, removeClass: function( value ) { var classes, elem, cur, curValue, clazz, j, finalValue, i = 0; if ( jQuery.isFunction( value ) ) { return this.each( function( j ) { jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); } ); } if ( !arguments.length ) { return this.attr( "class", "" ); } if ( typeof value === "string" && value ) { classes = value.match( rnotwhite ) || []; while ( ( elem = this[ i++ ] ) ) { curValue = getClass( elem ); // This expression is here for better compressibility (see addClass) cur = elem.nodeType === 1 && ( " " + curValue + " " ).replace( rclass, " " ); if ( cur ) { j = 0; while ( ( clazz = classes[ j++ ] ) ) { // Remove *all* instances while ( cur.indexOf( " " + clazz + " " ) > -1 ) { cur = cur.replace( " " + clazz + " ", " " ); } } // Only assign if different to avoid unneeded rendering. finalValue = jQuery.trim( cur ); if ( curValue !== finalValue ) { elem.setAttribute( "class", finalValue ); } } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value; if ( typeof stateVal === "boolean" && type === "string" ) { return stateVal ? this.addClass( value ) : this.removeClass( value ); } if ( jQuery.isFunction( value ) ) { return this.each( function( i ) { jQuery( this ).toggleClass( value.call( this, i, getClass( this ), stateVal ), stateVal ); } ); } return this.each( function() { var className, i, self, classNames; if ( type === "string" ) { // Toggle individual class names i = 0; self = jQuery( this ); classNames = value.match( rnotwhite ) || []; while ( ( className = classNames[ i++ ] ) ) { // Check each className given, space separated list if ( self.hasClass( className ) ) { self.removeClass( className ); } else { self.addClass( className ); } } // Toggle whole class name } else if ( value === undefined || type === "boolean" ) { className = getClass( this ); if ( className ) { // Store className if set dataPriv.set( this, "__className__", className ); } // If the element has a class name or if we're passed `false`, // then remove the whole classname (if there was one, the above saved it). // Otherwise bring back whatever was previously saved (if anything), // falling back to the empty string if nothing was stored. if ( this.setAttribute ) { this.setAttribute( "class", className || value === false ? "" : dataPriv.get( this, "__className__" ) || "" ); } } } ); }, hasClass: function( selector ) { var className, elem, i = 0; className = " " + selector + " "; while ( ( elem = this[ i++ ] ) ) { if ( elem.nodeType === 1 && ( " " + getClass( elem ) + " " ).replace( rclass, " " ) .indexOf( className ) > -1 ) { return true; } } return false; } } ); var rreturn = /\r/g, rspaces = /[\x20\t\r\n\f]+/g; jQuery.fn.extend( { val: function( value ) { var hooks, ret, isFunction, elem = this[ 0 ]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && ( ret = hooks.get( elem, "value" ) ) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // Handle most common string cases ret.replace( rreturn, "" ) : // Handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each( function( i ) { var val; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, jQuery( this ).val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map( val, function( value ) { return value == null ? "" : value + ""; } ); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; // If set returns undefined, fall back to normal setting if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } } ); } } ); jQuery.extend( { valHooks: { option: { get: function( elem ) { var val = jQuery.find.attr( elem, "value" ); return val != null ? val : // Support: IE10-11+ // option.text throws exceptions (#14686, #14858) // Strip and collapse whitespace // https://html.spec.whatwg.org/#strip-and-collapse-whitespace jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); } }, select: { get: function( elem ) { var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; // Loop through all the selected options for ( ; i < max; i++ ) { option = options[ i ]; // IE8-9 doesn't update selected after form reset (#2551) if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) && ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; }, set: function( elem, value ) { var optionSet, option, options = elem.options, values = jQuery.makeArray( value ), i = options.length; while ( i-- ) { option = options[ i ]; if ( option.selected = jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) { optionSet = true; } } // Force browsers to behave consistently when non-matching value is set if ( !optionSet ) { elem.selectedIndex = -1; } return values; } } } } ); // Radios and checkboxes getter/setter jQuery.each( [ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); } } }; if ( !support.checkOn ) { jQuery.valHooks[ this ].get = function( elem ) { return elem.getAttribute( "value" ) === null ? "on" : elem.value; }; } } ); // Return jQuery for attributes-only inclusion var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; jQuery.extend( jQuery.event, { trigger: function( event, data, elem, onlyHandlers ) { var i, cur, tmp, bubbleType, ontype, handle, special, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; cur = tmp = elem = elem || document; // Don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf( "." ) > -1 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split( "." ); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexOf( ":" ) < 0 && "on" + type; // Caller can pass in a jQuery.Event object, Object, or just an event type string event = event[ jQuery.expando ] ? event : new jQuery.Event( type, typeof event === "object" && event ); // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) event.isTrigger = onlyHandlers ? 2 : 3; event.namespace = namespaces.join( "." ); event.rnamespace = event.namespace ? new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : null; // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data == null ? [ event ] : jQuery.makeArray( data, [ event ] ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a globals ownerDocument var (#9724) if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { cur = cur.parentNode; } for ( ; cur; cur = cur.parentNode ) { eventPath.push( cur ); tmp = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( tmp === ( elem.ownerDocument || document ) ) { eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } // Fire handlers on the event path i = 0; while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && dataPriv.get( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Native handler handle = ontype && cur[ ontype ]; if ( handle && handle.apply && acceptData( cur ) ) { event.result = handle.apply( cur, data ); if ( event.result === false ) { event.preventDefault(); } } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( ( !special._default || special._default.apply( eventPath.pop(), data ) === false ) && acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Don't do default actions on window, that's where globals variables be (#6170) if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[ type ](); jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, // Piggyback on a donor event to simulate a different one // Used only for `focus(in | out)` events simulate: function( type, elem, event ) { var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true } ); jQuery.event.trigger( e, null, elem ); } } ); jQuery.fn.extend( { trigger: function( type, data ) { return this.each( function() { jQuery.event.trigger( type, data, this ); } ); }, triggerHandler: function( type, data ) { var elem = this[ 0 ]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } } ); jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu" ).split( " " ), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; } ); jQuery.fn.extend( { hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } } ); support.focusin = "onfocusin" in window; // Support: Firefox // Firefox doesn't have focus(in | out) events // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 // // Support: Chrome, Safari // focus(in | out) events fire after focus & blur events, // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order // Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857 if ( !support.focusin ) { jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler on the document while someone wants focusin/focusout var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); }; jQuery.event.special[ fix ] = { setup: function() { var doc = this.ownerDocument || this, attaches = dataPriv.access( doc, fix ); if ( !attaches ) { doc.addEventListener( orig, handler, true ); } dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { var doc = this.ownerDocument || this, attaches = dataPriv.access( doc, fix ) - 1; if ( !attaches ) { doc.removeEventListener( orig, handler, true ); dataPriv.remove( doc, fix ); } else { dataPriv.access( doc, fix, attaches ); } } }; } ); } var location = window.location; var nonce = jQuery.now(); var rquery = ( /\?/ ); // Support: Android 2.3 // Workaround failure to string-cast null input jQuery.parseJSON = function( data ) { return JSON.parse( data + "" ); }; // Cross-browser xml parsing jQuery.parseXML = function( data ) { var xml; if ( !data || typeof data !== "string" ) { return null; } // Support: IE9 try { xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); } catch ( e ) { xml = undefined; } if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }; var rhash = /#.*$/, rts = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, // #7653, #8125, #8152: local protocol detection rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression allTypes = "*/".concat( "*" ), // Anchor tag for parsing the document origin originAnchor = document.createElement( "a" ); originAnchor.href = location.href; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression while ( ( dataType = dataTypes[ i++ ] ) ) { // Prepend if requested if ( dataType[ 0 ] === "+" ) { dataType = dataType.slice( 1 ) || "*"; ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); // Otherwise append } else { ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); } } } }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { var inspected = {}, seekingTransport = ( structure === transports ); function inspect( dataType ) { var selected; inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; } else if ( seekingTransport ) { return !( selected = dataTypeOrTransport ); } } ); return selected; } return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } return target; } /* Handles responses to an ajax request: * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jqXHR, responses ) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes; // Remove auto dataType and get content-type in the process while ( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } /* Chain conversions given the request and the original response * Also sets the responseXXX fields on the jqXHR instance */ function ajaxConvert( s, response, jqXHR, isSuccess ) { var conv2, current, conv, tmp, prev, converters = {}, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(); // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } current = dataTypes.shift(); // Convert to each sequential dataType while ( current ) { if ( s.responseFields[ current ] ) { jqXHR[ s.responseFields[ current ] ] = response; } // Apply the dataFilter if provided if ( !prev && isSuccess && s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } prev = current; current = dataTypes.shift(); if ( current ) { // There's only work to do if current dataType is non-auto if ( current === "*" ) { current = prev; // Convert response if prev dataType is non-auto and differs from current } else if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split( " " ); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.unshift( tmp[ 1 ] ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s.throws ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } } } return { state: "success", data: response }; } jQuery.extend( { // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {}, ajaxSettings: { url: location.href, type: "GET", isLocal: rlocalProtocol.test( location.protocol ), global: true, processData: true, async: true, contentType: "application/x-www-form-urlencoded; charset=UTF-8", /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { "*": allTypes, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" }, contents: { xml: /\bxml\b/, html: /\bhtml/, json: /\bjson\b/ }, responseFields: { xml: "responseXML", text: "responseText", json: "responseJSON" }, // Data converters // Keys separate source (or catchall "*") and destination types with a single space converters: { // Convert anything to text "* text": String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": jQuery.parseJSON, // Parse text as xml "text xml": jQuery.parseXML }, // For options that shouldn't be deep extended: // you can add your own custom options here if // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { url: true, context: true } }, // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. ajaxSetup: function( target, settings ) { return settings ? // Building a settings object ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : // Extending ajaxSettings ajaxExtend( jQuery.ajaxSettings, target ); }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), // Main method ajax: function( url, options ) { // If url is an object, simulate pre-1.5 signature if ( typeof url === "object" ) { options = url; url = undefined; } // Force options to be an object options = options || {}; var transport, // URL without anti-cache param cacheURL, // Response headers responseHeadersString, responseHeaders, // timeout handle timeoutTimer, // Url cleanup var urlAnchor, // To know if globals events are to be dispatched fireGlobals, // Loop variable i, // Create the final options object s = jQuery.ajaxSetup( {}, options ), // Callbacks context callbackContext = s.context || s, // Context for globals events is callbackContext if it is a DOM node or jQuery collection globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks( "once memory" ), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, requestHeadersNames = {}, // The jqXHR state state = 0, // Default abort message strAbort = "canceled", // Fake xhr jqXHR = { readyState: 0, // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; while ( ( match = rheaders.exec( responseHeadersString ) ) ) { responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match == null ? null : match; }, // Raw string getAllResponseHeaders: function() { return state === 2 ? responseHeadersString : null; }, // Caches the header setRequestHeader: function( name, value ) { var lname = name.toLowerCase(); if ( !state ) { name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; requestHeaders[ name ] = value; } return this; }, // Overrides response content-type header overrideMimeType: function( type ) { if ( !state ) { s.mimeType = type; } return this; }, // Status-dependent callbacks statusCode: function( map ) { var code; if ( map ) { if ( state < 2 ) { for ( code in map ) { // Lazy-add the new callback in a way that preserves old ones statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; } } else { // Execute the appropriate callbacks jqXHR.always( map[ jqXHR.status ] ); } } return this; }, // Cancel the request abort: function( statusText ) { var finalText = statusText || strAbort; if ( transport ) { transport.abort( finalText ); } done( 0, finalText ); return this; } }; // Attach deferreds deferred.promise( jqXHR ).complete = completeDeferred.add; jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (prefilters might expect it) // Handle falsy url in the settings object (#10093: consistency with old signature) // We also use the url parameter if available s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" ) .replace( rprotocol, location.protocol + "//" ); // Alias method option to type as per ticket #12004 s.type = options.method || options.type || s.method || s.type; // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; // A cross-domain request is in order when the origin doesn't match the current origin. if ( s.crossDomain == null ) { urlAnchor = document.createElement( "a" ); // Support: IE8-11+ // IE throws exception if url is malformed, e.g. http://example.com:80x/ try { urlAnchor.href = s.url; // Support: IE8-11+ // Anchor's host property isn't correctly set when s.url is relative urlAnchor.href = urlAnchor.href; s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host; } catch ( e ) { // If there is an error parsing the URL, assume it is crossDomain, // it can be rejected by the transport if it is invalid s.crossDomain = true; } } // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } // Apply prefilters inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); // If request was aborted inside a prefilter, stop there if ( state === 2 ) { return jqXHR; } // We can fire globals events as of now if asked to // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) fireGlobals = jQuery.event && s.global; // Watch for a new set of requests if ( fireGlobals && jQuery.active++ === 0 ) { jQuery.event.trigger( "ajaxStart" ); } // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); // Save the URL in case we're toying with the If-Modified-Since // and/or If-None-Match header later on cacheURL = s.url; // More options handling for requests with no content if ( !s.hasContent ) { // If data is available, append data to url if ( s.data ) { cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); // #9682: remove data so that it's not used in an eventual retry delete s.data; } // Add anti-cache in url if needed if ( s.cache === false ) { s.url = rts.test( cacheURL ) ? // If there is already a '_' parameter, set its value cacheURL.replace( rts, "$1_=" + nonce++ ) : // Otherwise add one to the end cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; } } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { if ( jQuery.lastModified[ cacheURL ] ) { jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); } if ( jQuery.etag[ cacheURL ] ) { jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { jqXHR.setRequestHeader( "Content-Type", s.contentType ); } // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? s.accepts[ s.dataTypes[ 0 ] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); // Check for headers option for ( i in s.headers ) { jqXHR.setRequestHeader( i, s.headers[ i ] ); } // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { // Abort if not done already and return return jqXHR.abort(); } // Aborting is no longer a cancellation strAbort = "abort"; // Install callbacks on deferreds for ( i in { success: 1, error: 1, complete: 1 } ) { jqXHR[ i ]( s[ i ] ); } // Get transport transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); // If no transport, we auto-abort if ( !transport ) { done( -1, "No Transport" ); } else { jqXHR.readyState = 1; // Send globals event if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } // If request was aborted inside ajaxSend, stop there if ( state === 2 ) { return jqXHR; } // Timeout if ( s.async && s.timeout > 0 ) { timeoutTimer = window.setTimeout( function() { jqXHR.abort( "timeout" ); }, s.timeout ); } try { state = 1; transport.send( requestHeaders, done ); } catch ( e ) { // Propagate exception as error if not done if ( state < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { throw e; } } } // Callback for when everything is done function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { window.clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Determine if successful isSuccess = status >= 200 && status < 300 || status === 304; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // Convert no matter what (that way responseXXX fields are always set) response = ajaxConvert( s, response, jqXHR, isSuccess ); // If successful, handle type chaining if ( isSuccess ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader( "Last-Modified" ); if ( modified ) { jQuery.lastModified[ cacheURL ] = modified; } modified = jqXHR.getResponseHeader( "etag" ); if ( modified ) { jQuery.etag[ cacheURL ] = modified; } } // if no content if ( status === 204 || s.type === "HEAD" ) { statusText = "nocontent"; // if not modified } else if ( status === 304 ) { statusText = "notmodified"; // If we have data, let's convert it } else { statusText = response.state; success = response.data; error = response.error; isSuccess = !error; } } else { // Extract error from statusText and normalize for non-aborts error = statusText; if ( status || !statusText ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the globals AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); } } } return jqXHR; }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); } } ); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // Shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = undefined; } // The url can be an options object (which then must have .url) return jQuery.ajax( jQuery.extend( { url: url, type: method, dataType: type, data: data, success: callback }, jQuery.isPlainObject( url ) && url ) ); }; } ); jQuery._evalUrl = function( url ) { return jQuery.ajax( { url: url, // Make this explicit, since user can override this through ajaxSetup (#11264) type: "GET", dataType: "script", async: false, global: false, "throws": true } ); }; jQuery.fn.extend( { wrapAll: function( html ) { var wrap; if ( jQuery.isFunction( html ) ) { return this.each( function( i ) { jQuery( this ).wrapAll( html.call( this, i ) ); } ); } if ( this[ 0 ] ) { // The elements to wrap the target around wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); if ( this[ 0 ].parentNode ) { wrap.insertBefore( this[ 0 ] ); } wrap.map( function() { var elem = this; while ( elem.firstElementChild ) { elem = elem.firstElementChild; } return elem; } ).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each( function( i ) { jQuery( this ).wrapInner( html.call( this, i ) ); } ); } return this.each( function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } } ); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each( function( i ) { jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); } ); }, unwrap: function() { return this.parent().each( function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } } ).end(); } } ); jQuery.expr.filters.hidden = function( elem ) { return !jQuery.expr.filters.visible( elem ); }; jQuery.expr.filters.visible = function( elem ) { // Support: Opera <= 12.12 // Opera reports offsetWidths and offsetHeights less than zero on some elements // Use OR instead of AND as the element is not visible if either is true // See tickets #10406 and #13132 return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0; }; var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; function buildParams( prefix, obj, traditional, add ) { var name; if ( jQuery.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // Item is non-scalar (array or object), encode its numeric index. buildParams( prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", v, traditional, add ); } } ); } else if ( !traditional && jQuery.type( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { // Serialize scalar item. add( prefix, obj ); } } // Serialize an array of form elements or a set of // key/values into a query string jQuery.param = function( a, traditional ) { var prefix, s = [], add = function( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); } ); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization return s.join( "&" ).replace( r20, "+" ); }; jQuery.fn.extend( { serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map( function() { // Can add propHook for "elements" to filter or add form elements var elements = jQuery.prop( this, "elements" ); return elements ? jQuery.makeArray( elements ) : this; } ) .filter( function() { var type = this.type; // Use .is( ":disabled" ) so that fieldset[disabled] works return this.name && !jQuery( this ).is( ":disabled" ) && rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && ( this.checked || !rcheckableType.test( type ) ); } ) .map( function( i, elem ) { var val = jQuery( this ).val(); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val ) { return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; } ) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; } ).get(); } } ); jQuery.ajaxSettings.xhr = function() { try { return new window.XMLHttpRequest(); } catch ( e ) {} }; var xhrSuccessStatus = { // File protocol always yields status code 0, assume 200 0: 200, // Support: IE9 // #1450: sometimes IE returns 1223 when it should be 204 1223: 204 }, xhrSupported = jQuery.ajaxSettings.xhr(); support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); support.ajax = xhrSupported = !!xhrSupported; jQuery.ajaxTransport( function( options ) { var callback, errorCallback; // Cross domain only allowed if supported through XMLHttpRequest if ( support.cors || xhrSupported && !options.crossDomain ) { return { send: function( headers, complete ) { var i, xhr = options.xhr(); xhr.open( options.type, options.url, options.async, options.username, options.password ); // Apply custom fields if provided if ( options.xhrFields ) { for ( i in options.xhrFields ) { xhr[ i ] = options.xhrFields[ i ]; } } // Override mime type if needed if ( options.mimeType && xhr.overrideMimeType ) { xhr.overrideMimeType( options.mimeType ); } // X-Requested-With header // For cross-domain requests, seeing as conditions for a preflight are // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { headers[ "X-Requested-With" ] = "XMLHttpRequest"; } // Set headers for ( i in headers ) { xhr.setRequestHeader( i, headers[ i ] ); } // Callback callback = function( type ) { return function() { if ( callback ) { callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; if ( type === "abort" ) { xhr.abort(); } else if ( type === "error" ) { // Support: IE9 // On a manual native abort, IE9 throws // errors on any property access that is not readyState if ( typeof xhr.status !== "number" ) { complete( 0, "error" ); } else { complete( // File: protocol always yields status 0; see #8605, #14207 xhr.status, xhr.statusText ); } } else { complete( xhrSuccessStatus[ xhr.status ] || xhr.status, xhr.statusText, // Support: IE9 only // IE9 has no XHR2 but throws on binary (trac-11426) // For XHR2 non-text, let the caller handle it (gh-2498) ( xhr.responseType || "text" ) !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders() ); } } }; }; // Listen to events xhr.onload = callback(); errorCallback = xhr.onerror = callback( "error" ); // Support: IE9 // Use onreadystatechange to replace onabort // to handle uncaught aborts if ( xhr.onabort !== undefined ) { xhr.onabort = errorCallback; } else { xhr.onreadystatechange = function() { // Check readyState before timeout as it changes if ( xhr.readyState === 4 ) { // Allow onerror to be called first, // but that will not handle a native abort // Also, save errorCallback to a variable // as xhr.onerror cannot be accessed window.setTimeout( function() { if ( callback ) { errorCallback(); } } ); } }; } // Create the abort callback callback = callback( "abort" ); try { // Do send the request (this may raise an exception) xhr.send( options.hasContent && options.data || null ); } catch ( e ) { // #14683: Only rethrow if this hasn't been notified as an error yet if ( callback ) { throw e; } } }, abort: function() { if ( callback ) { callback(); } } }; } } ); // Install script dataType jQuery.ajaxSetup( { accepts: { script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript" }, contents: { script: /\b(?:java|ecma)script\b/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } } ); // Handle cache's special case and crossDomain jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; } } ); // Bind script tag hack transport jQuery.ajaxTransport( "script", function( s ) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, callback; return { send: function( _, complete ) { script = jQuery( "<script>" ).prop( { charset: s.scriptCharset, src: s.url } ).on( "load error", callback = function( evt ) { script.remove(); callback = null; if ( evt ) { complete( evt.type === "error" ? 404 : 200, evt.type ); } } ); // Use native DOM manipulation to avoid our domManip AJAX trickery document.head.appendChild( script[ 0 ] ); }, abort: function() { if ( callback ) { callback(); } } }; } } ); var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/; // Default jsonp settings jQuery.ajaxSetup( { jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } } ); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? "url" : typeof s.data === "string" && ( s.contentType || "" ) .indexOf( "application/x-www-form-urlencoded" ) === 0 && rjsonp.test( s.data ) && "data" ); // Handle iff the expected data type is "jsonp" or we have a parameter to set if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { // Get callback name, remembering preexisting value associated with it callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback; // Insert callback into url or form data if ( jsonProp ) { s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); } else if ( s.jsonp !== false ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } // Use data converter to retrieve json after script execution s.converters[ "script json" ] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); } return responseContainer[ 0 ]; }; // Force json dataType s.dataTypes[ 0 ] = "json"; // Install callback overwritten = window[ callbackName ]; window[ callbackName ] = function() { responseContainer = arguments; }; // Clean-up function (fires after converters) jqXHR.always( function() { // If previous value didn't exist - remove it if ( overwritten === undefined ) { jQuery( window ).removeProp( callbackName ); // Otherwise restore preexisting value } else { window[ callbackName ] = overwritten; } // Save back as free if ( s[ callbackName ] ) { // Make sure that re-using the options doesn't screw things around s.jsonpCallback = originalSettings.jsonpCallback; // Save the callback name for future use oldCallbacks.push( callbackName ); } // Call if it was a function and we have a response if ( responseContainer && jQuery.isFunction( overwritten ) ) { overwritten( responseContainer[ 0 ] ); } responseContainer = overwritten = undefined; } ); // Delegate to script return "script"; } } ); // Argument "data" should be string of html // context (optional): If specified, the fragment will be created in this context, // defaults to document // keepScripts (optional): If true, will include scripts passed in the html string jQuery.parseHTML = function( data, context, keepScripts ) { if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { keepScripts = context; context = false; } context = context || document; var parsed = rsingleTag.exec( data ), scripts = !keepScripts && []; // Single tag if ( parsed ) { return [ context.createElement( parsed[ 1 ] ) ]; } parsed = buildFragment( [ data ], context, scripts ); if ( scripts && scripts.length ) { jQuery( scripts ).remove(); } return jQuery.merge( [], parsed.childNodes ); }; // Keep a copy of the old load method var _load = jQuery.fn.load; /** * Load a url into a page */ jQuery.fn.load = function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); } var selector, type, response, self = this, off = url.indexOf( " " ); if ( off > -1 ) { selector = jQuery.trim( url.slice( off ) ); url = url.slice( 0, off ); } // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = undefined; // Otherwise, build a param string } else if ( params && typeof params === "object" ) { type = "POST"; } // If we have elements to modify, make the request if ( self.length > 0 ) { jQuery.ajax( { url: url, // If "type" variable is undefined, then "GET" method will be used. // Make value of this field explicit since // user can override it through ajaxSetup method type: type || "GET", dataType: "html", data: params } ).done( function( responseText ) { // Save response for use in complete callback response = arguments; self.html( selector ? // If a selector was specified, locate the right elements in a dummy div // Exclude scripts to avoid IE 'Permission Denied' errors jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : // Otherwise use the full result responseText ); // If the request succeeds, this function gets "data", "status", "jqXHR" // but they are ignored because response was set above. // If it fails, this function gets "jqXHR", "status", "error" } ).always( callback && function( jqXHR, status ) { self.each( function() { callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); } ); } ); } return this; }; // Attach a bunch of functions for handling common AJAX events jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { jQuery.fn[ type ] = function( fn ) { return this.on( type, fn ); }; } ); jQuery.expr.filters.animated = function( elem ) { return jQuery.grep( jQuery.timers, function( fn ) { return elem === fn.elem; } ).length; }; /** * Gets a window from an element */ function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView; } jQuery.offset = { setOffset: function( elem, options, i ) { var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css( elem, "position" ), curElem = jQuery( elem ), props = {}; // Set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } curOffset = curElem.offset(); curCSSTop = jQuery.css( elem, "top" ); curCSSLeft = jQuery.css( elem, "left" ); calculatePosition = ( position === "absolute" || position === "fixed" ) && ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; // Need to be able to calculate position if either // top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat( curCSSTop ) || 0; curLeft = parseFloat( curCSSLeft ) || 0; } if ( jQuery.isFunction( options ) ) { // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); } if ( options.top != null ) { props.top = ( options.top - curOffset.top ) + curTop; } if ( options.left != null ) { props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend( { offset: function( options ) { if ( arguments.length ) { return options === undefined ? this : this.each( function( i ) { jQuery.offset.setOffset( this, options, i ); } ); } var docElem, win, elem = this[ 0 ], box = { top: 0, left: 0 }, doc = elem && elem.ownerDocument; if ( !doc ) { return; } docElem = doc.documentElement; // Make sure it's not a disconnected DOM node if ( !jQuery.contains( docElem, elem ) ) { return box; } box = elem.getBoundingClientRect(); win = getWindow( doc ); return { top: box.top + win.pageYOffset - docElem.clientTop, left: box.left + win.pageXOffset - docElem.clientLeft }; }, position: function() { if ( !this[ 0 ] ) { return; } var offsetParent, offset, elem = this[ 0 ], parentOffset = { top: 0, left: 0 }; // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, // because it is its only offset parent if ( jQuery.css( elem, "position" ) === "fixed" ) { // Assume getBoundingClientRect is there when computed position is fixed offset = elem.getBoundingClientRect(); } else { // Get *real* offsetParent offsetParent = this.offsetParent(); // Get correct offsets offset = this.offset(); if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { parentOffset = offsetParent.offset(); } // Add offsetParent borders parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); } // Subtract parent offsets and element margins return { top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) }; }, // This method will return documentElement in the following cases: // 1) For the element inside the iframe without offsetParent, this method will return // documentElement of the parent window // 2) For the hidden or detached element // 3) For body or html element, i.e. in case of the html node - it will return itself // // but those exceptions were never presented as a real life use-cases // and might be considered as more preferable results. // // This logic, however, is not guaranteed and can change at any point in the future offsetParent: function() { return this.map( function() { var offsetParent = this.offsetParent; while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { offsetParent = offsetParent.offsetParent; } return offsetParent || documentElement; } ); } } ); // Create scrollLeft and scrollTop methods jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { var top = "pageYOffset" === prop; jQuery.fn[ method ] = function( val ) { return access( this, function( elem, method, val ) { var win = getWindow( elem ); if ( val === undefined ) { return win ? win[ prop ] : elem[ method ]; } if ( win ) { win.scrollTo( !top ? val : win.pageXOffset, top ? val : win.pageYOffset ); } else { elem[ method ] = val; } }, method, val, arguments.length ); }; } ); // Support: Safari<7-8+, Chrome<37-44+ // Add the top/left cssHooks using jQuery.fn.position // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280 // getComputedStyle returns percent when specified for top/left/bottom/right; // rather than make the css module depend on the offset module, just check for it here jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, function( elem, computed ) { if ( computed ) { computed = curCSS( elem, prop ); // If curCSS returns percentage, fallback to offset return rnumnonpx.test( computed ) ? jQuery( elem ).position()[ prop ] + "px" : computed; } } ); } ); // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { // Margin is only for outerHeight, outerWidth jQuery.fn[ funcName ] = function( margin, value ) { var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); return access( this, function( elem, type, value ) { var doc; if ( jQuery.isWindow( elem ) ) { // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there // isn't a whole lot we can do. See pull request at this URL for discussion: // https://github.com/jquery/jquery/pull/764 return elem.document.documentElement[ "client" + name ]; } // Get document width or height if ( elem.nodeType === 9 ) { doc = elem.documentElement; // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], // whichever is greatest return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); } return value === undefined ? // Get width or height on the element, requesting but not forcing parseFloat jQuery.css( elem, type, extra ) : // Set width or height on the element jQuery.style( elem, type, value, extra ); }, type, chainable ? margin : undefined, chainable, null ); }; } ); } ); jQuery.fn.extend( { bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); }, size: function() { return this.length; } } ); jQuery.fn.andSelf = jQuery.fn.addBack; // Register as a named AMD module, since jQuery can be concatenated with other // files that may use define, but not via a proper concatenation script that // understands anonymous AMD modules. A named AMD is safest and most robust // way to register. Lowercase jquery is used because AMD module names are // derived from file names, and jQuery is normally delivered in a lowercase // file name. Do this after creating the globals so that if an AMD module wants // to call noConflict to hide this version of jQuery, it will work. // Note that for maximum portability, libraries that are not jQuery should // declare themselves as anonymous modules, and avoid setting a globals if an // AMD loader is present. jQuery is a special case. For more information, see // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; } ); } var // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$; jQuery.noConflict = function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }; // Expose jQuery and $ identifiers, even in AMD // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) // and CommonJS for browser emulators (#13566) if ( !noGlobal ) { window.jQuery = window.$ = jQuery; } return jQuery; }));
gorobetssergey/dashboard
vendor/bower/jquery/dist/jquery.js
JavaScript
bsd-3-clause
257,566
'use strict'; angular.module('27th.common.services.alert', []) .service('alertService', class { constructor($rootScope) { this.alerts = []; this.$rootScope = $rootScope; } success(msg) { this.alerts.push({ type: 'success', message: msg }); this.$rootScope.$emit('alerts.new'); } error(msg) { let message = msg; if(typeof msg !== 'string') { if(msg.message) { message = msg.message; } else if(msg.error && msg.error.message) { message = msg.error.message; } } this.alerts.push({ type: 'error', message: message }); this.$rootScope.$emit('alerts.new'); } nextAlert() { return this.alerts.pop(); } });
brainling/27thvfw
src/common/client/services/alert-service.js
JavaScript
bsd-3-clause
900
/* @flow */ import * as React from "react"; import { nest } from "d3-collection"; import { scaleLinear } from "d3-scale"; import TooltipContent from "../tooltip-content"; const parentPath = (d, pathArray) => { if (d.parent) { pathArray = parentPath(d.parent, [d.key, ...pathArray]); } else { pathArray = ["root", ...pathArray]; } return pathArray; }; const hierarchicalTooltip = (d, primaryKey, metric) => { const pathString = d.parent ? parentPath(d.parent, (d.key && [d.key]) || []).join("->") : ""; const content = []; if (!d.parent) { content.push(<h2 key="hierarchy-title">Root</h2>); } else if (d.key) { content.push(<h2 key="hierarchy-title">{d.key}</h2>); content.push(<p key="path-string">{pathString}</p>); content.push(<p key="hierarchy-value">Total Value: {d.value}</p>); content.push(<p key="hierarchy-children">Children: {d.children.length}</p>); } else { content.push( <p key="leaf-label"> {pathString} -> {primaryKey.map(p => d[p]).join(", ")} </p> ); content.push( <p key="hierarchy-value"> {metric}: {d[metric]} </p> ); } return content; }; const hierarchicalColor = (colorHash: Object, d: Object) => { if (d.depth === 0) return "white"; if (d.depth === 1) return colorHash[d.key]; let colorNode = d; for (let x = d.depth; x > 1; x--) { colorNode = colorNode.parent; } const lightenScale = scaleLinear() .domain([6, 1]) .clamp(true) .range(["white", colorHash[colorNode.key]]); return lightenScale(d.depth); }; export const semioticHierarchicalChart = ( data: Array<Object>, schema: Object, options: Object ) => { const { hierarchyType = "dendrogram", chart, selectedDimensions, primaryKey, colors } = options; const { metric1 } = chart; if (selectedDimensions.length === 0) { return {}; } const nestingParams = nest(); selectedDimensions.forEach(d => { nestingParams.key(p => p[d]); }); const colorHash = {}; const sanitizedData = []; data.forEach(d => { if (!colorHash[d[selectedDimensions[0]]]) colorHash[d[selectedDimensions[0]]] = colors[Object.keys(colorHash).length]; sanitizedData.push({ ...d, sanitizedR: d.r, r: undefined }); }); const entries = nestingParams.entries(sanitizedData); const rootNode = { values: entries }; return { edges: rootNode, edgeStyle: () => ({ fill: "lightgray", stroke: "gray" }), nodeStyle: (d: Object) => { return { fill: hierarchicalColor(colorHash, d), stroke: d.depth === 1 ? "white" : "black", strokeOpacity: d.depth * 0.1 + 0.2 }; }, networkType: { type: hierarchyType, hierarchySum: (d: Object) => d[metric1], hierarchyChildren: (d: Object) => d.values, padding: hierarchyType === "treemap" ? 3 : hierarchyType === "circlepack" ? 2 : 0 }, edgeRenderKey: (d: Object, i: number) => { return i; }, baseMarkProps: { forceUpdate: true }, margin: { left: 100, right: 100, top: 10, bottom: 10 }, hoverAnnotation: true, tooltipContent: (d: Object) => { return ( <TooltipContent> {hierarchicalTooltip(d, primaryKey, metric1)} </TooltipContent> ); } }; };
jdfreder/nteract
packages/transform-dataresource/src/charts/hierarchical.js
JavaScript
bsd-3-clause
3,353
/* * Copyright (c) 2013, Yahoo! Inc. All rights reserved. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE.txt file for terms. */ /*jslint nomen:true, node:true */ 'use strict'; var core = require('./core'); module.exports = { describe: { summary: 'Compile dust templates to yui modules', extensions: ['dust'], nameParser: core.name }, fileUpdated: function (evt, api) { var self = this, file = evt.file, source_path = file.fullPath, bundleName = file.bundleName, templateName = this.describe.nameParser(source_path), moduleName = bundleName + '-templates-' + templateName, destination_path = moduleName + '.js'; return api.promise(function (fulfill, reject) { var compiled, partials; try { partials = core.partials(source_path); compiled = core.compile(source_path, templateName); } catch (e) { reject(e); } // trying to write the destination file which will fulfill or reject the initial promise api.writeFileInBundle(bundleName, destination_path, self._wrapAsYUI(bundleName, templateName, moduleName, compiled, partials)) .then(function () { // provisioning the module to be used on the server side automatically evt.bundle.useServerModules = evt.bundle.useServerModules || []; evt.bundle.useServerModules.push(moduleName); // we are now ready to roll fulfill(); }, reject); }); }, _wrapAsYUI: function (bundleName, templateName, moduleName, compiled, partials) { // base dependency var dependencies = ["template-base", "template-dust"]; // each partial should be provisioned thru another yui module // and the name of the partial should translate into a yui module // to become a dependency partials = partials || []; partials.forEach(function (name) { // adding prefix to each partial dependencies.push(bundleName + '-templates-' + name); }); return [ 'YUI.add("' + moduleName + '",function(Y, NAME){', ' var dust = Y.config.global.dust;', '', compiled, '', ' Y.Template.register("' + bundleName + '/' + templateName + '", function (data) {', ' var content;', ' dust.render("' + templateName + '", data, function (err, content) {', ' result = content;', ' });', ' return result; // hack to make dust sync', ' });', '}, "", {requires: ' + JSON.stringify(dependencies) + '});' ].join('\n'); } };
yahoo/locator-dust
lib/plugin.js
JavaScript
bsd-3-clause
2,981
/** * +--------------------------------------------------------------------+ * | This HTML_CodeSniffer file is Copyright (c) | * | Squiz Australia Pty Ltd ABN 53 131 581 247 | * +--------------------------------------------------------------------+ * | IMPORTANT: Your use of this Software is subject to the terms of | * | the Licence provided in the file licence.txt. If you cannot find | * | this file please contact Squiz (www.squiz.com.au) so we may | * | provide you a copy. | * +--------------------------------------------------------------------+ * */ /* Japanese translation by Yoshiki Kato @burnworks - v1.0.0 - 2016-03-01 */ var HTMLCS_Section508_Sniffs_C = { /** * Determines the elements to register for processing. * * Each element of the returned array can either be an element name, or "_top" * which is the top element of the tested code. * * @returns {Array} The list of elements. */ register: function() { return ['_top']; }, /** * Process the registered element. * * @param {DOMNode} element The element registered. * @param {DOMNode} top The top element of the tested code. */ process: function(element, top) { HTMLCS.addMessage(HTMLCS.NOTICE, top, '色が情報を伝える、あるいは視覚的な要素を判別するための唯一の視覚的手段になっていないことを確認してください。 Ensure that any information conveyed using colour alone is also available without colour, such as through context or markup.', 'Colour'); } };
burnworks/HTML_CodeSniffer-ja
Standards/Section508/Sniffs/C.js
JavaScript
bsd-3-clause
1,711
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //var MODAL = $("#modalProducto"); var URL = Define.URL_BASE; window.onload=function(){ //toastr.error("Ingresaaaaaaaaa"); var url_ajax = URL + Define.URL_OLVIDE; //le decimos a qué url tiene que mandar la información var data = { action: 'validar' }; httpPetition.ajxPost(url_ajax, data, function (data) { if(data.mensaje == "Ok"){ toastr.success("Bienvenido amante del cafe, esto es Coffee Market House"); redireccionar(Define.URL_BASE + "socialcoffee"); } }); }; function redireccionar(url_direccionar){ setTimeout(function(){ location.href=url_direccionar; }, 5000); //tiempo expresado en milisegundos } $("#olvide").delegate('#semeolvido', 'click', function () {//buscar pedido en bd var usuario_a_buscar = $("#username").val(); var url_ajax = URL + Define.URL_OLVIDE; //le decimos a qué url tiene que mandar la información var data = { action: 'semeolvido', username: usuario_a_buscar }; if(!SOLICITUSEMEOLVIDO){ httpPetition.ajxPost(url_ajax, data, function (data) { if(data.itemsCount != 0){ SOLICITUSEMEOLVIDO = true; url_direccionar = Define.URL_BASE + "cuenta/login" toastr.warning("Hola " + data.data[0].usuarioNombres + ", se te enviará la nueva contraseña al correo: " + data.data[0].usuarioEmail); redireccionar(url_direccionar); }else{ toastr.error("No existe una cuenta asociada a ese nombre de usuario."); } }); }else{ toastr.error("La solicitud ya fue enviada, revisa tu correo."); }; }); $("#login").delegate('#ingresoLogin', 'click', function () {//validar usuario var url_ajax = URL + Define.URL_LOGIN; //le decimos a qué url tiene que mandar la información var usuario_a_buscar = $("#name").val(); var passwd_user = $("#pswd").val(); var recordame_ve = false; if($('#recuerdame').is(':checked')){ recordame_ve = true; } alert(recordame_ve); var data = { action: 'ingresar', username: usuario_a_buscar, password_user: passwd_user, recuerdame: recordame_ve }; if(usuario_a_buscar == '' || passwd_user == ''){ toastr.error("Username y/o contraseña vacíos, por favor digite un valor"); }else{ httpPetition.ajxPost(url_ajax, data, function (data) { if(data.mensaje == "Ok"){ toastr.success("Bienvenido amante del cafe, esto es Coffee Market House"); redireccionar(Define.URL_BASE + "socialcoffee"); } }); }; });
jhonsfran/Coffee_market
public/js/Controllers/socialcoffee.js
JavaScript
bsd-3-clause
2,907
// Plugin for using a local directory as a Library. Generates the payload for // an AssetList REST endpoint consisting of asset models as well as pagination // helpers. var _ = require('underscore'), fs = require('fs'), url = require('url'), path = require('path'), querystring = require('querystring'), Step = require('step'); module.exports = function(app, options, callback) { // Recursive readdir. `callback(err, files)` is given a `files` array where // each file is an object with `filename` and `stat` properties. var lsR = function(basedir, callback) { var files = []; var ls = []; Step( function() { fs.readdir(basedir, this); }, function(err, data) { if (data.length === 0) return this(); var group = this.group(); ls = _.map(data, function(v) { return path.join(basedir, v); }); _.each(ls, function(v) { fs.stat(v, group()); }); }, function(err, stats) { if (ls.length === 0) return this(); var group = this.group(); _.each(ls, function(v, k) { var next = group(); if (stats[k].isDirectory()) { lsR(v, next); } else { files.push({ filename: v, stat: stats[k] }); next(); } }); }, function(err, sub) { _.each(sub, function(v) { v && (files = files.concat(v)); }); callback(err, files); } ); } // Filter an array of files where filenames match regex `re`. var lsFilter = function(files, re) { return _.filter(files, function(f) { return f.filename.match(re); }); }; // Convert a list of files into asset models. var toAssets = function(files, base_dir, port) { return _.map(files, function(f) { return { url: url.format({ host: 'localhost:' + port, protocol: 'http:', pathname: path.join( '/api/Library/' + options.id + '/files/' // Ensure only one trailing slash + querystring.escape(f.filename.replace( base_dir.replace(/(\/)$/, '') + '/', '')) ) }), bytes: (Math.ceil(parseInt(f.stat.size) / 1048576)) + ' MB', id: path.basename(f.filename) }; }); }; // Sort and slice to the specified page. var paginate = function(objects, page, limit) { return _.sortBy(objects, function(f) { return f.id; }).slice(page * limit, page * limit + limit); }; // Generate the AssetList payload object. lsR(options.directory_path, function(err, files) { var assets = toAssets( lsFilter(files, /\.(zip|json|geojson|vrt|tiff?)$/i), options.directory_path, require('settings').port ); callback({ models: paginate( assets, options.page, options.limit ), page: options.page, pageTotal: Math.ceil(assets.length / options.limit) }); }); };
makinacorpus/tilemill
server/library-directory.js
JavaScript
bsd-3-clause
3,711
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /** * @fileoverview Network drop-down implementation. */ cr.define('cr.ui', function() { /** * Creates a new container for the drop down menu items. * @constructor * @extends {HTMLDivElement} */ var DropDownContainer = cr.ui.define('div'); DropDownContainer.prototype = { __proto__: HTMLDivElement.prototype, /** @override */ decorate: function() { this.classList.add('dropdown-container'); // Selected item in the menu list. this.selectedItem = null; // First item which could be selected. this.firstItem = null; this.setAttribute('role', 'menu'); // Whether scroll has just happened. this.scrollJustHappened = false; }, /** * Gets scroll action to be done for the item. * @param {!Object} item Menu item. * @return {integer} -1 for scroll up; 0 for no action; 1 for scroll down. */ scrollAction: function(item) { var thisTop = this.scrollTop; var thisBottom = thisTop + this.offsetHeight; var itemTop = item.offsetTop; var itemBottom = itemTop + item.offsetHeight; if (itemTop <= thisTop) return -1; if (itemBottom >= thisBottom) return 1; return 0; }, /** * Selects new item. * @param {!Object} selectedItem Item to be selected. * @param {boolean} mouseOver Is mouseover event triggered? */ selectItem: function(selectedItem, mouseOver) { if (mouseOver && this.scrollJustHappened) { this.scrollJustHappened = false; return; } if (this.selectedItem) this.selectedItem.classList.remove('hover'); selectedItem.classList.add('hover'); this.selectedItem = selectedItem; if (!this.hidden) { this.previousSibling.setAttribute( 'aria-activedescendant', selectedItem.id); } var action = this.scrollAction(selectedItem); if (action != 0) { selectedItem.scrollIntoView(action < 0); this.scrollJustHappened = true; } } }; /** * Creates a new DropDown div. * @constructor * @extends {HTMLDivElement} */ var DropDown = cr.ui.define('div'); DropDown.ITEM_DIVIDER_ID = -2; DropDown.KEYCODE_DOWN = 40; DropDown.KEYCODE_ENTER = 13; DropDown.KEYCODE_ESC = 27; DropDown.KEYCODE_SPACE = 32; DropDown.KEYCODE_TAB = 9; DropDown.KEYCODE_UP = 38; DropDown.prototype = { __proto__: HTMLDivElement.prototype, /** @override */ decorate: function() { this.appendChild(this.createOverlay_()); this.appendChild(this.title_ = this.createTitle_()); var container = new DropDownContainer(); container.id = this.id + '-dropdown-container'; this.appendChild(container); this.addEventListener('keydown', this.keyDownHandler_); this.title_.id = this.id + '-dropdown'; this.title_.setAttribute('role', 'button'); this.title_.setAttribute('aria-haspopup', 'true'); this.title_.setAttribute('aria-owns', container.id); }, /** * Returns true if dropdown menu is shown. * @type {bool} Whether menu element is shown. */ get isShown() { return !this.container.hidden; }, /** * Sets dropdown menu visibility. * @param {bool} show New visibility state for dropdown menu. */ set isShown(show) { this.firstElementChild.hidden = !show; this.container.hidden = !show; if (show) { this.container.selectItem(this.container.firstItem, false); } else { this.title_.removeAttribute('aria-activedescendant'); } }, /** * Returns container of the menu items. */ get container() { return this.lastElementChild; }, /** * Sets title and icon. * @param {string} title Text on dropdown. * @param {string} icon Icon in dataURL format. */ setTitle: function(title, icon) { this.title_.firstElementChild.src = icon; this.title_.lastElementChild.textContent = title; }, /** * Sets dropdown items. * @param {Array} items Dropdown items array. */ setItems: function(items) { this.container.innerHTML = ''; this.container.firstItem = null; this.container.selectedItem = null; for (var i = 0; i < items.length; ++i) { var item = items[i]; if ('sub' in item) { // Workaround for submenus, add items on top level. // TODO(altimofeev): support submenus. for (var j = 0; j < item.sub.length; ++j) this.createItem_(this.container, item.sub[j]); continue; } this.createItem_(this.container, item); } this.container.selectItem(this.container.firstItem, false); }, /** * Id of the active drop-down element. * @private */ activeElementId_: '', /** * Creates dropdown item element and adds into container. * @param {HTMLElement} container Container where item is added. * @param {!Object} item Item to be added. * @private */ createItem_: function(container, item) { var itemContentElement; var className = 'dropdown-item'; if (item.id == DropDown.ITEM_DIVIDER_ID) { className = 'dropdown-divider'; itemContentElement = this.ownerDocument.createElement('hr'); } else { var span = this.ownerDocument.createElement('span'); itemContentElement = span; span.textContent = item.label; if ('bold' in item && item.bold) span.classList.add('bold'); var image = this.ownerDocument.createElement('img'); image.alt = ''; image.classList.add('dropdown-image'); if (item.icon) image.src = item.icon; } var itemElement = this.ownerDocument.createElement('div'); itemElement.classList.add(className); itemElement.appendChild(itemContentElement); itemElement.iid = item.id; itemElement.controller = this; var enabled = 'enabled' in item && item.enabled; if (!enabled) itemElement.classList.add('disabled-item'); if (item.id > 0) { var wrapperDiv = this.ownerDocument.createElement('div'); wrapperDiv.setAttribute('role', 'menuitem'); wrapperDiv.id = this.id + item.id; if (!enabled) wrapperDiv.setAttribute('aria-disabled', 'true'); wrapperDiv.classList.add('dropdown-item-container'); var imageDiv = this.ownerDocument.createElement('div'); imageDiv.appendChild(image); wrapperDiv.appendChild(imageDiv); wrapperDiv.appendChild(itemElement); wrapperDiv.addEventListener('click', function f(e) { var item = this.lastElementChild; if (item.iid < -1 || item.classList.contains('disabled-item')) return; item.controller.isShown = false; if (item.iid >= 0) chrome.send('networkItemChosen', [item.iid]); this.parentNode.parentNode.title_.focus(); }); wrapperDiv.addEventListener('mouseover', function f(e) { this.parentNode.selectItem(this, true); }); itemElement = wrapperDiv; } container.appendChild(itemElement); if (!container.firstItem && item.id >= 0) { container.firstItem = itemElement; } }, /** * Creates dropdown overlay element, which catches outside clicks. * @type {HTMLElement} * @private */ createOverlay_: function() { var overlay = this.ownerDocument.createElement('div'); overlay.classList.add('dropdown-overlay'); overlay.addEventListener('click', function() { this.parentNode.title_.focus(); this.parentNode.isShown = false; }); return overlay; }, /** * Creates dropdown title element. * @type {HTMLElement} * @private */ createTitle_: function() { var image = this.ownerDocument.createElement('img'); image.alt = ''; image.classList.add('dropdown-image'); var text = this.ownerDocument.createElement('div'); var el = this.ownerDocument.createElement('div'); el.appendChild(image); el.appendChild(text); el.tabIndex = 0; el.classList.add('dropdown-title'); el.iid = -1; el.controller = this; el.inFocus = false; el.opening = false; el.addEventListener('click', function f(e) { this.controller.isShown = !this.controller.isShown; }); el.addEventListener('focus', function(e) { this.inFocus = true; }); el.addEventListener('blur', function(e) { this.inFocus = false; }); el.addEventListener('keydown', function f(e) { if (this.inFocus && !this.controller.isShown && (e.keyCode == DropDown.KEYCODE_ENTER || e.keyCode == DropDown.KEYCODE_SPACE || e.keyCode == DropDown.KEYCODE_UP || e.keyCode == DropDown.KEYCODE_DOWN)) { this.opening = true; this.controller.isShown = true; e.stopPropagation(); e.preventDefault(); } }); return el; }, /** * Handles keydown event from the keyboard. * @private * @param {!Event} e Keydown event. */ keyDownHandler_: function(e) { if (!this.isShown) return; var selected = this.container.selectedItem; var handled = false; switch (e.keyCode) { case DropDown.KEYCODE_UP: { do { selected = selected.previousSibling; if (!selected) selected = this.container.lastElementChild; } while (selected.iid < 0); this.container.selectItem(selected, false); handled = true; break; } case DropDown.KEYCODE_DOWN: { do { selected = selected.nextSibling; if (!selected) selected = this.container.firstItem; } while (selected.iid < 0); this.container.selectItem(selected, false); handled = true; break; } case DropDown.KEYCODE_ESC: { this.isShown = false; handled = true; break; } case DropDown.KEYCODE_TAB: { this.isShown = false; handled = true; break; } case DropDown.KEYCODE_ENTER: { if (!this.title_.opening) { this.title_.focus(); this.isShown = false; var item = this.title_.controller.container.selectedItem.lastElementChild; if (item.iid >= 0 && !item.classList.contains('disabled-item')) chrome.send('networkItemChosen', [item.iid]); } handled = true; break; } } if (handled) { e.stopPropagation(); e.preventDefault(); } this.title_.opening = false; } }; /** * Updates networks list with the new data. * @param {!Object} data Networks list. */ DropDown.updateNetworks = function(data) { if (DropDown.activeElementId_) $(DropDown.activeElementId_).setItems(data); }; /** * Updates network title, which is shown by the drop-down. * @param {string} title Title to be displayed. * @param {!Object} icon Icon to be displayed. */ DropDown.updateNetworkTitle = function(title, icon) { if (DropDown.activeElementId_) $(DropDown.activeElementId_).setTitle(title, icon); }; /** * Activates network drop-down. Only one network drop-down * can be active at the same time. So activating new drop-down deactivates * the previous one. * @param {string} elementId Id of network drop-down element. * @param {boolean} isOobe Whether drop-down is used by an Oobe screen. * @param {integer} lastNetworkType Last active network type. Pass -1 if it * isn't known. */ DropDown.show = function(elementId, isOobe, lastNetworkType) { $(elementId).isShown = false; if (DropDown.activeElementId_ != elementId) { DropDown.activeElementId_ = elementId; chrome.send('networkDropdownShow', [elementId, isOobe, lastNetworkType]); } }; /** * Deactivates network drop-down. Deactivating inactive drop-down does * nothing. * @param {string} elementId Id of network drop-down element. */ DropDown.hide = function(elementId) { if (DropDown.activeElementId_ == elementId) { DropDown.activeElementId_ = ''; chrome.send('networkDropdownHide'); } }; /** * Refreshes network drop-down. Should be called on language change. */ DropDown.refresh = function() { chrome.send('networkDropdownRefresh'); }; return { DropDown: DropDown }; });
loopCM/chromium
chrome/browser/resources/chromeos/login/network_dropdown.js
JavaScript
bsd-3-clause
12,950
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Bam=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ },{}],2:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; // If obj.hasOwnProperty has been overridden, then calling // obj.hasOwnProperty(prop) will break. // See: https://github.com/joyent/node/issues/1707 function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } module.exports = function(qs, sep, eq, options) { sep = sep || '&'; eq = eq || '='; var obj = {}; if (typeof qs !== 'string' || qs.length === 0) { return obj; } var regexp = /\+/g; qs = qs.split(sep); var maxKeys = 1000; if (options && typeof options.maxKeys === 'number') { maxKeys = options.maxKeys; } var len = qs.length; // maxKeys <= 0 means that we should not limit keys count if (maxKeys > 0 && len > maxKeys) { len = maxKeys; } for (var i = 0; i < len; ++i) { var x = qs[i].replace(regexp, '%20'), idx = x.indexOf(eq), kstr, vstr, k, v; if (idx >= 0) { kstr = x.substr(0, idx); vstr = x.substr(idx + 1); } else { kstr = x; vstr = ''; } k = decodeURIComponent(kstr); v = decodeURIComponent(vstr); if (!hasOwnProperty(obj, k)) { obj[k] = v; } else if (isArray(obj[k])) { obj[k].push(v); } else { obj[k] = [obj[k], v]; } } return obj; }; var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; },{}],3:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; var stringifyPrimitive = function(v) { switch (typeof v) { case 'string': return v; case 'boolean': return v ? 'true' : 'false'; case 'number': return isFinite(v) ? v : ''; default: return ''; } }; module.exports = function(obj, sep, eq, name) { sep = sep || '&'; eq = eq || '='; if (obj === null) { obj = undefined; } if (typeof obj === 'object') { return map(objectKeys(obj), function(k) { var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; if (isArray(obj[k])) { return map(obj[k], function(v) { return ks + encodeURIComponent(stringifyPrimitive(v)); }).join(sep); } else { return ks + encodeURIComponent(stringifyPrimitive(obj[k])); } }).join(sep); } if (!name) return ''; return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj)); }; var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; function map (xs, f) { if (xs.map) return xs.map(f); var res = []; for (var i = 0; i < xs.length; i++) { res.push(f(xs[i], i)); } return res; } var objectKeys = Object.keys || function (obj) { var res = []; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); } return res; }; },{}],4:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = exports.stringify = require('./encode'); },{"./decode":2,"./encode":3}],5:[function(require,module,exports){ module.exports = require('backbone'); },{"backbone":1}],6:[function(require,module,exports){ var Backbone, Collection, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; Backbone = require('backbone'); Collection = (function(_super) { __extends(Collection, _super); function Collection() { return Collection.__super__.constructor.apply(this, arguments); } /* Returns the model at the index immediately before the passed in model instance. If the model instance is the first model in the collection, or the model instance does not exist in the collection, this will return null. */ Collection.prototype.before = function(model) { var index; index = this.indexOf(model); if (index === -1 || index === 0) { return null; } return this.at(index - 1); }; /* Returns the model at the index immediately after the passed in model instance. If the model instance is the last model in the collection, or the model instance does not exist in the collection, this will return null. */ Collection.prototype.after = function(model) { var index; index = this.indexOf(model); if (index === -1 || index === this.length - 1) { return null; } return this.at(index + 1); }; /* Convenience function for getting an array of all the models in a collection */ Collection.prototype.all = function() { return this.models.slice(); }; return Collection; })(Backbone.Collection); module.exports = Collection; },{"backbone":1}],7:[function(require,module,exports){ var Bam; module.exports = Bam = { Backbone: require('./backbone'), Router: require('./router'), View: require('./view'), Model: require('./model'), Collection: require('./collection') }; },{"./backbone":5,"./collection":6,"./model":8,"./router":9,"./view":10}],8:[function(require,module,exports){ var Backbone, DEFAULT_CASTS, Model, any, map, _ref, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; Backbone = require('backbone'); _ref = require('underscore'), map = _ref.map, any = _ref.any; DEFAULT_CASTS = { string: function(v) { return v + ''; }, int: function(v) { return Math.floor(+v); }, number: function(v) { return +v; }, date: function(v) { return new Date(v); }, boolean: function(v) { return !!v; } }; Model = (function(_super) { __extends(Model, _super); function Model() { return Model.__super__.constructor.apply(this, arguments); } /* Allows derived get values. The format is: derived: foo: deps: ['bar', 'baz'] value: (bar, baz) -> bar + ' ' + baz Your deps define which properties will be passed to the value function and in what order. They're also used to trigger change events for derived values i.e., if a dep changes the derived value will trigger a change too. */ Model.prototype.derived = {}; /* Allows casting specific keys. The format is: cast: timestamp: (v) -> moment(v) bar: 'string' baz: 'int' You can either provide your own function or use a provided basic cast. These include: * `'string'`: `(v) -> v + ''` * `'int'`: `(v) -> Math.floor(+v)` * `'number'`: `(v) -> +v` * `'date'`: `(v) -> new Date(v)` * `'boolean'`: (v) -> !!v Doesn't cast derived or null values. */ Model.prototype.cast = {}; /* Returns the model after this model in its collection. If it's not in a collection this will return null. */ Model.prototype.next = function() { var _ref1; return (_ref1 = this.collection) != null ? _ref1.after(this) : void 0; }; /* Returns the model before this model in its collection. If it's not in a collection this will return null. */ Model.prototype.prev = function() { var _ref1; return (_ref1 = this.collection) != null ? _ref1.before(this) : void 0; }; /* Returns a clone of the attributes object. */ Model.prototype.getAttributes = function() { return Backbone.$.extend(true, {}, this.attributes); }; /* Override get to allow default value and derived values. */ Model.prototype.get = function(key, defaultValue) { var ret; if (this.derived[key]) { ret = this._derive(derived[key]); } else { ret = Model.__super__.get.call(this, key); } if (ret === void 0) { return defaultValue; } else { return ret; } }; /* Derive a value from a definition */ Model.prototype._derive = function(definition) { var args; args = map(definition.deps, (function(_this) { return function(key) { return _this.get('key'); }; })(this)); return definition.value.apply(definition, args); }; /* Override the set method to allow for casting as data comes in. */ Model.prototype.set = function(key, val, options) { var attrs, changed, definition, derived, ret, _ref1; if (typeof key === 'object') { attrs = key; options = val; } else { attrs = {}; attrs[key] = val; } for (key in attrs) { val = attrs[key]; if (val === null) { continue; } if (this.cast[key]) { attrs[key] = this._cast(val, this.cast[key]); } } ret = Model.__super__.set.call(this, attrs, options); _ref1 = this.derived; for (derived in _ref1) { definition = _ref1[derived]; changed = map(definition.deps, function(key) { return attrs.hasOwnProperty(key); }); if (any(changed)) { this.trigger("change:" + derived, this._derive(definition)); } } return ret; }; /* Take a value, and a casting definition and perform the cast */ Model.prototype._cast = function(value, cast) { var error; try { return value = this._getCastFunc(cast)(value); } catch (_error) { error = _error; return value = null; } finally { return value; } }; /* Given a casting definition, return a function that should perform the cast */ Model.prototype._getCastFunc = function(cast) { var _ref1; if (typeof cast === 'function') { return cast; } return (_ref1 = DEFAULT_CASTS[cast]) != null ? _ref1 : function(v) { return v; }; }; return Model; })(Backbone.Model); module.exports = Model; },{"backbone":1,"underscore":1}],9:[function(require,module,exports){ var Backbone, Router, difference, extend, getIndexes, getNames, isFunction, isRegExp, keys, map, object, pluck, process, querystring, sortBy, splice, zip, _, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, __slice = [].slice; Backbone = require('backbone'); querystring = require('querystring'); _ = require('underscore'); extend = _.extend, object = _.object, isRegExp = _.isRegExp, isFunction = _.isFunction, zip = _.zip, pluck = _.pluck, sortBy = _.sortBy, keys = _.keys; difference = _.difference, map = _.map; getNames = function(string) { var ret; ret = []; ret.push.apply(ret, process(string, /(\(\?)?:\w+/g)); ret.push.apply(ret, process(string, /\*\w+/g)); return ret; }; process = function(string, regex) { var indexes, matches, _ref; matches = (_ref = string.match(regex)) != null ? _ref : []; indexes = getIndexes(string, regex); return zip(matches, indexes); }; getIndexes = function(string, regex) { var ret; ret = []; while (regex.test(string)) { ret.push(regex.lastIndex); } return ret; }; splice = function(source, from, to, replacement) { if (replacement == null) { replacement = ''; } return source.slice(0, from) + replacement + source.slice(to); }; Router = (function(_super) { __extends(Router, _super); /* Override so our _routes object is unique to each router. I hate this side of js. */ function Router() { var args; args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; this._routes = {}; Router.__super__.constructor.apply(this, args); } /* Override route to perform some subtle tweaks! Namely, storing raw string routes for reverse routing and passing the name to the buildRequest function */ Router.prototype.route = function(route, name, callback) { if (!isRegExp(route)) { this._routes[name] = route; route = this._routeToRegExp(route); } if (isFunction(name)) { callback = name; name = ''; } if (!callback) { callback = this[name]; } return Backbone.history.route(route, (function(_this) { return function(fragment) { var req; req = _this._buildRequest(route, fragment, name); _this.execute(callback, req); _this.trigger.apply(_this, ['route:' + name, req]); _this.trigger('route', name, req); return Backbone.history.trigger('route', _this, name, req); }; })(this)); }; /* Store names of parameters in a propery of route */ Router.prototype._routeToRegExp = function(route) { var names, ret; ret = Router.__super__._routeToRegExp.call(this, route); names = getNames(route); ret.names = map(pluck(sortBy(names, '1'), '0'), function(s) { return s.slice(1); }); return ret; }; /* Create a request object. It should have the route name, named params as keys with their values and a query object which is the query params, an empty object if no query params available. */ Router.prototype._buildRequest = function(route, fragment, name) { var names, query, req, values, _ref, _ref1; values = this._extractParameters(route, fragment); query = fragment.split('?').slice(1).join('?'); if (values[values.length - 1] === query) { values = values.slice(0, -1); } names = (_ref = route.names) != null ? _ref : map(values, function(v, i) { return i; }); req = { route: (_ref1 = this._routes[name]) != null ? _ref1 : route, fragment: fragment, name: name, values: values, params: object(names, values), query: querystring.parse(query) }; return req; }; /* No-op to stop the routes propery being used */ Router.prototype._bindRoutes = function() {}; /* Rather than the default backbone behaviour of applying the args to the callback, call the callback with the request object. */ Router.prototype.execute = function(callback, req) { if (callback) { return callback.call(this, req); } }; /* Reverse a named route with a barebones request object. */ Router.prototype.reverse = function(name, req) { var diff, lastIndex, nameds, names, optional, optionals, params, query, ret, route, segment, value, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3, _ref4; route = this._routes[name]; if (!route) { return null; } ret = route; params = (_ref = req.params) != null ? _ref : {}; query = (_ref1 = req.query) != null ? _ref1 : {}; names = keys(params); optionals = process(route, /\((.*?)\)/g).reverse(); for (_i = 0, _len = optionals.length; _i < _len; _i++) { _ref2 = optionals[_i], optional = _ref2[0], lastIndex = _ref2[1]; nameds = map(pluck(getNames(optional), '0'), function(s) { return s.slice(1); }); diff = difference(nameds, names).length; if (nameds.length === 0 || diff !== 0) { route = splice(route, lastIndex - optional.length, lastIndex); } else { route = splice(route, lastIndex - optional.length, lastIndex, optional.slice(1, -1)); } } nameds = getNames(route).reverse(); for (_j = 0, _len1 = nameds.length; _j < _len1; _j++) { _ref3 = nameds[_j], segment = _ref3[0], lastIndex = _ref3[1]; value = (_ref4 = params[segment.slice(1)]) != null ? _ref4 : null; if (value !== null) { route = splice(route, lastIndex - segment.length, lastIndex, params[segment.slice(1)]); } } query = querystring.stringify(query); if (query) { route += '?' + query; } return route; }; return Router; })(Backbone.Router); module.exports = Router; },{"backbone":1,"querystring":4,"underscore":1}],10:[function(require,module,exports){ var Backbone, View, difference, without, _ref, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, __slice = [].slice; Backbone = require('backbone'); _ref = require('underscore'), without = _ref.without, difference = _ref.difference; View = (function(_super) { __extends(View, _super); View.prototype.parent = null; View.prototype.children = null; View.prototype.namespace = ''; /* Ensure the classname is applied, then set the parent and children if any are passed in. Does the normal backbone constructor and then does the first state change. */ function View(options) { var _ref1; this.children = []; if (options.className) { this.className = options.className; } if (options.namespace) { this.namespace = options.namespace; } if (options.el) { this._ensureClass(options.el); } if (options.parent) { this.setParent(options.parent); } if ((_ref1 = options.children) != null ? _ref1.length : void 0) { this.addChildren(options.children); } View.__super__.constructor.call(this, options); } /* Used to ensure that the className property of the view is applied to an el passed in as an option. */ View.prototype._ensureClass = function(el, className) { if (className == null) { className = this.className; } return Backbone.$(el).addClass(className); }; /* Adds a list of views as children of this view. */ View.prototype.addChildren = function(views) { var view, _i, _len, _results; _results = []; for (_i = 0, _len = views.length; _i < _len; _i++) { view = views[_i]; _results.push(this.addChild(view)); } return _results; }; /* Adds a view as a child of this view. */ View.prototype.addChild = function(view) { if (view.parent) { view.unsetParent(); } this.children.push(view); return view.parent = this; }; /* Sets the parent view. */ View.prototype.setParent = function(parent) { if (this.parent) { this.unsetParent(); } this.parent = parent; return this.parent.children.push(this); }; /* Unsets the parent view. */ View.prototype.unsetParent = function() { if (!this.parent) { return; } return this.parent.removeChild(this); }; /* Parent and Child accessors. */ View.prototype.hasParent = function() { return !!this.parent; }; View.prototype.getParent = function() { return this.parent; }; View.prototype.hasChildren = function() { return this.children.length; }; View.prototype.getChildren = function() { return this.children; }; View.prototype.hasChild = function(view) { return __indexOf.call(this.children, view) >= 0; }; View.prototype.hasDescendant = function(view) { var child, _i, _len, _ref1; if (__indexOf.call(this.children, view) >= 0) { return true; } _ref1 = this.children; for (_i = 0, _len = _ref1.length; _i < _len; _i++) { child = _ref1[_i]; if (child.hasDescendant(view)) { return true; } } return false; }; View.prototype.removeChild = function(child) { this.children = without(this.children, child); return child.parent = null; }; View.prototype.removeChildren = function(children) { var child, _i, _len, _ref1, _results; _ref1 = this.children; _results = []; for (_i = 0, _len = _ref1.length; _i < _len; _i++) { child = _ref1[_i]; _results.push(this.removeChild(child)); } return _results; }; /* Gets the root view for a particular view. Can be itself. */ View.prototype.root = function() { var root; root = this; while (root.hasParent()) { root = root.getParent(); } return root; }; /* Calls remove on all child views before removing itself */ View.prototype.remove = function() { this.children.forEach(function(child) { return child.remove(); }); this.children = []; this.parent = null; this.off(); this.undelegateEvents(); return View.__super__.remove.call(this); }; /* Calls trigger on the root() object with the namespace added, and also on itself without the namespace. */ View.prototype.trigger = function() { var args; args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; Backbone.View.prototype.trigger.apply(this, args); if (this.namespace) { args[0] = this.namespace + '.' + args[0]; } if (this.parent) { return this.parent.trigger.apply(this.parent, args); } }; return View; })(Backbone.View); module.exports = View; },{"backbone":1,"underscore":1}]},{},[7])(7) });
Bockit/bam
dist/bam.js
JavaScript
bsd-3-clause
24,391
(function () { "use strict"; angular.module('BuDirectives', []). directive('bindHtmlWithJs', ['$sce', '$parse', function ($sce, $parse) { /** * It removes script tags from html and inserts it into DOM. * * Testing: * html += '<script>alert(1234)</script><script type="text/javascript">alert(12345)</script><script type="asdf">alert(1234)</script><script src="/js/alert.js">alert(1234)</script><span style="color: red;">1234</span>'; * or * html += '<script src="/js/alert.js"></script><script type="text/javascript">console.log(window.qwerqwerqewr1234)</script><span style="color: red;">1234</span>'; * * @param html {String} * @returns {String} */ function handleScripts(html) { // html must start with tag - it's angularjs' jqLite bug/feature html = '<i></i>' + html; var originElements = angular.element(html), elements = angular.element('<div></div>'); if (originElements.length) { // start from 1 for removing first tag we just added for (var i = 1, l = originElements.length; i < l; i ++) { var $el = originElements.eq(i), el = $el[0]; if (el.nodeName == 'SCRIPT' && ((! el.type) || el.type == 'text/javascript')) { evalScript($el[0]); } else { elements.append($el); } } } // elements = elements.contents(); html = elements.html(); return html; } /** * It's taken from AngularJS' jsonpReq function. * It's not ie < 9 compatible. * @param {DOMElement} element */ function evalScript(element) { var script = document.createElement('script'), body = document.body, doneWrapper = function() { script.onload = script.onerror = null; body.removeChild(script); }; script.type = 'text/javascript'; if (element.src) { script.src = element.src; script.async = element.async; script.onload = script.onerror = function () { doneWrapper(); }; } else { // doesn't work on ie... try { script.appendChild(document.createTextNode(element.innerText)); } // IE has funky script nodes catch (e) { script.text = element.innerText; } setTimeout(function () {doneWrapper()}, 10); } body.appendChild(script); } return function ($scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.bindHtmlWithJs); var parsed = $parse(attr.bindHtmlWithJs); function getStringValue() { return (parsed($scope) || '').toString(); } $scope.$watch(getStringValue, function bindHtmlWithJsWatchAction(value) { var html = value ? $sce.getTrustedHtml(parsed($scope)) : ''; if (html) { html = handleScripts(html); } element.html(html || ''); }); }; }]). /* This filter is for demo only */ filter('trustAsHtml', ['$sce', function ($sce) { return function trustAsHtml(value) { return $sce.trustAsHtml(value); } }]); }());
makc45/blog
web/js/directive_bind_html_with_js.js
JavaScript
bsd-3-clause
3,009
var NAVTREEINDEX1 = { "classcrossbow_1_1basic__string.html#acd8734bee97210a1c2600ce3c56cef95":[2,0,0,5,98], "classcrossbow_1_1basic__string.html#acdd883ec84ff972ef30486f4af448ce0":[2,0,0,5,54], "classcrossbow_1_1basic__string.html#ace46e4e9d1a632317c6584597deaa789":[2,0,0,5,29], "classcrossbow_1_1basic__string.html#ad16e6f0b50261ed8600afccff12e4366":[2,0,0,5,57], "classcrossbow_1_1basic__string.html#ad63a3db7d68d6d0847bc1a99c87cfdef":[2,0,0,5,99], "classcrossbow_1_1basic__string.html#ad6ac2ee49ffc8b09b90e723fb5a6d9d2":[2,0,0,5,55], "classcrossbow_1_1basic__string.html#ad77aaf4d117f8a658601368d8cf68b52":[2,0,0,5,20], "classcrossbow_1_1basic__string.html#ad87813baffb616dff0b5bd1bbc1e9f8b":[2,0,0,5,126], "classcrossbow_1_1basic__string.html#adc313b8b1c14d50984e2361a608b8ed1":[2,0,0,5,140], "classcrossbow_1_1basic__string.html#ade6af6157c96db8dc9a7e24f00b92fb7":[2,0,0,5,9], "classcrossbow_1_1basic__string.html#ae7891280b4bc5aaab7fe72e846ff61f7":[2,0,0,5,4], "classcrossbow_1_1basic__string.html#aea2798fbf5f4e47601ac0d2b02a32e4a":[2,0,0,5,15], "classcrossbow_1_1basic__string.html#aeb9d2e3eba8c78a72bfc75ef852fbd49":[2,0,0,5,70], "classcrossbow_1_1basic__string.html#aece4af5e1bc5fe0e4c15c37649430606":[2,0,0,5,48], "classcrossbow_1_1basic__string.html#aef65d6573a85fe38d15b01ebda098525":[2,0,0,5,90], "classcrossbow_1_1basic__string.html#af0c5f471f6a4b461696823cdd75ddbcf":[2,0,0,5,27], "classcrossbow_1_1basic__string.html#af245a40b570e609be525cc8891f26012":[2,0,0,5,64], "classcrossbow_1_1basic__string.html#af67ef102a9740f67b91259397a4449a8":[2,0,0,5,142], "classcrossbow_1_1basic__string.html#af758b8cb6b0125ff811cfad5298c9fa1":[2,0,0,5,74], "classcrossbow_1_1basic__string.html#af78b0cf30301287e8b08d826891e65ec":[2,0,0,5,47], "classcrossbow_1_1basic__string.html#afcfa6dd1d2a775a87a2e5728e49fe164":[2,0,0,5,49], "classcrossbow_1_1buffer__reader.html":[2,0,0,6], "classcrossbow_1_1buffer__reader.html#a0311322092badb5755f40e09c076a4f5":[2,0,0,6,2], "classcrossbow_1_1buffer__reader.html#a0e6cb5b3f061dbc638ca33bac5c5858d":[2,0,0,6,4], "classcrossbow_1_1buffer__reader.html#a29166d11e9f6db6aa91728e9207dfe4d":[2,0,0,6,0], "classcrossbow_1_1buffer__reader.html#a467ff4627e2ee5b109a59fd0754ad8e6":[2,0,0,6,9], "classcrossbow_1_1buffer__reader.html#a8107671442f3ec061ada4180fc359b1d":[2,0,0,6,3], "classcrossbow_1_1buffer__reader.html#a85b1f5f4a32d11a9aab8f895ed6acced":[2,0,0,6,1], "classcrossbow_1_1buffer__reader.html#a90d5cf56c68db2749a0b92db0687cb69":[2,0,0,6,5], "classcrossbow_1_1buffer__reader.html#aadb8f5bca74761999be6904e5901e729":[2,0,0,6,8], "classcrossbow_1_1buffer__reader.html#ab5f54f33e99fb4cc4068bf00af1ee6a4":[2,0,0,6,6], "classcrossbow_1_1buffer__reader.html#ad19a702b6c522fbf8a0f0e1757e76f88":[2,0,0,6,7], "classcrossbow_1_1buffer__writer.html":[2,0,0,7], "classcrossbow_1_1buffer__writer.html#a02fee8fbba1780aeae8a89ef5f550712":[2,0,0,7,11], "classcrossbow_1_1buffer__writer.html#a327571c57616830b085e11d6201df43d":[2,0,0,7,2], "classcrossbow_1_1buffer__writer.html#a44f69080102aabfcecd43577bd11fe33":[2,0,0,7,5], "classcrossbow_1_1buffer__writer.html#a644569934c908f46ba1419f6626d9137":[2,0,0,7,6], "classcrossbow_1_1buffer__writer.html#a75d4edc470cac391e78966d79ba11a7a":[2,0,0,7,3], "classcrossbow_1_1buffer__writer.html#a85982e17059614d924a7963f74e78144":[2,0,0,7,7], "classcrossbow_1_1buffer__writer.html#a98db3b5c32874c80ee0b9b050da9dabd":[2,0,0,7,10], "classcrossbow_1_1buffer__writer.html#a9917655354d206ab34ea957374f31603":[2,0,0,7,8], "classcrossbow_1_1buffer__writer.html#ac409737cb105a801bf11e6d65c192afb":[2,0,0,7,1], "classcrossbow_1_1buffer__writer.html#ad50ec2a8bd9da6008005961bd6543171":[2,0,0,7,0], "classcrossbow_1_1buffer__writer.html#ad9d132389923980304a4a59f42c0a16b":[2,0,0,7,9], "classcrossbow_1_1buffer__writer.html#afeed84606701f16f110a722e0234418f":[2,0,0,7,4], "classcrossbow_1_1concurrent__map.html":[2,0,0,11], "classcrossbow_1_1concurrent__map.html#a16b39293ce701d458bf2871ea4b4f01c":[2,0,0,11,22], "classcrossbow_1_1concurrent__map.html#a1d63dc57f6f83fb804dc75986a22a344":[2,0,0,11,25], "classcrossbow_1_1concurrent__map.html#a22b21ad0bcdbf839ead27b330d595d3d":[2,0,0,11,3], "classcrossbow_1_1concurrent__map.html#a2970ad2f0b05d52f8eeee3ddee09babf":[2,0,0,11,20], "classcrossbow_1_1concurrent__map.html#a29f81acb26bf290f3d4ffc85c02e7d59":[2,0,0,11,5], "classcrossbow_1_1concurrent__map.html#a2e42a2a7fc760109cfa183a0caa84267":[2,0,0,11,8], "classcrossbow_1_1concurrent__map.html#a4aff5cb5afde326b2e7c0b6d96b5fe8b":[2,0,0,11,1], "classcrossbow_1_1concurrent__map.html#a6778df3936e33f2037349057f0608157":[2,0,0,11,6], "classcrossbow_1_1concurrent__map.html#a7108c78b48e525ba42aef103c4142c05":[2,0,0,11,24], "classcrossbow_1_1concurrent__map.html#a762722da9390d9b385ee0d848c5309c6":[2,0,0,11,18], "classcrossbow_1_1concurrent__map.html#a7f43b025b95e94a8ca3023ca79a150ae":[2,0,0,11,12], "classcrossbow_1_1concurrent__map.html#a8036290fd74f104e9fff96e47b779315":[2,0,0,11,21], "classcrossbow_1_1concurrent__map.html#a8c2d2b360f588fcd0aa78a550ad5c4ec":[2,0,0,11,13], "classcrossbow_1_1concurrent__map.html#a9242d6f7770aac702b24f31726e6ddcf":[2,0,0,11,2], "classcrossbow_1_1concurrent__map.html#a955faffc552dcb84f624446228afd94b":[2,0,0,11,14], "classcrossbow_1_1concurrent__map.html#ab30f8ac027dea27ad7b9e5c3137094d3":[2,0,0,11,7], "classcrossbow_1_1concurrent__map.html#abd36c628e35fc20ce4a918126654a213":[2,0,0,11,17], "classcrossbow_1_1concurrent__map.html#ac6c87af8eeb7626a14a2b64e7026a083":[2,0,0,11,10], "classcrossbow_1_1concurrent__map.html#acefeeb56129aaa7ee2ea004843e4aabf":[2,0,0,11,19], "classcrossbow_1_1concurrent__map.html#ad8b4538fe8cda1ef35ad562f511e9efa":[2,0,0,11,9], "classcrossbow_1_1concurrent__map.html#ae6eb1248c28d1c9336b5738a4fe72aa9":[2,0,0,11,11], "classcrossbow_1_1concurrent__map.html#ae812f9cf3397e663625ec0fad7c8c86f":[2,0,0,11,16], "classcrossbow_1_1concurrent__map.html#af1ab12ec31ecb0a68256d679a47cb4eb":[2,0,0,11,4], "classcrossbow_1_1concurrent__map.html#af6ae89314c3222400eea9eb4cdee069b":[2,0,0,11,15], "classcrossbow_1_1concurrent__map.html#af7628f2f6957354e4972be60d0d5b332":[2,0,0,11,23], "classcrossbow_1_1fixed__size__stack.html":[2,0,0,32], "classcrossbow_1_1fixed__size__stack.html#a14d9917f053bcebda504255f176b8a06":[2,0,0,32,3], "classcrossbow_1_1fixed__size__stack.html#a3ddaa1c4ea4e8f28a4679678d971a71e":[2,0,0,32,4], "classcrossbow_1_1fixed__size__stack.html#a40eb1163de07825bd86ad486a9722fd9":[2,0,0,32,0], "classcrossbow_1_1fixed__size__stack.html#a5bc4f1e3568ce5104b3eb039dfbefc7c":[2,0,0,32,2], "classcrossbow_1_1fixed__size__stack.html#aabf178e9876c6860b4aecc7649f4b60d":[2,0,0,32,1], "classcrossbow_1_1has__visit__helper_1_1_helper.html":[2,0,0,34,2], "classcrossbow_1_1has__visit__helper_1_1no.html":[2,0,0,34,3], "classcrossbow_1_1has__visit__helper_1_1yes.html":[2,0,0,34,4], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html":[2,0,0,1,1], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#a2d425bffb81219cc4c11aa2f9758e810":[2,0,0,1,1,2], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#a417929fbf0872434a01b777f97103f6a":[2,0,0,1,1,3], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#a6c77463fbabc4eb9c4e5262289b8eac6":[2,0,0,1,1,5], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#a8b42ee82862ebc88432e43428516da87":[2,0,0,1,1,9], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#aa0bfe3a7b4a5ab6ae6533ecfc9445f31":[2,0,0,1,1,8], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#aa1043cd6d2c263260b675063046db35b":[2,0,0,1,1,11], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#aa98096c46c7836e83caab551defc94a0":[2,0,0,1,1,1], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#ab0e1fc475690b1a166d579e266e99da5":[2,0,0,1,1,0], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#ab60ac89e77b318de3842165cc64b092f":[2,0,0,1,1,7], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#ad1c6c25da2916be0fc06a06b3852c8d8":[2,0,0,1,1,6], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#aef6d4c2dc97d3d8d027350e2ce746540":[2,0,0,1,1,4], "classcrossbow_1_1infinio_1_1_allocated_memory_region.html#afc7709ffd84a4a8abb76ad6554d20aee":[2,0,0,1,1,10], "classcrossbow_1_1infinio_1_1_batching_message_socket.html":[2,0,0,1,2], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#a2336a845d9a48a6d6fc6919f308dcb9c":[2,0,0,1,2,9], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#a285f9e59c4591d23b0451b4817454d30":[2,0,0,1,2,1], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#a4aa0f87f34b11f6d8b28ca5933b24976":[2,0,0,1,2,7], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#a5e62cd53bf6e5d460d69d6ce61b3a01a":[2,0,0,1,2,4], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#a6bfd7b2d9d5871cad379425d8050ac93":[2,0,0,1,2,6], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#a6e7575aa9d9f21ac5dd147a235d05c46":[2,0,0,1,2,5], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#a961d1ae24f991b02566079d51872b3ab":[2,0,0,1,2,2], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#a9c8b1fbab0e49c3dedff2d707a3f92d2":[2,0,0,1,2,3], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#abd82278f6622efb0f0f4d7a71e2d94a3":[2,0,0,1,2,0], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#abd82278f6622efb0f0f4d7a71e2d94a3a99c8ce56e7ab246445d3b134724428f3":[2,0,0,1,2,0,0], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#abd82278f6622efb0f0f4d7a71e2d94a3a9a14f95e151eec641316e7c784ce832d":[2,0,0,1,2,0,2], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#abd82278f6622efb0f0f4d7a71e2d94a3aa5afd6edd5336d91316964e493936858":[2,0,0,1,2,0,3], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#abd82278f6622efb0f0f4d7a71e2d94a3ab9984206799a7f9fe4bd1b6c18db8112":[2,0,0,1,2,0,1], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#adb2b4ebd181dad63d354bda030f51d01":[2,0,0,1,2,10], "classcrossbow_1_1infinio_1_1_batching_message_socket.html#af435d48bba4c96fae56b165c830e6c01":[2,0,0,1,2,8], "classcrossbow_1_1infinio_1_1_condition_variable.html":[2,0,0,1,3], "classcrossbow_1_1infinio_1_1_condition_variable.html#a0466a9ace7b5dc9689bb88a2ff6162f9":[2,0,0,1,3,0], "classcrossbow_1_1infinio_1_1_condition_variable.html#a2ccd1a70e6e62e881e26afa522371cf8":[2,0,0,1,3,4], "classcrossbow_1_1infinio_1_1_condition_variable.html#a5a888f752f40f96491544a1dd3682297":[2,0,0,1,3,2], "classcrossbow_1_1infinio_1_1_condition_variable.html#aa888738b4853109df6d6b4afb068c5b6":[2,0,0,1,3,3], "classcrossbow_1_1infinio_1_1_condition_variable.html#af11132fff713b18625a039798d8fea08":[2,0,0,1,3,1], "classcrossbow_1_1infinio_1_1_endpoint.html":[2,0,0,1,4], "classcrossbow_1_1infinio_1_1_endpoint.html#a08809a6515f8adf722007a348b9909ec":[2,0,0,1,4,4], "classcrossbow_1_1infinio_1_1_endpoint.html#a43b1831cfe5abf5038b7a14c3af5efac":[2,0,0,1,4,6], "classcrossbow_1_1infinio_1_1_endpoint.html#a5017f6423ec7837eb8aa5f2479c6eadc":[2,0,0,1,4,2], "classcrossbow_1_1infinio_1_1_endpoint.html#a69614f5d8b5c2ee91f0065bcb9ae6695":[2,0,0,1,4,3], "classcrossbow_1_1infinio_1_1_endpoint.html#a7ae5515ae3f217c6ee84a243b332ffc1":[2,0,0,1,4,8], "classcrossbow_1_1infinio_1_1_endpoint.html#aaafa8e6ad5325313d254f34c60a9622a":[2,0,0,1,4,0], "classcrossbow_1_1infinio_1_1_endpoint.html#ab6a88eda3cd520fb70bdb6bf56b46fa4":[2,0,0,1,4,5], "classcrossbow_1_1infinio_1_1_endpoint.html#ac2dbe6b6c6cfd68d070a0e9771656e2c":[2,0,0,1,4,1], "classcrossbow_1_1infinio_1_1_endpoint.html#afb9122923a2423a95cf611901446cd89":[2,0,0,1,4,7], "classcrossbow_1_1infinio_1_1_event_poll.html":[2,0,0,1,5], "classcrossbow_1_1infinio_1_1_event_poll.html#a1680db113341250c64f51b3af14ca578":[2,0,0,1,5,1], "classcrossbow_1_1infinio_1_1_event_poll.html#a5531fb00028eb79adba7b678bab7e3d6":[2,0,0,1,5,0], "classcrossbow_1_1infinio_1_1_event_poll.html#ae4ce2ed048bafc1578df635c38c63259":[2,0,0,1,5,2], "classcrossbow_1_1infinio_1_1_event_processor.html":[2,0,0,1,6], "classcrossbow_1_1infinio_1_1_event_processor.html#a286824679461f308c2e7bafdc194b145":[2,0,0,1,6,2], "classcrossbow_1_1infinio_1_1_event_processor.html#a5f61a3d62361a5647a4b5155ccdbaf85":[2,0,0,1,6,4], "classcrossbow_1_1infinio_1_1_event_processor.html#a6e784628d548f72f5874570bfc42839c":[2,0,0,1,6,1], "classcrossbow_1_1infinio_1_1_event_processor.html#a8d948b3d64f0ce7c73d973631e54bc71":[2,0,0,1,6,5], "classcrossbow_1_1infinio_1_1_event_processor.html#ac62240d70c4fe864e1f32fa4eefa73b6":[2,0,0,1,6,0], "classcrossbow_1_1infinio_1_1_event_processor.html#aeda672519fde10112294b27d8ea357f2":[2,0,0,1,6,3], "classcrossbow_1_1infinio_1_1_fiber.html":[2,0,0,1,7], "classcrossbow_1_1infinio_1_1_fiber.html#a0de20c21c002560b0ff83362b9f451de":[2,0,0,1,7,2], "classcrossbow_1_1infinio_1_1_fiber.html#a506496c44cb8cdd9608ded88485f7fbc":[2,0,0,1,7,0], "classcrossbow_1_1infinio_1_1_fiber.html#a6bd47edaa664588f959b279f988e96ca":[2,0,0,1,7,3], "classcrossbow_1_1infinio_1_1_fiber.html#a94c9b20085e6a1d1df99835efef4578a":[2,0,0,1,7,6], "classcrossbow_1_1infinio_1_1_fiber.html#ac0edcfc882617fb8851e0c4a7d44f125":[2,0,0,1,7,4], "classcrossbow_1_1infinio_1_1_fiber.html#ac17b789298aa9f48f7b4fffd928c1886":[2,0,0,1,7,7], "classcrossbow_1_1infinio_1_1_fiber.html#aca60a5d8c78524d5d6e65150a2656861":[2,0,0,1,7,8], "classcrossbow_1_1infinio_1_1_fiber.html#ad209b959b4cd1598bd87b34f032852e7":[2,0,0,1,7,1], "classcrossbow_1_1infinio_1_1_fiber.html#af11c411aaf847d0a34ad4d2df03d9072":[2,0,0,1,7,9], "classcrossbow_1_1infinio_1_1_fiber.html#af5f8dd8683fb107f28a0929c11127c24":[2,0,0,1,7,5], "classcrossbow_1_1infinio_1_1_infiniband_acceptor_handler.html":[2,0,0,1,8], "classcrossbow_1_1infinio_1_1_infiniband_acceptor_handler.html#a1e48121bbb7ae989e3287191ca6fd45e":[2,0,0,1,8,0], "classcrossbow_1_1infinio_1_1_infiniband_acceptor_handler.html#a6e237853121016b1558a33ef41f755b4":[2,0,0,1,8,1], "classcrossbow_1_1infinio_1_1_infiniband_acceptor_impl.html":[2,0,0,1,9], "classcrossbow_1_1infinio_1_1_infiniband_acceptor_impl.html#a65448cadeea713a7bcfea68f74f9752c":[2,0,0,1,9,0], "classcrossbow_1_1infinio_1_1_infiniband_acceptor_impl.html#a88c9db079e85cae51ffc369aa9bbf922":[2,0,0,1,9,2], "classcrossbow_1_1infinio_1_1_infiniband_acceptor_impl.html#a993b817f0ced3175af08449a64ee38b0":[2,0,0,1,9,1], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html":[2,0,0,1,10], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#a05430bdd275d20fe59c3d02297051cb0":[2,0,0,1,10,1], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#a3022a638aaccff4755b7980e5e81541e":[2,0,0,1,10,8], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#a40b227137fc8cb90a1c321968a84067f":[2,0,0,1,10,2], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#a6f63321b9c926de4e2c0ebc2088ea4cb":[2,0,0,1,10,3], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#a9ac6132248f29fc85a73726578826d28":[2,0,0,1,10,5], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#a9e010b08158bf6083104f18ef0a3071b":[2,0,0,1,10,7], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#ac0bb5aa878e19ce99036ea08ca1e42e8":[2,0,0,1,10,9], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#acf360f73d57a8f560f536e721aad9e1a":[2,0,0,1,10,0], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#aedb40bfa0059fd3d18829563e4a8447d":[2,0,0,1,10,4], "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html#afd7818f5d086bead86cf28343e9ec1b5":[2,0,0,1,10,6], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html":[2,0,0,1,11], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#a2c8a3464fa011e6cf01f4647a22a57fa":[2,0,0,1,11,6], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#a4c57e479471d68da75dc9b2284d8ad0c":[2,0,0,1,11,7], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#a5a313da18f35c38898f6bbfb3058fa2d":[2,0,0,1,11,3], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#a77813f81944e046fb53d6bbd5c0d3d8a":[2,0,0,1,11,5], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#a9203219408532042c44d3d9cc6681aad":[2,0,0,1,11,2], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#aa92974e2bc7cb90c13fba8f27096836f":[2,0,0,1,11,1], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#aa93a1d14bc0cebf266b1fc1a939c55fc":[2,0,0,1,11,4], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#ac64e00a7100dd224dbac6f04493ed4d1":[2,0,0,1,11,0], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#acfa900a1ac4d204c43044595c75ee90c":[2,0,0,1,11,8], "classcrossbow_1_1infinio_1_1_infiniband_buffer.html#aea5dd4c74a61cf36b4526ba02f4510d1":[2,0,0,1,11,9], "classcrossbow_1_1infinio_1_1_infiniband_processor.html":[2,0,0,1,13], "classcrossbow_1_1infinio_1_1_infiniband_processor.html#a0def6dc4dcfd56dfae12e0b6898a4e45":[2,0,0,1,13,5], "classcrossbow_1_1infinio_1_1_infiniband_processor.html#a511ed6fa9672d47cff3d22a922663db7":[2,0,0,1,13,1], "classcrossbow_1_1infinio_1_1_infiniband_processor.html#a67973d0611959bb0eaa76e2fdf40b759":[2,0,0,1,13,0], "classcrossbow_1_1infinio_1_1_infiniband_processor.html#a67dd6490bc36ae8e38d7b6dfcd43c44b":[2,0,0,1,13,7], "classcrossbow_1_1infinio_1_1_infiniband_processor.html#a72b56531535b0b55acd59f47da8e26c9":[2,0,0,1,13,4], "classcrossbow_1_1infinio_1_1_infiniband_processor.html#a87a616a1350a043ee7172754e2521db8":[2,0,0,1,13,8], "classcrossbow_1_1infinio_1_1_infiniband_processor.html#a9f3e7af6e4891856c7b52486ccba0f14":[2,0,0,1,13,2], "classcrossbow_1_1infinio_1_1_infiniband_processor.html#aa2f199cc2d367a8ce968d554edbe42ab":[2,0,0,1,13,3], "classcrossbow_1_1infinio_1_1_infiniband_processor.html#abfafb2e53a7d67a761cd7b12d3964888":[2,0,0,1,13,6], "classcrossbow_1_1infinio_1_1_infiniband_service.html":[2,0,0,1,14], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a0f2fa6b12384e868943b980886159ea4":[2,0,0,1,14,6], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a379140a90244c1a1dcbedbbb2640b821":[2,0,0,1,14,10], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a3eddc3966b19f7a81218542791918c85":[2,0,0,1,14,0], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a45d1653b33fe2a9f17183086a503013e":[2,0,0,1,14,11], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a58deaaba80dc7aab9bfb01da12b7422d":[2,0,0,1,14,1], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a5a095f0a03ac2371ca54df7d10905392":[2,0,0,1,14,9], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a6f08328cd35740fc0be8d38c38abe04b":[2,0,0,1,14,5], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a6f113932afef04bb0df87be7506d2696":[2,0,0,1,14,4], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a71337e376f02c064736007944599794a":[2,0,0,1,14,8], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a8235e94e97c111ac19dafd746a550b0c":[2,0,0,1,14,3], "classcrossbow_1_1infinio_1_1_infiniband_service.html#a8448f4aeb3302513a7e5a8e64cf3810a":[2,0,0,1,14,2], "classcrossbow_1_1infinio_1_1_infiniband_service.html#ae0df2e571f013aa6812df30a95efe065":[2,0,0,1,14,7], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html":[2,0,0,1,15], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html#a16b55c9228eef44981a9b8547ffcc365":[2,0,0,1,15,1], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html#a47d531238f54e126f32c05f0a82a6917":[2,0,0,1,15,8], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html#a4b01b6f118f4b9552d1d79bdfd6c5c0a":[2,0,0,1,15,6], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html#a589d1aac79f52e033cac8376f5b1e735":[2,0,0,1,15,2], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html#a6d2cf3e35f6678fc1f0460975f8efba9":[2,0,0,1,15,0], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html#a7b5407f0a1d56c56fb58167bad6a37fd":[2,0,0,1,15,3], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html#a8039776c809c6a35556227e89b4cb6fa":[2,0,0,1,15,5], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html#aa65c1a89a1b864bde1f28f03b90309c9":[2,0,0,1,15,7], "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html#ac666313a5638dcf55887f9fbc55cb0e9":[2,0,0,1,15,4], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html":[2,0,0,1,16], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a043e82e717264e649e16e2c1f5ace5eb":[2,0,0,1,16,8], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a07d9f91ef930b1ee24a372d5a8791dc3":[2,0,0,1,16,9], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a0c71b98a6e691a1d8107d90df5ebf5ac":[2,0,0,1,16,3], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a29cc9f8efc14f7bd870300222879e461":[2,0,0,1,16,0], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a30a1a54c4425a5e61aa4259e4bf9e3f6":[2,0,0,1,16,15], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a4656209e36dfb474720c767aa568dd1a":[2,0,0,1,16,16], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a496845299b933d3f855f59ad16ad6fda":[2,0,0,1,16,4], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a49c52b28f29bf89bc704e8ac4f18e204":[2,0,0,1,16,19], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a49e07459471d21456e5f254501697282":[2,0,0,1,16,17], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a5293f9d12add24d69720ea791ef5326b":[2,0,0,1,16,13], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a567d5f1ac03388b208029b1f7d642cde":[2,0,0,1,16,14], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a5a1c5b02aa5835fee381c0ec356f64c9":[2,0,0,1,16,5], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a68b152d53045d60de2b13434c45988ec":[2,0,0,1,16,12], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a70c3d47e83e2524f6006672583303521":[2,0,0,1,16,6], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a7efedc602e7cd90f6c0cc95f4fdc2930":[2,0,0,1,16,24], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a7f9ffd8a77abdaecc9674134f38235ba":[2,0,0,1,16,21], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a808abdff97bf8cb7b8d0b490bc230d55":[2,0,0,1,16,7], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a88c9db079e85cae51ffc369aa9bbf922":[2,0,0,1,16,27], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a8bb0a02cdff8ebf0bf3d99c73059586c":[2,0,0,1,16,26], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a96d1d2d25f040f5941eb9fac6d125912":[2,0,0,1,16,10], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a98922de863d46b1e583705c58e1b06f8":[2,0,0,1,16,1], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#a9a5f8586f4f12eeb7cecb57ec2e2876f":[2,0,0,1,16,2], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#aaada3cfae17909d95bb02542ad79070f":[2,0,0,1,16,11], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#ae025a52c29dd5b612c584b12624f1b1e":[2,0,0,1,16,18], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#ae05b8b5ec59d64c42a12a4f78ef025d2":[2,0,0,1,16,23], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#ae733bbdbcf7fee16b0ecf22be2522dfe":[2,0,0,1,16,20], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#aea695116fe44c5265d139beb3bc9e7b8":[2,0,0,1,16,25], "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html#aedc62fc168abbb4cd3b8a63f59527726":[2,0,0,1,16,22], "classcrossbow_1_1infinio_1_1_local_memory_region.html":[2,0,0,1,17], "classcrossbow_1_1infinio_1_1_local_memory_region.html#a0593e2c7ea6de96b5d8ae94e1b7b66e0":[2,0,0,1,17,3], "classcrossbow_1_1infinio_1_1_local_memory_region.html#a124c03ac42f2c1e82a9d54d0c6f647b3":[2,0,0,1,17,5], "classcrossbow_1_1infinio_1_1_local_memory_region.html#a41fc8d4df7494ac55c11be96fff4d019":[2,0,0,1,17,8], "classcrossbow_1_1infinio_1_1_local_memory_region.html#a4534a746809145b19e5519d90ffc8dd8":[2,0,0,1,17,6], "classcrossbow_1_1infinio_1_1_local_memory_region.html#a4b285b29b94633ea0b975998f6f80f42":[2,0,0,1,17,7], "classcrossbow_1_1infinio_1_1_local_memory_region.html#a541d7af8c9dd46e6f7c38216cc89896d":[2,0,0,1,17,0], "classcrossbow_1_1infinio_1_1_local_memory_region.html#a8f555b1680fd818d972ff2ed406f8c56":[2,0,0,1,17,9], "classcrossbow_1_1infinio_1_1_local_memory_region.html#a95b049f4f20954a1bca106719bd145e2":[2,0,0,1,17,4], "classcrossbow_1_1infinio_1_1_local_memory_region.html#a96dbe592a5daef58e233066be2d0436c":[2,0,0,1,17,2], "classcrossbow_1_1infinio_1_1_local_memory_region.html#abcf24e06d1c8c090b148daf7a766827e":[2,0,0,1,17,11], "classcrossbow_1_1infinio_1_1_local_memory_region.html#aca3c2f33d23d158b65131fe5dd23f6ec":[2,0,0,1,17,10] };
tellproject/homepage-generator
api/navtreeindex1.js
JavaScript
bsd-3-clause
24,314
var Backbone = require('backbone'), $ = require('jquery'), lang = require('../lang'), template = require('../templates/nav.hbs') module.exports = Backbone.View.extend({ events: { 'click .js-nav': 'navigate' }, initialize: function (options) { this.$el.html(template({ name: window.app.name, lang: lang })) this.$navLis = this.$('.js-li') this.setActivePage() this.listenTo(options.router, 'route', this.setActivePage) return this }, setActivePage: function () { var pathname = window.location.pathname this.$navLis.removeClass('active') this.$('.js-nav').each(function (index, value) { var $this = $(this) var href = $this.attr('href') if(href === '/') { if(pathname === '/') $this.parent().addClass('active') } else { if(href && pathname.match(new RegExp('^' + href.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')))) { $this.parent().addClass('active') } } }) }, navigate: function (e) { e.preventDefault() this.$('.navbar-collapse').removeClass('in') Backbone.history.navigate($(e.target).attr('href'), { trigger: true, replace: false }) } })
akileh/fermpi
front/views/nav.js
JavaScript
bsd-3-clause
1,413
import Subject from "parsers/Subject"; describe("parsers/Subject", () => { it("should split valid subject lines into object hash", () => { let subject = "type(scope): summary summary summary"; let pull = { commits: [{ commit: { message: subject } }] }; expect((new Subject()).parse(pull)).toEqual({ type: "type", scope: "scope", summary: "summary summary summary" }); }); it("should return object with null values on invalid message", () => { let subject = "type(scope) summary summary summary"; let pull = { commits: [{ commit: { message: subject } }] }; expect((new Subject()).parse(pull)).toEqual({ type: null, scope: null, summary: null }); }); it("should parse subjects with special characters", () => { let subject = "type($state!): summary summary summary"; let pull = { commits: [{ commit: { message: subject } }] }; expect((new Subject()).parse(pull).scope).toBe("$state!"); }); });
radify/PR.js
spec/parsers/Subject.js
JavaScript
bsd-3-clause
988
/******************************************************/ /* Funciones para manejo de datos del home */ /******************************************************/ var endpoint = 'http://localhost/RelemancoShopsWeb/api/web/v1/'; var rootURL = "/RelemancoShopsWeb/frontend/web"; var comercioMarkers = []; var markersColors = ["blue", "brown", "green", "orange", "paleblue", "yellow", "pink", "purple", "red", "darkgreen"]; var markersName = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "M", "N", "O", "P", "Q", "R", "S", "T", "X"]; var map = null; $( document ).ready(function() { // localizarComercios(); initComerciosMap(); getRutasHistorico(); }); function getRutasHistorico() { var user = $('#perfil-usuario').data('user'); if(user) { $.ajax({ method: "GET", url: endpoint + 'rutas/obtenerhistoricorutas', data: {'id_relevador': user-1}, dataType: "json", contentType: 'application/json' }).done(function(data){ var rutas = jQuery.parseJSON(data); dibujarTablaRutas(rutas, 'tabla-body'); }).fail(function(response){ alert(response.status); }); } } function cambiarRutas() { var id = this.id; var ruta = $('#'+id).data('ruta'); clearComercios(comercioMarkers); comercioMarkers.length = 0; if(ruta && ruta.comercios && ruta.comercios.length > 0) { var comercios = ruta.comercios; geoService.clearRoutes(map); for (var i = 0; i < comercios.length; i++) { addComercio(comercios[i], 200, map); } geoService.createRoutes(comercios, map); } } function dibujarTablaRutas(rutas, idTableBody) { if(rutas.length > 0 ){ var tabla = $('#'+idTableBody); rutas.forEach(function (val) { tabla.append('<tr id="' + val.id + '"><td>' + val.fecha_asignada + '</td><td>' + val.estado.nombre + '</td></tr>'); var tr = $('#' + val.id); tr.on('click', cambiarRutas); tr.attr('id', val.id); tr.data('ruta', val); }); } } /** * Returns a random integer between min (inclusive) and max (inclusive) * Using Math.round() will give you a non-uniform distribution! */ function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function initComerciosMap() { var myLatlng = {lat: -34.8059635, lng: -56.2145634}; map = new google.maps.Map(document.getElementById('mapa-comercios'), { zoom: 15, center: myLatlng }); } function dropComercios(comercios, map) { clearComercios(comercioMarkers); for (var i = 0; i < comercios.length; i++) { addComercio(comercios[i], 2000, map); } } function clearComercios(comercios) { for (var i = 0; i < comercios.length; i++) { comercios[i].setMap(null); } } function markerAnimation(marker){ if (marker.getAnimation() !== null) { marker.setAnimation(null); } else { marker.setAnimation(google.maps.Animation.BOUNCE); } } /* Funcion para genera la lista de comercios en la ventana de informacion del Comercio */ function generarInfoListaProductoComercio(productos){ if(productos != null){ var lista = "<ul>"; for (var i = 0; i < productos.length; i++){ lista += "<li>" + productos[i].nombre + "</li>"; } lista += "</ul>"; return lista; } return "<li>Este comercio no tiene productos asignados.</li>"; } function generarEnlaceComecio(comercio){ return "&nbsp;&nbsp;&nbsp;<a href='" + rootURL + '/comercio/view?id=' + comercio.id + "'><i class='fa fa-eye'>&nbsp;</i>Ver Comercio</a>"; } function generarInfoComercio(comercio){ if(comercio != null){ var info = "<h4>" + comercio.nombre + "</h4>"; info += "<hr/>"; info += generarInfoListaProductoComercio(comercio.productos); info += "<hr/>"; info += generarEnlaceComecio(comercio); return info; } return null; } function addComercio(comercio, timeout, map) { var loc = comercio.localizacion; var position = { lat : Number(loc.latitud), lng: Number(loc.longitud) }; var comercioMark = null; comercioMark = new google.maps.Marker({ position: position, map: map, animation: google.maps.Animation.DROP, title: comercio.nombre, icon: rootURL + "/img/GMapsMarkers/" + markersColors[getRandomInt(0,9)] + "_Marker" + markersName[getRandomInt(0,19)] + ".png" }); var infowindow = new google.maps.InfoWindow({ content: generarInfoComercio(comercio) }); comercioMark.addListener('click', function() { infowindow.addListener('closeclick', function(){ comercioMark.setAnimation(null); }); markerAnimation(this); infowindow.open(map, this); }); comercioMarkers.push(comercioMark); } var geoService = { createRoutes: function(markers, map) { var directionsService = new google.maps.DirectionsService(); map._directions = []; function renderDirections(result) { var directionsRenderer = new google.maps.DirectionsRenderer({ suppressMarkers: true }); directionsRenderer.setMap(map); directionsRenderer.setDirections(result); map._directions.push(directionsRenderer); } function requestDirections(start, end) { directionsService.route({ origin: start, destination: end, travelMode: google.maps.DirectionsTravelMode.DRIVING, unitSystem: google.maps.UnitSystem.METRIC }, function (result, status) { renderDirections(result); }); } for (var i = 0; i < markers.length; i++) { if (i < markers.length - 1) { var origen = {lat: Number(markers[i].localizacion.latitud), lng: Number(markers[i].localizacion.longitud)}; var destino = {lat: Number(markers[i + 1].localizacion.latitud), lng: Number(markers[i + 1].localizacion.longitud)}; requestDirections(origen, destino); } } }, clearRoutes: function (Gmap) { if (Gmap._directions && Gmap._directions.length > 0) { var directions = Gmap._directions; directions.forEach(function (val) { val.setMap(null); }); } } };
DRIMTIM/RelemancoShopsWeb
frontend/web/js/relemanco/site.js
JavaScript
bsd-3-clause
6,678
(function($){ $(function(){ $('#zen-gallery a').lightBox({ fixedNavigation:true, imageLoading: 'zen-gallery/images/lightbox-btn-loading.gif', imageBtnClose: 'zen-gallery/images/lightbox-btn-close.gif', imageBtnPrev: 'zen-gallery/images/lightbox-btn-prev.gif', imageBtnNext: 'zen-gallery/images/lightbox-btn-next.gif' }); }); })(jQuery);
silverstripe-australia/council-demo
zen-gallery/javascript/zengallery.js
JavaScript
bsd-3-clause
366
// Generated by CoffeeScript 1.3.3 (function() { var CMinion, Minion, port, restify, server; restify = require("restify"); CMinion = require("../../minion"); Minion = new CMinion(); server = restify.createServer(); server.use(restify.queryParser()); server.get("/", function(req, res) { res.send("Hello World."); return Minion.logRequest(req.query); }); port = process.env.PORT || 3000; Minion.started(); server.listen(port, function() { return console.log("Listening on port " + port); }); }).call(this);
thegoleffect/hapi-benchmarking
lib/servers/restify/helloworld.js
JavaScript
bsd-3-clause
552
/* * Copyright (C) 2012-2018 Doubango Telecom <http://www.doubango.org> * License: BSD * This file is part of Open Source sipML5 solution <http://www.sipml5.org> */ // http://tools.ietf.org/html/draft-uberti-rtcweb-jsep-02 // JSEP00: webkitPeerConnection00 (http://www.w3.org/TR/2012/WD-webrtc-20120209/) // JSEP01: webkitRTCPeerConnection (http://www.w3.org/TR/webrtc/), https://webrtc-demos.appspot.com/html/pc1.html // Mozilla: http://mozilla.github.com/webrtc-landing/pc_test.html // Contraints: https://webrtc-demos.appspot.com/html/constraints-and-stats.html // Android: https://groups.google.com/group/discuss-webrtc/browse_thread/thread/b8538c85df801b40 // Canary 'muted': https://groups.google.com/group/discuss-webrtc/browse_thread/thread/8200f2049c4de29f // Canary state events: https://groups.google.com/group/discuss-webrtc/browse_thread/thread/bd30afc3e2f43f6d // DTMF: https://groups.google.com/group/discuss-webrtc/browse_thread/thread/1354781f202adbf9 // IceRestart: https://groups.google.com/group/discuss-webrtc/browse_thread/thread/c189584d380eaa97 // Video Resolution: https://code.google.com/p/chromium/issues/detail?id=143631#c9 // Webrtc-Everywhere: https://github.com/sarandogou/webrtc-everywhere // Adapter.js: https://github.com/sarandogou/webrtc tmedia_session_jsep.prototype = Object.create(tmedia_session.prototype); tmedia_session_jsep01.prototype = Object.create(tmedia_session_jsep.prototype); tmedia_session_jsep.prototype.o_pc = null; tmedia_session_jsep.prototype.b_cache_stream = false; tmedia_session_jsep.prototype.o_local_stream = null; tmedia_session_jsep.prototype.o_sdp_jsep_lo = null; tmedia_session_jsep.prototype.o_sdp_lo = null; tmedia_session_jsep.prototype.b_sdp_lo_pending = false; tmedia_session_jsep.prototype.o_sdp_json_ro = null; tmedia_session_jsep.prototype.o_sdp_ro = null; tmedia_session_jsep.prototype.b_sdp_ro_pending = false; tmedia_session_jsep.prototype.b_sdp_ro_offer = false; tmedia_session_jsep.prototype.s_answererSessionId = null; tmedia_session_jsep.prototype.s_offererSessionId = null; tmedia_session_jsep.prototype.ao_ice_servers = null; tmedia_session_jsep.prototype.o_bandwidth = { audio: undefined, video: undefined }; tmedia_session_jsep.prototype.o_video_size = { minWidth: undefined, minHeight: undefined, maxWidth: undefined, maxHeight: undefined }; tmedia_session_jsep.prototype.d_screencast_windowid = 0; // BFCP. #0 means entire desktop tmedia_session_jsep.prototype.b_ro_changed = false; tmedia_session_jsep.prototype.b_lo_held = false; tmedia_session_jsep.prototype.b_ro_held = false; // // JSEP // tmedia_session_jsep.prototype.CreateInstance = function (o_mgr) { return new tmedia_session_jsep01(o_mgr); } function tmedia_session_jsep(o_mgr) { tmedia_session.call(this, o_mgr.e_type, o_mgr); } tmedia_session_jsep.prototype.__set = function (o_param) { if (!o_param) { return -1; } switch (o_param.s_key) { case 'ice-servers': { this.ao_ice_servers = o_param.o_value; return 0; } case 'cache-stream': { this.b_cache_stream = !!o_param.o_value; return 0; } case 'bandwidth': { this.o_bandwidth = o_param.o_value; return 0; } case 'video-size': { this.o_video_size = o_param.o_value; return 0; } case 'screencast-windowid': { this.d_screencast_windowid = parseFloat(o_param.o_value.toString()); if (this.o_pc && this.o_pc.setScreencastSrcWindowId) { this.o_pc.setScreencastSrcWindowId(this.d_screencast_windowid); } return 0; } case 'mute-audio': case 'mute-video': { if (this.o_pc && typeof o_param.o_value == "boolean") { if (this.o_pc.mute) { this.o_pc.mute((o_param.s_key === 'mute-audio') ? "audio" : "video", o_param.o_value); } else if (this.o_local_stream) { var tracks = (o_param.s_key === 'mute-audio') ? this.o_local_stream.getAudioTracks() : this.o_local_stream.getVideoTracks(); if (tracks) { for (var i = 0; i < tracks.length; ++i) { tracks[i].enabled = !o_param.o_value; } } } } } } return -2; } tmedia_session_jsep.prototype.__prepare = function () { return 0; } tmedia_session_jsep.prototype.__set_media_type = function (e_type) { if (e_type != this.e_type) { this.e_type = e_type; this.o_sdp_lo = null; } return 0; } tmedia_session_jsep.prototype.__processContent = function (s_req_name, s_content_type, s_content_ptr, i_content_size) { if (this.o_pc && this.o_pc.processContent) { this.o_pc.processContent(s_req_name, s_content_type, s_content_ptr, i_content_size); return 0; } return -1; } tmedia_session_jsep.prototype.__send_dtmf = function (s_digit) { if (this.o_pc && this.o_pc.sendDTMF) { this.o_pc.sendDTMF(s_digit); return 0; } return -1; } tmedia_session_jsep.prototype.__start = function () { if (this.o_local_stream && this.o_local_stream.start) { // cached stream would be stopped in close() this.o_local_stream.start(); } return 0; } tmedia_session_jsep.prototype.__pause = function () { if (this.o_local_stream && this.o_local_stream.pause) { this.o_local_stream.pause(); } return 0; } tmedia_session_jsep.prototype.__stop = function () { this.close(); this.o_sdp_lo = null; tsk_utils_log_info("PeerConnection::stop()"); return 0; } tmedia_session_jsep.prototype.decorate_lo = function () { if (this.o_sdp_lo) { /* Session name for debugging - Requires by webrtc2sip to set RTCWeb type */ var o_hdr_S; if ((o_hdr_S = this.o_sdp_lo.get_header(tsdp_header_type_e.S))) { o_hdr_S.s_value = "Doubango Telecom - " + tsk_utils_get_navigator_friendly_name(); } /* HACK: https://bugzilla.mozilla.org/show_bug.cgi?id=1072384 */ var o_hdr_O; if ((o_hdr_O = this.o_sdp_lo.get_header(tsdp_header_type_e.O))) { if (o_hdr_O.s_addr === "0.0.0.0") { o_hdr_O.s_addr = "127.0.0.1"; } } /* Remove 'video' media if not enabled (bug in chrome: doesn't honor 'has_video' parameter) */ if (!(this.e_type.i_id & tmedia_type_e.VIDEO.i_id)) { this.o_sdp_lo.remove_media("video"); } /* hold / resume, profile, bandwidth... */ var i_index = 0; var o_hdr_M; var b_fingerprint = !!this.o_sdp_lo.get_header_a("fingerprint"); // session-level fingerprint while ((o_hdr_M = this.o_sdp_lo.get_header_at(tsdp_header_type_e.M, i_index++))) { // hold/resume o_hdr_M.set_holdresume_att(this.b_lo_held, this.b_ro_held); // HACK: Nightly 20.0a1 uses RTP/SAVPF for DTLS-SRTP which is not correct. More info at https://bugzilla.mozilla.org/show_bug.cgi?id=827932. if (o_hdr_M.find_a("crypto")) { o_hdr_M.s_proto = "RTP/SAVPF"; } else if (b_fingerprint || o_hdr_M.find_a("fingerprint")) { o_hdr_M.s_proto = "UDP/TLS/RTP/SAVPF"; } // HACK: https://bugzilla.mozilla.org/show_bug.cgi?id=1072384 if (o_hdr_M.o_hdr_C && o_hdr_M.o_hdr_C.s_addr === "0.0.0.0") { o_hdr_M.o_hdr_C.s_addr = "127.0.0.1"; } // bandwidth if (this.o_bandwidth) { if (this.o_bandwidth.audio && o_hdr_M.s_media.toLowerCase() == "audio") { o_hdr_M.add_header(new tsdp_header_B("AS:" + this.o_bandwidth.audio)); } else if (this.o_bandwidth.video && o_hdr_M.s_media.toLowerCase() == "video") { o_hdr_M.add_header(new tsdp_header_B("AS:" + this.o_bandwidth.video)); } } } } return 0; } tmedia_session_jsep.prototype.decorate_ro = function (b_remove_bundle) { if (this.o_sdp_ro) { var o_hdr_M, o_hdr_A; var i_index = 0, i; // FIXME: Chrome fails to parse SDP with global SDP "a=" attributes // Chrome 21.0.1154.0+ generate "a=group:BUNDLE audio video" but cannot parse it // In fact, new the attribute is left the ice callback is called twice and the 2nd one trigger new INVITE then 200OK. The SYN_ERR is caused by the SDP in the 200 OK. // Is it because of "a=rtcp:1 IN IP4 0.0.0.0"? if (b_remove_bundle) { this.o_sdp_ro.remove_header(tsdp_header_type_e.A); } // ==== START: RFC5939 utility functions ==== // var rfc5939_get_acap_part = function (o_hdr_a, i_part/* i_part = 1: field, 2: value*/) { var ao_match = o_hdr_a.s_value.match(/^\d\s+(\w+):([\D|\d]+)/i); if (ao_match && ao_match.length == 3) { return ao_match[i_part]; } } var rfc5939_acap_ensure = function (o_hdr_a) { if (o_hdr_a && o_hdr_a.s_field == "acap") { o_hdr_a.s_field = rfc5939_get_acap_part(o_hdr_a, 1); o_hdr_a.s_value = rfc5939_get_acap_part(o_hdr_a, 2); } } var rfc5939_get_headerA_at = function (o_msg, s_media, s_field, i_index) { var i_pos = 0; var get_headerA_at = function (o_sdp, s_field, i_index) { if (o_sdp) { var ao_headersA = (o_sdp.ao_headers || o_sdp.ao_hdr_A); for (var i = 0; i < ao_headersA.length; ++i) { if (ao_headersA[i].e_type == tsdp_header_type_e.A && ao_headersA[i].s_value) { var b_found = (ao_headersA[i].s_field === s_field); if (!b_found && ao_headersA[i].s_field == "acap") { b_found = (rfc5939_get_acap_part(ao_headersA[i], 1) == s_field); } if (b_found && i_pos++ >= i_index) { return ao_headersA[i]; } } } } } var o_hdr_a = get_headerA_at(o_msg, s_field, i_index); // find at session level if (!o_hdr_a) { return get_headerA_at(o_msg.get_header_m_by_name(s_media), s_field, i_index); // find at media level } return o_hdr_a; } // ==== END: RFC5939 utility functions ==== // // change profile if not secure //!\ firefox nighly: DTLS-SRTP only, chrome: SDES-SRTP var b_fingerprint = !!this.o_sdp_ro.get_header_a("fingerprint"); // session-level fingerprint while ((o_hdr_M = this.o_sdp_ro.get_header_at(tsdp_header_type_e.M, i_index++))) { // check for "crypto:"/"fingerprint:" lines (event if it's not valid to provide "crypto" lines in non-secure SDP many clients do it, so, just check) if (o_hdr_M.s_proto.indexOf("SAVP") < 0) { if (o_hdr_M.find_a("crypto")) { o_hdr_M.s_proto = "RTP/SAVPF"; break; } else if (b_fingerprint || o_hdr_M.find_a("fingerprint")) { o_hdr_M.s_proto = "UDP/TLS/RTP/SAVPF"; break; } } // rfc5939: "acap:fingerprint,setup,connection" if (o_hdr_M.s_proto.indexOf("SAVP") < 0) { if ((o_hdr_A = rfc5939_get_headerA_at(this.o_sdp_ro, o_hdr_M.s_media, "fingerprint", 0))) { rfc5939_acap_ensure(o_hdr_A); if ((o_hdr_A = rfc5939_get_headerA_at(this.o_sdp_ro, o_hdr_M.s_media, "setup", 0))) { rfc5939_acap_ensure(o_hdr_A); } if ((o_hdr_A = rfc5939_get_headerA_at(this.o_sdp_ro, o_hdr_M.s_media, "connection", 0))) { rfc5939_acap_ensure(o_hdr_A); } o_hdr_M.s_proto = "UDP/TLS/RTP/SAVP"; } } // rfc5939: "acap:crypto". Only if DTLS is OFF if (o_hdr_M.s_proto.indexOf("SAVP") < 0) { i = 0; while ((o_hdr_A = rfc5939_get_headerA_at(this.o_sdp_ro, o_hdr_M.s_media, "crypto", i++))) { rfc5939_acap_ensure(o_hdr_A); o_hdr_M.s_proto = "RTP/SAVPF"; // do not break => find next "acap:crypto" lines and ensure them } } // HACK: Nightly 20.0a1 uses RTP/SAVPF for DTLS-SRTP which is not correct. More info at https://bugzilla.mozilla.org/show_bug.cgi?id=827932 // Same for chrome: https://code.google.com/p/sipml5/issues/detail?id=92 if (o_hdr_M.s_proto.indexOf("UDP/TLS/RTP/SAVP") != -1) { o_hdr_M.s_proto = "RTP/SAVPF"; } } } return 0; } tmedia_session_jsep.prototype.subscribe_stream_events = function () { if (this.o_pc) { var This = (tmedia_session_jsep01.mozThis || this); this.o_pc.onaddstream = function (evt) { tsk_utils_log_info("__on_add_stream"); This.o_remote_stream = evt.stream; if (This.o_mgr) { This.o_mgr.set_stream_remote(evt.stream); } } this.o_pc.onremovestream = function (evt) { tsk_utils_log_info("__on_remove_stream"); This.o_remote_stream = null; if (This.o_mgr) { This.o_mgr.set_stream_remote(null); } } } } tmedia_session_jsep.prototype.close = function () { if (this.o_mgr) { // 'onremovestream' not always called this.o_mgr.set_stream_remote(null); this.o_mgr.set_stream_local(null); } if (this.o_pc) { if (this.o_local_stream) { // TODO: On Firefox 26: Error: "removeStream not implemented yet" try { this.o_pc.removeStream(this.o_local_stream); } catch (e) { tsk_utils_log_error(e); } if (!this.b_cache_stream || (this.e_type == tmedia_type_e.SCREEN_SHARE)) { // only stop if caching is disabled or screenshare try { var tracks = this.o_local_stream.getTracks(); for (var track in tracks) { tracks[track].stop(); } } catch (e) { tsk_utils_log_error(e); } try { this.o_local_stream.stop(); } catch (e) { } // Deprecated in Chrome 45: https://github.com/DoubangoTelecom/sipml5/issues/231 } this.o_local_stream = null; } this.o_pc.close(); this.o_pc = null; this.b_sdp_lo_pending = false; this.b_sdp_ro_pending = false; } } tmedia_session_jsep.prototype.__acked = function () { return 0; } tmedia_session_jsep.prototype.__hold = function () { if (this.b_lo_held) { // tsk_utils_log_warn('already on hold'); return; } this.b_lo_held = true; this.o_sdp_ro = null; this.o_sdp_lo = null; if (this.o_pc && this.o_local_stream) { this.o_pc.removeStream(this.o_local_stream); } return 0; } tmedia_session_jsep.prototype.__resume = function () { if (!this.b_lo_held) { // tsk_utils_log_warn('not on hold'); return; } this.b_lo_held = false; this.o_sdp_lo = null; this.o_sdp_ro = null; if (this.o_pc && this.o_local_stream) { this.o_pc.addStream(this.o_local_stream); } return 0; } // // JSEP01 // function tmedia_session_jsep01(o_mgr) { tmedia_session_jsep.call(this, o_mgr); this.o_media_constraints = { 'mandatory': { 'OfferToReceiveAudio': !!(this.e_type.i_id & tmedia_type_e.AUDIO.i_id), 'OfferToReceiveVideo': !!(this.e_type.i_id & tmedia_type_e.VIDEO.i_id) } }; if (tsk_utils_get_navigator_friendly_name() == 'firefox') { tmedia_session_jsep01.mozThis = this; // FIXME: no longer needed? At least not needed on FF 34.05 this.o_media_constraints.mandatory.MozDontOfferDataChannel = true; } } tmedia_session_jsep01.mozThis = undefined; tmedia_session_jsep01.onGetUserMediaSuccess = function (o_stream, _This) { tsk_utils_log_info("onGetUserMediaSuccess"); var This = (tmedia_session_jsep01.mozThis || _This); if (This && This.o_pc && This.o_mgr) { if (!This.b_sdp_lo_pending) { tsk_utils_log_warn("onGetUserMediaSuccess but no local sdp request is pending"); return; } if (o_stream) { // save stream other next calls if (o_stream.getAudioTracks().length > 0 && o_stream.getVideoTracks().length == 0) { __o_jsep_stream_audio = o_stream; } else if (o_stream.getAudioTracks().length > 0 && o_stream.getVideoTracks().length > 0) { __o_jsep_stream_audiovideo = o_stream; } if (!This.o_local_stream) { This.o_mgr.callback(tmedia_session_events_e.STREAM_LOCAL_ACCEPTED, this.e_type); } // HACK: Firefox only allows to call gum one time if (tmedia_session_jsep01.mozThis) { __o_jsep_stream_audiovideo = __o_jsep_stream_audio = o_stream; } This.o_local_stream = o_stream; This.o_pc.addStream(o_stream); } else { // Probably call held } This.o_mgr.set_stream_local(o_stream); var b_answer = ((This.b_sdp_ro_pending || This.b_sdp_ro_offer) && (This.o_sdp_ro != null)); if (b_answer) { tsk_utils_log_info("createAnswer"); This.o_pc.createAnswer( tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onCreateSdpSuccess : function (o_offer) { tmedia_session_jsep01.onCreateSdpSuccess(o_offer, This); }, tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onCreateSdpError : function (s_error) { tmedia_session_jsep01.onCreateSdpError(s_error, This); }, This.o_media_constraints, false // createProvisionalAnswer ); } else { tsk_utils_log_info("createOffer"); This.o_pc.createOffer( tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onCreateSdpSuccess : function (o_offer) { tmedia_session_jsep01.onCreateSdpSuccess(o_offer, This); }, tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onCreateSdpError : function (s_error) { tmedia_session_jsep01.onCreateSdpError(s_error, This); }, This.o_media_constraints ); } } } tmedia_session_jsep01.onGetUserMediaError = function (s_error, _This) { tsk_utils_log_info("onGetUserMediaError"); var This = (tmedia_session_jsep01.mozThis || _This); if (This && This.o_mgr) { tsk_utils_log_error(s_error); This.o_mgr.callback(tmedia_session_events_e.STREAM_LOCAL_REFUSED, This.e_type); } } tmedia_session_jsep01.onCreateSdpSuccess = function (o_sdp, _This) { tsk_utils_log_info("onCreateSdpSuccess"); var This = (tmedia_session_jsep01.mozThis || _This); if (This && This.o_pc) { This.o_pc.setLocalDescription(o_sdp, tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onSetLocalDescriptionSuccess : function () { tmedia_session_jsep01.onSetLocalDescriptionSuccess(This); }, tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onSetLocalDescriptionError : function (s_error) { tmedia_session_jsep01.onSetLocalDescriptionError(s_error, This); } ); } } tmedia_session_jsep01.onCreateSdpError = function (s_error, _This) { tsk_utils_log_info("onCreateSdpError"); var This = (tmedia_session_jsep01.mozThis || _This); if (This && This.o_mgr) { tsk_utils_log_error(s_error); This.o_mgr.callback(tmedia_session_events_e.GET_LO_FAILED, This.e_type); } } tmedia_session_jsep01.onSetLocalDescriptionSuccess = function (_This) { tsk_utils_log_info("onSetLocalDescriptionSuccess"); var This = (tmedia_session_jsep01.mozThis || _This); if (This && This.o_pc) { if ((This.o_pc.iceGatheringState || This.o_pc.iceState) === "complete") { tmedia_session_jsep01.onIceGatheringCompleted(This); } This.b_sdp_ro_offer = false; // reset until next incoming RO } } tmedia_session_jsep01.onSetLocalDescriptionError = function (s_error, _This) { tsk_utils_log_info("onSetLocalDescriptionError"); var This = (tmedia_session_jsep01.mozThis || _This); if (This && This.o_mgr) { tsk_utils_log_error(s_error.toString()); This.o_mgr.callback(tmedia_session_events_e.GET_LO_FAILED, This.e_type); } } tmedia_session_jsep01.onSetRemoteDescriptionSuccess = function (_This) { tsk_utils_log_info("onSetRemoteDescriptionSuccess"); var This = (tmedia_session_jsep01.mozThis || _This); if (This) { if (!This.b_sdp_ro_pending && This.b_sdp_ro_offer) { This.o_sdp_lo = null; // to force new SDP when get_lo() is called } } } tmedia_session_jsep01.onSetRemoteDescriptionError = function (s_error, _This) { tsk_utils_log_info("onSetRemoteDescriptionError"); var This = (tmedia_session_jsep01.mozThis || _This); if (This) { This.o_mgr.callback(tmedia_session_events_e.SET_RO_FAILED, This.e_type); tsk_utils_log_error(s_error); } } tmedia_session_jsep01.onIceGatheringCompleted = function (_This) { tsk_utils_log_info("onIceGatheringCompleted"); var This = (tmedia_session_jsep01.mozThis || _This); if (This && This.o_pc) { if (!This.b_sdp_lo_pending) { tsk_utils_log_warn("onIceGatheringCompleted but no local sdp request is pending"); return; } This.b_sdp_lo_pending = false; // HACK: Firefox Nightly 20.0a1(2013-01-08): PeerConnection.localDescription has a wrong value (remote sdp). More info at https://bugzilla.mozilla.org/show_bug.cgi?id=828235 var localDescription = (This.localDescription || This.o_pc.localDescription); if (localDescription) { This.o_sdp_jsep_lo = localDescription; This.o_sdp_lo = tsdp_message.prototype.Parse(This.o_sdp_jsep_lo.sdp); This.decorate_lo(); if (This.o_mgr) { This.o_mgr.callback(tmedia_session_events_e.GET_LO_SUCCESS, This.e_type); } } else { This.o_mgr.callback(tmedia_session_events_e.GET_LO_FAILED, This.e_type); tsk_utils_log_error("localDescription is null"); } } } tmedia_session_jsep01.onIceCandidate = function (o_event, _This) { var This = (tmedia_session_jsep01.mozThis || _This); if (!This || !This.o_pc) { tsk_utils_log_error("This/PeerConnection is null: unexpected"); return; } var iceState = (This.o_pc.iceGatheringState || This.o_pc.iceState); tsk_utils_log_info("onIceCandidate = " + iceState); if (iceState === "complete" || (o_event && !o_event.candidate)) { tsk_utils_log_info("ICE GATHERING COMPLETED!"); tmedia_session_jsep01.onIceGatheringCompleted(This); } else if (This.o_pc.iceState === "failed") { tsk_utils_log_error("Ice state is 'failed'"); This.o_mgr.callback(tmedia_session_events_e.GET_LO_FAILED, This.e_type); } } tmedia_session_jsep01.onNegotiationNeeded = function (o_event, _This) { tsk_utils_log_info("onNegotiationNeeded"); var This = (tmedia_session_jsep01.mozThis || _This); if (!This || !This.o_pc) { // do not raise error: could happen after pc.close() return; } if ((This.o_pc.iceGatheringState || This.o_pc.iceState) !== "new") { tmedia_session_jsep01.onGetUserMediaSuccess(This.b_lo_held ? null : This.o_local_stream, This); } } tmedia_session_jsep01.onSignalingstateChange = function (o_event, _This) { var This = (tmedia_session_jsep01.mozThis || _This); if (!This || !This.o_pc) { // do not raise error: could happen after pc.close() return; } tsk_utils_log_info("onSignalingstateChange:" + This.o_pc.signalingState); if (This.o_local_stream && This.o_pc.signalingState === "have-remote-offer") { tmedia_session_jsep01.onGetUserMediaSuccess(This.o_local_stream, This); } } tmedia_session_jsep01.prototype.__get_lo = function () { var This = this; if (!this.o_pc && !this.b_lo_held) { var o_video_constraints = { mandatory: {}, optional: [] }; if ((this.e_type.i_id & tmedia_type_e.SCREEN_SHARE.i_id) == tmedia_type_e.SCREEN_SHARE.i_id) { o_video_constraints.mandatory.chromeMediaSource = 'screen'; } if (this.e_type.i_id & tmedia_type_e.VIDEO.i_id) { if (this.o_video_size) { if (this.o_video_size.minWidth) o_video_constraints.mandatory.minWidth = this.o_video_size.minWidth; if (this.o_video_size.minHeight) o_video_constraints.mandatory.minHeight = this.o_video_size.minHeight; if (this.o_video_size.maxWidth) o_video_constraints.mandatory.maxWidth = this.o_video_size.maxWidth; if (this.o_video_size.maxHeight) o_video_constraints.mandatory.maxHeight = this.o_video_size.maxHeight; } try { tsk_utils_log_info("Video Contraints:" + JSON.stringify(o_video_constraints)); } catch (e) { } } var o_iceServers = this.ao_ice_servers; if (!o_iceServers) { // defines default ICE servers only if none exist (because WebRTC requires ICE) // HACK Nightly 21.0a1 (2013-02-18): // - In RTCConfiguration passed to RTCPeerConnection constructor: FQDN not yet implemented (only IP-#s). Omitting "stun:stun.l.google.com:19302" // - CHANGE-REQUEST not supported when using "numb.viagenie.ca" // - (stun/ERR) Missing XOR-MAPPED-ADDRESS when using "stun.l.google.com" // numb.viagenie.ca: 66.228.45.110: // stun.l.google.com: 173.194.78.127 // stun.counterpath.net: 216.93.246.18 // "23.21.150.121" is the default STUN server used in Nightly o_iceServers = tmedia_session_jsep01.mozThis ? [{ url: 'stun:23.21.150.121:3478' }, { url: 'stun:216.93.246.18:3478' }, { url: 'stun:66.228.45.110:3478' }, { url: 'stun:173.194.78.127:19302' }] : [{ url: 'stun:stun.l.google.com:19302' }, { url: 'stun:stun.counterpath.net:3478' }, { url: 'stun:numb.viagenie.ca:3478' }]; } try { tsk_utils_log_info("ICE servers:" + JSON.stringify(o_iceServers)); } catch (e) { } this.o_pc = new window.RTCPeerConnection( (o_iceServers && !o_iceServers.length) ? null : { iceServers: o_iceServers, rtcpMuxPolicy: "negotiate" }, // empty array is used to disable STUN/TURN. this.o_media_constraints ); this.o_pc.onicecandidate = tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onIceCandidate : function (o_event) { tmedia_session_jsep01.onIceCandidate(o_event, This); }; this.o_pc.onnegotiationneeded = tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onNegotiationNeeded : function (o_event) { tmedia_session_jsep01.onNegotiationNeeded(o_event, This); }; this.o_pc.onsignalingstatechange = tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onSignalingstateChange : function (o_event) { tmedia_session_jsep01.onSignalingstateChange(o_event, This); }; this.subscribe_stream_events(); } if (!this.o_sdp_lo && !this.b_sdp_lo_pending) { this.b_sdp_lo_pending = true; // set penfing ro if there is one if (this.b_sdp_ro_pending && this.o_sdp_ro) { this.__set_ro(this.o_sdp_ro, true); } // get media stream if (this.e_type == tmedia_type_e.AUDIO && (this.b_cache_stream && __o_jsep_stream_audio)) { tmedia_session_jsep01.onGetUserMediaSuccess(__o_jsep_stream_audio, This); } else if (this.e_type == tmedia_type_e.AUDIO_VIDEO && (this.b_cache_stream && __o_jsep_stream_audiovideo)) { tmedia_session_jsep01.onGetUserMediaSuccess(__o_jsep_stream_audiovideo, This); } else { if (!this.b_lo_held && !this.o_local_stream) { this.o_mgr.callback(tmedia_session_events_e.STREAM_LOCAL_REQUESTED, this.e_type); navigator.getUserMedia( { audio: (this.e_type == tmedia_type_e.SCREEN_SHARE) ? false : !!(this.e_type.i_id & tmedia_type_e.AUDIO.i_id), // IMPORTANT: Chrome '28.0.1500.95 m' doesn't support using audio with screenshare video: !!(this.e_type.i_id & tmedia_type_e.VIDEO.i_id) ? o_video_constraints : false, // "SCREEN_SHARE" contains "VIDEO" flag -> (VIDEO & SCREEN_SHARE) = VIDEO data: false }, tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onGetUserMediaSuccess : function (o_stream) { tmedia_session_jsep01.onGetUserMediaSuccess(o_stream, This); }, tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onGetUserMediaError : function (s_error) { tmedia_session_jsep01.onGetUserMediaError(s_error, This); } ); } } } return this.o_sdp_lo; } tmedia_session_jsep01.prototype.__set_ro = function (o_sdp, b_is_offer) { if (!o_sdp) { tsk_utils_log_error("Invalid argument"); return -1; } /* update remote offer */ this.o_sdp_ro = o_sdp; this.b_sdp_ro_offer = b_is_offer; /* reset local sdp */ if (b_is_offer) { this.o_sdp_lo = null; } if (this.o_pc) { try { var This = this; this.decorate_ro(false); tsk_utils_log_info("setRemoteDescription(" + (b_is_offer ? "offer)" : "answer)") + "\n" + this.o_sdp_ro); this.o_pc.setRemoteDescription( new window.RTCSessionDescription({ type: b_is_offer ? "offer" : "answer", sdp: This.o_sdp_ro.toString() }), tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onSetRemoteDescriptionSuccess : function () { tmedia_session_jsep01.onSetRemoteDescriptionSuccess(This); }, tmedia_session_jsep01.mozThis ? tmedia_session_jsep01.onSetRemoteDescriptionError : function (s_error) { tmedia_session_jsep01.onSetRemoteDescriptionError(s_error, This); } ); } catch (e) { tsk_utils_log_error(e); this.o_mgr.callback(tmedia_session_events_e.SET_RO_FAILED, this.e_type); return -2; } finally { this.b_sdp_ro_pending = false; } } else { this.b_sdp_ro_pending = true; } return 0; }
DoubangoTelecom/sipml5
src/tinyMEDIA/src/tmedia_session_jsep.js
JavaScript
bsd-3-clause
31,502
// varinput.js // Javascript routines to handle variable rendering // $Id: //dev/EPS/js/varinput.js#48 $ function inspect() { form1.xml.value = '1'; SubmitFormSpecial('table'); } // global variable used for items that submit on change or selection var autosubmit = ''; var autopublish = ''; var workspaceByPass = false; function valueChanged(ident) { var theField = document.getElementById('form1').variablechanged; if (theField != null) { theField.value = (theField.value == '') ? ',' + ident + ',' : (theField.value.indexOf(',' + ident + ',') > -1) ? theField.value : theField.value + ident + ','; if (autopublish.indexOf(',' + ident + ',') > -1 && autosubmitting == 0) { bypass_comment = 1; autosubmitting = 1; document.form1.pubPress.value = 'pubPress'; document.form1.autopubvar.value = ident; PreSubmit('autopublish'); } else if (autosubmit.indexOf(',' + ident + ',') > -1 && autosubmitting == 0) { bypass_comment = 1; autosubmitting = 1; document.form1.subPress.value = 'subPress'; if (workspaceByPass == true) { document.form1.bypassPress.value = 'bypassPress'; } PreSubmit(); } } } function valueUnChanged(ident) { var theField = document.getElementById('form1').variablechanged; if (theField != null) { if (theField.value.indexOf(ident + ',') > -1) { theField.value = theField.value.replace(ident + ',', ''); } } } function processCmt(obj, ident) { obj.value = obj.value.substring(0, 1999); var theField = document.getElementById('form1').commentchanged; theField.value = (theField.value == '') ? ',' + ident + ',' : (theField.value.indexOf(',' + ident + ',') > -1) ? theField.value : theField.value + ident + ','; valueChanged(ident); } function addAutosubmit(ident) { autosubmit = ((autosubmit == '') ? ',' + ident + ',' : autosubmit + ident + ','); } function hasAutoSubmit(ident) { return (autosubmit.indexOf(',' + ident + ',') > -1); } function addAutoPublish(ident) { autopublish = ((autopublish == '') ? ',' + ident + ',' : autopublish + ident + ','); } function hasVariableChanged() { return (document.getElementById('form1').variablechanged.value.length > 1); } function hasCommentChanged() { return (document.getElementById('form1').commentchanged.value.length > 1); } function keyPressed(f,e, acceptEnter) // can use as form or field handler { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) return acceptEnter; else return true; } function SubmitFormSpecial(s, s2) { var form1 = document.getElementById('form1'); if (s2 != null) { if (s2 == 'table_image') form1.table_image.value = 'true'; } form1.act.value = s; form1.submit(); } function SubmitFormSpecialLarge(s,v) { var form1 = document.getElementById('form1'); form1.act.value = s; form1.sview.value = v; form1.submit(); form1.act.value = ''; form1.sview.value = ''; } function SubmitFormAndExcel() { var form1 = document.getElementById('form1'); form1.act.value = 'Excel'; form1.submit(); form1.act.value = ''; form1.sview.value = ''; } function ExcelandRestore(s, isPortForm, varMode) { var form1 = document.getElementById('form1'); var formType = 'proj'; if (isPortForm == 'true') { formType = 'port'; } if (varMode != 'output') { varMode = 'input'; } var aspxPage = formType + varMode + '.aspx?var='; form1.target = 'excel'; var oldact = form1.action; form1.action = aspxPage + s + oldact.substring(oldact.indexOf('&')).replace(/var=(\w+)&/, ''); form1.act.value = 'Excel'; form1.submit(); form1.target = '_self'; form1.act.value = ''; form1.action = oldact; } function SubmitFormSpecialWithMenus(s) { var d = new Date(), form1 = document.getElementById('form1'); var wName = d.getUTCSeconds() + '_' + d.getUTCMinutes() + '_'; //Create a unique name for the window window.open('about:blank', wName, 'toolbar=yes,location=no,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=850,height=700'); form1.target = wName; form1.act.value = s; form1.submit(); form1.target = '_self'; form1.act.value = ''; } function ReturnComment() { PostSubmit(); } function SubmitFormSpecialOnValue(field,s) { if (field.value.length > 0) { SubmitFormSpecial(s); field.selectedIndex = 0; } } function currTime() { var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds(); var timeValue = '' + ((hours > 12) ? hours - 12 : hours); if (timeValue == '0') timeValue = 12; timeValue += ((minutes < 10) ? ':0' : ':') + minutes; timeValue += ((seconds < 10) ? ':0' : ':') + seconds; timeValue += (hours >= 12) ? ' PM' : ' AM'; return timeValue; } function showHandle() { if (showHandleFlag == 0) { showHandleFlag = 1; $('img.frameHandle').show(); setTimeout("$('img.frameHandle').hide(); showHandleFlag=0;", 2600); } } function frameResize() { if (window.parent.document.getElementById('fs2').getAttribute('cols') == '200,*') { window.parent.document.getElementById('fs2').setAttribute('cols', '0,*'); $('img.frameHandle').attr('src', 'images/dbl_r.gif').attr('alt', 'Restore the navigation bar').attr('title', 'Restore the navigation bar'); } else { window.parent.document.getElementById('fs2').setAttribute('cols', '200,*'); $('img.frameHandle').attr('src', 'images/dbl_l.gif').attr('alt', 'Minimize the navigation bar').attr('title', 'Minimize the navigation bar'); } } function bindEvents() { var justFocused; $('.epsgrid input').mouseup(function(e) {if (justFocused == 1) {e.preventDefault(); justFocused = 0;} }); $('.epsgrid input[type!="checkbox"]').focus(function() { origVals[this.name] = this.value; this.select(); justFocused = 1; setTimeout('justFocused = 0', 50); }).blur(function() { resizeCol(this); }).keydown(function(e) { return InputKeyPress(this, e); }).keypress(function(e) { return keyPressed(this, e, false); }).change(function() { fch(this, true, this.id.substring(0, this.id.lastIndexOf('_id'))); }); } // LEAVE AT BOTTOM OF JS FILE // // special jQuery to paint events onto inputs // var showHandleFlag; showHandleFlag = 0; if (typeof jQuery != 'undefined') { $(document).ready(function() { setTimeout('bindEvents()', 1); $('.epsvar').change(function() { var cmdStr; cmdStr = 'validate_' + $(this).attr('vname') + "($('#valueField_" + $(this).attr('vname') + "').val(),'" + $(this).attr('orig_value') + "',true)"; setTimeout(cmdStr, 1); }); var textValue; $('textarea.expanding').each(function() { textValue = $(this).text(); while (textValue.indexOf('**br**') != -1) { textValue = textValue.replace('**br**', '\n'); } $(this).val(textValue); }); $('textarea.expanding').autogrow(); if (window.parent.document.getElementById('fs2')) { $('body').mousemove(function(e) { if (e.pageX < 50 && e.pageY < 50) showHandle(); }).append('<img class="frameHandle" src="images/dbl_l.gif"/>'); $('img.frameHandle').bind('click', function() {frameResize()}); if (window.parent.document.getElementById('fs2').getAttribute('cols') == '0,*') { $('img.frameHandle').attr('src', 'images/dbl_r.gif'); $('img.frameHandle').attr('alt', 'Restore the navigation bar'); $('img.frameHandle').attr('title', 'Restore the navigation bar'); } else { $('img.frameHandle').attr('src', 'images/dbl_l.gif').attr('alt', 'Minimize the navigation bar').attr('title', 'Minimize the navigation bar'); } } }); } function openShortcutNode(aspxfile, sc_tid, sc_pid, sc_var, formcls) { var urlStr; urlStr = aspxfile + '?' + 'tempid=' + sc_tid + '\&modelid=' + sc_pid + '\&var=' + sc_var + '\&form_class=' + formcls; urlStr = urlStr + '\&shortcut_popup=true'; window.open(urlStr, 'shortcut_popup', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=550'); /* // TODO: thread this into comment and form submit logic // fixup close button not working $("#shortcutdiv").load(urlStr).dialog( { autoOpen: false , modal:true, height: 650, width: 800, buttons: [ {text: "Cancel", click: function() { $(this).dialog("close"); alert('closing'); } }, { text: "Submit", click: function() { var thisForm = $("#shortcutdiv form"); thisForm.submit(); } } ] } ); $("#shortcutdiv").dialog("open"); */ }
danenrich/d3_training
js/varinput.js
JavaScript
bsd-3-clause
8,742
var _ = require('underscore'); module.exports = function () { beforeEach(function () { spyOn(_, 'debounce').and.callFake(function (func) { return function () { func.apply(this, arguments); }; }); this.geometryView.render(); }); describe('when the model is removed', function () { it('should remove each geometry', function () { this.geometry.geometries.each(function (polygon) { spyOn(polygon, 'remove'); }); this.geometry.remove(); expect(this.geometry.geometries.all(function (geometry) { return geometry.remove.calls.count() === 1; })).toBe(true); }); it('should remove the view', function () { spyOn(this.geometryView, 'remove'); this.geometry.remove(); expect(this.geometryView.remove).toHaveBeenCalled(); }); }); };
splashblot/cartodb.js
test/spec/geo/geometry-views/shared-tests-for-multi-geometry-views.js
JavaScript
bsd-3-clause
826
module("support", {teardown: moduleTeardown}); var computedSupport = getComputedSupport(jQuery.support); function getComputedSupport(support) { var prop, result = {}; for (prop in support) { if (typeof support[prop] === "function") { result[prop] = support[prop](); } else { result[prop] = support[prop]; } } return result; } if (jQuery.css) { testIframeWithCallback("body background is not lost if set prior to loading jQuery (#9239)", "support/bodyBackground.html", function (color, support) { expect(2); var okValue = { "#000000": true, "rgb(0, 0, 0)": true }; ok(okValue[color], "color was not reset (" + color + ")"); deepEqual(jQuery.extend({}, support), computedSupport, "Same support properties"); }); } // This test checkes CSP only for browsers with "Content-Security-Policy" header support // i.e. no old WebKit or old Firefox testIframeWithCallback("Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions", "support/csp.php", function (support) { expect(2); deepEqual(jQuery.extend({}, support), computedSupport, "No violations of CSP polices"); stop(); supportjQuery.get("data/support/csp.log").done(function (data) { equal(data, "", "No log request should be sent"); supportjQuery.get("data/support/csp-clean.php").done(start); }); } ); (function () { var expected, userAgent = window.navigator.userAgent; if (/chrome/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": true, "checkClone": true, "checkOn": true, "clearCloneStyle": true, "cors": true, "focusinBubbles": false, "noCloneChecked": true, "optDisabled": true, "optSelected": true, "pixelPosition": true, "radioValue": true, "reliableMarginRight": true }; } else if (/opera.*version\/12\.1/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": true, "checkClone": true, "checkOn": true, "clearCloneStyle": true, "cors": true, "focusinBubbles": false, "noCloneChecked": true, "optDisabled": true, "optSelected": true, "pixelPosition": true, "radioValue": false, "reliableMarginRight": true }; } else if (/trident\/7\.0/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": false, "checkClone": true, "checkOn": true, "clearCloneStyle": false, "cors": true, "focusinBubbles": true, "noCloneChecked": false, "optDisabled": true, "optSelected": false, "pixelPosition": true, "radioValue": false, "reliableMarginRight": true }; } else if (/msie 10\.0/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": false, "checkClone": true, "checkOn": true, "clearCloneStyle": false, "cors": true, "focusinBubbles": true, "noCloneChecked": false, "optDisabled": true, "optSelected": false, "pixelPosition": true, "radioValue": false, "reliableMarginRight": true }; } else if (/msie 9\.0/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": false, "checkClone": true, "checkOn": true, "clearCloneStyle": false, "cors": false, "focusinBubbles": true, "noCloneChecked": false, "optDisabled": true, "optSelected": false, "pixelPosition": true, "radioValue": false, "reliableMarginRight": true }; } else if (/7\.0(\.\d+|) safari/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": true, "checkClone": true, "checkOn": true, "clearCloneStyle": true, "cors": true, "focusinBubbles": false, "noCloneChecked": true, "optDisabled": true, "optSelected": true, "pixelPosition": false, "radioValue": true, "reliableMarginRight": true }; } else if (/6\.0(\.\d+|) safari/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": true, "checkClone": true, "checkOn": true, "clearCloneStyle": true, "cors": true, "focusinBubbles": false, "noCloneChecked": true, "optDisabled": true, "optSelected": true, "pixelPosition": false, "radioValue": true, "reliableMarginRight": true }; } else if (/5\.1(\.\d+|) safari/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": true, "checkClone": false, "checkOn": false, "clearCloneStyle": true, "cors": true, "focusinBubbles": false, "noCloneChecked": true, "optDisabled": true, "optSelected": true, "pixelPosition": false, "radioValue": true, "reliableMarginRight": true }; } else if (/firefox/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": true, "checkClone": true, "checkOn": true, "clearCloneStyle": true, "cors": true, "focusinBubbles": false, "noCloneChecked": true, "optDisabled": true, "optSelected": true, "pixelPosition": true, "radioValue": true, "reliableMarginRight": true }; } else if (/iphone os (?:6|7)_/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": true, "checkClone": true, "checkOn": true, "clearCloneStyle": true, "cors": true, "focusinBubbles": false, "noCloneChecked": true, "optDisabled": true, "optSelected": true, "pixelPosition": false, "radioValue": true, "reliableMarginRight": true }; } else if (/android 2\.3/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": true, "checkClone": true, "checkOn": false, "clearCloneStyle": false, "cors": true, "focusinBubbles": false, "noCloneChecked": true, "optDisabled": false, "optSelected": true, "pixelPosition": false, "radioValue": true, "reliableMarginRight": false }; } else if (/android 4\.[0-3]/i.test(userAgent)) { expected = { "ajax": true, "boxSizingReliable": true, "checkClone": false, "checkOn": false, "clearCloneStyle": true, "cors": true, "focusinBubbles": false, "noCloneChecked": true, "optDisabled": true, "optSelected": true, "pixelPosition": false, "radioValue": true, "reliableMarginRight": true }; } if (expected) { test("Verify that the support tests resolve as expected per browser", function () { var i, prop, j = 0; for (prop in computedSupport) { j++; } expect(j); for (i in expected) { // TODO check for all modules containing support properties if (jQuery.ajax || i !== "ajax" && i !== "cors") { equal(computedSupport[i], expected[i], "jQuery.support['" + i + "']: " + computedSupport[i] + ", expected['" + i + "']: " + expected[i]); } else { ok(true, "no ajax; skipping jQuery.support[' " + i + " ']"); } } }); } })();
malvinder/glscode
vendor/bower-asset/jquery/test/unit/support.js
JavaScript
bsd-3-clause
8,655
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); const debug_1 = __importDefault(require("debug")); const fs_1 = __importDefault(require("fs")); const ts = __importStar(require("typescript")); const shared_1 = require("./shared"); const log = debug_1.default('typescript-eslint:typescript-estree:createWatchProgram'); /** * Maps tsconfig paths to their corresponding file contents and resulting watches */ const knownWatchProgramMap = new Map(); /** * Maps file/folder paths to their set of corresponding watch callbacks * There may be more than one per file/folder if a file/folder is shared between projects */ const fileWatchCallbackTrackingMap = new Map(); const folderWatchCallbackTrackingMap = new Map(); /** * Stores the list of known files for each program */ const programFileListCache = new Map(); /** * Caches the last modified time of the tsconfig files */ const tsconfigLastModifiedTimestampCache = new Map(); const parsedFilesSeenHash = new Map(); /** * Clear all of the parser caches. * This should only be used in testing to ensure the parser is clean between tests. */ function clearCaches() { knownWatchProgramMap.clear(); fileWatchCallbackTrackingMap.clear(); folderWatchCallbackTrackingMap.clear(); parsedFilesSeenHash.clear(); programFileListCache.clear(); tsconfigLastModifiedTimestampCache.clear(); } exports.clearCaches = clearCaches; function saveWatchCallback(trackingMap) { return (fileName, callback) => { const normalizedFileName = shared_1.getCanonicalFileName(fileName); const watchers = (() => { let watchers = trackingMap.get(normalizedFileName); if (!watchers) { watchers = new Set(); trackingMap.set(normalizedFileName, watchers); } return watchers; })(); watchers.add(callback); return { close: () => { watchers.delete(callback); }, }; }; } /** * Holds information about the file currently being linted */ const currentLintOperationState = { code: '', filePath: '', }; /** * Appropriately report issues found when reading a config file * @param diagnostic The diagnostic raised when creating a program */ function diagnosticReporter(diagnostic) { throw new Error(ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine)); } /** * Hash content for compare content. * @param content hashed contend * @returns hashed result */ function createHash(content) { // No ts.sys in browser environments. if (ts.sys && ts.sys.createHash) { return ts.sys.createHash(content); } return content; } /** * Calculate project environments using options provided by consumer and paths from config * @param code The code being linted * @param filePathIn The path of the file being parsed * @param extra.tsconfigRootDir The root directory for relative tsconfig paths * @param extra.projects Provided tsconfig paths * @returns The programs corresponding to the supplied tsconfig paths */ function getProgramsForProjects(code, filePathIn, extra) { const filePath = shared_1.getCanonicalFileName(filePathIn); const results = []; // preserve reference to code and file being linted currentLintOperationState.code = code; currentLintOperationState.filePath = filePath; // Update file version if necessary const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(filePath); const codeHash = createHash(code); if (parsedFilesSeenHash.get(filePath) !== codeHash && fileWatchCallbacks && fileWatchCallbacks.size > 0) { fileWatchCallbacks.forEach(cb => cb(filePath, ts.FileWatcherEventKind.Changed)); } /* * before we go into the process of attempting to find and update every program * see if we know of a program that contains this file */ for (const rawTsconfigPath of extra.projects) { const tsconfigPath = shared_1.getTsconfigPath(rawTsconfigPath, extra); const existingWatch = knownWatchProgramMap.get(tsconfigPath); if (!existingWatch) { continue; } let fileList = programFileListCache.get(tsconfigPath); let updatedProgram = null; if (!fileList) { updatedProgram = existingWatch.getProgram().getProgram(); fileList = new Set(updatedProgram.getRootFileNames().map(f => shared_1.getCanonicalFileName(f))); programFileListCache.set(tsconfigPath, fileList); } if (fileList.has(filePath)) { log('Found existing program for file. %s', filePath); updatedProgram = (updatedProgram !== null && updatedProgram !== void 0 ? updatedProgram : existingWatch.getProgram().getProgram()); // sets parent pointers in source files updatedProgram.getTypeChecker(); return [updatedProgram]; } } log('File did not belong to any existing programs, moving to create/update. %s', filePath); /* * We don't know of a program that contains the file, this means that either: * - the required program hasn't been created yet, or * - the file is new/renamed, and the program hasn't been updated. */ for (const rawTsconfigPath of extra.projects) { const tsconfigPath = shared_1.getTsconfigPath(rawTsconfigPath, extra); const existingWatch = knownWatchProgramMap.get(tsconfigPath); if (existingWatch) { const updatedProgram = maybeInvalidateProgram(existingWatch, filePath, tsconfigPath); if (!updatedProgram) { continue; } // sets parent pointers in source files updatedProgram.getTypeChecker(); results.push(updatedProgram); continue; } const programWatch = createWatchProgram(tsconfigPath, extra); const program = programWatch.getProgram().getProgram(); // cache watch program and return current program knownWatchProgramMap.set(tsconfigPath, programWatch); results.push(program); } return results; } exports.getProgramsForProjects = getProgramsForProjects; function createWatchProgram(tsconfigPath, extra) { log('Creating watch program for %s.', tsconfigPath); // create compiler host const watchCompilerHost = ts.createWatchCompilerHost(tsconfigPath, shared_1.createDefaultCompilerOptionsFromExtra(extra), ts.sys, ts.createSemanticDiagnosticsBuilderProgram, diagnosticReporter, /*reportWatchStatus*/ () => { }); // ensure readFile reads the code being linted instead of the copy on disk const oldReadFile = watchCompilerHost.readFile; watchCompilerHost.readFile = (filePathIn, encoding) => { const filePath = shared_1.getCanonicalFileName(filePathIn); const fileContent = filePath === currentLintOperationState.filePath ? currentLintOperationState.code : oldReadFile(filePath, encoding); if (fileContent) { parsedFilesSeenHash.set(filePath, createHash(fileContent)); } return fileContent; }; // ensure process reports error on failure instead of exiting process immediately watchCompilerHost.onUnRecoverableConfigFileDiagnostic = diagnosticReporter; // ensure process doesn't emit programs watchCompilerHost.afterProgramCreate = (program) => { // report error if there are any errors in the config file const configFileDiagnostics = program .getConfigFileParsingDiagnostics() .filter(diag => diag.category === ts.DiagnosticCategory.Error && diag.code !== 18003); if (configFileDiagnostics.length > 0) { diagnosticReporter(configFileDiagnostics[0]); } }; /* * From the CLI, the file watchers won't matter, as the files will be parsed once and then forgotten. * When running from an IDE, these watchers will let us tell typescript about changes. * * ESLint IDE plugins will send us unfinished file content as the user types (before it's saved to disk). * We use the file watchers to tell typescript about this latest file content. * * When files are created (or renamed), we won't know about them because we have no filesystem watchers attached. * We use the folder watchers to tell typescript it needs to go and find new files in the project folders. */ watchCompilerHost.watchFile = saveWatchCallback(fileWatchCallbackTrackingMap); watchCompilerHost.watchDirectory = saveWatchCallback(folderWatchCallbackTrackingMap); // allow files with custom extensions to be included in program (uses internal ts api) const oldOnDirectoryStructureHostCreate = watchCompilerHost.onCachedDirectoryStructureHostCreate; watchCompilerHost.onCachedDirectoryStructureHostCreate = (host) => { const oldReadDirectory = host.readDirectory; host.readDirectory = (path, extensions, exclude, include, depth) => oldReadDirectory(path, !extensions ? undefined : extensions.concat(extra.extraFileExtensions), exclude, include, depth); oldOnDirectoryStructureHostCreate(host); }; /* * The watch change callbacks TS provides us all have a 250ms delay before firing * https://github.com/microsoft/TypeScript/blob/b845800bdfcc81c8c72e2ac6fdc2c1df0cdab6f9/src/compiler/watch.ts#L1013 * * We live in a synchronous world, so we can't wait for that. * This is a bit of a hack, but it lets us immediately force updates when we detect a tsconfig or directory change */ const oldSetTimeout = watchCompilerHost.setTimeout; watchCompilerHost.setTimeout = (cb, ms, ...args) => { var _a; if (ms === 250) { cb(); return null; } return (_a = oldSetTimeout) === null || _a === void 0 ? void 0 : _a(cb, ms, ...args); }; return ts.createWatchProgram(watchCompilerHost); } exports.createWatchProgram = createWatchProgram; function hasTSConfigChanged(tsconfigPath) { const stat = fs_1.default.statSync(tsconfigPath); const lastModifiedAt = stat.mtimeMs; const cachedLastModifiedAt = tsconfigLastModifiedTimestampCache.get(tsconfigPath); tsconfigLastModifiedTimestampCache.set(tsconfigPath, lastModifiedAt); if (cachedLastModifiedAt === undefined) { return false; } return Math.abs(cachedLastModifiedAt - lastModifiedAt) > Number.EPSILON; } function maybeInvalidateProgram(existingWatch, filePath, tsconfigPath) { /* * By calling watchProgram.getProgram(), it will trigger a resync of the program based on * whatever new file content we've given it from our input. */ let updatedProgram = existingWatch.getProgram().getProgram(); // In case this change causes problems in larger real world codebases // Provide an escape hatch so people don't _have_ to revert to an older version if (process.env.TSESTREE_NO_INVALIDATION === 'true') { return updatedProgram; } if (hasTSConfigChanged(tsconfigPath)) { /* * If the stat of the tsconfig has changed, that could mean the include/exclude/files lists has changed * We need to make sure typescript knows this so it can update appropriately */ log('tsconfig has changed - triggering program update. %s', tsconfigPath); fileWatchCallbackTrackingMap .get(tsconfigPath) .forEach(cb => cb(tsconfigPath, ts.FileWatcherEventKind.Changed)); // tsconfig change means that the file list more than likely changed, so clear the cache programFileListCache.delete(tsconfigPath); } let sourceFile = updatedProgram.getSourceFile(filePath); if (sourceFile) { return updatedProgram; } /* * Missing source file means our program's folder structure might be out of date. * So we need to tell typescript it needs to update the correct folder. */ log('File was not found in program - triggering folder update. %s', filePath); // Find the correct directory callback by climbing the folder tree const currentDir = shared_1.canonicalDirname(filePath); let current = null; let next = currentDir; let hasCallback = false; while (current !== next) { current = next; const folderWatchCallbacks = folderWatchCallbackTrackingMap.get(current); if (folderWatchCallbacks) { folderWatchCallbacks.forEach(cb => { if (currentDir !== current) { cb(currentDir, ts.FileWatcherEventKind.Changed); } cb(current, ts.FileWatcherEventKind.Changed); }); hasCallback = true; } next = shared_1.canonicalDirname(current); } if (!hasCallback) { /* * No callback means the paths don't matchup - so no point returning any program * this will signal to the caller to skip this program */ log('No callback found for file, not part of this program. %s', filePath); return null; } // directory update means that the file list more than likely changed, so clear the cache programFileListCache.delete(tsconfigPath); // force the immediate resync updatedProgram = existingWatch.getProgram().getProgram(); sourceFile = updatedProgram.getSourceFile(filePath); if (sourceFile) { return updatedProgram; } /* * At this point we're in one of two states: * - The file isn't supposed to be in this program due to exclusions * - The file is new, and was renamed from an old, included filename * * For the latter case, we need to tell typescript that the old filename is now deleted */ log('File was still not found in program after directory update - checking file deletions. %s', filePath); const rootFilenames = updatedProgram.getRootFileNames(); // use find because we only need to "delete" one file to cause typescript to do a full resync const deletedFile = rootFilenames.find(file => !fs_1.default.existsSync(file)); if (!deletedFile) { // There are no deleted files, so it must be the former case of the file not belonging to this program return null; } const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(shared_1.getCanonicalFileName(deletedFile)); if (!fileWatchCallbacks) { // shouldn't happen, but just in case log('Could not find watch callbacks for root file. %s', deletedFile); return updatedProgram; } log('Marking file as deleted. %s', deletedFile); fileWatchCallbacks.forEach(cb => cb(deletedFile, ts.FileWatcherEventKind.Deleted)); // deleted files means that the file list _has_ changed, so clear the cache programFileListCache.delete(tsconfigPath); updatedProgram = existingWatch.getProgram().getProgram(); sourceFile = updatedProgram.getSourceFile(filePath); if (sourceFile) { return updatedProgram; } log('File was still not found in program after deletion check, assuming it is not part of this program. %s', filePath); return null; } //# sourceMappingURL=createWatchProgram.js.map
endlessm/chromium-browser
third_party/devtools-frontend/src/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js
JavaScript
bsd-3-clause
15,691
/* *Resize the graph container */ function resizegraph(){ var windowHeight = $( window ).innerHeight(); $("#stacked").css('min-height',(windowHeight * 0.35) ); } //From facebook window.fbAsyncInit = function(){ FB.init({ appId: facebook_api_key, status: true, cookie: true, xfbml: true }); }; (function(d, debug){var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if(d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true;js.src = "//connect.facebook.net/fr_CA/all" + (debug ? "/debug" : "") + ".js"; ref.parentNode.insertBefore(js, ref);}(document, /*debug*/ false)); function postToFeed(title, desc, url, image){ desc = desc + url; var obj = {method: 'feed',link: url, picture: image,name: title,description: desc}; function callback(response){} FB.ui(obj, callback); } /* * Sharing functions * @param {string} url - An url * @param {string} desc - A small description * @param {int} winWidth - Width of the popup * @param {int} winHeight - height of the popup */ function twittershare(url, descr, winWidth, winHeight) { var winTop = (screen.height / 2) - (winHeight / 2); var winLeft = (screen.width / 2) - (winWidth / 2); descr = encodeURIComponent(descr); url = encodeURIComponent(url); window.open('https://twitter.com/share?url=' + url + '&text='+ descr , 'Partage', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width='+winWidth+',height='+winHeight); } function linkedinshare(url, title, descr, winWidth, winHeight) { var winTop = (screen.height / 2) - (winHeight / 2); var winLeft = (screen.width / 2) - (winWidth / 2); title = encodeURIComponent(title); descr = encodeURIComponent(descr + url); window.open('http://www.linkedin.com/shareArticle?mini=true&url=' + url + '&title='+ title + '&summary='+ descr , 'Partage', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width='+winWidth+',height='+winHeight); } /* * Sharing functions * @param {string} url - An url * Set sharing functions to contracts by ID */ function setSocialMedia(contractId){ var base_url = window.location.protocol + '//' + window.location.hostname + location.pathname; var url = base_url + '?q=' + contractId + '&type='+$('[name=type]:checked').val(); var image_url = base_url + 'img/rosette.jpg'; var info = $("#contract_"+contractId); var titlet = "Vue sur les contrats. Consultez les contrats et subventions octroyés par la Ville de Montréal."; var titlefb = "Vue sur les contrats de la ville de Montréal"; var descriptionfb = "Vue sur les contrats est un outil de visualisation qui permet de consulter les contrats et les subventions octroyés par la Ville de façon simple et conviviale. "; var titleli = "Vue sur les contrats de la Ville de Montréal"; var descriptionli = "Vue sur les contrats est un outil de visualisation qui permet de consulter les contrats et les subventions octroyés par la Ville de façon simple et conviviale. "; var formattedBody = encodeURIComponent("Vue sur les contrats est un outil de visualisation qui permet de consulter les contrats et les subventions octroyés par la Ville de façon simple et conviviale. \n \n "+ url); var box = $("#modalsocialmedia"); box.find(".sharetwitter").attr("href",'javascript:twittershare("'+url+'", "'+titlet+'", 520, 350);'); box.find(".sharefacebook").attr("href",'javascript:postToFeed("'+titlefb+'", "'+descriptionfb+'","'+url+'", "'+image_url+'");'); box.find(".sharelinkedin").attr("href",'javascript:linkedinshare("'+url+'", "'+titleli+'", "'+descriptionli+'", 520, 350);'); box.find(".shareemail").attr('href','mailto:?body='+formattedBody+'&subject=Vue sur les contrats de la Ville de Montréal'); box.find(".sharelink").val(url); box.modal('show'); } /* * @param {string} result - object from the API * @return {{ boolean }} * Define if data was received */ function results_accepted(results) { if (results && results.meta) { if (results.meta.count) { $(".graph-container").css('visibility','visible'); $(".mainContent").show(); $(".filters").show(); $(".noResults").hide(); return true; }else{ $('html, body').animate({ scrollTop: 0 }, 300); $(".mainContent").hide(); $(".graph-container").css('visibility','hidden'); $(".filters").hide(); $(".noResults").show(); return false; } }else{ $('html, body').animate({ scrollTop: 0 }, 300); $(".mainContent").hide(); $(".graph-container").css('visibility','hidden'); $(".filters").hide(); $(".noResults").show(); return false; } } /* * @param {string} text * @param {int} length * @return {{ text }} * add an ellipsis if needed */ function TextAbstract(text, length) { if (text == null) { return ""; } if (text.length <= length) { return text; } text = text.substring(0, length); return text + "..."; } /* *bootstrap-selectpicker init */ $.fn.selectpicker.defaults = { mobile : false, selectAllText: "Tout sélectionner", deselectAllText: "Désélectionner", noneSelectedText: "Aucune sélection", countSelectedText: function (numSelected, numTotal) { if (numTotal == numSelected) { return "Tous"; }else{ return (numSelected == 1) ? "{0} sélection" : "{0} sélections"; } }, } /* * Clear the form */ function clearForm() { $(':input').not(':button, :submit, :reset, :checkbox, :radio, [name="limit"]').val(''); $(':checkbox, :radio').prop('checked', false); $("#offset").val('0'); } function renameLabels(){ if ($( ".switchgraph span" ).hasClass('value')) { $( ".switchgraph span" ).html('Voir nombre de '+defTypeName()+'s par mois'); $(".graphTitle").html('Montant total des '+defTypeName()+'s par mois'); }else if($( ".switchgraph span" ).hasClass('count')) { $( ".switchgraph span" ).html('Voir montant des '+defTypeName()+'s par mois'); $(".graphTitle").html('Nombre total de '+defTypeName()+'s par mois'); } } /* * Add a buyer ID to the request */ function bybuyer(buyerid, reset) { init = true; $('.searchboxLabel').html("Octroyé par"); $("input#offset").val('0'); $("input#supplier").val(''); $("input#buyer").val(buyerid); $('.searchboxhidden').tagsinput('removeAll'); $('.searchboxhidden').tagsinput('add', buyerid); $(".bootstrap-tagsinput").find('.tag').addClass('buyer'); } /* * Add a supplier ID to the request */ function bysupplier(supplierid, reset) { init = true; $('.searchboxLabel').html("Fournisseur"); $("input#offset").val('0'); $("input#buyer").val(''); $("input#supplier").val(supplierid); $('.searchboxhidden').tagsinput('removeAll'); $('.searchboxhidden').tagsinput('add', supplierid); $(".bootstrap-tagsinput").find('.tag').addClass('supplier'); } var previousPoint = null, previousLabel = null; var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; /* * Tooltip */ $.fn.UseTooltip = function () { if($(window).width() > 768){ $(this).bind("plothover", function (event, pos, item) { if (item) { if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) { previousPoint = item.dataIndex; previousLabel = item.series.label; $("#tooltip").remove(); var color = item.series.color; showTooltip(item.pageX, item.pageY, item.series.color, getTemplateForToolip(item)); } } else { $("#tooltip").remove(); previousPoint = null; } }); } }; function showTooltip(x, y, color, contents) { var tooltip = $('<div id="tooltip">' + contents + '</div>').css({ 'border-color': color }); tooltip.find('#tooltip-arrow').css('border-top-color', color); tooltip.appendTo("body").fadeIn(200); tooltip.css({ top: y - (tooltip[0].offsetHeight + 10), left: x - (tooltip[0].offsetWidth - 18) }); } function getTemplateForToolip(item){ if(dataSet == 'amount'){ var amount = formatedData.value[item.seriesIndex].data[item.dataIndex][1]; var count = formatedData.value_count[item.seriesIndex].data[item.dataIndex][1]; }else{ var count = formatedData.count[item.seriesIndex].data[item.dataIndex][1]; var amount = formatedData.count_value[item.seriesIndex].data[item.dataIndex][1]; } var x = item.datapoint[0]; labelContrat = (count == 1) ? " "+defTypeName() : " "+defTypeName()+'s'; var text = ""; text += "<div style='position: relative;'>"; text += " <div style='' class='domaineName'><strong>{month}</strong></div>"; text += " <h5 style='margin: 0;'>{label}</h5 style='margin: 0;'>"; text += " <div><strong>{money} - {count} "+labelContrat+"</strong></div>"; text += " <div id='tooltip-arrow'></div>"; text += "</div>"; var amountFormatted = amount.formatMoney('0', ',', ' ')+ ' $'; return text .replace('{month}', new Date(x).toLongFrenchFormatMonth()) .replace('{label}', item.series.label) .replace('{money}', amountFormatted) .replace('{count}', count); } /* * from http://stackoverflow.com/a/14994860 * Transform Y labels - money */ function valueFormatter(num) { if (num >= 1000000000) { return (num / 1000000000).toFixed(1).replace(/\.0$/, '') + ' G $'; } if (num >= 1000000) { return (num / 1000000).toFixed(1).replace(/\.0$/, '') + ' M $'; } if (num >= 1000) { return (num / 1000).toFixed(1).replace(/\.0$/, '') + ' K $'; } return num + ' $'; } /* * from http://stackoverflow.com/a/14994860 * Transform Y labels */ function countFormatter(num) { if (num >= 1000000000) { return (num / 1000000000).toFixed(1).replace(/\.0$/, '') + ' G'; } if (num >= 1000000) { return (num / 1000000).toFixed(1).replace(/\.0$/, '') + ' M'; } if (num >= 1000) { return (num / 1000).toFixed(1).replace(/\.0$/, '') + ' K'; } if (num === +num && num !== (num|0)) { return num.toFixed(1); } return num; } /* * Init plot */ function plotWithOptions(formatedData,options) { if (formatedData.length > 0) { window.plot = $.plot("#stacked", formatedData, options); $("#stacked").UseTooltip(); } } /* * Refresh the plot with a new width */ function resizedw(){ resizegraph(); plotWithOptions(wg(formatedData), options); } /* * define which graph is currently displayed */ function wgcheck() { if ($(".switchgraph span").hasClass('value')) { return 'value'; }else{ return 'count'; } } /* * define which graph is currently displayed * return the good dataset */ function wg(data) { if (data) { if ($(".switchgraph span").hasClass('value')) { return data.value; }else{ return data.count; } }return {}; } /* * Plot configuration */ var options = { series: { grow: { active: true, duration: 400, reanimate: false, valueIndex: 1 }, stack: true, lines: { show: false, fill: true, steps: false }, bars: { align: "left", lineWidth: 0, fill: 0.7, show: true, barWidth: 800 * 60 * 60 * 24 * 30 } }, yaxis:{ min: 0, tickFormatter: valueFormatter }, xaxis: { mode: "time", timeformat: "%Y", timezone: "browser", minTickSize: [1, "year"] }, grid: { hoverable: true, mouseActiveRadius:1, }, legend: { container: "#legend", labelFormatter: function (label, series) { $('<div class="labelG col-lg-4 col-md-6 col-sm-12"><i class="fa fa-circle-o colorG" style="color:'+series.color+'"></i><span class="innerTextG">'+label+'</span></div>').appendTo("#legend"); return false; } //sorted: "ascending", } }; /* * Launch a query with the selected page * linked with simplepagination */ function page(num) { $('html, body').animate({ scrollTop: $(".filters").offset().top - 150 }, 600); var limit = $("#limit").val(); var offset = (num - 1)*limit; $("#offset").val(offset); $("#offset").trigger('change'); } /* * Launch a query with the selected page * Linked with simplepagination */ function calculHeight() { if ($(window).width() > 1200) { return { padding:150, height:150 } }else if($(window).width() <= 1200 && $(window).width() > 992){ return { padding:240, height:240 } }else if($(window).width() <= 992) { return { padding:60, height:60 } }else { return { padding:60, height:60 } } } /* * Return the french translation of the current type */ function defTypeName(){ if ($("input[type='radio'][name=type]:checked").val() == 'contract') { return 'contrat'; }else{ return 'subvention'; } } /* *Global variables */ var dataSet = 'amount'; var formatedData; var ovc; var init = true; var navmod; resizegraph(); $(function() { $(".noResults").hide(); $(".searchbar").sticky({ responsiveWidth: true, topSpacing: 0, }) /* //Uncomment if you want to have the "filters bar" sticky $(".filters").sticky({ responsiveWidth: true, topSpacing: 0, }) .on('sticky-start', function() { $(".toolbars.filters").css('padding-top', calculHeight().padding); $(".toolbars.filters").parent().css('height',calculHeight().height); }) .on('sticky-end', function() { $(".toolbars.filters").css('padding-top', '60px'); $(".toolbars.filters").parent().css('height','auto'); }); $(".toolbars.filters").css('padding-top', '60px'); $(".toolbars.filters").parent().css('height','auto'); */ // Init API client ovc = new OvcMtlApi(); if (ovc_api_url) { ovc.base_url = ovc_api_url; } ovc.init(); // Init pagination var pages = $(ovc.paginationSelector).pagination({ displayedPages : 3, edges: 1, prevText: '<', nextText: '>', hrefTextPrefix : "javascript:page('", hrefTextSuffix : "')", }); // the default request if(ovc.historyState()){ var apiData = ovc.byMonthActivity(); if (results_accepted(apiData.stats)) { formatedData = ovc.flotChartsFormat(apiData.stats); var links = ovc.export(); for (var l in links) { if(links[l].enabled){ $(".export."+l).attr('href',links[l].link_to); $(".export."+l).css('cursor','pointer'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); }else{ $(".export."+l).css('cursor','not-allowed'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); } } pages.pagination('updateItemsOnPage', ovc.itemsOnPage); pages.pagination('updateItems', ovc.items); pages.pagination('selectPage', ovc.currentPageByOffset()); renameLabels(); } } //Needed - Growraf is not enough fast to calculate on each screen resize, Y axis bug var doit; $( window ).resize(function() { if (window.plot) { window.plot.shutdown(); clearTimeout(doit); doit = setTimeout(resizedw, 1000); } }); $('#procuring_entity').selectpicker('render'); $('#activity').selectpicker('render'); if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { $('#procuring_entity').selectpicker('mobile'); $('#activity').selectpicker('mobile'); } /* * On each request */ if (ovc.detectIE() > 9 || !ovc.detectIE()) { $(window).bind('popstate', function(event){ init = false navmod = 'popstate'; if(ovc.refresh()){ var apiData = ovc.byMonthActivity(); if (results_accepted(apiData.stats)) { formatedData = ovc.flotChartsFormat(apiData.stats); var links = ovc.export(); for (var l in links) { if(links[l].enabled){ $(".export."+l).attr('href',links[l].link_to); $(".export."+l).css('cursor','pointer'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); }else{ $(".export."+l).css('cursor','not-allowed'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); } } pages.pagination('updateItemsOnPage', ovc.itemsOnPage); pages.pagination('updateItems', ovc.items); pages.pagination('selectPage', ovc.currentPageByOffset()); plotWithOptions(wg(formatedData), options); } var qd = ovc.paramsExtract(); $('.searchboxhidden').tagsinput('removeAll'); if (qd.supplier) { $('.searchboxLabel').html("Fournisseur"); $(".bootstrap-tagsinput").find('.searchbox').hide(); $(".bootstrap-tagsinput").find('.searchbutton').hide(); $('.searchboxhidden').tagsinput('removeAll'); $('.searchboxhidden').tagsinput('add', ovc.decode(qd).supplier); $(".bootstrap-tagsinput").find('.tag').addClass('supplier'); }else if(qd.buyer) { $('.searchboxLabel').html("Octroyé par"); $(".bootstrap-tagsinput").find('.searchbox').hide(); $(".bootstrap-tagsinput").find('.searchbutton').hide(); $('.searchboxhidden').tagsinput('add', ovc.decode(qd).buyer); $(".bootstrap-tagsinput").find('.tag').addClass('buyer'); }else if(qd.q){ $('.searchboxLabel').html("Mots clés"); $(".bootstrap-tagsinput").find('.searchbox').hide(); $(".bootstrap-tagsinput").find('.searchbutton').hide(); $('.searchboxhidden').tagsinput('add',ovc.decode(qd).q); }else{ $('.searchboxLabel').html("Mots clés"); $("#theMainTag").css('display','none'); $(".bootstrap-tagsinput").find('.searchbox').show(); $(".bootstrap-tagsinput").find('.searchbutton').show(); } $('#procuring_entity').selectpicker('refresh'); $('#activity').selectpicker('refresh'); renameLabels(); } }); }else{ $(window).bind('hashchange', function() { init = false navmod = 'hashchange'; if(ovc.refresh()){ var apiData = ovc.byMonthActivity(); if (results_accepted(apiData.stats)) { formatedData = ovc.flotChartsFormat(apiData.stats); var links = ovc.export(); for (var l in links) { if(links[l].enabled){ $(".export."+l).attr('href',links[l].link_to); $(".export."+l).css('cursor','pointer'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); }else{ $(".export."+l).css('cursor','not-allowed'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); } } pages.pagination('updateItemsOnPage', ovc.itemsOnPage); pages.pagination('updateItems', ovc.items); pages.pagination('selectPage', ovc.currentPageByOffset()); plotWithOptions(wg(formatedData), options); } var qd = ovc.paramsExtract(); $('.searchboxhidden').tagsinput('removeAll'); if (qd.supplier) { $('.searchboxLabel').html("Fournisseur"); $(".bootstrap-tagsinput").find('.searchbox').hide(); $(".bootstrap-tagsinput").find('.searchbutton').hide(); $('.searchboxhidden').tagsinput('removeAll'); $('.searchboxhidden').tagsinput('add', ovc.decode(qd).supplier); $(".bootstrap-tagsinput").find('.tag').addClass('supplier'); }else if(qd.buyer) { $('.searchboxLabel').html("Octroyé par"); $(".bootstrap-tagsinput").find('.searchbox').hide(); $(".bootstrap-tagsinput").find('.searchbutton').hide(); $('.searchboxhidden').tagsinput('add', ovc.decode(qd).buyer); $(".bootstrap-tagsinput").find('.tag').addClass('buyer'); }else if(qd.q){ $('.searchboxLabel').html("Mots clés"); $(".bootstrap-tagsinput").find('.searchbox').hide(); $(".bootstrap-tagsinput").find('.searchbutton').hide(); $('.searchboxhidden').tagsinput('add',ovc.decode(qd).q); }else{ $('.searchboxLabel').html("Mots clés"); $("#theMainTag").css('display','none'); $(".bootstrap-tagsinput").find('.searchbox').show(); $(".bootstrap-tagsinput").find('.searchbutton').show(); } $('#procuring_entity').selectpicker('refresh'); $('#activity').selectpicker('refresh'); renameLabels(); } }); } $("input, select, textarea").not('[name=q]').not("[type=hidden]").not('.loading').change(function(event){ //offset to zero, it is a new search if (!$(event.currentTarget).hasClass('loading')) { $(ovc.currOffsetFieldSelector).val(0); //remove buyer and supplier input values if(ovc.historyState()){ var apiData = ovc.byMonthActivity(); if (results_accepted(apiData.stats)) { formatedData = ovc.flotChartsFormat(apiData.stats); var links = ovc.export(); for (var l in links) { if(links[l].enabled){ $(".export."+l).attr('href',links[l].link_to); $(".export."+l).css('cursor','pointer'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); }else{ $(".export."+l).css('cursor','not-allowed'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); } } } } pages.pagination('updateItems', ovc.items); pages.pagination('selectPage', ovc.currentPageByOffset()); plotWithOptions(wg(formatedData), options); $('html, body').animate({ scrollTop: 0 }, 300); } }).keyup(function(event){ if(event.keyCode == 13){ $("[name=q]").trigger("change"); } }); $("input[type='hidden']").not(".buyer").not(".supplier").change(function(event){ if(event.currentTarget.name == 'date_lt' || event.currentTarget.name == 'date_gt' || event.currentTarget.name == 'order_by'){ $(ovc.currOffsetFieldSelector).val(0); pages.pagination('selectPage', '1'); } console.log('keyword'); $("[name=q]").val($("[name=q]").val().replace(/\?/g,'').replace(/&/g,'').replace(/%/g,'')); if(ovc.historyState()){ var apiData = ovc.byMonthActivity(); if (results_accepted(apiData.stats)) { formatedData = ovc.flotChartsFormat(apiData.stats); var links = ovc.export(); for (var l in links) { if(links[l].enabled){ $(".export."+l).attr('href',links[l].link_to); $(".export."+l).css('cursor','pointer'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); }else{ $(".export."+l).css('cursor','not-allowed'); $(".export."+l).attr('title','Exportation limitée à '+links[l].limit +' fiches'); } } } } pages.pagination('updateItems', ovc.items); plotWithOptions(wg(formatedData), options); }); plotWithOptions(wg(formatedData), options); $("#date_gt_view").datepicker( { format: "yyyy-mm", viewMode: "months", minViewMode: "months", minDate: '2012/01/01', }).on('changeDate', function(ev){ var unix_timestamp = ev.date.valueOf(); formatedDate = new Date(unix_timestamp ).yyyymmdd(); $("#date_gt").val(formatedDate); $("#date_gt").trigger('change'); $(this).datepicker('hide'); }); $("#date_lt_view").datepicker( { format: "yyyy-mm", viewMode: "months", minViewMode: "months", minDate: '2012/01/01', }).on('changeDate', function(ev){ var unix_timestamp = ev.date.valueOf(); formatedDate = new Date(unix_timestamp ).yyyymmlastdd(); $("#date_lt").val(formatedDate); $("#date_lt").trigger('change'); $(this).datepicker('hide'); }); $("#ob_value").on('click', function(){ $("#order_by").val('value'); $("#order_dir").val('desc'); $("#order_by").trigger('change'); $(".orderby").removeClass("active"); $(this).addClass("active"); }); $("#ob_date").on('click', function(){ $("#order_by").val('date'); $("#order_dir").val('desc'); $("#order_by").trigger('change'); $(".orderby").removeClass("active"); $(this).addClass("active"); }); $("#od_supplier").on('click', function(){ $("#order_by").val('supplier'); $("#order_dir").val('asc'); $("#order_by").trigger('change'); $(".orderby").removeClass("active"); $(this).addClass("active"); }); $( ".upbtn-container" ).click(function() { $(".graph-container").toggle(function(e){ if ($(this).is(":visible") ) { $(".filters").css("padding-top","0px"); $("#toggleGraph").find('i').removeClass('fa-angle-double-down'); $("#toggleGraph").find('i').addClass('fa-angle-double-up'); $('html, body').animate({ scrollTop: 0 }, 300); }else{ $(".filters").css("padding-top","70px"); $("#toggleGraph").find('i').removeClass('fa-angle-double-up'); $("#toggleGraph").find('i').addClass('fa-angle-double-down'); } $(".filters").sticky('update'); }); }); $(".btnmenu").on('click', function(){ if (!$(".searchbar").is(':visible')) { $(".searchbar").show(); $(".btnmenu i").removeClass('fa-bars'); $(".btnmenu i").addClass('fa-close'); }else { $(".searchbar").hide(); $(".btnmenu i").removeClass('fa-close'); $(".btnmenu i").addClass('fa-bars'); } return false; }); $('.money').mask('00000000000000', {reverse: true}); $( ".switchgraph span" ).click(function() { var optionsx = options; if ($(this).hasClass('count')) { var apiData = ovc.byMonthActivity('count'); $(this).removeClass('count'); $(this).addClass('value'); $(this).html('Voir nombre de '+defTypeName()+'s par mois'); $(".graphTitle").html('Montant total des '+defTypeName()+'s par mois'); dataSet = 'amount'; optionsx.yaxis.tickFormatter = valueFormatter; }else if($(this).hasClass('value')) { var apiData = ovc.byMonthActivity('value'); $(this).removeClass('value'); $(this).addClass('count'); $(this).html('Voir montant des '+defTypeName()+'s par mois'); $(".graphTitle").html('Nombre total de '+defTypeName()+'s par mois'); dataSet = 'count'; optionsx.yaxis.tickFormatter = countFormatter; } formatedData = ovc.flotChartsFormat(apiData.stats); plotWithOptions(wg(formatedData), options); }); $('.searchboxhidden').tagsinput({ maxTags: 1, trimValue: true, addOnBlur: false, }); if ($(".searchboxhidden").val()) { $(".bootstrap-tagsinput").find('.searchbox').hide(); $(".bootstrap-tagsinput").find('.searchbutton').hide(); //$('.searchboxhidden').tagsinput('refresh'); } $('.searchboxhidden').on('beforeItemAdd', function(event) { $(".bootstrap-tagsinput").find('.searchbox').hide(); $(".bootstrap-tagsinput").find('.searchbutton').hide(); $("input#offset").val('0'); pages.pagination('selectPage', '1'); }) $('.searchboxhidden').on('itemAdded', function(event) { if (init || (ovc.decode(ovc.paramsExtract()).q != event.item && navmod == 'hashchange') || /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { $("#supplier").trigger('change'); } init = true; }) $('.searchboxhidden').on('itemRemoved', function(event) { $('.searchboxLabel').html("Mots clés"); $(".bootstrap-tagsinput").find('.searchbox').show(); $(".bootstrap-tagsinput").find('.searchbutton').show(); $("#buyer").val(''); $("#supplier").val(''); if (init) { $("#supplier").trigger('change'); } init = true; }); if ($('#supplier').val()) { bysupplier($('#supplier').val()); } if ($('#buyer').val()) { bybuyer($('#buyer').val()); } $(".scrolltop").on('click', function(){ $('html, body').animate({ scrollTop: 0 }, 300); }); $(".scrolldown").on('click', function(){ $('html, body').animate({ scrollTop: $(".filters").offset().top - 140 }, 600); }); $(".searchbutton i.fa").on('click', function(){ $('.searchbox').trigger($.Event( "keypress", { which: 13 } )); }); $("[name=type]").on('change', function(){renameLabels()}); $(".export").hover( function() // on mouseover { $(".exportInfo").html($(this).attr('title')); }, function() // on mouseout { $(".exportInfo").html(''); }); }); $(window).load(function() { $(".loading").fadeOut(500); })
opennorth/ovc-vdm
static/js/main.js
JavaScript
bsd-3-clause
33,353
var _ = require('underscore') module.exports = function (cdb) { (function () { var Layers = cdb.vis.Layers; /* * if we are using http and the tiles of base map need to be fetched from * https try to fix it */ var HTTPS_TO_HTTP = { 'https://dnv9my2eseobd.cloudfront.net/': 'http://a.tiles.mapbox.com/', 'https://maps.nlp.nokia.com/': 'http://maps.nlp.nokia.com/', 'https://tile.stamen.com/': 'http://tile.stamen.com/', "https://{s}.maps.nlp.nokia.com/": "http://{s}.maps.nlp.nokia.com/", "https://cartocdn_{s}.global.ssl.fastly.net/": "http://{s}.api.cartocdn.com/", "https://cartodb-basemaps-{s}.global.ssl.fastly.net/": "http://{s}.basemaps.cartocdn.com/" }; function transformToHTTP(tilesTemplate) { for (var url in HTTPS_TO_HTTP) { if (tilesTemplate.indexOf(url) !== -1) { return tilesTemplate.replace(url, HTTPS_TO_HTTP[url]) } } return tilesTemplate; } function transformToHTTPS(tilesTemplate) { for (var url in HTTPS_TO_HTTP) { var httpsUrl = HTTPS_TO_HTTP[url]; if (tilesTemplate.indexOf(httpsUrl) !== -1) { return tilesTemplate.replace(httpsUrl, url); } } return tilesTemplate; } Layers.register('tilejson', function (vis, data) { var url = data.tiles[0]; if (vis.https === true) { url = transformToHTTPS(url); } else if (vis.https === false) { // Checking for an explicit false value. If it's undefined the url is left as is. url = transformToHTTP(url); } return new cdb.geo.TileLayer({ urlTemplate: url }); }); Layers.register('tiled', function (vis, data) { var url = data.urlTemplate; if (vis.https === true) { url = transformToHTTPS(url); } else if (vis.https === false) { // Checking for an explicit false value. If it's undefined the url is left as is. url = transformToHTTP(url); } data.urlTemplate = url; return new cdb.geo.TileLayer(data); }); Layers.register('wms', function (vis, data) { return new cdb.geo.WMSLayer(data); }); Layers.register('gmapsbase', function (vis, data) { return new cdb.geo.GMapsBaseLayer(data); }); Layers.register('plain', function (vis, data) { return new cdb.geo.PlainLayer(data); }); Layers.register('background', function (vis, data) { return new cdb.geo.PlainLayer(data); }); function normalizeOptions(vis, data) { if (data.infowindow && data.infowindow.fields) { if (data.interactivity) { if (data.interactivity.indexOf('cartodb_id') === -1) { data.interactivity = data.interactivity + ",cartodb_id"; } } else { data.interactivity = 'cartodb_id'; } } // if https is forced if (vis.https) { data.tiler_protocol = 'https'; data.tiler_port = 443; data.sql_api_protocol = 'https'; data.sql_api_port = 443; } data.cartodb_logo = vis.cartodb_logo == undefined ? data.cartodb_logo : vis.cartodb_logo; } var cartoLayer = function (vis, data) { normalizeOptions(vis, data); // if sublayers are included that means a layergroup should // be created if (data.sublayers) { data.type = 'layergroup'; return new cdb.geo.CartoDBGroupLayer(data); } return new cdb.geo.CartoDBLayer(data); }; Layers.register('cartodb', cartoLayer); Layers.register('carto', cartoLayer); Layers.register('layergroup', function (vis, data) { normalizeOptions(vis, data); return new cdb.geo.CartoDBGroupLayer(data); }); Layers.register('namedmap', function (vis, data) { normalizeOptions(vis, data); return new cdb.geo.CartoDBNamedMapLayer(data); }); Layers.register('torque', function (vis, data) { normalizeOptions(vis, data); // default is https if (vis.https) { if (data.sql_api_domain && data.sql_api_domain.indexOf('cartodb.com') !== -1) { data.sql_api_protocol = 'https'; data.sql_api_port = 443; data.tiler_protocol = 'https'; data.tiler_port = 443; } } data.cartodb_logo = vis.cartodb_logo == undefined ? data.cartodb_logo : vis.cartodb_logo; return new cdb.geo.TorqueLayer(data); }); })(); }
Stonelinks/cartodb-lite
src/vis/layers.js
JavaScript
bsd-3-clause
5,195
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 50; // 50 seconds describe('marker_selection_test', function () { it('all_aml', function (done) { var dataset; var referenceDataset; var promises = []; promises.push(morpheus.DatasetUtil.read('test_files/all_aml_train.gct').done(function (d) { dataset = d; })); promises.push(morpheus.DatasetUtil.read('test_files/aml_aml_train_marker_selection.gct').done(function (d) { referenceDataset = d; })); Promise.all(promises).then(function () { var project = new morpheus.Project(dataset); new morpheus.MarkerSelection().execute({ project: project, input: { background: false, permutations: 1000, number_of_markers: 0, field: 'id', metric: morpheus.SignalToNoise.toString(), class_a: ['AML_12', 'AML_13', 'AML_14', 'AML_16', 'AML_20', 'AML_1', 'AML_2', 'AML_3', 'AML_5', 'AML_6', 'AML_7'], class_b: ['ALL_19769_B-cell', 'ALL_23953_B-cell', 'ALL_28373_B-cell', 'ALL_9335_B-cell', 'ALL_9692_B-cell', 'ALL_14749_B-cell', 'ALL_17281_B-cell', 'ALL_19183_B-cell', 'ALL_20414_B-cell', 'ALL_21302_B-cell', 'ALL_549_B-cell', 'ALL_17929_B-cell', 'ALL_20185_B-cell', 'ALL_11103_B-cell', 'ALL_18239_B-cell', 'ALL_5982_B-cell', 'ALL_7092_B-cell', 'ALL_R11_B-cell', 'ALL_R23_B-cell', 'ALL_16415_T-cell', 'ALL_19881_T-cell', 'ALL_9186_T-cell', 'ALL_9723_T-cell', 'ALL_17269_T-cell', 'ALL_14402_T-cell', 'ALL_17638_T-cell', 'ALL_22474_T-cell'] } }); // compare metadata fields var vector = dataset.getRowMetadata().getByName('p_value'); var referenceVector = referenceDataset.getRowMetadata().getByName('p-value'); for (var i = 0, size = vector.size(); i < size; i++) { expect(vector.getValue(i)).toBeCloseTo(referenceVector.getValue(i), 0.001); } var vector = dataset.getRowMetadata().getByName('FDR(BH)'); var referenceVector = referenceDataset.getRowMetadata().getByName('FDR(BH)'); for (var i = 0, size = vector.size(); i < size; i++) { expect(vector.getValue(i)).toBeCloseTo(referenceVector.getValue(i), 0.001); } var vector = dataset.getRowMetadata().getByName('Signal to noise'); var referenceVector = referenceDataset.getRowMetadata().getByName('Signal to noise'); for (var i = 0, size = vector.size(); i < size; i++) { expect(vector.getValue(i)).toBeCloseTo(referenceVector.getValue(i), 0.001); } done(); }); }); });
cmap/morpheus.js
jasmine/spec/marker_selection_test.js
JavaScript
bsd-3-clause
2,522
module.exports = function Clock() { // TODO }
MantarayAR/paugme-pack-circuits
src/circuit-components/active-components/clock.js
JavaScript
bsd-3-clause
47
/** * View abstract class * * @author Mautilus s.r.o. * @class View * @abstract * @mixins Events * @mixins Deferrable */ function View() { Events.call(this); Deferrable.call(this); this.construct.apply(this, arguments); }; View.prototype.__proto__ = Events.prototype; View.prototype.__proto__.__proto__ = Deferrable.prototype; /** * Construct object * * @constructor * @param {String} [parent=null] Another View instance this view belongs to * @param {Object} [attributes={}] Object attrs */ View.prototype.construct = function(parent, attributes) { if (typeof attributes === 'undefined' && parent && !parent.construct) { // parent is not provided, but attributes are attributes = $.extend(true, {}, parent); parent = null; } /** * @property {Object} parent Parent snippet or scene */ this.parent = parent; this.reset(attributes); this.$el = this.create(); if (this.id) { this.$el.attr('id', this.id); } if (this.cls) { this.$el.addClass(this.cls); } this.init.apply(this, arguments); this.bindEvents(); }; /** * Destruct object * * @private */ View.prototype.desctruct = function() { this.deinit.apply(this, arguments); this.destroy(); }; /** * Set focus to the scene * * @template */ View.prototype.focus = function() { }; /** * Reset properties * * @param {Object} [attributes] Object attrs */ View.prototype.reset = function(attributes) { this.isVisible = false; this.isActive = false; if (attributes) { this.setAttributes(attributes); } }; /** * Set object properties, functions and attributes that start with '_' are not allowed * * @param {Object} attributes */ View.prototype.setAttributes = function(attributes) { for (var i in attributes) { if (typeof attributes[i] !== 'undefined' && typeof attributes[i] !== 'function' && typeof this[i] !== 'fucntion' && i.substr(0, 1) !== '_') { this[i] = attributes[i]; } } }; /** * Bind listeners to the `key` event and some others */ View.prototype.bindEvents = function() { if (this.parent) { this.parent.on('key', this._onKey, this); this.parent.on('click', this._onClick, this); this.parent.on('scroll', this._onScroll, this); this.parent.on('focus', this._onFocus, this); } else { Control.on('key', this._onKey, this); Mouse.on('click', this._onClick, this); Mouse.on('scroll', this._onScroll, this); Focus.on('focus', this._onFocus, this); } I18n.on('langchange', this._onLangChange, this); }; /** * Un-bind all default listeners */ View.prototype.unbindEvents = function() { if (this.parent) { this.parent.off('key', this._onKey, this); this.parent.off('click', this._onClick, this); this.parent.off('scroll', this._onScroll, this); this.parent.off('focus', this._onFocus, this); } else { Control.off('key', this._onKey, this); Mouse.off('click', this._onClick, this); Mouse.off('scroll', this._onScroll, this); Focus.off('focus', this._onFocus, this); } I18n.off('langchange', this._onLangChange, this); }; /** * Create scene's element, is called when scene is being constructed * * @template * @returns {Object} Element, jQuery collection */ View.prototype.create = function() { return $('<div />'); }; /** * Remove scene's elements when scene is hiding * * @template */ View.prototype.remove = function() { }; /** * Remove or hide scene's element, is called when scene is being destructed * * @template * @return {Boolean/Promise} Return FALSE when you don't want to hide this scene, Promise may be also returned */ View.prototype.destroy = function() { }; /** * Initialise scene * * @template */ View.prototype.init = function() { }; /** * De-initialise scene * * @template */ View.prototype.deinit = function() { }; /** * Activate and focus scene when its shown * * @template * @return {Boolean/Promise} Return FALSE when you don't want to show this scene, Promise may be also returned */ View.prototype.activate = function() { }; /** * Deactivate scene when its hidden * * @template * @return {Boolean} Return FALSE when you don't want to destroy this scene when its hidden */ View.prototype.deactivate = function() { }; /** * This method is called when and 'activate' method fails * * @template * @return {Boolean} If TRUE is returned, router will call goBack (default action) */ View.prototype.revert = function() { return true; }; /** * Render snippet * * @template * @return {Promise} */ View.prototype.render = function() { }; /** * Render snippet into specified target element * * @param {Object} target jQuery collection or HTMLElement */ View.prototype.renderTo = function(target) { var p; this.$el.appendTo(target); p = this.render(); if (p instanceof Promise) { p.done(function() { this.show(); }, this); } else { this.show(); } return p; }; /** * Display scene's element and set `this.isVisible` to TRUE */ View.prototype.show = function() { var args = arguments; return this.when(function(promise) { var activated; if (this.onBeforeShow() === false) { promise.reject(); return false; } this.$el.show(); this.isVisible = true; this.isActive = false; this.onShow(); this.trigger('show'); promise.fail(function() { this.hide(); }, this); activated = this.activate.apply(this, args); if (activated instanceof Promise) { activated.then(function(status) { this.isActive = status; if (status) { promise.resolve(); } else { promise.reject(); } }, this); } else if (activated !== false) { this.isActive = true; promise.resolve(); } else { this.isActive = false; promise.reject(); } }, this); }; /** * Fired before the view is being shown and before `activate` method * * @template * @return {Boolean} */ View.prototype.onBeforeShow = function() { }; /** * Fired when this view is displayed * * @template */ View.prototype.onShow = function() { }; /** * Hide scene's element and set `this.isVisible` to FALSE */ View.prototype.hide = function() { return this.when(function(promise) { var deactivated; promise.done(function() { this.onBeforeHide(); this.$el.hide(); this.isVisible = false; this.onHide(); this.trigger('hide'); }, this); deactivated = this.deactivate(); if (deactivated instanceof Promise) { deactivated.then(function(status) { if (status) { this.isActive = false; promise.resolve(); } else { promise.reject(); } }, this); } else if (deactivated !== false) { this.isActive = false; promise.resolve(); } else { promise.reject(); } }, this); }; /** * Fired before the view is being hidden but after `deactivate` method (no return value) * * @template */ View.prototype.onBeforeHide = function() { }; /** * Fired when this view is hidden * * @template */ View.prototype.onHide = function() { }; /** * Test if this scene has focus (or any snippet inside this scene) * * @returns {Boolean} */ View.prototype.hasFocus = function() { return Focus.isIn(this.$el); }; /** * @private */ View.prototype._onKey = function(keyCode, ev, stop) { if (!this.isVisible || !this.hasFocus()) { return; } if (this.trigger('beforekey', keyCode, ev) === false) { return false; } if (this.onKey(keyCode, ev, stop) === false) { return false; } if (Control.isArrow(keyCode) && this.navigate(Control.getArrow(keyCode), stop) === false) { return false; } if (keyCode === Control.key.ENTER && this.onEnter(Focus.focused, ev, stop) === false) { return false; } else if (keyCode === Control.key.RETURN && this.onReturn(Focus.focused, ev, stop) === false) { return false; } if (this.trigger('key', keyCode, ev) === false) { return false; } }; /** * Handles keyDown events * * @template * @param {Number} keyCode * @param {Event} event * @param {Function} stop * @returns {Boolean} */ View.prototype.onKey = function(keyCode, ev, stop) { }; /** * Handles ENTER event * * @template * @param {Object} $el Target element, jQuery collection * @param {Event} event * @returns {Boolean} */ View.prototype.onEnter = function($el, event) { }; /** * Handles RETURN event * * @template * @param {Object} $el Target element, jQuery collection * @param {Event} event * @returns {Boolean} */ View.prototype.onReturn = function($el, event) { }; /** * @private */ View.prototype._onClick = function($el, event) { if (!$el.belongsTo(this.$el)) { return; } if (this.onClick.apply(this, arguments) === false) { return false; } return this.trigger('click', $el, event); }; /** * Handles Click event * * @param {Object} $el Target element, jQuery collection * @param {Event} event Mouse event * @returns {Boolean} */ View.prototype.onClick = function($el, event) { }; /** * @private */ View.prototype._onScroll = function($el, delta, event) { if (!$el.belongsTo(this.$el)) { return; } if (this.onScroll.apply(this, arguments) === false) { return false; } return this.trigger('scroll', $el, delta, event); }; /** * Handles Scroll event when this scene is visible * * @param {Object} $el Target element, jQuery collection * @param {Number} delta, 1 or -1 * @param {Event} event Mouse event * @returns {Boolean} */ View.prototype.onScroll = function($el, delta, event) { }; /** * @private */ View.prototype._onFocus = function($el) { if (!$el.belongsTo(this.$el)) { return; } if (this.onFocus.apply(this, arguments) === false) { return false; } return this.trigger('focus', $el); }; /** * Handles Focus event * * @template * @param {Object} $el Target element, jQuery collection * @returns {Boolean} */ View.prototype.onFocus = function($el) { }; /** * @private */ View.prototype._onLangChange = function() { if (this.onLangChange.apply(this, arguments) === false) { return false; } this.trigger('langchange'); }; /** * When app language is changed * * @template * @returns {Boolean} */ View.prototype.onLangChange = function() { }; /** * Navigate in 4-way direction * * @template * @param {String} direction Possible values: 'left', 'right', 'up', 'down' * @param {Function} stop * @return {Boolean} Return FALSE to prevent event from bubeling */ View.prototype.navigate = function(direction, stop) { }; /** * Get all focusable elements inside this snippet. This takes currentyl focused * element and calculates new one. If the new sibling is not exits, new focus * is getting from the start / end of collection - cyclic. * * Is the same like getFocusable, but you can specify parent and also you can * walkthrough all elements in cyclic. * * @param {Number} direction left is equal to -1, right to 1 * @param {Object} parent jquery object. All focusable elements belongs only to this parent. * @returns {Object} jQuery collection */ View.prototype.getCircleFocusable = function(direction, parent) { var els = $('.focusable', parent || this.$el).not('.disabled').filter(':visible'), focusedIndex = Focus.focused ? els.index(Focus.focused) : -1; if (focusedIndex !== -1) { focusedIndex += direction; if (focusedIndex === -1) return els.eq(els.length - 1); else if (focusedIndex > els.length - 1) return els.eq(0); else return els.eq(focusedIndex); } }; /** * Get all focusable elements inside this scene * * @param {Number} [index] If specified, then returns only one element at the specified position * @param {Boolean} [fromCurrentlyFocused=false] If TRUE, than elements before focused element are cut off * @param {Object} [$el=this.$el] Limit search for just this specified element, jQuery collection * @param {String} [selector=.focusable] * @returns {Object} jQuery collection */ View.prototype.getFocusable = function(index, fromCurrentlyFocused, $el, selector) { var els, focusedIndex, _index = index; if (!selector) { selector = '.focusable'; } els = $(selector, $el || this.$el).filter(':visible').not('.disabled'); if (fromCurrentlyFocused) { if(typeof fromCurrentlyFocused === 'boolean'){ focusedIndex = Focus.focused ? els.index(Focus.focused) : -1; } else { focusedIndex = els.index(fromCurrentlyFocused); } if (typeof index !== 'undefined' && _index < 0) { els = els.slice(0, (focusedIndex >= 0 ? focusedIndex : 1)); //_index += els.length; } else { els = els.slice(focusedIndex >= 0 ? focusedIndex : 0); } } if (typeof _index !== 'undefined') { return els.eq(_index >> 0); } return els; }; /** * Convert View into string * * @returns {String} */ View.prototype.toString = function() { this.render(); return this.$el[0].outerHTML; };
wdoganowski/inio-tvapp
framework/view.js
JavaScript
bsd-3-clause
12,630
'use strict'; describe('Registry', function() { describe('create()', function() { it('name', function() { let blot = Registry.create('bold'); expect(blot instanceof BoldBlot).toBe(true); expect(blot.statics.blotName).toBe('bold'); }); it('node', function() { let node = document.createElement('strong'); let blot = Registry.create(node); expect(blot instanceof BoldBlot).toBe(true); expect(blot.statics.blotName).toBe('bold'); }); it('block', function() { let blot = Registry.create(Registry.Scope.BLOCK_BLOT); expect(blot instanceof BlockBlot).toBe(true); expect(blot.statics.blotName).toBe('block'); }); it('inline', function() { let blot = Registry.create(Registry.Scope.INLINE_BLOT); expect(blot instanceof InlineBlot).toBe(true); expect(blot.statics.blotName).toBe('inline'); }); it('string index', function() { let blot = Registry.create('header', '2'); expect(blot instanceof HeaderBlot).toBe(true); expect(blot.formats()).toEqual({ header: 'h2' }); }); it('invalid', function() { expect(function() { Registry.create(BoldBlot); }).toThrowError(/\[Parchment\]/); }); }); describe('register()', function() { it('invalid', function() { expect(function() { Registry.register({}); }).toThrowError(/\[Parchment\]/); }); it('abstract', function() { expect(function() { Registry.register(ShadowBlot); }).toThrowError(/\[Parchment\]/); }); }); describe('find()', function() { it('exact', function() { let blockNode = document.createElement('p'); blockNode.innerHTML = '<span>01</span><em>23<strong>45</strong></em>'; let blockBlot = Registry.create(blockNode); expect(Registry.find(document.body)).toBeFalsy(); expect(Registry.find(blockNode)).toBe(blockBlot); expect(Registry.find(blockNode.querySelector('span'))).toBe(blockBlot.children.head); expect(Registry.find(blockNode.querySelector('em'))).toBe(blockBlot.children.tail); expect(Registry.find(blockNode.querySelector('strong'))).toBe( blockBlot.children.tail.children.tail, ); let text01 = blockBlot.children.head.children.head; let text23 = blockBlot.children.tail.children.head; let text45 = blockBlot.children.tail.children.tail.children.head; expect(Registry.find(text01.domNode)).toBe(text01); expect(Registry.find(text23.domNode)).toBe(text23); expect(Registry.find(text45.domNode)).toBe(text45); }); it('bubble', function() { let blockBlot = Registry.create('block'); let textNode = document.createTextNode('Test'); blockBlot.domNode.appendChild(textNode); expect(Registry.find(textNode)).toBeFalsy(); expect(Registry.find(textNode, true)).toEqual(blockBlot); }); it('detached parent', function() { let blockNode = document.createElement('p'); blockNode.appendChild(document.createTextNode('Test')); expect(Registry.find(blockNode.firstChild)).toBeFalsy(); expect(Registry.find(blockNode.firstChild, true)).toBeFalsy(); }); }); describe('query()', function() { it('class', function() { let node = document.createElement('em'); node.setAttribute('class', 'author-blot'); expect(Registry.query(node)).toBe(AuthorBlot); }); it('type mismatch', function() { let match = Registry.query('italic', Registry.Scope.ATTRIBUTE); expect(match).toBeFalsy(); }); it('level mismatch for blot', function() { let match = Registry.query('italic', Registry.Scope.BLOCK); expect(match).toBeFalsy(); }); it('level mismatch for attribute', function() { let match = Registry.query('color', Registry.Scope.BLOCK); expect(match).toBeFalsy(); }); it('either level', function() { let match = Registry.query('italic', Registry.Scope.BLOCK | Registry.Scope.INLINE); expect(match).toBe(ItalicBlot); }); it('level and type match', function() { let match = Registry.query('italic', Registry.Scope.INLINE & Registry.Scope.BLOT); expect(match).toBe(ItalicBlot); }); it('level match and type mismatch', function() { let match = Registry.query('italic', Registry.Scope.INLINE & Registry.Scope.ATTRIBUTE); expect(match).toBeFalsy(); }); it('type match and level mismatch', function() { let match = Registry.query('italic', Registry.Scope.BLOCK & Registry.Scope.BLOT); expect(match).toBeFalsy(); }); }); });
quilljs/parchment
test/unit/registry.js
JavaScript
bsd-3-clause
4,631
/*-------------------------------------------------------- * Copyright (c) 2011, The Dojo Foundation * This software is distributed under the "Simplified BSD license", * the text of which is available at http://www.winktoolkit.org/licence.txt * or see the "license.txt" file for more details. *--------------------------------------------------------*/ /** * @fileOverview Implements an image opener. Creates an "image opener" with a 3D rendering * * @author Jerome GIRAUD */ /** * The event is fired when someone clicks on the image * * @name wink.ui.xyz.Opener#/opener/events/click * @event * @param {object} param The parameters object * @param {integer} param.openerId uId of the opener */ define(['../../../../_amd/core', '../../../../math/_geometric/js/geometric', '../../../../fx/_xyz/js/3dfx'], function(wink) { /** * @class Implements an image opener. Creates an "image opener" with a 3D rendering. * Define the image you want to see as the opener's background. Use the "getDomNode" method to insert the opener into the page. * * @param {object} properties The properties object * @param {string} properties.image The URL of the image to display * @param {integer} properties.height The height of the opener (should be the same as the image height) * @param {integer} properties.width The width of the opener (should be the same as the image width) * @param {integer} [properties.panelHeight=20] The height of each panel. The image is divided into X panels * @param {integer} [properties.panelsAngle=140] The winding angle of the opener * @param {integer} [properties.openerXAngle=10] The angle between the opener and the page on the X-axis * @param {integer} [properties.openerYAngle=15] The angle between the opener and the page on the Y-axis * @param {integer} [properties.duration=500] The opening duration in milliseconds * * @requires wink.math._geometric * @requires wink.math._matrix * @requires wink.fx._xyz * * @example * * var properties = * { * 'image': './img/wink.png', * 'height': 185, * 'width': 185, * 'panelsAngle': 200, * 'panelHeight': 5, * 'openerXAngle': 5, * 'openerYAngle': -50, * 'duration': 300 * } * * opener = new wink.ui.xyz.Opener(properties); * wink.byId('content').appendChild(opener.getDomNode()); * * @compatibility iOS2, iOS3, iOS4, iOS5, iOS6, Android 3.0, Android 3.1, Android 4.0, Android 4.1.2, BlackBerry 7, BB10 * * @see <a href="WINK_ROOT_URL/ui/xyz/opener/test/test_opener_1.html" target="_blank">Test page</a> * @see <a href="WINK_ROOT_URL/ui/xyz/opener/test/test_opener_2.html" target="_blank">Test page</a> */ wink.ui.xyz.Opener = function(properties) { /** * Unique identifier * * @property uId * @type integer */ this.uId = wink.getUId(); /** * True if the image is "opened", false otherwise * * @property opened * @type boolean */ this.opened = false; /** * The URL of the opener image * * @property image * @type string */ this.image = null; /** * The height of the opener * * @property height * @type integer */ this.height = 0; /** * The width of the opener * * @property width * @type integer */ this.width = 0; /** * The height of each panel * * @property panelHeight * @type integer */ this.panelHeight = 20; /** * The winding angle of the opener * * @property panelsAngle * @type integer */ this.panelsAngle = 140; /** * The angle between the opener and the page on the X-axis * * @property openerXAngle * @type integer */ this.openerXAngle = 10; /** * The angle between the opener and the page on the Y-axis * * @property the angle between the opener and the page on the Y-axis * @type integer */ this.openerYAngle = 15; /** * the opening duration in milliseconds * * @property duration * @type integer */ this.duration = 500; this._nbPanels = 0; this._panelAngle = 0; this._panelsList = []; this._domNode = null; this._panelsNode = null; this._contentNode = null; wink.mixin(this, properties); if ( this._validateProperties() === false )return; this._initProperties(); this._initDom(); this._initListeners(); }; wink.ui.xyz.Opener.prototype = { /** * @returns {HTMLElement} The dom node containing the Opener */ getDomNode: function() { return this._domNode; }, /** * Opens the image */ open: function() { wink.fx.initComposedTransform(this._panelsNode, false); wink.fx.setTransformPart(this._panelsNode, 1, { type: 'rotate', x: 0, y: 1, z: 0, angle: this.openerYAngle }); wink.fx.setTransformPart(this._panelsNode, 2, { type: 'rotate', x: 1, y: 0, z: 0, angle: this.openerXAngle }); wink.fx.applyComposedTransform(this._panelsNode); this._domNode.style['height'] = '0px'; var l = this._panelsList.length; for ( var i = l-1; i > 0; i-- ) { this._panelsList[i].open(); } this.opened = true; }, /** * Closes the image */ close: function() { wink.fx.setTransformPart(this._panelsNode, 1, { type: 'rotate', x: 0, y: 1, z: 0, angle: 0 }); wink.fx.setTransformPart(this._panelsNode, 2, { type: 'rotate', x: 1, y: 0, z: 0, angle: 0 }); wink.fx.applyComposedTransform(this._panelsNode); this._domNode.style['height'] = 'auto'; var l = this._panelsList.length; for ( var i = l-1; i > 0; i-- ) { this._panelsList[i].close(); } this.opened = false; }, /** * Toggles the image display */ toggle: function() { if ( this.opened ) { this.close(); } else { this.open(); } }, /** * Handles the click events */ _handleClick: function() { this.toggle(); wink.publish('/opener/events/click', {'openerId': this.uId}); }, /** * Validate the properties of the component * @returns {boolean} True if the properties are valid, false otherwise */ _validateProperties: function() { // Check duration if ( !wink.isInteger(this.duration) ) { wink.log('[Opener] The property duration must be an integer'); return false; } // Check opener X angle if ( !wink.isInteger(this.openerXAngle) ) { wink.log('[Opener] The property openerXAngle must be an integer'); return false; } // Check opener Y angle if ( !wink.isInteger(this.openerYAngle) ) { wink.log('[Opener] The property openerYAngle must be an integer'); return false; } // Check panel angle if ( !wink.isInteger(this.panelsAngle) ) { wink.log('[Opener] The property panelsAngle must be an integer'); return false; } // Check panelHeight if ( !wink.isInteger(this.panelHeight) ) { wink.log('[Opener] The property panelHeight must be an integer'); return false; } // Check height if ( !wink.isInteger(this.height) ) { wink.log('[Opener] The property height must be an integer'); return false; } // Check width if ( !wink.isInteger(this.width) ) { wink.log('[Opener] The property width must be an integer'); return false; } // Check image if ( !wink.isSet(this.image) ) { wink.log('[Opener] The property image must be set'); return false; } return true; }, /** * Initialize the 'click' listener */ _initListeners: function() { wink.subscribe('/opener_panel/events/click', {context: this, method: '_handleClick'}); }, /** * Initialize the Opener properties */ _initProperties: function() { this._nbPanels = Math.ceil(this.height / this.panelHeight); this._panelAngle = this.panelsAngle / this._nbPanels; }, /** * Initialize the Opener DOM nodes */ _initDom: function() { this._domNode = document.createElement('div'); this._domNode.className = 'op_container'; wink.fx.apply(this._domNode, { height: this.height + 'px', width: this.width + 'px' }); this._panelsNode = document.createElement('div'); this._panelsNode.className = 'op_panels'; wink.fx.apply(this._panelsNode, {'transform-origin': '100% 0', 'transform-style': 'preserve-3d'}); for ( var i=0; i<this._nbPanels; i++ ) { var panel = new wink.ui.xyz.Opener.Panel({index: i, image: this.image, height: this.panelHeight, angle: this._panelAngle}); this._panelsList.push(panel); this._panelsNode.appendChild(panel.getDomNode()); wink.fx.applyTransformTransition(panel.getDomNode(), this.duration + 'ms', '0ms', 'linear'); } this._domNode.appendChild(this._panelsNode); wink.fx.applyTransformTransition(this._panelsNode, this.duration + 'ms', '0ms', 'linear'); } }; /** * @class Implements an image opener panel. Should only be instantiated by the Opener itself * * @param {object} properties The properties object * @param {integer} properties.index The position of the panel in the panels list * @param {string} properties.image The URL of the image to display * @param {integer} properties.height The height of the panel * @param {integer} properties.angle The opening angle of the panel * */ wink.ui.xyz.Opener.Panel = function(properties) { /** * Unique identifier * * @property uId * @type integer */ this.uId = wink.getUId(); /** * The position of the panel * * @property index * @type integer */ this.index = null; /** * The URL of the image to display * * @property image * @type string */ this.image = null; /** * The height of the panel * * @property height * @type integer */ this.height = 0; /** * The opening angle of the panel * * @property angle * @type integer */ this.angle = 0; this._y = 0; this._z = 0; this._domNode = null; wink.mixin(this, properties); this._initProperties(); this._initDom(); }; /** * The event is fired when someone clicks on the panel * * @name wink.ui.xyz.Opener#/opener_panel/events/click * @event * @param {object} param The parameters object * @param {integer} param.panelId uId of the panel */ wink.ui.xyz.Opener.Panel.prototype = { /** * @returns {HTMLElement} The component main dom node */ getDomNode: function() { return this._domNode; }, /** * Opens the image */ open: function() { wink.fx.initComposedTransform(this._domNode, false); wink.fx.setTransformPart(this._domNode, 1, { type: 'rotate', x: 1, y: 0, z: 0, angle: (this.angle*(this.index)) }); wink.fx.setTransformPart(this._domNode, 2, { type: 'translate', x: 0, y: this._y, z: this._z }); wink.fx.applyComposedTransform(this._domNode); }, /** * Closes the image */ close: function() { wink.fx.setTransformPart(this._domNode, 1, { type: 'rotate', x: 1, y: 0, z: 0, angle: 0 }); wink.fx.setTransformPart(this._domNode, 2, { type: 'translate', x: 0, y: (this.index * this.height), z: 0 }); wink.fx.applyComposedTransform(this._domNode); }, /** * Initialize the Panel properties */ _initProperties: function() { for ( var i=0; i<this.index; i++ ) { this._y += Math.cos(wink.math.degToRad(this.angle*i))*this.height; this._z += Math.sin(wink.math.degToRad(this.angle*i))*this.height; } }, /** * Initialize the Panel DOM node */ _initDom: function() { this._domNode = document.createElement('div'); this._domNode.className = 'op_panel'; wink.fx.apply(this._domNode, { height: (this.height + 2) + 'px', 'transform-origin': '0 0', backgroundImage: 'url(' + this.image + ')', backgroundRepeat: 'no-repeat', backgroundPositionX: '0', backgroundPositionY: -this.index*this.height + 'px' }); this._domNode.onclick = function() { wink.publish('/opener_panel/events/click', {'panelId': this.uId}); }; wink.fx.translate(this._domNode, 0, this.index*this.height); } }; return wink.ui.xyz.Opener; });
winktoolkit/wink
ui/xyz/opener/js/opener.js
JavaScript
bsd-3-clause
12,838
var class_app_store_1_1_templates_1_1_info_page = [ [ "InfoPage", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#aacc915c912d65ce33fa9e7e52c6be216", null ], [ "Connect", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#ad34ee8cdb8ff2d76fed2cad1bc2aa1a1", null ], [ "Connect", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#ad34ee8cdb8ff2d76fed2cad1bc2aa1a1", null ], [ "InfoList_ContainerContentChanging", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a5ba4cd133487f329f59b77b4071581a5", null ], [ "InfoList_SelectionChanged", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#ac18e2bfeb522be8c569b00790b56646f", null ], [ "InitializeComponent", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a948b35bd12444a987d43a245c8a447a9", null ], [ "InitializeComponent", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a948b35bd12444a987d43a245c8a447a9", null ], [ "NavigationHelper_LoadState", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a3e4dd18f960ae46d18dd2fabcda739d3", null ], [ "NavigationHelper_SaveState", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a4957626abb3a418f95e79f52e7d4786f", null ], [ "OnNavigatedFrom", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a3abe2573383323a9784b03d91c315e8e", null ], [ "OnNavigatedTo", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a9644617a3dce2b967413daad6372ea7c", null ], [ "_contentLoaded", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#ae5e3755c0f3095eaf5a57f921eff76cd", null ], [ "ContentRoot", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a1792869655742195874998209830b1d0", null ], [ "defaultViewModel", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a1d8f9530d49804e16998dda4b146f684", null ], [ "info", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#aa56bac7891d986b6c94b39597bf645c5", null ], [ "InfoList", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#ac3b6ab57fd3bc5004c05e927ba94e095", null ], [ "infoTitle", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a63f533136625c01d57b80ede1a0a23f3", null ], [ "LayoutRoot", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#aadefb64072d2be0c45a367457f24b079", null ], [ "navigationHelper", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a2fd7aa6ad416cfd7070bcd2d30c79daf", null ], [ "pageTitle", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a37465f226e4eb95d28f945810d59e68d", null ], [ "selectionWordList", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#a4afa18de00bb76682634e302cbf5b338", null ], [ "DefaultViewModel", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#af8e896eca5646b361804ebc6ef114d73", null ], [ "NavigationHelper", "dc/dec/class_app_store_1_1_templates_1_1_info_page.html#aaa26aeaebb4107d65639ec2fc1685677", null ] ];
BuildmLearn/BuildmLearn-Store
WP/doc/DOxygen_HTML/dc/dec/class_app_store_1_1_templates_1_1_info_page.js
JavaScript
bsd-3-clause
2,950
import propertyTest from '../../helpers/propertyTest' propertyTest('DTEND', { transformableValue: new Date('1991-03-07 09:00:00'), transformedValue: '19910307T090000' })
angeloashmore/ics-js
test/unit/properties/DTEND.js
JavaScript
isc
175
module.exports = function(environment) { var ENV = { modulePrefix: 'dummy', environment: environment, baseURL: '/', locationType: 'auto', EmberENV: { EXTEND_PROTOTYPES: false, FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true } }, APP: { // Here you can pass flags/options to your application instance // when it is created } }; if (environment === 'development') { // ENV.APP.LOG_RESOLVER = true; // ENV.APP.LOG_ACTIVE_GENERATION = true; // ENV.APP.LOG_TRANSITIONS = true; // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; // ENV.APP.LOG_VIEW_LOOKUPS = true; } if (environment === 'test') { // Testem prefers this... ENV.baseURL = '/'; ENV.locationType = 'none'; // keep test console output quieter ENV.APP.LOG_ACTIVE_GENERATION = false; ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; ENV.APP.autoboot = false; } if (environment === 'production') { ENV.baseURL = '/ember-collection'; ENV.locationType = 'hash'; } return ENV; };
arenoir/ember-collection
tests/dummy/config/environment.js
JavaScript
mit
1,177
/** * Created by fengyuanzemin on 17/2/15. */ import Vue from 'vue'; import Vuex from 'vuex'; import * as actions from './actions'; import * as mutations from './mutations'; Vue.use(Vuex); const state = { isShow: false, msg: '出错了', isBig: true, token: localStorage.getItem('f-token'), init: false }; export default new Vuex.Store({ state, actions, mutations });
fengyuanzemin/graduation
frontend/src/store/index.js
JavaScript
mit
389
/*global describe, it, expect, require*/ const nodeToBox = require('../../../src/core/layout/node-to-box'); describe('nodeToBox', function () { 'use strict'; it('should convert node to a box', function () { expect(nodeToBox({x: 10, styles: ['blue'], y: 20, width: 30, height: 40, level: 2})).toEqual({left: 10, styles: ['blue'], top: 20, width: 30, height: 40, level: 2}); }); it('should append default styles if not provided', function () { expect(nodeToBox({x: 10, y: 20, width: 30, height: 40, level: 2})).toEqual({left: 10, styles: ['default'], top: 20, width: 30, height: 40, level: 2}); }); it('should return falsy for undefined', function () { expect(nodeToBox()).toBeFalsy(); }); it('should return falsy for falsy', function () { expect(nodeToBox(false)).toBeFalsy(); }); });
mindmup/mapjs
specs/core/layout/node-to-box-spec.js
JavaScript
mit
802
//= require redactor-rails/plugins/clips //= require redactor-rails/plugins/fontcolor //= require redactor-rails/plugins/fontfamily //= require redactor-rails/plugins/fontsize //= require redactor-rails/plugins/fullscreen //= require redactor-rails/plugins/table //= require redactor-rails/plugins/textdirection //= require redactor-rails/plugins/video
lawrrn/redactor
vendor/assets/javascripts/redactor-rails/plugins.js
JavaScript
mit
353
import webpack from "webpack" import { spawn } from "child_process" import appRootDir from "app-root-dir" import path from "path" import { createNotification } from "./util" import HotServerManager from "./HotServerManager" import HotClientManager from "./HotClientManager" import ConfigFactory from "../webpack/ConfigFactory" import StatusPlugin from "../webpack/plugins/Status" function safeDisposer(manager) { return manager ? manager.dispose() : Promise.resolve() } /* eslint-disable arrow-body-style, no-console */ function createCompiler({ name, start, done }) { try { const webpackConfig = ConfigFactory({ target: name === "server" ? "node" : "web", mode: "development" }) // Offering a special status handling until Webpack offers a proper `done()` callback // See also: https://github.com/webpack/webpack/issues/4243 webpackConfig.plugins.push(new StatusPlugin({ name, start, done })) return webpack(webpackConfig) } catch (error) { createNotification({ title: "development", level: "error", message: "Webpack config is invalid, please check the console for more information.", notify: true }) console.error(error) throw error } } export default class HotController { constructor() { this.hotClientManager = null this.hotServerManager = null this.clientIsBuilding = false this.serverIsBuilding = false this.timeout = 0 const createClientManager = () => { return new Promise((resolve) => { const compiler = createCompiler({ name: "client", start: () => { this.clientIsBuilding = true createNotification({ title: "Hot Client", level: "info", message: "Building new bundle..." }) }, done: () => { this.clientIsBuilding = false createNotification({ title: "Hot Client", level: "info", message: "Bundle is ready.", notify: true }) resolve(compiler) } }) this.hotClientCompiler = compiler this.hotClientManager = new HotClientManager(compiler) }) } const createServerManager = () => { return new Promise((resolve) => { const compiler = createCompiler({ name: "server", start: () => { this.serverIsBuilding = true createNotification({ title: "Hot Server", level: "info", message: "Building new bundle..." }) }, done: () => { this.serverIsBuilding = false createNotification({ title: "Hot Server", level: "info", message: "Bundle is ready.", notify: true }) this.tryStartServer() resolve(compiler) } }) this.compiledServer = path.resolve( appRootDir.get(), compiler.options.output.path, `${Object.keys(compiler.options.entry)[0]}.js`, ) this.hotServerCompiler = compiler this.hotServerManager = new HotServerManager(compiler, this.hotClientCompiler) }) } createClientManager().then(createServerManager).catch((error) => { console.error("Error during build:", error) }) } tryStartServer = () => { if (this.clientIsBuilding) { if (this.serverTryTimeout) { clearTimeout(this.serverTryTimeout) } this.serverTryTimeout = setTimeout(this.tryStartServer, this.timeout) this.timeout += 100 return } this.startServer() this.timeout = 0 } startServer = () => { if (this.server) { this.server.kill() this.server = null createNotification({ title: "Hot Server", level: "info", message: "Restarting server..." }) } const newServer = spawn("node", [ "--inspect", this.compiledServer, "--colors" ], { stdio: [ process.stdin, process.stdout, "pipe" ] }) createNotification({ title: "Hot Server", level: "info", message: "Server running with latest changes.", notify: true }) newServer.stderr.on("data", (data) => { createNotification({ title: "Hot Server", level: "error", message: "Error in server execution, check the console for more info." }) process.stderr.write("\n") process.stderr.write(data) process.stderr.write("\n") }) this.server = newServer } dispose() { // First the hot client server. Then dispose the hot node server. return safeDisposer(this.hotClientManager).then(() => safeDisposer(this.hotServerManager)).catch((error) => { console.error(error) }) } }
sebastian-software/edgestack
src/hotdev/HotController.js
JavaScript
mit
4,927
"use strict"; exports.__esModule = true; // istanbul ignore next var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor); } }return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor; }; })(); // istanbul ignore next function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {};if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } }newObj["default"] = obj;return newObj; } } // istanbul ignore next function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } // istanbul ignore next function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var _convertSourceMap = require("convert-source-map"); var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap); var _modules = require("../modules"); var _modules2 = _interopRequireDefault(_modules); var _optionsOptionManager = require("./options/option-manager"); var _optionsOptionManager2 = _interopRequireDefault(_optionsOptionManager); var _pluginManager = require("./plugin-manager"); var _pluginManager2 = _interopRequireDefault(_pluginManager); var _shebangRegex = require("shebang-regex"); var _shebangRegex2 = _interopRequireDefault(_shebangRegex); var _traversalPath = require("../../traversal/path"); var _traversalPath2 = _interopRequireDefault(_traversalPath); var _lodashLangIsFunction = require("lodash/lang/isFunction"); var _lodashLangIsFunction2 = _interopRequireDefault(_lodashLangIsFunction); var _sourceMap = require("source-map"); var _sourceMap2 = _interopRequireDefault(_sourceMap); var _generation = require("../../generation"); var _generation2 = _interopRequireDefault(_generation); var _helpersCodeFrame = require("../../helpers/code-frame"); var _helpersCodeFrame2 = _interopRequireDefault(_helpersCodeFrame); var _lodashObjectDefaults = require("lodash/object/defaults"); var _lodashObjectDefaults2 = _interopRequireDefault(_lodashObjectDefaults); var _lodashCollectionIncludes = require("lodash/collection/includes"); var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes); var _traversal = require("../../traversal"); var _traversal2 = _interopRequireDefault(_traversal); var _tryResolve = require("try-resolve"); var _tryResolve2 = _interopRequireDefault(_tryResolve); var _logger = require("./logger"); var _logger2 = _interopRequireDefault(_logger); var _plugin = require("../plugin"); var _plugin2 = _interopRequireDefault(_plugin); var _helpersParse = require("../../helpers/parse"); var _helpersParse2 = _interopRequireDefault(_helpersParse); var _traversalHub = require("../../traversal/hub"); var _traversalHub2 = _interopRequireDefault(_traversalHub); var _util = require("../../util"); var util = _interopRequireWildcard(_util); var _path = require("path"); var _path2 = _interopRequireDefault(_path); var _types = require("../../types"); var t = _interopRequireWildcard(_types); /** * [Please add a description.] */ var File = (function () { function File(opts, pipeline) { if (opts === undefined) opts = {}; _classCallCheck(this, File); this.transformerDependencies = {}; this.dynamicImportTypes = {}; this.dynamicImportIds = {}; this.dynamicImports = []; this.declarations = {}; this.usedHelpers = {}; this.dynamicData = {}; this.data = {}; this.ast = {}; this.metadata = { modules: { imports: [], exports: { exported: [], specifiers: [] } } }; this.hub = new _traversalHub2["default"](this); this.pipeline = pipeline; this.log = new _logger2["default"](this, opts.filename || "unknown"); this.opts = this.initOptions(opts); this.buildTransformers(); } /** * [Please add a description.] */ File.prototype.initOptions = function initOptions(opts) { opts = new _optionsOptionManager2["default"](this.log, this.pipeline).init(opts); if (opts.inputSourceMap) { opts.sourceMaps = true; } if (opts.moduleId) { opts.moduleIds = true; } opts.basename = _path2["default"].basename(opts.filename, _path2["default"].extname(opts.filename)); opts.ignore = util.arrayify(opts.ignore, util.regexify); if (opts.only) opts.only = util.arrayify(opts.only, util.regexify); _lodashObjectDefaults2["default"](opts, { moduleRoot: opts.sourceRoot }); _lodashObjectDefaults2["default"](opts, { sourceRoot: opts.moduleRoot }); _lodashObjectDefaults2["default"](opts, { filenameRelative: opts.filename }); _lodashObjectDefaults2["default"](opts, { sourceFileName: opts.filenameRelative, sourceMapTarget: opts.filenameRelative }); // if (opts.externalHelpers) { this.set("helpersNamespace", t.identifier("babelHelpers")); } return opts; }; /** * [Please add a description.] */ File.prototype.isLoose = function isLoose(key) { return _lodashCollectionIncludes2["default"](this.opts.loose, key); }; /** * [Please add a description.] */ File.prototype.buildTransformers = function buildTransformers() { var file = this; var transformers = this.transformers = {}; var secondaryStack = []; var stack = []; // build internal transformers for (var key in this.pipeline.transformers) { var transformer = this.pipeline.transformers[key]; var pass = transformers[key] = transformer.buildPass(file); if (pass.canTransform()) { stack.push(pass); if (transformer.metadata.secondPass) { secondaryStack.push(pass); } if (transformer.manipulateOptions) { transformer.manipulateOptions(file.opts, file); } } } // init plugins! var beforePlugins = []; var afterPlugins = []; var pluginManager = new _pluginManager2["default"]({ file: this, transformers: this.transformers, before: beforePlugins, after: afterPlugins }); for (var i = 0; i < file.opts.plugins.length; i++) { pluginManager.add(file.opts.plugins[i]); } stack = beforePlugins.concat(stack, afterPlugins); // build transformer stack this.uncollapsedTransformerStack = stack = stack.concat(secondaryStack); // build dependency graph var _arr = stack; for (var _i = 0; _i < _arr.length; _i++) { var pass = _arr[_i];var _arr2 = pass.plugin.dependencies; for (var _i2 = 0; _i2 < _arr2.length; _i2++) { var dep = _arr2[_i2]; this.transformerDependencies[dep] = pass.key; } } // collapse stack categories this.transformerStack = this.collapseStack(stack); }; /** * [Please add a description.] */ File.prototype.collapseStack = function collapseStack(_stack) { var stack = []; var ignore = []; var _arr3 = _stack; for (var _i3 = 0; _i3 < _arr3.length; _i3++) { var pass = _arr3[_i3]; // been merged if (ignore.indexOf(pass) >= 0) continue; var group = pass.plugin.metadata.group; // can't merge if (!pass.canTransform() || !group) { stack.push(pass); continue; } var mergeStack = []; var _arr4 = _stack; for (var _i4 = 0; _i4 < _arr4.length; _i4++) { var _pass = _arr4[_i4]; if (_pass.plugin.metadata.group === group) { mergeStack.push(_pass); ignore.push(_pass); } } var visitors = []; var _arr5 = mergeStack; for (var _i5 = 0; _i5 < _arr5.length; _i5++) { var _pass2 = _arr5[_i5]; visitors.push(_pass2.plugin.visitor); } var visitor = _traversal2["default"].visitors.merge(visitors); var mergePlugin = new _plugin2["default"](group, { visitor: visitor }); stack.push(mergePlugin.buildPass(this)); } return stack; }; /** * [Please add a description.] */ File.prototype.set = function set(key, val) { return this.data[key] = val; }; /** * [Please add a description.] */ File.prototype.setDynamic = function setDynamic(key, fn) { this.dynamicData[key] = fn; }; /** * [Please add a description.] */ File.prototype.get = function get(key) { var data = this.data[key]; if (data) { return data; } else { var dynamic = this.dynamicData[key]; if (dynamic) { return this.set(key, dynamic()); } } }; /** * [Please add a description.] */ File.prototype.resolveModuleSource = function resolveModuleSource(source) { var resolveModuleSource = this.opts.resolveModuleSource; if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename); return source; }; /** * [Please add a description.] */ File.prototype.addImport = function addImport(source, name, type) { name = name || source; var id = this.dynamicImportIds[name]; if (!id) { source = this.resolveModuleSource(source); id = this.dynamicImportIds[name] = this.scope.generateUidIdentifier(name); var specifiers = [t.importDefaultSpecifier(id)]; var declar = t.importDeclaration(specifiers, t.literal(source)); declar._blockHoist = 3; if (type) { var modules = this.dynamicImportTypes[type] = this.dynamicImportTypes[type] || []; modules.push(declar); } if (this.transformers["es6.modules"].canTransform()) { this.moduleFormatter.importSpecifier(specifiers[0], declar, this.dynamicImports, this.scope); this.moduleFormatter.hasLocalImports = true; } else { this.dynamicImports.push(declar); } } return id; }; /** * [Please add a description.] */ File.prototype.attachAuxiliaryComment = function attachAuxiliaryComment(node) { var beforeComment = this.opts.auxiliaryCommentBefore; if (beforeComment) { node.leadingComments = node.leadingComments || []; node.leadingComments.push({ type: "CommentLine", value: " " + beforeComment }); } var afterComment = this.opts.auxiliaryCommentAfter; if (afterComment) { node.trailingComments = node.trailingComments || []; node.trailingComments.push({ type: "CommentLine", value: " " + afterComment }); } return node; }; /** * [Please add a description.] */ File.prototype.addHelper = function addHelper(name) { var isSolo = _lodashCollectionIncludes2["default"](File.soloHelpers, name); if (!isSolo && !_lodashCollectionIncludes2["default"](File.helpers, name)) { throw new ReferenceError("Unknown helper " + name); } var declar = this.declarations[name]; if (declar) return declar; this.usedHelpers[name] = true; if (!isSolo) { var generator = this.get("helperGenerator"); var runtime = this.get("helpersNamespace"); if (generator) { return generator(name); } else if (runtime) { var id = t.identifier(t.toIdentifier(name)); return t.memberExpression(runtime, id); } } var ref = util.template("helper-" + name); var uid = this.declarations[name] = this.scope.generateUidIdentifier(name); if (t.isFunctionExpression(ref) && !ref.id) { ref.body._compact = true; ref._generated = true; ref.id = uid; ref.type = "FunctionDeclaration"; this.attachAuxiliaryComment(ref); this.path.unshiftContainer("body", ref); } else { ref._compact = true; this.scope.push({ id: uid, init: ref, unique: true }); } return uid; }; File.prototype.addTemplateObject = function addTemplateObject(helperName, strings, raw) { // Generate a unique name based on the string literals so we dedupe // identical strings used in the program. var stringIds = raw.elements.map(function (string) { return string.value; }); var name = helperName + "_" + raw.elements.length + "_" + stringIds.join(","); var declar = this.declarations[name]; if (declar) return declar; var uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject"); var helperId = this.addHelper(helperName); var init = t.callExpression(helperId, [strings, raw]); init._compact = true; this.scope.push({ id: uid, init: init, _blockHoist: 1.9 // This ensures that we don't fail if not using function expression helpers }); return uid; }; /** * [Please add a description.] */ File.prototype.errorWithNode = function errorWithNode(node, msg) { var Error = arguments.length <= 2 || arguments[2] === undefined ? SyntaxError : arguments[2]; var err; var loc = node && (node.loc || node._loc); if (loc) { err = new Error("Line " + loc.start.line + ": " + msg); err.loc = loc.start; } else { // todo: find errors with nodes inside to at least point to something err = new Error("There's been an error on a dynamic node. This is almost certainly an internal error. Please report it."); } return err; }; /** * [Please add a description.] */ File.prototype.mergeSourceMap = function mergeSourceMap(map) { var opts = this.opts; var inputMap = opts.inputSourceMap; if (inputMap) { map.sources[0] = inputMap.file; var inputMapConsumer = new _sourceMap2["default"].SourceMapConsumer(inputMap); var outputMapConsumer = new _sourceMap2["default"].SourceMapConsumer(map); var outputMapGenerator = _sourceMap2["default"].SourceMapGenerator.fromSourceMap(outputMapConsumer); outputMapGenerator.applySourceMap(inputMapConsumer); var mergedMap = outputMapGenerator.toJSON(); mergedMap.sources = inputMap.sources; mergedMap.file = inputMap.file; return mergedMap; } return map; }; /** * [Please add a description.] */ File.prototype.getModuleFormatter = function getModuleFormatter(type) { if (_lodashLangIsFunction2["default"](type) || !_modules2["default"][type]) { this.log.deprecate("Custom module formatters are deprecated and will be removed in the next major. Please use Babel plugins instead."); } var ModuleFormatter = _lodashLangIsFunction2["default"](type) ? type : _modules2["default"][type]; if (!ModuleFormatter) { var loc = _tryResolve2["default"].relative(type); if (loc) ModuleFormatter = require(loc); } if (!ModuleFormatter) { throw new ReferenceError("Unknown module formatter type " + JSON.stringify(type)); } return new ModuleFormatter(this); }; /** * [Please add a description.] */ File.prototype.parse = function parse(code) { var opts = this.opts; // var parseOpts = { highlightCode: opts.highlightCode, nonStandard: opts.nonStandard, sourceType: opts.sourceType, filename: opts.filename, plugins: {} }; var features = parseOpts.features = {}; for (var key in this.transformers) { var transformer = this.transformers[key]; features[key] = transformer.canTransform(); } parseOpts.looseModules = this.isLoose("es6.modules"); parseOpts.strictMode = features.strict; this.log.debug("Parse start"); var ast = _helpersParse2["default"](code, parseOpts); this.log.debug("Parse stop"); return ast; }; /** * [Please add a description.] */ File.prototype._addAst = function _addAst(ast) { this.path = _traversalPath2["default"].get({ hub: this.hub, parentPath: null, parent: ast, container: ast, key: "program" }).setContext(); this.scope = this.path.scope; this.ast = ast; }; /** * [Please add a description.] */ File.prototype.addAst = function addAst(ast) { this.log.debug("Start set AST"); this._addAst(ast); this.log.debug("End set AST"); this.log.debug("Start module formatter init"); var modFormatter = this.moduleFormatter = this.getModuleFormatter(this.opts.modules); if (modFormatter.init && this.transformers["es6.modules"].canTransform()) { modFormatter.init(); } this.log.debug("End module formatter init"); }; /** * [Please add a description.] */ File.prototype.transform = function transform() { this.call("pre"); var _arr6 = this.transformerStack; for (var _i6 = 0; _i6 < _arr6.length; _i6++) { var pass = _arr6[_i6]; pass.transform(); } this.call("post"); return this.generate(); }; /** * [Please add a description.] */ File.prototype.wrap = function wrap(code, callback) { code = code + ""; try { if (this.shouldIgnore()) { return this.makeResult({ code: code, ignored: true }); } else { return callback(); } } catch (err) { if (err._babel) { throw err; } else { err._babel = true; } var message = err.message = this.opts.filename + ": " + err.message; var loc = err.loc; if (loc) { err.codeFrame = _helpersCodeFrame2["default"](code, loc.line, loc.column + 1, this.opts); message += "\n" + err.codeFrame; } if (process.browser) { // chrome has it's own pretty stringifier which doesn't use the stack property // https://github.com/babel/babel/issues/2175 err.message = message; } if (err.stack) { var newStack = err.stack.replace(err.message, message); try { err.stack = newStack; } catch (e) { // `err.stack` may be a readonly property in some environments } } throw err; } }; /** * [Please add a description.] */ File.prototype.addCode = function addCode(code) { code = (code || "") + ""; code = this.parseInputSourceMap(code); this.code = code; }; /** * [Please add a description.] */ File.prototype.parseCode = function parseCode() { this.parseShebang(); var ast = this.parse(this.code); this.addAst(ast); }; /** * [Please add a description.] */ File.prototype.shouldIgnore = function shouldIgnore() { var opts = this.opts; return util.shouldIgnore(opts.filename, opts.ignore, opts.only); }; /** * [Please add a description.] */ File.prototype.call = function call(key) { var _arr7 = this.uncollapsedTransformerStack; for (var _i7 = 0; _i7 < _arr7.length; _i7++) { var pass = _arr7[_i7]; var fn = pass.plugin[key]; if (fn) fn(this); } }; /** * [Please add a description.] */ File.prototype.parseInputSourceMap = function parseInputSourceMap(code) { var opts = this.opts; if (opts.inputSourceMap !== false) { var inputMap = _convertSourceMap2["default"].fromSource(code); if (inputMap) { opts.inputSourceMap = inputMap.toObject(); code = _convertSourceMap2["default"].removeComments(code); } } return code; }; /** * [Please add a description.] */ File.prototype.parseShebang = function parseShebang() { var shebangMatch = _shebangRegex2["default"].exec(this.code); if (shebangMatch) { this.shebang = shebangMatch[0]; this.code = this.code.replace(_shebangRegex2["default"], ""); } }; /** * [Please add a description.] */ File.prototype.makeResult = function makeResult(_ref) { var code = _ref.code; var _ref$map = _ref.map; var map = _ref$map === undefined ? null : _ref$map; var ast = _ref.ast; var ignored = _ref.ignored; var result = { metadata: null, ignored: !!ignored, code: null, ast: null, map: map }; if (this.opts.code) { result.code = code; } if (this.opts.ast) { result.ast = ast; } if (this.opts.metadata) { result.metadata = this.metadata; result.metadata.usedHelpers = Object.keys(this.usedHelpers); } return result; }; /** * [Please add a description.] */ File.prototype.generate = function generate() { var opts = this.opts; var ast = this.ast; var result = { ast: ast }; if (!opts.code) return this.makeResult(result); this.log.debug("Generation start"); var _result = _generation2["default"](ast, opts, this.code); result.code = _result.code; result.map = _result.map; this.log.debug("Generation end"); if (this.shebang) { // add back shebang result.code = this.shebang + "\n" + result.code; } if (result.map) { result.map = this.mergeSourceMap(result.map); } if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") { result.code += "\n" + _convertSourceMap2["default"].fromObject(result.map).toComment(); } if (opts.sourceMaps === "inline") { result.map = null; } return this.makeResult(result); }; _createClass(File, null, [{ key: "helpers", /** * [Please add a description.] */ value: ["inherits", "defaults", "create-class", "create-decorated-class", "create-decorated-object", "define-decorated-property-descriptor", "tagged-template-literal", "tagged-template-literal-loose", "to-array", "to-consumable-array", "sliced-to-array", "sliced-to-array-loose", "object-without-properties", "has-own", "slice", "bind", "define-property", "async-to-generator", "interop-export-wildcard", "interop-require-wildcard", "interop-require-default", "typeof", "extends", "get", "set", "new-arrow-check", "class-call-check", "object-destructuring-empty", "temporal-undefined", "temporal-assert-defined", "self-global", "typeof-react-element", "default-props", "instanceof", // legacy "interop-require"], /** * [Please add a description.] */ enumerable: true }, { key: "soloHelpers", value: [], enumerable: true }]); return File; })(); exports["default"] = File; module.exports = exports["default"]; //# sourceMappingURL=index-compiled.js.map
patelsan/fetchpipe
node_modules/babel-core/lib/transformation/file/index-compiled.js
JavaScript
mit
22,758
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let SyncDisabled = props => <SvgIcon {...props}> <path d="M10 6.35V4.26c-.8.21-1.55.54-2.23.96l1.46 1.46c.25-.12.5-.24.77-.33zm-7.14-.94l2.36 2.36C4.45 8.99 4 10.44 4 12c0 2.21.91 4.2 2.36 5.64L4 20h6v-6l-2.24 2.24C6.68 15.15 6 13.66 6 12c0-1 .25-1.94.68-2.77l8.08 8.08c-.25.13-.5.25-.77.34v2.09c.8-.21 1.55-.54 2.23-.96l2.36 2.36 1.27-1.27L4.14 4.14 2.86 5.41zM20 4h-6v6l2.24-2.24C17.32 8.85 18 10.34 18 12c0 1-.25 1.94-.68 2.77l1.46 1.46C19.55 15.01 20 13.56 20 12c0-2.21-.91-4.2-2.36-5.64L20 4z" /> </SvgIcon>; SyncDisabled = pure(SyncDisabled); SyncDisabled.muiName = 'SvgIcon'; export default SyncDisabled;
AndriusBil/material-ui
packages/material-ui-icons/src/SyncDisabled.js
JavaScript
mit
728
// Generated by CoffeeScript 1.6.3 (function() { var Stl, stl_parser; stl_parser = require('../parser/stl_parser'); Stl = (function() { function Stl() {} return Stl; })(); Stl.PovRay = (function() { function PovRay() {} PovRay.prototype._povHeaders = function(name) { return "#declare " + name + " = mesh {\n"; }; PovRay.prototype._povFooters = function() { return "}"; }; PovRay.prototype.convertFile = function(filePath, callback, progressCb) { var output, _this = this; output = ""; return stl_parser.parseFile(filePath, function(err, polygons, name) { var unique_name; if (err != null) { callback(err); return; } unique_name = '__' + name + '__'; output += _this._povFooters(); return callback(null, output, unique_name); }, function(err, polygon, name) { var povPolygon, unique_name; unique_name = '__' + name + '__'; if (output.length === 0) { output += _this._povHeaders(unique_name); } povPolygon = _this.convertPolygon(polygon); output += povPolygon; if (progressCb != null) { return progressCb(err, povPolygon, unique_name); } }); }; PovRay.prototype.convertPolygon = function(polygon) { var idx, output, vertex, _i, _len, _ref; output = ""; output += " triangle {\n"; _ref = polygon.verticies; for (idx = _i = 0, _len = _ref.length; _i < _len; idx = ++_i) { vertex = _ref[idx]; output += " <" + vertex[0] + ", " + (-vertex[1]) + ", " + vertex[2] + ">"; if (idx !== (polygon.verticies.length - 1)) { output += ",\n"; } } output += " }\n"; return output; }; return PovRay; })(); module.exports = new Stl.PovRay(); }).call(this);
cubehero/stljs
lib/to/povray.js
JavaScript
mit
1,910
ace.define("ace/snippets/apache_conf",["require","exports","module"], function(require, exports, module) { "use strict"; exports.snippetText = ""; exports.scope = "apache_conf"; }); (function() { ace.require(["ace/snippets/apache_conf"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; } }); })();
NPellet/jsGraph
web/site/js/ace-builds/src-noconflict/snippets/apache_conf.js
JavaScript
mit
519
// @flow var React = require('react') var {assign} = require('lodash') import {Source, emptySource} from './model/source' import {displayIf, Colors} from './style' // but get the images at 2x resolution so they can be retina yo // or just get the photos at that ratio // 200x320 x2 // 150x240 // 100x160 // Blank Image - http://i.imgur.com/bMwt85W.jpg type Size = { Width: number; Height: number; } export var CoverSize = { Width: 150, Height: 240, Ratio: 1.6 } export var CoverThumb = { Width: 50, Height: 80, } export function coverStyle(url:string, size:Size = CoverSize):Object { // otherwise it forgets about the cover. Wait until the image is ready if (!url) { return {} } return { background: 'url('+url+') no-repeat center center', backgroundSize: 'cover', width: size.Width, height: size.Height } } export class CoverOverlay extends React.Component { render():React.Element { var style = assign( displayIf(this.props.show !== false), OverlayStyle, CoverTextStyle, this.props.style ) return <div style={style}> {this.props.children} </div> } } export class Cover extends React.Component { props: { src: string; size?: Size; children: Array<React.Element>; }; render():React.Element { var size = this.props.size || CoverSize return <div style={assign(coverStyle(this.props.src, size), {position: 'relative'})}> {this.props.children} </div> } } export class SourceCover extends React.Component { render():React.Element { var source:Source = this.props.source || emptySource() var showTitle:bool = source.imageMissingTitle return <Cover src={source.imageUrl}> <CoverOverlay show={showTitle}>{source.name}</CoverOverlay> </Cover> } } // I could specify it in terms of percentages instead? // that's a good idea. // so do I want 2 or 3 across? // definitely 3 :) export var OverlayStyle = { padding: 10, color: Colors.light, textAlign: 'center', position: 'absolute', bottom: 0, fontSize: 18, backgroundColor: 'rgba(0, 0, 0, 0.5)', width: CoverSize.Width } export var CoverTextStyle = { fontSize: 18, }
seanhess/serials
web/app/cover.js
JavaScript
mit
2,205
define([ 'jquery', 'underscore', 'backbone', 'views/AdminView', 'authentication', 'models/Beach' ], function ( $, _, Backbone, AdminView, Authentication, BeachModel) { var AdminRouter = Backbone.Router.extend({ routes: { 'admin' : 'index' }, index: function () { Authentication.authorize(function () { $('#content').html("<p style='display: block; font-size: 15%; text-align: center; line-height: 100vh; margin: 0;'>LOADING</p>"); beaches = new BeachModel.Collection(); beaches.fetch( { success: function( collection, response, options) { var adminView = new AdminView({ collection: collection }); $('#content').html(adminView.el); }, failure: function( collection, response, options) { $('#content').html("An error has occured."); } }); }, true); }, }); return AdminRouter; });
alex-driedger/Nurdles
clients/web/js/routers/AdminRouter.js
JavaScript
mit
1,209
const labels = { collectionFilterLabels: { edit: { name: 'Event name', event_type: 'Type of event', address_country: 'Country', uk_region: 'UK Region', organiser: 'Organiser', start_date_after: 'From', start_date_before: 'To', }, }, } module.exports = labels
uktrade/data-hub-fe-beta2
src/apps/events/labels.js
JavaScript
mit
314
(function ($) { var smileys = [ ":(", ":)", ":O", ":D", ":p", ":*", ":-)", ":-(", ":-O", ":-D" ], extras = { "<3": true, "&lt;3": true }, smileParts = { "O": "middle-mouth", "D": "middle-mouth", "d": "middle-mouth", "p": "low-mouth", "*": "high-mouth", "-": "nose" }, oppositeSmileParts = { "p": "d", ")": "(", "(": ")" }, reverseSmileys = []; for (var i = 0; i < smileys.length; i++) { var reverse = ""; for (var j = smileys[i].length - 1; j >= 0; j--) { var character = smileys[i][j]; if (character in oppositeSmileParts) { reverse += oppositeSmileParts[smileys[i][j]]; } else { reverse += smileys[i][j]; } } reverseSmileys.push(reverse); } function toggleSmiley() { $(this).toggleClass("active"); } function prepareSmileys(html) { for (var extra in extras) { html = checkForSmiley(html, extra, extras[extra]); } for (var i = smileys.length - 1; i >= 0; i--) { html = checkForSmiley(html, smileys[i], false); } for (var i = reverseSmileys.length - 1; i >= 0; i--) { html = checkForSmiley(html, reverseSmileys[i], true); } return html; } function checkForSmiley(html, smiley, isReverse) { var index = html.indexOf(smiley), replace = null; while (index >= 0) { if (replace === null) { replace = prepareSmiley(smiley, isReverse); } html = replaceString(html, replace, index, index + smiley.length); index = html.indexOf(smiley, index + replace.length); } return html; } function prepareSmiley(smiley, isReverse) { var html = '<span class="smiley-wrapper"><span class="smiley' + (isReverse ? ' smiley-reverse' : '') + '">'; for (var i = 0; i < smiley.length; i++) { if (smiley[i] in smileParts) { html += '<span class="' + smileParts[smiley[i]] + '">' + smiley[i] + '</span>'; } else { html += smiley[i]; } }; html += '</span></span>'; return html; } function replaceString(string, replace, from, to) { return string.substring(0, from) + replace + string.substring(to); } function fixSmiles($el) { var smiles = prepareSmileys($el.html()); $el.html(smiles); } $(document).on("click", ".smiley", toggleSmiley); $.fn.smilify = function() { var $els = $(this).each(function () { fixSmiles($(this)); }); setTimeout(function () { $els.find(".smiley").each(toggleSmiley); }, 20); return this; }; }(jQuery));
daltonrowe/daltonrowe.github.io
smileys/js/smileys.js
JavaScript
mit
2,469
/* * jQuery UI 1.7.2 * * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://docs.jquery.com/UI */ (function($) { var _remove = $.fn.remove, isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9); //Helper functions and ui object $.ui = { version: "1.7.2", // $.ui.plugin is deprecated. Use the proxy pattern instead. plugin: { add: function(module, option, set) { var proto = $.ui[module].prototype; for(var i in set) { proto.plugins[i] = proto.plugins[i] || []; proto.plugins[i].push([option, set[i]]); } }, call: function(instance, name, args) { var set = instance.plugins[name]; if(!set || !instance.element[0].parentNode) { return; } for (var i = 0; i < set.length; i++) { if (instance.options[set[i][0]]) { set[i][1].apply(instance.element, args); } } } }, contains: function(a, b) { return document.compareDocumentPosition ? a.compareDocumentPosition(b) & 16 : a !== b && a.contains(b); }, hasScroll: function(el, a) { //If overflow is hidden, the element might have extra content, but the user wants to hide it if ($(el).css('overflow') == 'hidden') { return false; } var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', has = false; if (el[scroll] > 0) { return true; } // TODO: determine which cases actually cause this to happen // if the element doesn't have the scroll set, see if it's possible to // set the scroll el[scroll] = 1; has = (el[scroll] > 0); el[scroll] = 0; return has; }, isOverAxis: function(x, reference, size) { //Determines when x coordinate is over "b" element axis return (x > reference) && (x < (reference + size)); }, isOver: function(y, x, top, left, height, width) { //Determines when x, y coordinates is over "b" element return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width); }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38 } }; // WAI-ARIA normalization if (isFF2) { var attr = $.attr, removeAttr = $.fn.removeAttr, ariaNS = "http://www.w3.org/2005/07/aaa", ariaState = /^aria-/, ariaRole = /^wairole:/; $.attr = function(elem, name, value) { var set = value !== undefined; return (name == 'role' ? (set ? attr.call(this, elem, name, "wairole:" + value) : (attr.apply(this, arguments) || "").replace(ariaRole, "")) : (ariaState.test(name) ? (set ? elem.setAttributeNS(ariaNS, name.replace(ariaState, "aaa:"), value) : attr.call(this, elem, name.replace(ariaState, "aaa:"))) : attr.apply(this, arguments))); }; $.fn.removeAttr = function(name) { return (ariaState.test(name) ? this.each(function() { this.removeAttributeNS(ariaNS, name.replace(ariaState, "")); }) : removeAttr.call(this, name)); }; } //jQuery plugins $.fn.extend({ remove: function() { // Safari has a native remove event which actually removes DOM elements, // so we have to use triggerHandler instead of trigger (#3037). $("*", this).add(this).each(function() { $(this).triggerHandler("remove"); }); return _remove.apply(this, arguments ); }, enableSelection: function() { return this .attr('unselectable', 'off') .css('MozUserSelect', '') .unbind('selectstart.ui'); }, disableSelection: function() { return this .attr('unselectable', 'on') .css('MozUserSelect', 'none') .bind('selectstart.ui', function() { return false; }); }, scrollParent: function() { var scrollParent; if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { scrollParent = this.parents().filter(function() { return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); }).eq(0); } else { scrollParent = this.parents().filter(function() { return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); }).eq(0); } return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; } }); //Additional selectors $.extend($.expr[':'], { data: function(elem, i, match) { return !!$.data(elem, match[3]); }, focusable: function(element) { var nodeName = element.nodeName.toLowerCase(), tabIndex = $.attr(element, 'tabindex'); return (/input|select|textarea|button|object/.test(nodeName) ? !element.disabled : 'a' == nodeName || 'area' == nodeName ? element.href || !isNaN(tabIndex) : !isNaN(tabIndex)) // the element and all of its ancestors must be visible // the browser may report that the area is hidden && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length; }, tabbable: function(element) { var tabIndex = $.attr(element, 'tabindex'); return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable'); } }); // $.widget is a factory to create jQuery plugins // taking some boilerplate code out of the plugin code function getter(namespace, plugin, method, args) { function getMethods(type) { var methods = $[namespace][plugin][type] || []; return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods); } var methods = getMethods('getter'); if (args.length == 1 && typeof args[0] == 'string') { methods = methods.concat(getMethods('getterSetter')); } return ($.inArray(method, methods) != -1); } $.widget = function(name, prototype) { var namespace = name.split(".")[0]; name = name.split(".")[1]; // create plugin method $.fn[name] = function(options) { var isMethodCall = (typeof options == 'string'), args = Array.prototype.slice.call(arguments, 1); // prevent calls to internal methods if (isMethodCall && options.substring(0, 1) == '_') { return this; } // handle getter methods if (isMethodCall && getter(namespace, name, options, args)) { var instance = $.data(this[0], name); return (instance ? instance[options].apply(instance, args) : undefined); } // handle initialization and non-getter methods return this.each(function() { var instance = $.data(this, name); // constructor (!instance && !isMethodCall && $.data(this, name, new $[namespace][name](this, options))._init()); // method call (instance && isMethodCall && $.isFunction(instance[options]) && instance[options].apply(instance, args)); }); }; // create widget constructor $[namespace] = $[namespace] || {}; $[namespace][name] = function(element, options) { var self = this; this.namespace = namespace; this.widgetName = name; this.widgetEventPrefix = $[namespace][name].eventPrefix || name; this.widgetBaseClass = namespace + '-' + name; this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, $.metadata && $.metadata.get(element)[name], options); this.element = $(element) .bind('setData.' + name, function(event, key, value) { if (event.target == element) { return self._setData(key, value); } }) .bind('getData.' + name, function(event, key) { if (event.target == element) { return self._getData(key); } }) .bind('remove', function() { return self.destroy(); }); }; // add widget prototype $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); // TODO: merge getter and getterSetter properties from widget prototype // and plugin prototype $[namespace][name].getterSetter = 'option'; }; $.widget.prototype = { _init: function() {}, destroy: function() { this.element.removeData(this.widgetName) .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled') .removeAttr('aria-disabled'); }, option: function(key, value) { var options = key, self = this; if (typeof key == "string") { if (value === undefined) { return this._getData(key); } options = {}; options[key] = value; } $.each(options, function(key, value) { self._setData(key, value); }); }, _getData: function(key) { return this.options[key]; }, _setData: function(key, value) { this.options[key] = value; if (key == 'disabled') { this.element [value ? 'addClass' : 'removeClass']( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled') .attr("aria-disabled", value); } }, enable: function() { this._setData('disabled', false); }, disable: function() { this._setData('disabled', true); }, _trigger: function(type, event, data) { var callback = this.options[type], eventName = (type == this.widgetEventPrefix ? type : this.widgetEventPrefix + type); event = $.Event(event); event.type = eventName; // copy original event properties over to the new event // this would happen if we could call $.event.fix instead of $.Event // but we don't have a way to force an event to be fixed multiple times if (event.originalEvent) { for (var i = $.event.props.length, prop; i;) { prop = $.event.props[--i]; event[prop] = event.originalEvent[prop]; } } this.element.trigger(event, data); return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false || event.isDefaultPrevented()); } }; $.widget.defaults = { disabled: false }; /** Mouse Interaction Plugin **/ $.ui.mouse = { _mouseInit: function() { var self = this; this.element .bind('mousedown.'+this.widgetName, function(event) { return self._mouseDown(event); }) .bind('click.'+this.widgetName, function(event) { if(self._preventClickEvent) { self._preventClickEvent = false; event.stopImmediatePropagation(); return false; } }); // Prevent text selection in IE if ($.browser.msie) { this._mouseUnselectable = this.element.attr('unselectable'); this.element.attr('unselectable', 'on'); } this.started = false; }, // TODO: make sure destroying one instance of mouse doesn't mess with // other instances of mouse _mouseDestroy: function() { this.element.unbind('.'+this.widgetName); // Restore text selection in IE ($.browser.msie && this.element.attr('unselectable', this._mouseUnselectable)); }, _mouseDown: function(event) { // don't let more than one widget handle mouseStart // TODO: figure out why we have to use originalEvent event.originalEvent = event.originalEvent || {}; if (event.originalEvent.mouseHandled) { return; } // we may have missed mouseup (out of window) (this._mouseStarted && this._mouseUp(event)); this._mouseDownEvent = event; var self = this, btnIsLeft = (event.which == 1), elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false); if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { return true; } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { self.mouseDelayMet = true; }, this.options.delay); } if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { this._mouseStarted = (this._mouseStart(event) !== false); if (!this._mouseStarted) { event.preventDefault(); return true; } } // these delegates are required to keep context this._mouseMoveDelegate = function(event) { return self._mouseMove(event); }; this._mouseUpDelegate = function(event) { return self._mouseUp(event); }; $(document) .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); // preventDefault() is used to prevent the selection of text here - // however, in Safari, this causes select boxes not to be selectable // anymore, so this fix is needed ($.browser.safari || event.preventDefault()); event.originalEvent.mouseHandled = true; return true; }, _mouseMove: function(event) { // IE mouseup check - mouseup happened when mouse was out of window if ($.browser.msie && !event.button) { return this._mouseUp(event); } if (this._mouseStarted) { this._mouseDrag(event); return event.preventDefault(); } if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, event) !== false); (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); } return !this._mouseStarted; }, _mouseUp: function(event) { $(document) .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = (event.target == this._mouseDownEvent.target); this._mouseStop(event); } return false; }, _mouseDistanceMet: function(event) { return (Math.max( Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY) ) >= this.options.distance ); }, _mouseDelayMet: function(event) { return this.mouseDelayMet; }, // These are placeholder methods, to be overriden by extending plugin _mouseStart: function(event) {}, _mouseDrag: function(event) {}, _mouseStop: function(event) {}, _mouseCapture: function(event) { return true; } }; $.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0 }; })(jQuery); /* * jQuery UI Tabs 1.7.2 * * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://docs.jquery.com/UI/Tabs * * Depends: * ui.core.js */ (function($) { $.widget("ui.tabs", { _init: function() { if (this.options.deselectable !== undefined) { this.options.collapsible = this.options.deselectable; } this._tabify(true); }, _setData: function(key, value) { if (key == 'selected') { if (this.options.collapsible && value == this.options.selected) { return; } this.select(value); } else { this.options[key] = value; if (key == 'deselectable') { this.options.collapsible = value; } this._tabify(); } }, _tabId: function(a) { return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') || this.options.idPrefix + $.data(a); }, _sanitizeSelector: function(hash) { return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":" }, _cookie: function() { var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + $.data(this.list[0])); return $.cookie.apply(null, [cookie].concat($.makeArray(arguments))); }, _ui: function(tab, panel) { return { tab: tab, panel: panel, index: this.anchors.index(tab) }; }, _cleanup: function() { // restore all former loading tabs labels this.lis.filter('.ui-state-processing').removeClass('ui-state-processing') .find('span:data(label.tabs)') .each(function() { var el = $(this); el.html(el.data('label.tabs')).removeData('label.tabs'); }); }, _tabify: function(init) { this.list = this.element.children('ul:first'); this.lis = $('li:has(a[href])', this.list); this.anchors = this.lis.map(function() { return $('a', this)[0]; }); this.panels = $([]); var self = this, o = this.options; var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash this.anchors.each(function(i, a) { var href = $(a).attr('href'); // For dynamically created HTML that contains a hash as href IE < 8 expands // such href to the full page url with hash and then misinterprets tab as ajax. // Same consideration applies for an added tab with a fragment identifier // since a[href=#fragment-identifier] does unexpectedly not match. // Thus normalize href attribute... var hrefBase = href.split('#')[0], baseEl; if (hrefBase && (hrefBase === location.toString().split('#')[0] || (baseEl = $('base')[0]) && hrefBase === baseEl.href)) { href = a.hash; a.href = href; } // inline tab if (fragmentId.test(href)) { self.panels = self.panels.add(self._sanitizeSelector(href)); } // remote tab else if (href != '#') { // prevent loading the page itself if href is just "#" $.data(a, 'href.tabs', href); // required for restore on destroy // TODO until #3808 is fixed strip fragment identifier from url // (IE fails to load from such url) $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data var id = self._tabId(a); a.href = '#' + id; var $panel = $('#' + id); if (!$panel.length) { $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom') .insertAfter(self.panels[i - 1] || self.list); $panel.data('destroy.tabs', true); } self.panels = self.panels.add($panel); } // invalid tab href else { o.disabled.push(i); } }); // initialization from scratch if (init) { // attach necessary classes for styling this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all'); this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); this.lis.addClass('ui-state-default ui-corner-top'); this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom'); // Selected tab // use "selected" option or try to retrieve: // 1. from fragment identifier in url // 2. from cookie // 3. from selected class attribute on <li> if (o.selected === undefined) { if (location.hash) { this.anchors.each(function(i, a) { if (a.hash == location.hash) { o.selected = i; return false; // break } }); } if (typeof o.selected != 'number' && o.cookie) { o.selected = parseInt(self._cookie(), 10); } if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) { o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); } o.selected = o.selected || 0; } else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release o.selected = -1; } // sanity check - default to first tab... o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0; // Take disabling tabs via class attribute from HTML // into account and update option properly. // A selected tab cannot become disabled. o.disabled = $.unique(o.disabled.concat( $.map(this.lis.filter('.ui-state-disabled'), function(n, i) { return self.lis.index(n); } ) )).sort(); if ($.inArray(o.selected, o.disabled) != -1) { o.disabled.splice($.inArray(o.selected, o.disabled), 1); } // highlight selected tab this.panels.addClass('ui-tabs-hide'); this.lis.removeClass('ui-tabs-selected ui-state-active'); if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list this.panels.eq(o.selected).removeClass('ui-tabs-hide'); this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active'); // seems to be expected behavior that the show callback is fired self.element.queue("tabs", function() { self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected])); }); this.load(o.selected); } // clean up to avoid memory leaks in certain versions of IE 6 $(window).bind('unload', function() { self.lis.add(self.anchors).unbind('.tabs'); self.lis = self.anchors = self.panels = null; }); } // update selected after add/remove else { o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); } // update collapsible this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible'); // set or update cookie after init and add/remove respectively if (o.cookie) { this._cookie(o.selected, o.cookie); } // disable tabs for (var i = 0, li; (li = this.lis[i]); i++) { $(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled'); } // reset cache if switching from cached to not cached if (o.cache === false) { this.anchors.removeData('cache.tabs'); } // remove all handlers before, tabify may run on existing tabs after add or option change this.lis.add(this.anchors).unbind('.tabs'); if (o.event != 'mouseover') { var addState = function(state, el) { if (el.is(':not(.ui-state-disabled)')) { el.addClass('ui-state-' + state); } }; var removeState = function(state, el) { el.removeClass('ui-state-' + state); }; this.lis.bind('mouseover.tabs', function() { addState('hover', $(this)); }); this.lis.bind('mouseout.tabs', function() { removeState('hover', $(this)); }); this.anchors.bind('focus.tabs', function() { addState('focus', $(this).closest('li')); }); this.anchors.bind('blur.tabs', function() { removeState('focus', $(this).closest('li')); }); } // set up animations var hideFx, showFx; if (o.fx) { if ($.isArray(o.fx)) { hideFx = o.fx[0]; showFx = o.fx[1]; } else { hideFx = showFx = o.fx; } } // Reset certain styles left over from animation // and prevent IE's ClearType bug... function resetStyle($el, fx) { $el.css({ display: '' }); if ($.browser.msie && fx.opacity) { $el[0].style.removeAttribute('filter'); } } // Show a tab... var showTab = showFx ? function(clicked, $show) { $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active'); $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way .animate(showFx, showFx.duration || 'normal', function() { resetStyle($show, showFx); self._trigger('show', null, self._ui(clicked, $show[0])); }); } : function(clicked, $show) { $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active'); $show.removeClass('ui-tabs-hide'); self._trigger('show', null, self._ui(clicked, $show[0])); }; // Hide a tab, $show is optional... var hideTab = hideFx ? function(clicked, $hide) { $hide.animate(hideFx, hideFx.duration || 'normal', function() { self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default'); $hide.addClass('ui-tabs-hide'); resetStyle($hide, hideFx); self.element.dequeue("tabs"); }); } : function(clicked, $hide, $show) { self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default'); $hide.addClass('ui-tabs-hide'); self.element.dequeue("tabs"); }; // attach tab event handler, unbind to avoid duplicates from former tabifying... this.anchors.bind(o.event + '.tabs', function() { var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'), $show = $(self._sanitizeSelector(this.hash)); // If tab is already selected and not collapsible or tab disabled or // or is already loading or click callback returns false stop here. // Check if click handler returns false last so that it is not executed // for a disabled or loading tab! if (($li.hasClass('ui-tabs-selected') && !o.collapsible) || $li.hasClass('ui-state-disabled') || $li.hasClass('ui-state-processing') || self._trigger('select', null, self._ui(this, $show[0])) === false) { this.blur(); return false; } o.selected = self.anchors.index(this); self.abort(); // if tab may be closed if (o.collapsible) { if ($li.hasClass('ui-tabs-selected')) { o.selected = -1; if (o.cookie) { self._cookie(o.selected, o.cookie); } self.element.queue("tabs", function() { hideTab(el, $hide); }).dequeue("tabs"); this.blur(); return false; } else if (!$hide.length) { if (o.cookie) { self._cookie(o.selected, o.cookie); } self.element.queue("tabs", function() { showTab(el, $show); }); self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 this.blur(); return false; } } if (o.cookie) { self._cookie(o.selected, o.cookie); } // show new tab if ($show.length) { if ($hide.length) { self.element.queue("tabs", function() { hideTab(el, $hide); }); } self.element.queue("tabs", function() { showTab(el, $show); }); self.load(self.anchors.index(this)); } else { throw 'jQuery UI Tabs: Mismatching fragment identifier.'; } // Prevent IE from keeping other link focussed when using the back button // and remove dotted border from clicked link. This is controlled via CSS // in modern browsers; blur() removes focus from address bar in Firefox // which can become a usability and annoying problem with tabs('rotate'). if ($.browser.msie) { this.blur(); } }); // disable click in any case this.anchors.bind('click.tabs', function(){return false;}); }, destroy: function() { var o = this.options; this.abort(); this.element.unbind('.tabs') .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible') .removeData('tabs'); this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); this.anchors.each(function() { var href = $.data(this, 'href.tabs'); if (href) { this.href = href; } var $this = $(this).unbind('.tabs'); $.each(['href', 'load', 'cache'], function(i, prefix) { $this.removeData(prefix + '.tabs'); }); }); this.lis.unbind('.tabs').add(this.panels).each(function() { if ($.data(this, 'destroy.tabs')) { $(this).remove(); } else { $(this).removeClass([ 'ui-state-default', 'ui-corner-top', 'ui-tabs-selected', 'ui-state-active', 'ui-state-hover', 'ui-state-focus', 'ui-state-disabled', 'ui-tabs-panel', 'ui-widget-content', 'ui-corner-bottom', 'ui-tabs-hide' ].join(' ')); } }); if (o.cookie) { this._cookie(null, o.cookie); } }, add: function(url, label, index) { if (index === undefined) { index = this.anchors.length; // append by default } var self = this, o = this.options, $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)), id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]); $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true); // try to find an existing element before creating a new one var $panel = $('#' + id); if (!$panel.length) { $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true); } $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide'); if (index >= this.lis.length) { $li.appendTo(this.list); $panel.appendTo(this.list[0].parentNode); } else { $li.insertBefore(this.lis[index]); $panel.insertBefore(this.panels[index]); } o.disabled = $.map(o.disabled, function(n, i) { return n >= index ? ++n : n; }); this._tabify(); if (this.anchors.length == 1) { // after tabify $li.addClass('ui-tabs-selected ui-state-active'); $panel.removeClass('ui-tabs-hide'); this.element.queue("tabs", function() { self._trigger('show', null, self._ui(self.anchors[0], self.panels[0])); }); this.load(0); } // callback this._trigger('add', null, this._ui(this.anchors[index], this.panels[index])); }, remove: function(index) { var o = this.options, $li = this.lis.eq(index).remove(), $panel = this.panels.eq(index).remove(); // If selected tab was removed focus tab to the right or // in case the last tab was removed the tab to the left. if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) { this.select(index + (index + 1 < this.anchors.length ? 1 : -1)); } o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }), function(n, i) { return n >= index ? --n : n; }); this._tabify(); // callback this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0])); }, enable: function(index) { var o = this.options; if ($.inArray(index, o.disabled) == -1) { return; } this.lis.eq(index).removeClass('ui-state-disabled'); o.disabled = $.grep(o.disabled, function(n, i) { return n != index; }); // callback this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index])); }, disable: function(index) { var self = this, o = this.options; if (index != o.selected) { // cannot disable already selected tab this.lis.eq(index).addClass('ui-state-disabled'); o.disabled.push(index); o.disabled.sort(); // callback this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index])); } }, select: function(index) { if (typeof index == 'string') { index = this.anchors.index(this.anchors.filter('[href$=' + index + ']')); } else if (index === null) { // usage of null is deprecated, TODO remove in next release index = -1; } if (index == -1 && this.options.collapsible) { index = this.options.selected; } this.anchors.eq(index).trigger(this.options.event + '.tabs'); }, load: function(index) { var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs'); this.abort(); // not remote or from cache if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) { this.element.dequeue("tabs"); return; } // load remote from here on this.lis.eq(index).addClass('ui-state-processing'); if (o.spinner) { var span = $('span', a); span.data('label.tabs', span.html()).html(o.spinner); } this.xhr = $.ajax($.extend({}, o.ajaxOptions, { url: url, success: function(r, s) { $(self._sanitizeSelector(a.hash)).html(r); // take care of tab labels self._cleanup(); if (o.cache) { $.data(a, 'cache.tabs', true); // if loaded once do not load them again } // callbacks self._trigger('load', null, self._ui(self.anchors[index], self.panels[index])); try { o.ajaxOptions.success(r, s); } catch (e) {} // last, so that load event is fired before show... self.element.dequeue("tabs"); } })); }, abort: function() { // stop possibly running animations this.element.queue([]); this.panels.stop(false, true); // terminate pending requests from other tabs if (this.xhr) { this.xhr.abort(); delete this.xhr; } // take care of tab labels this._cleanup(); }, url: function(index, url) { this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url); }, length: function() { return this.anchors.length; } }); $.extend($.ui.tabs, { version: '1.7.2', getter: 'length', defaults: { ajaxOptions: null, cache: false, cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } collapsible: false, disabled: [], event: 'click', fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } idPrefix: 'ui-tabs-', panelTemplate: '<div></div>', spinner: '<em>Loading&#8230;</em>', tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>' } }); /* * Tabs Extensions */ /* * Rotate */ $.extend($.ui.tabs.prototype, { rotation: null, rotate: function(ms, continuing) { var self = this, o = this.options; var rotate = self._rotate || (self._rotate = function(e) { clearTimeout(self.rotation); self.rotation = setTimeout(function() { var t = o.selected; self.select( ++t < self.anchors.length ? t : 0 ); }, ms); if (e) { e.stopPropagation(); } }); var stop = self._unrotate || (self._unrotate = !continuing ? function(e) { if (e.clientX) { // in case of a true click self.rotate(null); } } : function(e) { t = o.selected; rotate(); }); // start rotation if (ms) { this.element.bind('tabsshow', rotate); this.anchors.bind(o.event + '.tabs', stop); rotate(); } // stop rotation else { clearTimeout(self.rotation); this.element.unbind('tabsshow', rotate); this.anchors.unbind(o.event + '.tabs', stop); delete this._rotate; delete this._unrotate; } } }); })(jQuery);
nazar/wasters
public/javascripts/jquery/ui/tabs.js
JavaScript
mit
32,986
//@flow var x = 42; x = "true"; var y = 42; if (x) { y = "hello world"; } (42: string); // should still have some errors!
mroch/flow
tests/constrain_writes_dir/excluded/test.js
JavaScript
mit
127
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let BeachAccess = props => <SvgIcon {...props}> <path d="M13.127 14.56l1.43-1.43 6.44 6.443L19.57 21zm4.293-5.73l2.86-2.86c-3.95-3.95-10.35-3.96-14.3-.02 3.93-1.3 8.31-.25 11.44 2.88zM5.95 5.98c-3.94 3.95-3.93 10.35.02 14.3l2.86-2.86C5.7 14.29 4.65 9.91 5.95 5.98zm.02-.02l-.01.01c-.38 3.01 1.17 6.88 4.3 10.02l5.73-5.73c-3.13-3.13-7.01-4.68-10.02-4.3z" /> </SvgIcon>; BeachAccess = pure(BeachAccess); BeachAccess.muiName = 'SvgIcon'; export default BeachAccess;
AndriusBil/material-ui
packages/material-ui-icons/src/BeachAccess.js
JavaScript
mit
579
/* A proxy for observing object state changes. var obj={person:'Eddie',age:22}; _o.onUpdate(obj,{ age:function(value){ if(value>this.oldValue) console.log('Happy birthday, Peter!') }, person:function(value){ console.log(this.oldValue+' is now '+value); } }); _o(obj).person='Peter'; //> Eddie is now Peter _o(obj).age++; //> Happy birthday, Peter! */ !function(){ 'use strict'; var tl=function(i,ln,ms){ return function(ms,f){ i++; if(f()) ln='info',ms='Test '+i+' passed: '+ms; else ln='error',ms='Test '+i+' failed: '+ms; console[ln](ms)}}(0); var cl=function(){ console.log.apply(console,arguments)}; var observingProxy=function(targetStack,proxyStack,changeStack,handlerStack,timeoutStack){ function getDeepPropertyDescriptors(o) { var ns; if(o){ ns=getDeepPropertyDescriptors(Object.getPrototypeOf(o))||[]; Array.prototype.push.apply(ns, Object.getOwnPropertyNames(o) .filter(function(k){ return isNaN(parseInt(k))}) .map(function(k){ return {name:k,descriptor:Object.getOwnPropertyDescriptor(o,k)}})); } return ns; } function newProxy(t) { var p={},ns=getDeepPropertyDescriptors(t); for(var i=ns.length;i--;){ delete ns[i].descriptor.value; delete ns[i].descriptor.writable; ns[i].descriptor.get=propertyGetter.bind({target:t,name:ns[i].name}); ns[i].descriptor.set=propertySetter.bind({target:t,name:ns[i].name}); try{ Object.defineProperty(p,ns[i].name,ns[i].descriptor); } catch(e){} } return p; } function notifyObservers(target) { var targetInd=targetIndex(target); if(changeStack[targetInd].length){ for(var l=0;l<handlerStack[targetInd].length;l++) handlerStack[targetInd][l].call({},changeStack[targetInd]); changeStack[targetInd]=[]; } } function propertyGetter() { var r=this.target[this.name]; if(Array.isArray(this.target)&&['pop','push','shift','splice','unshift']. indexOf(this.name)>-1) r=function(){ var res=this.target[this.name].apply(this.target,arguments), targetInd=targetIndex(this.target); changeStack[targetInd].push(({ 'pop':{object:this.target,type:'splice',index:this.target.length-1, removed:[res],addedCount:0}, 'push':{object:this.target,type:'splice',index:this.target.length-1, removed:[],addedCount:1}, 'shift':{object:this.target,type:'splice',index:0,removed:[res], addedCount:0}, 'splice':{object:this.target,type:'splice',index:arguments[0], removed:res,addedCount:Array.prototype.slice.call(arguments,2).length}, 'unshift':{object:this.target,type:'splice',index:0,removed:[], addedCount:1} })[this.name]); clearTimeout(timeoutStack[targetInd]); timeoutStack[targetInd]=setTimeout(function(){ notifyObservers(this.target)}.bind(this)); }.bind(this); return r; } function propertySetter(userVal) { var val=this.target[this.name], targetInd=targetIndex(this.target); if(val!==userVal){ this.target[this.name]=userVal; changeStack[targetInd].push( {name:this.name,object:this.target,type:'update',oldValue:val}); clearTimeout(timeoutStack[targetInd]); timeoutStack[targetInd]=setTimeout(function(){ notifyObservers(this.target)}.bind(this)); } } function targetIndex(t) { var i=targetStack.indexOf(t); if(i===-1&&t){ i=targetStack.push(t)-1; proxyStack.push(newProxy(t)); changeStack.push([]); handlerStack.push([]); timeoutStack.push(0); } return i; } if(this.test_o) tl('getDeepPropertyDescriptors',function(){ return getDeepPropertyDescriptors([1,2,3]).reduce(function(hasPush,item){ return hasPush||item.name==='push'; },false)}); if(this.test_o) tl('Property getter',function(){ var s={p1:1}; return newProxy(s).p1===s.p1}); if(this.test_o) tl('Property setter',function(){ var s={p1:1}; newProxy(s).p1=2; return s.p1===2}); if(this.test_o) tl('Array splice',function(){ var s=[]; newProxy(s).push(1); return s.length===1}); return { addChangeHandler:function(target,changeHandler,callOnInit){ var targetInd=targetIndex(target); handlerStack[targetInd].indexOf(changeHandler)===-1&& handlerStack[targetInd].push(changeHandler); if(callOnInit){ var changes=Array.isArray(target) ?target.map(function(_,index){ return {object:target,type:'splice',index:index,removed:[], addedCount:1}}) :Object.getOwnPropertyNames(target).map(function(key){ return {name:key,object:target,type:'update',oldValue:target[key]} }); changeHandler.call({},changes); } }, getProxy:function(target){ return proxyStack[targetIndex(target)]||target; }, removeChangeHandler:function(target,changeHandler){ var targetInd=targetIndex(target),rmInd; if((rmInd=handlerStack[targetInd].indexOf(changeHandler))>-1) handlerStack[targetInd].splice(rmInd,1); else if(!changeHandler) handlerStack[targetInd]=[]; clearTimeout(timeoutStack[targetInd]); } } }.bind(this)([],[],[],[],[]); function _o(target) { return observingProxy.getProxy(target); } _o.observe=function(target,changeHandler,callOnInit){ if(!target) throw 'Observing proxy error: cannot _o.observe '+target+' object'; return observingProxy.addChangeHandler.apply(observingProxy,arguments); }; _o.unobserve=function(target,changeHandler){ if(!target) throw 'Observing proxy error: cannot _o.unobserve '+target+' object'; return observingProxy.removeChangeHandler.apply(observingProxy,arguments); }; _o.onUpdate=function(target,onChangeCollection,callOnInit){ var onPropertyChange; if(typeof onChangeCollection==='string'){ onChangeCollection={}; onChangeCollection[arguments[1]]=arguments[2]; callOnInit=arguments[3]; } callOnInit=callOnInit===undefined&&true||callOnInit; if(target) observingProxy.addChangeHandler(target,onPropertyChange=function(changes){ for(var key in onChangeCollection) for(var i=changes.length;i--;) if(changes[i].name===key&&changes[i].type==='update'){ onChangeCollection[key].call(changes[i],changes[i].object[changes[i].name]); break; } },callOnInit); return{ destroy:function(){ observingProxy.removeChangeHandler(target,onPropertyChange); }, report:function(){ if(!target) throw 'Observing proxy error: cannot _o.onUpdate '+target+' object'; }, restore:function(){ observingProxy.addChangeHandler(target,onPropertyChange,callOnInit); } }; }; if(typeof Object.defineProperty!=='function') throw 'Object.defineProperty is not a function'; if(this.exports&&this.module) this.module.exports=_o; else if(this.define&&this.define.amd) this.define(function(){return _o}); else this._o=_o; if(this.test_o) tl('getProxy',function(){ var s={p1:1}; return observingProxy.getProxy(s).p1===s.p1}); if(this.test_o) !function(){ var u; var s={p1:1}; observingProxy.addChangeHandler(s,function(changes){ clearTimeout(u); tl('addChangeHandler',function(){return true}); }); observingProxy.getProxy(s).p1=101; u=setTimeout(function(){ tl('addChangeHandler',function(){return false}); }); }(); if(this.test_o) !function(){ var u; var f=function(){ clearTimeout(u); tl('removeChangeHandler',function(){return false}); }; var s={p1:1}; observingProxy.addChangeHandler(s,f); observingProxy.removeChangeHandler(s,f); observingProxy.getProxy(s).p1=2; u=setTimeout(function(){ tl('removeChangeHandler',function(){return true}); }); }(); if(this.test_o) !function(){ var s={p1:1}; var u=setTimeout(function(){ tl('callOnInit',function(){return false}); }); observingProxy.addChangeHandler(s,function(changes){ clearTimeout(u); tl('callOnInit',function(){return true}); },true); }(); if(this.test_o) !function(){ var s={p1:0},proxy=observingProxy.getProxy(s),n=0; observingProxy.addChangeHandler(s,function(ch){ n++; }); for(var i=10;i--;) proxy.p1++; setTimeout(function(){ tl('Delayed notify',function(){return n===1}); }) }(); if(this.test_o) !function(){ var s={p1:1}; _o.onUpdate(s,'p1',function(value){ if(value===2){ clearTimeout(u); tl('onUpdateHandler',function(){return value===2}); } }); observingProxy.getProxy(s).p1=2; var u=setTimeout(function(){ tl('onUpdateHandler',function(){return false}); }); }(); if(this.test_o) !function(){ var s={p1:1},proxy=observingProxy.getProxy(s),i=0; var observer=_o.onUpdate(s,'p1',function(value){ i++; }); setTimeout(function(){ proxy.p1=2; setTimeout(function(){ observer.destroy(); proxy.p1=3; setTimeout(function(){ observer.restore(); proxy.p1=4; setTimeout(function(){ tl('onUpdateHandler destructor',function(){return i==4}); }); }); }); }); }(); }.bind(this)()
ytiurin/observingproxy
observing-proxy.js
JavaScript
mit
9,561
module.exports={A:{A:{"2":"J C G E B A TB"},B:{"2":"D X g H L"},C:{"2":"1 2 3 RB F I J C G E B A D X g H L M N O P Q R S T U V W t Y Z a b c d e f K h i j k l m n o p q v w x y z s r PB OB"},D:{"2":"1 2 7 9 F I J C G E B A D X g H L M N O P Q R S T U V W t Y Z a b c d e f K h i j k l m n o p q v w x y z s r DB SB AB BB"},E:{"2":"6 F I J C G E B A CB EB FB GB HB IB JB"},F:{"2":"0 4 5 E A D H L M N O P Q R S T U V W t Y Z a b c d e f K h i j k l m n o p q KB LB MB NB QB"},G:{"2":"6 8 G A u UB VB WB XB YB ZB aB bB"},H:{"2":"cB"},I:{"2":"3 F r dB eB fB gB u hB iB"},J:{"2":"C B"},K:{"2":"0 4 5 B A D K"},L:{"2":"7"},M:{"2":"s"},N:{"2":"B A"},O:{"2":"jB"},P:{"2":"F I"},Q:{"2":"kB"},R:{"2":"lB"}},B:7,C:":has() CSS relational pseudo-class"};
asrar7787/Test-Frontools
node_modules/caniuse-lite/data/features/css-has.js
JavaScript
mit
743
{ var x = f; x = items[0]; x = items[1]; }
stas-vilchik/bdd-ml
data/2043.js
JavaScript
mit
49
import xhr from './lib/xhr'; class ShowsModel { constructor() { this.shows = []; } fetch(cb) { xhr('https://raw.githubusercontent.com/dashersw/erste.js-demo/master/src/static/data/shows.json', (err, data) => { this.shows = data.slice(0, 20); cb(this.shows); }); }; } export default new ShowsModel();
korayguney/veteranteam_project
src/shows-model.js
JavaScript
mit
368
export default function calculateScore (subject, chosenId, time) { const isCorrectAnswer = subject.id === chosenId let score if(isCorrectAnswer) { if(time < 7) { score = 3 } else { // Needs review score = .9 + (2 * (1/subject.seenCount)) } } else { // Degrees of failure score = 1/subject.seenCount } subject.score = score return [subject, score] }
johnloy/wat-namegame
lib/calculate-score.js
JavaScript
mit
401
import { createRouter, createWebHistory } from "vue-router/dist/vue-router.esm.js"; import Home from "./views/Home.vue"; const routerHistory = createWebHistory("/"); let router = createRouter({ history: routerHistory, routes: [ { path: '/', component: Home, name: '' }, { path: '/who', component: Home, name: 'who' }, { path: '/what', component: Home, name: 'what' }, { path: '/where', component: Home, name: 'where' }, { path: '/when', component: Home, name: 'when' }, { path: '/why', component: Home, name: 'why' } ] }); router.afterEach((to, from) => { console.info((to, from, window.location.pathname)); }) export default router;
senei/senei.github.io
router/router.js
JavaScript
mit
680
'use strict'; var crypto = require('crypto'); exports.typeOf = function(obj) { var classToType; if (obj === void 0 || obj === null) { return String(obj); } classToType = { '[object Boolean]': 'boolean', '[object Number]': 'number', '[object String]': 'string', '[object Function]': 'function', '[object Array]': 'array', '[object Date]': 'date', '[object RegExp]': 'regexp', '[object Object]': 'object' }; return classToType[Object.prototype.toString.call(obj)]; }; exports.unauthResp = function(res) { res.statusCode = 401; res.setHeader('content-type', 'application/json; charset=UTF-8'); return res.end(JSON.stringify({ code: 401, error: 'Unauthorized.' })); }; exports.signHook = function(masterKey, hookName, ts) { return ts + ',' + crypto.createHmac('sha1', masterKey).update(hookName + ':' + ts).digest('hex'); }; exports.verifyHookSign = function(masterKey, hookName, sign) { if (sign) { return exports.signHook(masterKey, hookName, sign.split(',')[0]) === sign; } else { return false; } }; /* options: req, user, params, object*/ exports.prepareRequestObject = function(options) { var req = options.req; var user = options.user; var currentUser = user || (req && req.AV && req.AV.user); return { expressReq: req, params: options.params, object: options.object, meta: { remoteAddress: req && req.headers && getRemoteAddress(req) }, user: user, currentUser: currentUser, sessionToken: (currentUser && currentUser.getSessionToken()) || (req && req.sessionToken) }; }; exports.prepareResponseObject = function(res, callback) { return { success: function(result) { callback(null, result); }, error: function(error) { callback(error); } }; }; var getRemoteAddress = exports.getRemoteAddress = function(req) { return req.headers['x-real-ip'] || req.headers['x-forwarded-for'] || req.connection.remoteAddress }; exports.endsWith = function(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; };
CxyYuan/luyoutec_lanyou5_2
node_modules/leanengine/lib/utils.js
JavaScript
mit
2,089
import createSvgIcon from './utils/createSvgIcon'; import { jsx as _jsx } from "react/jsx-runtime"; export default createSvgIcon( /*#__PURE__*/_jsx("path", { d: "M17 3H3v18h18V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z" }), 'SaveSharp');
oliviertassinari/material-ui
packages/mui-icons-material/lib/esm/SaveSharp.js
JavaScript
mit
278
import fulfillQuery from '../../../src/webserver/db/fulfillQuery' // eslint-disable-line describe('webserver/db/fulfillQuery', () => { it('should work') })
esex/esex
test/webserver/db/fulfillQueryTest.js
JavaScript
mit
159
'use strict'; var Foundationify = (function () { // Initalize product image gallery function on product pages function initProductImages() { // Define the scope var $productImages = $('#product-images', 'body.product'); // Select the thumbnails var $thumbs = $('ul img', $productImages); if ($thumbs.length) { // Select the large image var $largeImage = $('img', $productImages).first(); // Change the large image src and alt attributes on click $thumbs.on('click', function (e) { e.preventDefault(); // Skip if thumb matches large if ($largeImage.attr('src') === $(this).parent('a').attr('href')) { return; } // Change the cursor to the loading cursor $('body').css('cursor', 'progress'); // Change the src and alt attributes of the large image $largeImage.attr('src', $(this).parent('a').attr('href')) .attr('alt', $(this).attr('alt')); }); // Return the loading cursor to default after the large image has loaded $largeImage.on('load', function () { $('body').css('cursor', 'auto'); }); } } return { init: function () { initProductImages(); } }; }()); $(document).ready(function () { Foundationify.init(); });
Leland/foundationify
src/scripts/main.js
JavaScript
mit
1,229
"use strict"; var SourceLine_1 = require("../source/SourceLine"); var Prop_1 = require("../entities/Prop"); var Method_1 = require("../entities/Method"); var MethodKind_1 = require("../kind/MethodKind"); var ProgramError_1 = require("../errors/ProgramError"); var ClassDefn_1 = require("../define/ClassDefn"); var StructDefn_1 = require("../define/StructDefn"); var CONST_1 = require("../CONST"); var PropQual_1 = require("../entities/PropQual"); var ParamParser_1 = require("../parser/ParamParser"); /** * Created by Nidin Vinayakan on 4/7/2016. */ var DefinitionService = (function () { function DefinitionService() { } /** * Collect all definitions from the source code * */ DefinitionService.prototype.collectDefinitions = function (filename, lines) { var _this = this; var defs = []; var turboLines = []; var i = 0; var numLines = lines.length; var line; while (i < numLines) { line = lines[i++]; if (!CONST_1.Matcher.START.test(line)) { turboLines.push(new SourceLine_1.SourceLine(filename, i, line)); continue; } var kind = ""; var name_1 = ""; var inherit = ""; var lineNumber = i; var m = null; if (m = CONST_1.Matcher.STRUCT.exec(line)) { kind = "struct"; name_1 = m[1]; } else if (m = CONST_1.Matcher.CLASS.exec(line)) { kind = "class"; name_1 = m[1]; inherit = m[2] ? m[2] : ""; } else { throw new ProgramError_1.ProgramError(filename, i, "Syntax error: Malformed definition line"); } var properties = []; var methods = []; var in_method = false; var mbody = null; var method_type = MethodKind_1.MethodKind.Virtual; var method_name = ""; var method_line = 0; var method_signature = null; // Do not check for duplicate names here since that needs to // take into account inheritance. while (i < numLines) { line = lines[i++]; if (CONST_1.Matcher.END.test(line)) { break; } if (m = CONST_1.Matcher.METHOD.exec(line.trim())) { if (kind != "class") { throw new ProgramError_1.ProgramError(filename, i, "@method is only allowed in classes"); } if (in_method) { methods.push(new Method_1.Method(method_line, method_type, method_name, method_signature, mbody)); } in_method = true; method_line = i; method_type = (m[1] == "method" ? MethodKind_1.MethodKind.NonVirtual : MethodKind_1.MethodKind.Virtual); method_name = m[2]; // Parse the signature. Just use the param parser for now, // but note that what we get back will need postprocessing. var pp = new ParamParser_1.ParamParser(filename, i, m[3], /* skip left paren */ 1); var args = pp.allArgs(); args.shift(); // Discard SELF // Issue #15: In principle there are two signatures here: there is the // parameter signature, which we should keep intact in the // virtual, and there is the set of arguments extracted from that, // including any splat. method_signature = args.map(function (x) { return _this.parameterToArgument(filename, i, x); }); mbody = [m[3]]; } else if (m = CONST_1.Matcher.SPECIAL.exec(line.trim())) { if (kind != "struct") throw new ProgramError_1.ProgramError(filename, i, "@" + m[1] + " is only allowed in structs"); if (in_method) methods.push(new Method_1.Method(method_line, method_type, method_name, method_signature, mbody)); method_line = i; in_method = true; switch (m[1]) { case "get": method_type = MethodKind_1.MethodKind.Get; break; case "set": method_type = MethodKind_1.MethodKind.Set; break; } method_name = ""; method_signature = null; mbody = [m[2]]; } else if (in_method) { // TODO: if we're going to be collecting random cruft // then blank and comment lines at the end of a method // really should be placed at the beginning of the // next method. Also see hack in pasteupTypes() that // removes blank lines from the end of a method body. mbody.push(line); } else if (m = CONST_1.Matcher.PROP.exec(line)) { var qual = PropQual_1.PropQual.None; switch (m[3]) { case "synchronic": qual = PropQual_1.PropQual.Synchronic; break; case "atomic": qual = PropQual_1.PropQual.Atomic; break; } properties.push(new Prop_1.Prop(i, m[1], qual, m[4] == "Array", m[2])); } else if (CONST_1.blank_re.test(line)) { } else throw new ProgramError_1.ProgramError(filename, i, "Syntax error: Not a property or method: " + line); } if (in_method) methods.push(new Method_1.Method(method_line, method_type, method_name, method_signature, mbody)); if (kind == "class") defs.push(new ClassDefn_1.ClassDefn(filename, lineNumber, name_1, inherit, properties, methods, turboLines.length)); else defs.push(new StructDefn_1.StructDefn(filename, lineNumber, name_1, properties, methods, turboLines.length)); } return [defs, turboLines]; }; // The input is Id, Id:Blah, or ...Id. Strip any :Blah annotations. DefinitionService.prototype.parameterToArgument = function (file, line, s) { if (/^\s*(?:\.\.\.)[A-Za-z_$][A-Za-z0-9_$]*\s*$/.test(s)) return s; var m = /^\s*([A-Za-z_\$][A-Za-z0-9_\$]*)\s*:?/.exec(s); if (!m) throw new ProgramError_1.ProgramError(file, line, "Unable to understand argument to virtual function: " + s); return m[1]; }; return DefinitionService; }()); exports.DefinitionService = DefinitionService; //# sourceMappingURL=DefinitionService.js.map
01alchemist/parallel-js
src/modules/turbo.js/compiler/services/DefinitionService.js
JavaScript
mit
7,225
/* eslint-env mocha */ import { Controller } from '../' import assert from 'assert' import { equals } from './' import { state, props } from '../tags' describe('operator.equals', () => { it('should go down path based on props', () => { let count = 0 const controller = Controller({ state: { foo: 'bar', }, signals: { test: [ equals(props`foo`), { bar: [ () => { count++ }, ], otherwise: [], }, ], }, }) controller.getSignal('test')({ foo: 'bar' }) assert.equal(count, 1) }) it('should go down path based on state', () => { let count = 0 const controller = Controller({ state: { foo: 'bar', }, signals: { test: [ equals(state`foo`), { bar: [ () => { count++ }, ], otherwise: [], }, ], }, }) controller.getSignal('test')() assert.equal(count, 1) }) it('should throw on bad argument', done => { const controller = Controller({ state: { foo: 'bar', }, signals: { test: [ equals('foo'), { bar: [() => {}], otherwise: [], }, ], }, }) controller.removeListener('error') controller.once('error', error => { assert.ok(error) done() }) controller.getSignal('test')() }) })
garth/cerebral
packages/node_modules/cerebral/src/operators/equals.test.js
JavaScript
mit
1,570
module.exports = function(EmailAddress) { };
soltrinox/vator-api-dev
common/models/email-address.js
JavaScript
mit
46
import { create } from 'ember-cli-page-object'; import leadershipCollapsed from 'ilios-common/page-objects/components/leadership-collapsed'; import overview from './overview'; import header from './header'; import leadershipExpanded from './leadership-expanded'; const definition = { scope: '[data-test-program-details]', header, overview, leadershipCollapsed, leadershipExpanded, }; export default definition; export const component = create(definition);
jrjohnson/frontend
tests/pages/components/program/root.js
JavaScript
mit
468
version https://git-lfs.github.com/spec/v1 oid sha256:07e25b6c05d06d085c2840d85f2966476dc38544be904c978d7c66dbe688decb size 4672
yogeshsaroya/new-cdnjs
ajax/libs/dojo/1.8.1/cldr/nls/pt/gregorian.js.uncompressed.js
JavaScript
mit
129
/** * Copyright 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @providesModule relayUnstableBatchedUpdates * * @format */ 'use strict'; module.exports = require('react-dom').unstable_batchedUpdates;
amiechen/amiechen.github.io
node_modules/relay-runtime/lib/relayUnstableBatchedUpdates.js
JavaScript
mit
322
// support CommonJS, AMD & browser /* istanbul ignore next */ if (typeof exports === T_OBJECT) module.exports = riot else if (typeof define === 'function' && define.amd) define(function() { return (window.riot = riot) }) else window.riot = riot })(typeof window != 'undefined' ? window : void 0);
xtity/riot
lib/browser/wrap/suffix.js
JavaScript
mit
320
/* $(document.body).ready(function() { FormKit.install(); FormKit.initialize(document.body); }); Inside Ajax Region: $(document.body).ready(function() { FormKit.initialize( div element ); }); */ var FormKit = { register: function(initHandler,installHandler) { $(FormKit).bind('formkit.initialize',initHandler); if( installHandler ) { $(this).bind('formkit.install',installHandler); } }, initialize: function(scopeEl) { if(!scopeEl) scopeEl = document.body; $(FormKit).trigger('formkit.initialize',[scopeEl]); }, install: function() { $(FormKit).trigger('formkit.install'); } };
c9s/FormKit
assets/formkit/formkit.js
JavaScript
mit
703
// webpack.config.js module.exports = { module: { rules: [ { test: /\.css$/, use: [ 'vue-style-loader', { loader: 'css-loader', options: { importLoaders: 1 } }, 'postcss-loader' ] } ] } }
JosefFriedrich-nodejs/baldr
src/vue/components/modal-dialog/webpack.config.js
JavaScript
mit
300
/** * Validates the inputted Firebase reference. * * @param {Firebase} firebaseRef The Firebase reference to validate. */ var _validateFirebaseRef = function(firebaseRef) { var error; if (typeof firebaseRef === "undefined") { error = "no \"firebaseRef\" specified"; } else if (firebaseRef instanceof Firebase === false) { // TODO: can they pass in a limit query? error = "\"firebaseRef\" must be an instance of Firebase"; } if (typeof error !== "undefined") { throw new Error("FireGrapher: " + error); } }; /** * Validates the inputted CSS selector. * * @param {string} cssSelector The CSS selector to validate. */ var _validateCssSelector = function(cssSelector) { var error; if (typeof cssSelector === "undefined") { error = "no \"cssSelector\" specified"; } else if (typeof cssSelector !== "string") { error = "\"cssSelector\" must be a string"; } else { var matchedElements = document.querySelectorAll(cssSelector); if (matchedElements.length === 0) { error = "no element matches the CSS selector '" + cssSelector + "'"; } else if (matchedElements.length > 1) { error = "multiple elements (" + matchedElements.length + " total) match the CSS selector '" + cssSelector + "'"; } } if (typeof error !== "undefined") { throw new Error("FireGrapher: " + error); } }; /** * Validates the inputted config object and makes sure no options have invalid values. * * @param {object} config The graph configuration object to validate. */ var _validateConfig = function(config) { // TODO: upgrade var error; if (typeof config === "undefined") { error = "no \"config\" specified"; } else if (typeof config !== "object") { error = "\"config\" must be an object"; } // Every config needs to specify the graph type var validGraphTypes = ["table", "line", "scatter", "bar", "map"]; if (typeof config.type === "undefined") { error = "no graph \"type\" specified. Must be \"table\", \"line\", or \"scatter\""; } if (validGraphTypes.indexOf(config.type) === -1) { error = "Invalid graph \"type\" specified. Must be \"table\", \"line\", or \"scatter\""; } // Every config needs to specify the path to an individual record if (typeof config.path === "undefined") { error = "no \"path\" to individual record specified"; } // TODO: other validation for things like $, *, etc. switch (config.type) { case "map": if (typeof config.marker === "undefined" || typeof config.marker.latitude === "undefined" || typeof config.marker.longitude === "undefined" || typeof config.marker.magnitude === "undefined") { error = "incomplete \"marker\" definition specified. \nExpected: " + JSON.stringify(_getDefaultConfig().marker) + "\nActual: " + JSON.stringify(config.marker); } break; case "table": // Every table config needs to specify its column labels and values if (typeof config.columns === "undefined") { error = "no table \"columns\" specified"; } config.columns.forEach(function(column) { if (typeof column.label === "undefined") { error = "missing \"columns\" label"; } if (typeof column.value === "undefined") { error = "missing \"columns\" value"; } }); break; case "line": if (typeof config.xCoord === "undefined") { error = "no \"xCoord\" specified"; } if (typeof config.yCoord === "undefined") { error = "no \"yCoord\" specified."; } break; case "bar": if (typeof config.value === "undefined") { error = "no \"value\" specified."; } break; case "scatter": break; } if (typeof error !== "undefined") { throw new Error("FireGrapher: " + error); } }; /** * Validates the inputted grapher object. * * @param {object} grapher The grapher object to validate. */ var _validateGrapher = function(grapher) { var error; if (grapher === null || typeof grapher !== "object") { error = "\"grapher\" must be an object"; } // TODO: figure out what this should be to support both production and testing /*if (grapher instanceof D3Graph === false && grapher instanceof D3Table === false && grapher instanceof D3Map === false) { throw new Error("FireGrapher: \"grapher\" must be an instance of FireGrapherD3"); }*/ else if (typeof grapher.init !== "function") { error = "\"grapher\" must have an init() method"; } else if (typeof grapher.draw !== "function") { error = "\"grapher\" must have a draw() method"; } else if (typeof grapher.addDataPoint !== "function") { error = "\"grapher\" must have a addDataPoint() method"; } if (typeof error !== "undefined") { throw new Error("FireGrapher: " + error); } }; /** * Adds default values to the graph config object */ var _getDefaultConfig = function() { // Default colors (turquoise, alizaren (red), amethyst (purple), peter river (blue), sunflower, pumpkin, emerald, carrot, midnight blue, pomegranate) var defaultStrokeColors = ["#1ABC9C", "#E74C3C", "#9B59B6", "#3498DB", "#F1C40F", "#D35400", "#2ECC71", "#E67E22", "#2C3E50", "#C0392B"]; var defaultFillColors = ["#28E1BC", "#ED7469", "#B07CC6", "#5FAEE3", "#F4D03F", "#FF6607", "#54D98B", "#EB9850", "#3E5771", "#D65448"]; // Define a default config object return { "styles": { "fillColor": "#DDDDDD", "fillOpacity": 0.3, "outerStrokeColor": "#000000", "outerStrokeWidth": 2, "innerStrokeColor": "#000000", "innerStrokeWidth": 1, /*"size": { "width": 500, "height": 300 },*/ "axes": { "x": { "ticks": { "fillColor": "#000000", "fontSize": "14px" }, "label": { "fillColor": "#000000", "fontSize": "14px" } }, "y": { "ticks": { "fillColor": "#000000", "fontSize": "14px" }, "label": { "fillColor": "#000000", "fontSize": "14px" } } }, "series": { "strokeWidth": 2, "strokeColors": defaultStrokeColors }, "markers": { "size": 3.5, "strokeWidth": 2, "style": "default", "strokeColors": defaultStrokeColors, "fillColors": defaultFillColors // What about if style is set to "flat"? }, "legend": { "fontSize": "16px", "stroke": "#000000", "strokeWidth": "2px", "fill": "#AAAAAA", "fillOpacity": 0.7 } }, "xCoord": { "label": "" }, "yCoord": { "label": "" }, "marker": { "label" : "label", "latitude" : "latitude", "longitude" : "longitude", "magnitude" : "radius" } }; };
lauradhamilton/firegrapher
src/firegrapherUtils.js
JavaScript
mit
6,936
/** * @module kat-cr/lib/fetch * @description * Wraps request in a Promise */ /** * The HTTP response class provided by request * @external HTTPResponse * @see {@link http://github.com/request/request} */ "use strict"; const request = (function loadPrivate(module) { let modulePath = require.resolve(module), cached = require.cache[modulePath]; delete require.cache[modulePath]; let retval = require(module); require.cache[modulePath] = cached; return retval; })('request'), USER_AGENTS = require('../config/user-agents'); // Not necessary as of now, but in case Kickass Torrents requires cookies enabled in the future, and in case the library user needs to use request with his or her own cookie jar, we load a private copy of request so we can use our own cookie jar instead of overriding the global one request.defaults({ jar: true }); /** * @description * Wraps request in a Promise, also sets a random user agent * @param {Object} config The details of the request as if it were passed to request directly * @returns {Promise.<external:HTTPResponse>} A promise which resolves with the response, or rejects with an error * @example * // Make a request to a JSON API * require('kat-cr/lib/fetch')({ * method: 'GET', * url: 'http://server.com/json-endpoint', * }).then(function (response) { * JSON.parse(response.body); * }); */ module.exports = function fetch(config) { if (!config) config = {}; if (!config.headers) config.headers = {}; config.headers['user-agent'] = USER_AGENTS[Math.floor(Math.random()*USER_AGENTS.length)]; return new Promise(function (resolve, reject) { request(config, function (err, resp, body) { if (err) reject(err); resolve(resp); }); }); }; /** Expose private request module for debugging */ module.exports._request = request;
raypulver/kat-cr
lib/fetch.js
JavaScript
mit
1,846
/** * Method to set dom events * * @example * wysihtml.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); */ wysihtml.dom.observe = function(element, eventNames, handler) { eventNames = typeof(eventNames) === "string" ? [eventNames] : eventNames; var handlerWrapper, eventName, i = 0, length = eventNames.length; for (; i<length; i++) { eventName = eventNames[i]; if (element.addEventListener) { element.addEventListener(eventName, handler, false); } else { handlerWrapper = function(event) { if (!("target" in event)) { event.target = event.srcElement; } event.preventDefault = event.preventDefault || function() { this.returnValue = false; }; event.stopPropagation = event.stopPropagation || function() { this.cancelBubble = true; }; handler.call(element, event); }; element.attachEvent("on" + eventName, handlerWrapper); } } return { stop: function() { var eventName, i = 0, length = eventNames.length; for (; i<length; i++) { eventName = eventNames[i]; if (element.removeEventListener) { element.removeEventListener(eventName, handler, false); } else { element.detachEvent("on" + eventName, handlerWrapper); } } } }; };
Voog/wysihtml
src/dom/observe.js
JavaScript
mit
1,440
import { includes } from './array_proxy' /** * Given a record and an update object, apply the update on the record. Note * that the `operate` object is unapplied. * * @param {Object} record * @param {Object} update */ export default function applyUpdate (record, update) { for (let field in update.replace) record[field] = update.replace[field] for (let field in update.push) { const value = update.push[field] record[field] = record[field] ? record[field].slice() : [] if (Array.isArray(value)) record[field].push(...value) else record[field].push(value) } for (let field in update.pull) { const value = update.pull[field] record[field] = record[field] ? record[field].slice().filter(exclude.bind(null, Array.isArray(value) ? value : [ value ])) : [] } } function exclude (values, value) { return !includes(values, value) }
geoapi/crowdclarify
node_modules/fortune/lib/common/apply_update.js
JavaScript
mit
891
#!/usr/bin/env node var logger = require('../lib/logger')('test-logger'); var config = require('../lib/config'); var count = 1; setInterval(function() { logger.debug(count); logger.info(count); count += 1; }, 1000);
oakfire/oak-site
test/test-logger.js
JavaScript
mit
230
/** * Parse an array of chromsizes, for example that result * from reading rows of a chromsizes CSV file. * @param {array} data Array of [chrName, chrLen] "tuples". * @returns {object} Object containing properties * { cumPositions, chrPositions, totalLength, chromLengths }. */ function parseChromsizesRows(data) { const cumValues = []; const chromLengths = {}; const chrPositions = {}; let totalLength = 0; for (let i = 0; i < data.length; i++) { const length = Number(data[i][1]); totalLength += length; const newValue = { id: i, chr: data[i][0], pos: totalLength - length, }; cumValues.push(newValue); chrPositions[newValue.chr] = newValue; chromLengths[data[i][0]] = length; } return { cumPositions: cumValues, chrPositions, totalLength, chromLengths, }; } export default parseChromsizesRows;
hms-dbmi/4DN_matrix-viewer
app/scripts/utils/parse-chromsizes-rows.js
JavaScript
mit
887
'use strict'; /** * Module dependencies */ var hbs = require('express-hbs'); function content(options) { return new hbs.handlebars.SafeString(this.html || ''); } module.exports = content; // downsize = Tag-safe truncation for HTML and XML. Works by word!
Robinyo/Vardyger
core/server/helpers/content.js
JavaScript
mit
263
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)([/*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M15 6H4v12.01h16V11h-5z", opacity: ".3" }, "0"), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M4 4c-1.1 0-2 .9-2 2v12.01c0 1.1.9 1.99 2 1.99h16c1.1 0 2-.9 2-2v-8l-6-6H4zm16 14.01H4V6h11v5h5v7.01z" }, "1")], 'NoteTwoTone'); exports.default = _default;
oliviertassinari/material-ui
packages/mui-icons-material/lib/NoteTwoTone.js
JavaScript
mit
675
/* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const _ = require("underscore") const path = require("path") const jade = require("jade") const fs = require("fs") const moment = require("moment") const Curation = require("../../../../../models/curation.coffee") const Article = require("../../../../../models/article.coffee") const render = function (templateName) { const filename = path.resolve( __dirname, `../../../components/venice_2017/templates/${templateName}.jade` ) return jade.compile(fs.readFileSync(filename), { filename }) } describe("Venice index", () => it("uses social metadata", function () { const curation = new Curation({ sections: [ { social_description: "Social Description", social_title: "Social Title", social_image: "files.artsy.net/img/social_image.jpg", seo_description: "Seo Description", }, ], sub_articles: [], }) const html = render("index")({ videoIndex: 0, curation, isSubscribed: false, sub_articles: [], videoGuide: new Article(), crop(url) { return url }, resize(url) { return url }, moment, sd: {}, markdown() {}, asset() {}, }) html.should.containEql( '<meta property="og:image" content="files.artsy.net/img/social_image.jpg">' ) html.should.containEql('<meta property="og:title" content="Social Title">') html.should.containEql( '<meta property="og:description" content="Social Description">' ) return html.should.containEql( '<meta name="description" content="Seo Description">' ) })) describe("Venice video_completed", () => it("passes section url to social mixin", function () { const html = render("video_completed")({ section: { social_title: "Social Title", slug: "ep-1", }, sd: { APP_URL: "http://localhost:5000" }, }) html.should.containEql( "https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Flocalhost%3A5000%2Fvenice-biennale%2Fep-1" ) return html.should.containEql("Social Title") })) describe("Venice video_description", () => it("passes section url to social mixin", function () { const html = render("video_description")({ section: { social_title: "Social Title", slug: "ep-1", published: true, }, sd: { APP_URL: "http://localhost:5000" }, markdown() {}, }) html.should.containEql( "https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Flocalhost%3A5000%2Fvenice-biennale%2Fep-1" ) return html.should.containEql("Social Title") }))
joeyAghion/force
src/desktop/apps/editorial_features/test/components/venice_2017/templates.test.js
JavaScript
mit
2,842
module.exports = require('../lib/') .extend('faker', function() { try { return require('faker/locale/zh_CN'); } catch (e) { return null; } });
etzJohn/speedboost
node_modules/json-schema-faker/locale/zh_CN.js
JavaScript
mit
179
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 2); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! * jQuery JavaScript Library v3.2.1 * https://jquery.com/ * * Includes Sizzle.js * https://sizzlejs.com/ * * Copyright JS Foundation and other contributors * Released under the MIT license * https://jquery.org/license * * Date: 2017-03-20T18:59Z */ ( function( global, factory ) { "use strict"; if ( typeof module === "object" && typeof module.exports === "object" ) { // For CommonJS and CommonJS-like environments where a proper `window` // is present, execute the factory and get jQuery. // For environments that do not have a `window` with a `document` // (such as Node.js), expose a factory as module.exports. // This accentuates the need for the creation of a real `window`. // e.g. var jQuery = require("jquery")(window); // See ticket #14549 for more info. module.exports = global.document ? factory( global, true ) : function( w ) { if ( !w.document ) { throw new Error( "jQuery requires a window with a document" ); } return factory( w ); }; } else { factory( global ); } // Pass this if window is not defined yet } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common // enough that all such attempts are guarded in a try block. "use strict"; var arr = []; var document = window.document; var getProto = Object.getPrototypeOf; var slice = arr.slice; var concat = arr.concat; var push = arr.push; var indexOf = arr.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var fnToString = hasOwn.toString; var ObjectFunctionString = fnToString.call( Object ); var support = {}; function DOMEval( code, doc ) { doc = doc || document; var script = doc.createElement( "script" ); script.text = code; doc.head.appendChild( script ).parentNode.removeChild( script ); } /* global Symbol */ // Defining this global in .eslintrc.json would create a danger of using the global // unguarded in another place, it seems safer to define global only for this module var version = "3.2.1", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init( selector, context ); }, // Support: Android <=4.0 only // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // The default length of a jQuery object is 0 length: 0, toArray: function() { return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { // Return all the elements in a clean array if ( num == null ) { return slice.call( this ); } // Return just the one element from the set return num < 0 ? this[ num + this.length ] : this[ num ]; }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. each: function( callback ) { return jQuery.each( this, callback ); }, map: function( callback ) { return this.pushStack( jQuery.map( this, function( elem, i ) { return callback.call( elem, i, elem ); } ) ); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); }, end: function() { return this.prevObject || this.constructor(); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: arr.sort, splice: arr.splice }; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[ 0 ] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; // Skip the boolean and the target target = arguments[ i ] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { target = {}; } // Extend jQuery itself if only one argument is passed if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( ( options = arguments[ i ] ) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject( copy ) || ( copyIsArray = Array.isArray( copy ) ) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && Array.isArray( src ) ? src : []; } else { clone = src && jQuery.isPlainObject( src ) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend( { // Unique for each copy of jQuery on the page expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), // Assume jQuery is ready without the ready module isReady: true, error: function( msg ) { throw new Error( msg ); }, noop: function() {}, isFunction: function( obj ) { return jQuery.type( obj ) === "function"; }, isWindow: function( obj ) { return obj != null && obj === obj.window; }, isNumeric: function( obj ) { // As of jQuery 3.0, isNumeric is limited to // strings and numbers (primitives or objects) // that can be coerced to finite numbers (gh-2662) var type = jQuery.type( obj ); return ( type === "number" || type === "string" ) && // parseFloat NaNs numeric-cast false positives ("") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN !isNaN( obj - parseFloat( obj ) ); }, isPlainObject: function( obj ) { var proto, Ctor; // Detect obvious negatives // Use toString instead of jQuery.type to catch host objects if ( !obj || toString.call( obj ) !== "[object Object]" ) { return false; } proto = getProto( obj ); // Objects with no prototype (e.g., `Object.create( null )`) are plain if ( !proto ) { return true; } // Objects with prototype are plain iff they were constructed by a global Object function Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; }, isEmptyObject: function( obj ) { /* eslint-disable no-unused-vars */ // See https://github.com/eslint/eslint/issues/6125 var name; for ( name in obj ) { return false; } return true; }, type: function( obj ) { if ( obj == null ) { return obj + ""; } // Support: Android <=2.3 only (functionish RegExp) return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call( obj ) ] || "object" : typeof obj; }, // Evaluates a script in a global context globalEval: function( code ) { DOMEval( code ); }, // Convert dashed to camelCase; used by the css and data modules // Support: IE <=9 - 11, Edge 12 - 13 // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, each: function( obj, callback ) { var length, i = 0; if ( isArrayLike( obj ) ) { length = obj.length; for ( ; i < length; i++ ) { if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { break; } } } else { for ( i in obj ) { if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { break; } } } return obj; }, // Support: Android <=4.0 only trim: function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArrayLike( Object( arr ) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit merge: function( first, second ) { var len = +second.length, j = 0, i = first.length; for ( ; j < len; j++ ) { first[ i++ ] = second[ j ]; } first.length = i; return first; }, grep: function( elems, callback, invert ) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { callbackInverse = !callback( elems[ i ], i ); if ( callbackInverse !== callbackExpect ) { matches.push( elems[ i ] ); } } return matches; }, // arg is for internal usage only map: function( elems, callback, arg ) { var length, value, i = 0, ret = []; // Go through the array, translating each of the items to their new values if ( isArrayLike( elems ) ) { length = elems.length; for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } // Go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } // Flatten any nested arrays return concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: Date.now, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support } ); if ( typeof Symbol === "function" ) { jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; } // Populate the class2type map jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), function( i, name ) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); } ); function isArrayLike( obj ) { // Support: real iOS 8.2 only (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = !!obj && "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v2.3.3 * https://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2016-08-08 */ (function( window ) { var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; } return 0; }, // Instance methods hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf as it's faster than native // https://jsperf.com/thor-indexof-vs-for/5 indexOf = function( list, elem ) { var i = 0, len = list.length; for ( ; i < len; i++ ) { if ( list[i] === elem ) { return i; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", // Regular expressions // http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + ")(?:\\((" + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + // 2. simple (capture 6) "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + // 3. anything else (capture 2) ".*" + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new RegExp( whitespace + "+", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + identifier + ")" ), "CLASS": new RegExp( "^\\.(" + identifier + ")" ), "TAG": new RegExp( "^(" + identifier + "|[*])" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, // CSS escapes // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint // Support: Firefox<24 // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, // CSS string/identifier serialization // https://drafts.csswg.org/cssom/#common-serializing-idioms rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, fcssescape = function( ch, asCodePoint ) { if ( asCodePoint ) { // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER if ( ch === "\0" ) { return "\uFFFD"; } // Control characters and (dependent upon position) numbers get escaped as code points return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; } // Other potentially-special ASCII characters get backslash-escaped return "\\" + ch; }, // Used for iframes // See setDocument() // Removing the function wrapper causes a "Permission Denied" // error in IE unloadHandler = function() { setDocument(); }, disabledAncestor = addCombinator( function( elem ) { return elem.disabled === true && ("form" in elem || "label" in elem); }, { dir: "parentNode", next: "legend" } ); // Optimize for push.apply( _, NodeList ) try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); // Support: Android<4.0 // Detect silently failing push.apply arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? // Leverage slice if possible function( target, els ) { push_native.apply( target, slice.call(els) ); } : // Support: IE<9 // Otherwise append directly function( target, els ) { var j = target.length, i = 0; // Can't trust NodeList.length while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } function Sizzle( selector, context, results, seed ) { var m, i, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, // nodeType defaults to 9, since context defaults to document nodeType = context ? context.nodeType : 9; results = results || []; // Return early from calls with invalid selector or context if ( typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { return results; } // Try to shortcut find operations (as opposed to filters) in HTML documents if ( !seed ) { if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; if ( documentIsHTML ) { // If the selector is sufficiently simple, try using a "get*By*" DOM method // (excepting DocumentFragment context, where the methods don't exist) if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { // ID selector if ( (m = match[1]) ) { // Document context if ( nodeType === 9 ) { if ( (elem = context.getElementById( m )) ) { // Support: IE, Opera, Webkit // TODO: identify versions // getElementById can match elements by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } // Element context } else { // Support: IE, Opera, Webkit // TODO: identify versions // getElementById can match elements by name instead of ID if ( newContext && (elem = newContext.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Type selector } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; // Class selector } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // Take advantage of querySelectorAll if ( support.qsa && !compilerCache[ selector + " " ] && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { if ( nodeType !== 1 ) { newContext = context; newSelector = selector; // qSA looks outside Element context, which is not what we want // Thanks to Andrew Dupont for this workaround technique // Support: IE <=8 // Exclude object elements } else if ( context.nodeName.toLowerCase() !== "object" ) { // Capture the context ID, setting it first if necessary if ( (nid = context.getAttribute( "id" )) ) { nid = nid.replace( rcssescape, fcssescape ); } else { context.setAttribute( "id", (nid = expando) ); } // Prefix every selector in the list groups = tokenize( selector ); i = groups.length; while ( i-- ) { groups[i] = "#" + nid + " " + toSelector( groups[i] ); } newSelector = groups.join( "," ); // Expand context for sibling selectors newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch ( qsaError ) { } finally { if ( nid === expando ) { context.removeAttribute( "id" ); } } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /** * Create key-value caches of limited size * @returns {function(string, object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var keys = []; function cache( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key + " " ] = value); } return cache; } /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /** * Support testing using an element * @param {Function} fn Passed the created element and returns a boolean result */ function assert( fn ) { var el = document.createElement("fieldset"); try { return !!fn( el ); } catch (e) { return false; } finally { // Remove from its parent by default if ( el.parentNode ) { el.parentNode.removeChild( el ); } // release memory in IE el = null; } } /** * Adds the same handler for all of the specified attrs * @param {String} attrs Pipe-separated list of attributes * @param {Function} handler The method that will be applied */ function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = arr.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } } /** * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex; // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } /** * Returns a function to use in pseudos for buttons * @param {String} type */ function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } /** * Returns a function to use in pseudos for :enabled/:disabled * @param {Boolean} disabled true for :disabled; false for :enabled */ function createDisabledPseudo( disabled ) { // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable return function( elem ) { // Only certain elements can match :enabled or :disabled // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled if ( "form" in elem ) { // Check for inherited disabledness on relevant non-disabled elements: // * listed form-associated elements in a disabled fieldset // https://html.spec.whatwg.org/multipage/forms.html#category-listed // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled // * option elements in a disabled optgroup // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled // All such elements have a "form" property. if ( elem.parentNode && elem.disabled === false ) { // Option elements defer to a parent optgroup if present if ( "label" in elem ) { if ( "label" in elem.parentNode ) { return elem.parentNode.disabled === disabled; } else { return elem.disabled === disabled; } } // Support: IE 6 - 11 // Use the isDisabled shortcut property to check for disabled fieldset ancestors return elem.isDisabled === disabled || // Where there is no isDisabled, check manually /* jshint -W018 */ elem.isDisabled !== !disabled && disabledAncestor( elem ) === disabled; } return elem.disabled === disabled; // Try to winnow out elements that can't be disabled before trusting the disabled property. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't // even exist on them, let alone have a boolean value. } else if ( "label" in elem ) { return elem.disabled === disabled; } // Remaining elements are neither :enabled nor :disabled return false; }; } /** * Returns a function to use in pseudos for positionals * @param {Function} fn */ function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Checks a node for validity as a Sizzle context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; } // Expose support vars for convenience support = Sizzle.support = {}; /** * Detects XML nodes * @param {Element|Object} elem An element or a document * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var hasCompare, subWindow, doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Update global variables document = doc; docElem = document.documentElement; documentIsHTML = !isXML( document ); // Support: IE 9-11, Edge // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) if ( preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow ) { // Support: IE 11, Edge if ( subWindow.addEventListener ) { subWindow.addEventListener( "unload", unloadHandler, false ); // Support: IE 9 - 10 only } else if ( subWindow.attachEvent ) { subWindow.attachEvent( "onunload", unloadHandler ); } } /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 // Verify that getAttribute really returns attributes and not properties // (excepting IE8 booleans) support.attributes = assert(function( el ) { el.className = "i"; return !el.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( el ) { el.appendChild( document.createComment("") ); return !el.getElementsByTagName("*").length; }); // Support: IE<9 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); // Support: IE<10 // Check if getElementById returns elements by name // The broken getElementById methods don't pick up programmatically-set names, // so use a roundabout getElementsByName test support.getById = assert(function( el ) { docElem.appendChild( el ).id = expando; return !document.getElementsByName || !document.getElementsByName( expando ).length; }); // ID filter and find if ( support.getById ) { Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var elem = context.getElementById( id ); return elem ? [ elem ] : []; } }; } else { Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; // Support: IE 6 - 7 only // getElementById is not reliable as a find shortcut Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var node, i, elems, elem = context.getElementById( id ); if ( elem ) { // Verify the id attribute node = elem.getAttributeNode("id"); if ( node && node.value === id ) { return [ elem ]; } // Fall back on getElementsByName elems = context.getElementsByName( id ); i = 0; while ( (elem = elems[i++]) ) { node = elem.getAttributeNode("id"); if ( node && node.value === id ) { return [ elem ]; } } } return []; } }; } // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( tag ); // DocumentFragment nodes don't have gEBTN } else if ( support.qsa ) { return context.querySelectorAll( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { return context.getElementsByClassName( className ); } }; /* QSA/matchesSelector ---------------------------------------------------------------------- */ // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21) // We allow this because of a bug in IE8/9 that throws an error // whenever `document.activeElement` is accessed on an iframe // So, we allow :focus to pass through QSA all the time to avoid the IE error // See https://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( el ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough // https://bugs.jquery.com/ticket/12359 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>"; // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= // The test attribute must be unknown in Opera but "safe" for WinRT // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section if ( el.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly if ( !el.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { rbuggyQSA.push("~="); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !el.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } // Support: Safari 8+, iOS 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 // In-page `selector#id sibling-combinator selector` fails if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { rbuggyQSA.push(".#.+[+~]"); } }); assert(function( el ) { el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>"; // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = document.createElement("input"); input.setAttribute( "type", "hidden" ); el.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute if ( el.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( el.querySelectorAll(":enabled").length !== 2 ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Support: IE9-11+ // IE's :disabled selector does not pick up the children of disabled fieldsets docElem.appendChild( el ).disabled = true; if ( el.querySelectorAll(":disabled").length !== 2 ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos el.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( el ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( el, "*" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( el, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); /* Contains ---------------------------------------------------------------------- */ hasCompare = rnative.test( docElem.compareDocumentPosition ); // Element contains another // Purposefully self-exclusive // As in, an element does not contain itself contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; /* Sorting ---------------------------------------------------------------------- */ // Document order sorting sortOrder = hasCompare ? function( a, b ) { // Flag for duplicate removal if ( a === b ) { hasDuplicate = true; return 0; } // Sort on method existence if only one input has compareDocumentPosition var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if ( compare ) { return compare; } // Calculate position if both inputs belong to the same document compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? a.compareDocumentPosition( b ) : // Otherwise we know they are disconnected 1; // Disconnected nodes if ( compare & 1 || (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { // Choose the first element that is related to our preferred document if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { return -1; } if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { return 1; } // Maintain original order return sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } : function( a, b ) { // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; } var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Parentless nodes are either documents or disconnected if ( !aup || !bup ) { return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return document; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); if ( support.matchesSelector && documentIsHTML && !compilerCache[ expr + " " ] && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch (e) {} } return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } var fn = Expr.attrHandle[ name.toLowerCase() ], // Don't get fooled by Object.prototype properties (jQuery #13807) val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute( name ) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; }; Sizzle.escape = function( sel ) { return (sel + "").replace( rcssescape, fcssescape ); }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; /** * Document sorting and removing duplicates * @param {ArrayLike} results */ Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } // Clear input after sorting to release objects // See https://github.com/jquery/sizzle/pull/225 sortInput = null; return results; }; /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (jQuery #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is if ( match[3] ) { match[2] = match[4] || match[5] || ""; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeNameSelector ) { var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? // Shortcut for :nth-*(n) function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, uniqueCache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } // Reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && useCache ) { // Seek `elem` from a previously-cached index // ...in a gzip-friendly way node = parent; outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); cache = uniqueCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex && cache[ 2 ]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } } else { // Use previously-cached element index if available if ( useCache ) { // ...in a gzip-friendly way node = elem; outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); cache = uniqueCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex; } // xml :nth-child(...) // or :nth-last-child(...) or :nth(-last)?-of-type(...) if ( diff === false ) { // Use the same loop as above to seek `elem` from the start while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { // Cache the index of each encountered element if ( useCache ) { outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); uniqueCache[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } } // Incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // Potentially complex pseudos "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); // Don't keep the element (issue #299) input[0] = null; return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { text = text.replace( runescape, funescape ); return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), // "Whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier C, // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." // http://www.w3.org/TR/selectors/#lang-pseudo "lang": markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), // Miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": createDisabledPseudo( false ), "disabled": createDisabledPseudo( true ), "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodeType < 6 works because attributes (2) do not appear as children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeType < 6 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && // Support: IE<8 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } // Easy API for creating new setFilters function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( (tokens = []) ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push({ value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) }); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push({ value: matched, type: type, matches: match }); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); }; function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, skip = combinator.next, key = skip || dir, checkNonElements = base && key === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } return false; } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var oldCache, uniqueCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); if ( skip && skip === elem.nodeName.toLowerCase() ) { elem = elem[ dir ] || elem; } else if ( (oldCache = uniqueCache[ key ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements uniqueCache[ key ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } return false; }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); // Avoid hanging onto element (issue #299) checkContext = null; return ret; } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( // If the preceding token was a descendant combinator, insert an implicit any-element `*` tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context === document || context || outermost; } // Add elements passing elementMatchers directly to results // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; if ( !context && elem.ownerDocument !== document ) { setDocument( elem ); xml = !documentIsHTML; } while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context || document, xml) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // `i` is now the count of elements visited above, and adding it to `matchedCount` // makes the latter nonnegative. matchedCount += i; // Apply set filters to unmatched elements // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` // equals `i`), unless we didn't visit _any_ elements in the above loop because we have // no element matchers and no seed. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that // case, which will result in a "00" `matchedCount` that differs from `i` but is also // numerically zero. if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !match ) { match = tokenize( selector ); } i = match.length; while ( i-- ) { cached = matcherFromTokens( match[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); // Save selector and tokenization cached.selector = selector; } return cached; }; /** * A low-level selection function that works with Sizzle's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled * selector function built with Sizzle.compile * @param {Element} context * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ select = Sizzle.select = function( selector, context, results, seed ) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize( (selector = compiled.selector || selector) ); results = results || []; // Try to minimize operations if there is only one selector in the list and no seed // (the latter of which guarantees us context) if ( match.length === 1 ) { // Reduce context if the leading compound selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; // Precompiled matchers will still verify ancestry, so step up a level } else if ( compiled ) { context = context.parentNode; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } // Compile and execute a filtering function if one is not provided // Provide `match` to avoid retokenization if we modified the selector above ( compiled || compile( selector, match ) )( seed, context, !documentIsHTML, results, !context || rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; }; // One-time assignments // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; // Support: Chrome 14-35+ // Always assume duplicates if they aren't passed to the comparison function support.detectDuplicates = !!hasDuplicate; // Initialize against the default document setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Detached nodes confoundingly follow *each other* support.sortDetached = assert(function( el ) { // Should return 1, but returns 4 (following) return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !assert(function( el ) { el.innerHTML = "<a href='#'></a>"; return el.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); } }); } // Support: IE<9 // Use defaultValue in place of getAttribute("value") if ( !support.attributes || !assert(function( el ) { el.innerHTML = "<input/>"; el.firstChild.setAttribute( "value", "" ); return el.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { return elem.defaultValue; } }); } // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies if ( !assert(function( el ) { return el.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; if ( !isXML ) { return elem[ name ] === true ? name.toLowerCase() : (val = elem.getAttributeNode( name )) && val.specified ? val.value : null; } }); } return Sizzle; })( window ); jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; // Deprecated jQuery.expr[ ":" ] = jQuery.expr.pseudos; jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; jQuery.escapeSelector = Sizzle.escape; var dir = function( elem, dir, until ) { var matched = [], truncate = until !== undefined; while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { if ( elem.nodeType === 1 ) { if ( truncate && jQuery( elem ).is( until ) ) { break; } matched.push( elem ); } } return matched; }; var siblings = function( n, elem ) { var matched = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { matched.push( n ); } } return matched; }; var rneedsContext = jQuery.expr.match.needsContext; function nodeName( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }; var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); var risSimple = /^.[^:#\[\.,]*$/; // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { return !!qualifier.call( elem, i, elem ) !== not; } ); } // Single element if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; } ); } // Arraylike of elements (jQuery, arguments, Array) if ( typeof qualifier !== "string" ) { return jQuery.grep( elements, function( elem ) { return ( indexOf.call( qualifier, elem ) > -1 ) !== not; } ); } // Simple selector that can be filtered directly, removing non-Elements if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } // Complex selector, compare the two sets, removing non-Elements qualifier = jQuery.filter( qualifier, elements ); return jQuery.grep( elements, function( elem ) { return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; } ); } jQuery.filter = function( expr, elems, not ) { var elem = elems[ 0 ]; if ( not ) { expr = ":not(" + expr + ")"; } if ( elems.length === 1 && elem.nodeType === 1 ) { return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; } return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; } ) ); }; jQuery.fn.extend( { find: function( selector ) { var i, ret, len = this.length, self = this; if ( typeof selector !== "string" ) { return this.pushStack( jQuery( selector ).filter( function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } } ) ); } ret = this.pushStack( [] ); for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } return len > 1 ? jQuery.uniqueSort( ret ) : ret; }, filter: function( selector ) { return this.pushStack( winnow( this, selector || [], false ) ); }, not: function( selector ) { return this.pushStack( winnow( this, selector || [], true ) ); }, is: function( selector ) { return !!winnow( this, // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". typeof selector === "string" && rneedsContext.test( selector ) ? jQuery( selector ) : selector || [], false ).length; } } ); // Initialize a jQuery object // A central reference to the root jQuery(document) var rootjQuery, // A simple way to check for HTML strings // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) // Shortcut simple #id case for speed rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery.fn.init = function( selector, context, root ) { var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Method init() accepts an alternate rootjQuery // so migrate can support jQuery.sub (gh-2101) root = root || rootjQuery; // Handle HTML strings if ( typeof selector === "string" ) { if ( selector[ 0 ] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && ( match[ 1 ] || !context ) ) { // HANDLE: $(html) -> $(array) if ( match[ 1 ] ) { context = context instanceof jQuery ? context[ 0 ] : context; // Option to run scripts is true for back-compat // Intentionally let the error be thrown if parseHTML is not present jQuery.merge( this, jQuery.parseHTML( match[ 1 ], context && context.nodeType ? context.ownerDocument || context : document, true ) ); // HANDLE: $(html, props) if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { for ( match in context ) { // Properties of context are called as methods if possible if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes } else { this.attr( match, context[ match ] ); } } } return this; // HANDLE: $(#id) } else { elem = document.getElementById( match[ 2 ] ); if ( elem ) { // Inject the element directly into the jQuery object this[ 0 ] = elem; this.length = 1; } return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || root ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(DOMElement) } else if ( selector.nodeType ) { this[ 0 ] = selector; this.length = 1; return this; // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return root.ready !== undefined ? root.ready( selector ) : // Execute immediately if ready is not present selector( jQuery ); } return jQuery.makeArray( selector, this ); }; // Give the init function the jQuery prototype for later instantiation init.prototype = jQuery.fn; // Initialize central reference rootjQuery = jQuery( document ); var rparentsprev = /^(?:parents|prev(?:Until|All))/, // Methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend( { has: function( target ) { var targets = jQuery( target, this ), l = targets.length; return this.filter( function() { var i = 0; for ( ; i < l; i++ ) { if ( jQuery.contains( this, targets[ i ] ) ) { return true; } } } ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, matched = [], targets = typeof selectors !== "string" && jQuery( selectors ); // Positional selectors never match, since there's no _selection_ context if ( !rneedsContext.test( selectors ) ) { for ( ; i < l; i++ ) { for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { // Always skip document fragments if ( cur.nodeType < 11 && ( targets ? targets.index( cur ) > -1 : // Don't pass non-elements to Sizzle cur.nodeType === 1 && jQuery.find.matchesSelector( cur, selectors ) ) ) { matched.push( cur ); break; } } } } return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); }, // Determine the position of an element within the set index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; } // Index in selector if ( typeof elem === "string" ) { return indexOf.call( jQuery( elem ), this[ 0 ] ); } // Locate the position of the desired element return indexOf.call( this, // If it receives a jQuery object, the first element is used elem.jquery ? elem[ 0 ] : elem ); }, add: function( selector, context ) { return this.pushStack( jQuery.uniqueSort( jQuery.merge( this.get(), jQuery( selector, context ) ) ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter( selector ) ); } } ); function sibling( cur, dir ) { while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} return cur; } jQuery.each( { parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return siblings( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return siblings( elem.firstChild ); }, contents: function( elem ) { if ( nodeName( elem, "iframe" ) ) { return elem.contentDocument; } // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only // Treat the template element as a regular one in browsers that // don't support it. if ( nodeName( elem, "template" ) ) { elem = elem.content || elem; } return jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var matched = jQuery.map( this, fn, until ); if ( name.slice( -5 ) !== "Until" ) { selector = until; } if ( selector && typeof selector === "string" ) { matched = jQuery.filter( selector, matched ); } if ( this.length > 1 ) { // Remove duplicates if ( !guaranteedUnique[ name ] ) { jQuery.uniqueSort( matched ); } // Reverse order for parents* and prev-derivatives if ( rparentsprev.test( name ) ) { matched.reverse(); } } return this.pushStack( matched ); }; } ); var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); // Convert String-formatted options into Object-formatted ones function createOptions( options ) { var object = {}; jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { object[ flag ] = true; } ); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? createOptions( options ) : jQuery.extend( {}, options ); var // Flag to know if list is currently firing firing, // Last fire value for non-forgettable lists memory, // Flag to know if list was already fired fired, // Flag to prevent firing locked, // Actual callback list list = [], // Queue of execution data for repeatable lists queue = [], // Index of currently firing callback (modified by add/remove as needed) firingIndex = -1, // Fire callbacks fire = function() { // Enforce single-firing locked = locked || options.once; // Execute callbacks for all pending executions, // respecting firingIndex overrides and runtime changes fired = firing = true; for ( ; queue.length; firingIndex = -1 ) { memory = queue.shift(); while ( ++firingIndex < list.length ) { // Run callback and check for early termination if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && options.stopOnFalse ) { // Jump to end and forget the data so .add doesn't re-fire firingIndex = list.length; memory = false; } } } // Forget the data if we're done with it if ( !options.memory ) { memory = false; } firing = false; // Clean up if we're done firing for good if ( locked ) { // Keep an empty list if we have data for future add calls if ( memory ) { list = []; // Otherwise, this object is spent } else { list = ""; } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // If we have memory from a past run, we should fire after adding if ( memory && !firing ) { firingIndex = list.length - 1; queue.push( memory ); } ( function add( args ) { jQuery.each( args, function( _, arg ) { if ( jQuery.isFunction( arg ) ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { // Inspect recursively add( arg ); } } ); } )( arguments ); if ( memory && !firing ) { fire(); } } return this; }, // Remove a callback from the list remove: function() { jQuery.each( arguments, function( _, arg ) { var index; while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( index <= firingIndex ) { firingIndex--; } } } ); return this; }, // Check if a given callback is in the list. // If no argument is given, return whether or not list has callbacks attached. has: function( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : list.length > 0; }, // Remove all callbacks from the list empty: function() { if ( list ) { list = []; } return this; }, // Disable .fire and .add // Abort any current/pending executions // Clear all callbacks and values disable: function() { locked = queue = []; list = memory = ""; return this; }, disabled: function() { return !list; }, // Disable .fire // Also disable .add unless we have memory (since it would have no effect) // Abort any pending executions lock: function() { locked = queue = []; if ( !memory && !firing ) { list = memory = ""; } return this; }, locked: function() { return !!locked; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( !locked ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; queue.push( args ); if ( !firing ) { fire(); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; function Identity( v ) { return v; } function Thrower( ex ) { throw ex; } function adoptValue( value, resolve, reject, noValue ) { var method; try { // Check for promise aspect first to privilege synchronous behavior if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { method.call( value ).done( resolve ).fail( reject ); // Other thenables } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { method.call( value, resolve, reject ); // Other non-thenables } else { // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: // * false: [ value ].slice( 0 ) => resolve( value ) // * true: [ value ].slice( 1 ) => resolve() resolve.apply( undefined, [ value ].slice( noValue ) ); } // For Promises/A+, convert exceptions into rejections // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in // Deferred#then to conditionally suppress rejection. } catch ( value ) { // Support: Android 4.0 only // Strict mode functions invoked without .call/.apply get global-object context reject.apply( undefined, [ value ] ); } } jQuery.extend( { Deferred: function( func ) { var tuples = [ // action, add listener, callbacks, // ... .then handlers, argument index, [final state] [ "notify", "progress", jQuery.Callbacks( "memory" ), jQuery.Callbacks( "memory" ), 2 ], [ "resolve", "done", jQuery.Callbacks( "once memory" ), jQuery.Callbacks( "once memory" ), 0, "resolved" ], [ "reject", "fail", jQuery.Callbacks( "once memory" ), jQuery.Callbacks( "once memory" ), 1, "rejected" ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, "catch": function( fn ) { return promise.then( null, fn ); }, // Keep pipe for back-compat pipe: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred( function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { // Map tuples (progress, done, fail) to arguments (done, fail, progress) var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; // deferred.progress(function() { bind to newDefer or newDefer.notify }) // deferred.done(function() { bind to newDefer or newDefer.resolve }) // deferred.fail(function() { bind to newDefer or newDefer.reject }) deferred[ tuple[ 1 ] ]( function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .progress( newDefer.notify ) .done( newDefer.resolve ) .fail( newDefer.reject ); } else { newDefer[ tuple[ 0 ] + "With" ]( this, fn ? [ returned ] : arguments ); } } ); } ); fns = null; } ).promise(); }, then: function( onFulfilled, onRejected, onProgress ) { var maxDepth = 0; function resolve( depth, deferred, handler, special ) { return function() { var that = this, args = arguments, mightThrow = function() { var returned, then; // Support: Promises/A+ section 2.3.3.3.3 // https://promisesaplus.com/#point-59 // Ignore double-resolution attempts if ( depth < maxDepth ) { return; } returned = handler.apply( that, args ); // Support: Promises/A+ section 2.3.1 // https://promisesaplus.com/#point-48 if ( returned === deferred.promise() ) { throw new TypeError( "Thenable self-resolution" ); } // Support: Promises/A+ sections 2.3.3.1, 3.5 // https://promisesaplus.com/#point-54 // https://promisesaplus.com/#point-75 // Retrieve `then` only once then = returned && // Support: Promises/A+ section 2.3.4 // https://promisesaplus.com/#point-64 // Only check objects and functions for thenability ( typeof returned === "object" || typeof returned === "function" ) && returned.then; // Handle a returned thenable if ( jQuery.isFunction( then ) ) { // Special processors (notify) just wait for resolution if ( special ) { then.call( returned, resolve( maxDepth, deferred, Identity, special ), resolve( maxDepth, deferred, Thrower, special ) ); // Normal processors (resolve) also hook into progress } else { // ...and disregard older resolution values maxDepth++; then.call( returned, resolve( maxDepth, deferred, Identity, special ), resolve( maxDepth, deferred, Thrower, special ), resolve( maxDepth, deferred, Identity, deferred.notifyWith ) ); } // Handle all other returned values } else { // Only substitute handlers pass on context // and multiple values (non-spec behavior) if ( handler !== Identity ) { that = undefined; args = [ returned ]; } // Process the value(s) // Default process is resolve ( special || deferred.resolveWith )( that, args ); } }, // Only normal processors (resolve) catch and reject exceptions process = special ? mightThrow : function() { try { mightThrow(); } catch ( e ) { if ( jQuery.Deferred.exceptionHook ) { jQuery.Deferred.exceptionHook( e, process.stackTrace ); } // Support: Promises/A+ section 2.3.3.3.4.1 // https://promisesaplus.com/#point-61 // Ignore post-resolution exceptions if ( depth + 1 >= maxDepth ) { // Only substitute handlers pass on context // and multiple values (non-spec behavior) if ( handler !== Thrower ) { that = undefined; args = [ e ]; } deferred.rejectWith( that, args ); } } }; // Support: Promises/A+ section 2.3.3.3.1 // https://promisesaplus.com/#point-57 // Re-resolve promises immediately to dodge false rejection from // subsequent errors if ( depth ) { process(); } else { // Call an optional hook to record the stack, in case of exception // since it's otherwise lost when execution goes async if ( jQuery.Deferred.getStackHook ) { process.stackTrace = jQuery.Deferred.getStackHook(); } window.setTimeout( process ); } }; } return jQuery.Deferred( function( newDefer ) { // progress_handlers.add( ... ) tuples[ 0 ][ 3 ].add( resolve( 0, newDefer, jQuery.isFunction( onProgress ) ? onProgress : Identity, newDefer.notifyWith ) ); // fulfilled_handlers.add( ... ) tuples[ 1 ][ 3 ].add( resolve( 0, newDefer, jQuery.isFunction( onFulfilled ) ? onFulfilled : Identity ) ); // rejected_handlers.add( ... ) tuples[ 2 ][ 3 ].add( resolve( 0, newDefer, jQuery.isFunction( onRejected ) ? onRejected : Thrower ) ); } ).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 5 ]; // promise.progress = list.add // promise.done = list.add // promise.fail = list.add promise[ tuple[ 1 ] ] = list.add; // Handle state if ( stateString ) { list.add( function() { // state = "resolved" (i.e., fulfilled) // state = "rejected" state = stateString; }, // rejected_callbacks.disable // fulfilled_callbacks.disable tuples[ 3 - i ][ 2 ].disable, // progress_callbacks.lock tuples[ 0 ][ 2 ].lock ); } // progress_handlers.fire // fulfilled_handlers.fire // rejected_handlers.fire list.add( tuple[ 3 ].fire ); // deferred.notify = function() { deferred.notifyWith(...) } // deferred.resolve = function() { deferred.resolveWith(...) } // deferred.reject = function() { deferred.rejectWith(...) } deferred[ tuple[ 0 ] ] = function() { deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); return this; }; // deferred.notifyWith = list.fireWith // deferred.resolveWith = list.fireWith // deferred.rejectWith = list.fireWith deferred[ tuple[ 0 ] + "With" ] = list.fireWith; } ); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( singleValue ) { var // count of uncompleted subordinates remaining = arguments.length, // count of unprocessed arguments i = remaining, // subordinate fulfillment data resolveContexts = Array( i ), resolveValues = slice.call( arguments ), // the master Deferred master = jQuery.Deferred(), // subordinate callback factory updateFunc = function( i ) { return function( value ) { resolveContexts[ i ] = this; resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( !( --remaining ) ) { master.resolveWith( resolveContexts, resolveValues ); } }; }; // Single- and empty arguments are adopted like Promise.resolve if ( remaining <= 1 ) { adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, !remaining ); // Use .then() to unwrap secondary thenables (cf. gh-3000) if ( master.state() === "pending" || jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { return master.then(); } } // Multiple arguments are aggregated like Promise.all array elements while ( i-- ) { adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); } return master.promise(); } } ); // These usually indicate a programmer mistake during development, // warn about them ASAP rather than swallowing them by default. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; jQuery.Deferred.exceptionHook = function( error, stack ) { // Support: IE 8 - 9 only // Console exists when dev tools are open, which can happen at any time if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); } }; jQuery.readyException = function( error ) { window.setTimeout( function() { throw error; } ); }; // The deferred used on DOM ready var readyList = jQuery.Deferred(); jQuery.fn.ready = function( fn ) { readyList .then( fn ) // Wrap jQuery.readyException in a function so that the lookup // happens at the time of error handling instead of callback // registration. .catch( function( error ) { jQuery.readyException( error ); } ); return this; }; jQuery.extend( { // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); } } ); jQuery.ready.then = readyList.then; // The ready event handler and self cleanup method function completed() { document.removeEventListener( "DOMContentLoaded", completed ); window.removeEventListener( "load", completed ); jQuery.ready(); } // Catch cases where $(document).ready() is called // after the browser event has already occurred. // Support: IE <=9 - 10 only // Older IE sometimes signals "interactive" too soon if ( document.readyState === "complete" || ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { // Handle it asynchronously to allow scripts the opportunity to delay ready window.setTimeout( jQuery.ready ); } else { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed ); } // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, len = elems.length, bulk = key == null; // Sets many values if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { access( elems, fn, i, key[ i ], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !jQuery.isFunction( value ) ) { raw = true; } if ( bulk ) { // Bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < len; i++ ) { fn( elems[ i ], key, raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) ); } } } if ( chainable ) { return elems; } // Gets if ( bulk ) { return fn.call( elems ); } return len ? fn( elems[ 0 ], key ) : emptyGet; }; var acceptData = function( owner ) { // Accepts only: // - Node // - Node.ELEMENT_NODE // - Node.DOCUMENT_NODE // - Object // - Any return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); }; function Data() { this.expando = jQuery.expando + Data.uid++; } Data.uid = 1; Data.prototype = { cache: function( owner ) { // Check if the owner object already has a cache var value = owner[ this.expando ]; // If not, create one if ( !value ) { value = {}; // We can accept data for non-element nodes in modern browsers, // but we should not, see #8335. // Always return an empty object. if ( acceptData( owner ) ) { // If it is a node unlikely to be stringify-ed or looped over // use plain assignment if ( owner.nodeType ) { owner[ this.expando ] = value; // Otherwise secure it in a non-enumerable property // configurable must be true to allow the property to be // deleted when data is removed } else { Object.defineProperty( owner, this.expando, { value: value, configurable: true } ); } } } return value; }, set: function( owner, data, value ) { var prop, cache = this.cache( owner ); // Handle: [ owner, key, value ] args // Always use camelCase key (gh-2257) if ( typeof data === "string" ) { cache[ jQuery.camelCase( data ) ] = value; // Handle: [ owner, { properties } ] args } else { // Copy the properties one-by-one to the cache object for ( prop in data ) { cache[ jQuery.camelCase( prop ) ] = data[ prop ]; } } return cache; }, get: function( owner, key ) { return key === undefined ? this.cache( owner ) : // Always use camelCase key (gh-2257) owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; }, access: function( owner, key, value ) { // In cases where either: // // 1. No key was specified // 2. A string key was specified, but no value provided // // Take the "read" path and allow the get method to determine // which value to return, respectively either: // // 1. The entire cache object // 2. The data stored at the key // if ( key === undefined || ( ( key && typeof key === "string" ) && value === undefined ) ) { return this.get( owner, key ); } // When the key is not a string, or both a key and value // are specified, set or extend (existing objects) with either: // // 1. An object of properties // 2. A key and value // this.set( owner, key, value ); // Since the "set" path can have two possible entry points // return the expected data based on which path was taken[*] return value !== undefined ? value : key; }, remove: function( owner, key ) { var i, cache = owner[ this.expando ]; if ( cache === undefined ) { return; } if ( key !== undefined ) { // Support array or space separated string of keys if ( Array.isArray( key ) ) { // If key is an array of keys... // We always set camelCase keys, so remove that. key = key.map( jQuery.camelCase ); } else { key = jQuery.camelCase( key ); // If a key with the spaces exists, use it. // Otherwise, create an array by matching non-whitespace key = key in cache ? [ key ] : ( key.match( rnothtmlwhite ) || [] ); } i = key.length; while ( i-- ) { delete cache[ key[ i ] ]; } } // Remove the expando if there's no more data if ( key === undefined || jQuery.isEmptyObject( cache ) ) { // Support: Chrome <=35 - 45 // Webkit & Blink performance suffers when deleting properties // from DOM nodes, so set to undefined instead // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) if ( owner.nodeType ) { owner[ this.expando ] = undefined; } else { delete owner[ this.expando ]; } } }, hasData: function( owner ) { var cache = owner[ this.expando ]; return cache !== undefined && !jQuery.isEmptyObject( cache ); } }; var dataPriv = new Data(); var dataUser = new Data(); // Implementation Summary // // 1. Enforce API surface and semantic compatibility with 1.9.x branch // 2. Improve the module's maintainability by reducing the storage // paths to a single mechanism. // 3. Use the same single mechanism to support "private" and "user" data. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) // 5. Avoid exposing implementation details on user objects (eg. expando properties) // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; function getData( data ) { if ( data === "true" ) { return true; } if ( data === "false" ) { return false; } if ( data === "null" ) { return null; } // Only convert to a number if it doesn't change the string if ( data === +data + "" ) { return +data; } if ( rbrace.test( data ) ) { return JSON.parse( data ); } return data; } function dataAttr( elem, key, data ) { var name; // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = getData( data ); } catch ( e ) {} // Make sure we set the data so it isn't changed later dataUser.set( elem, key, data ); } else { data = undefined; } } return data; } jQuery.extend( { hasData: function( elem ) { return dataUser.hasData( elem ) || dataPriv.hasData( elem ); }, data: function( elem, name, data ) { return dataUser.access( elem, name, data ); }, removeData: function( elem, name ) { dataUser.remove( elem, name ); }, // TODO: Now that all calls to _data and _removeData have been replaced // with direct calls to dataPriv methods, these can be deprecated. _data: function( elem, name, data ) { return dataPriv.access( elem, name, data ); }, _removeData: function( elem, name ) { dataPriv.remove( elem, name ); } } ); jQuery.fn.extend( { data: function( key, value ) { var i, name, data, elem = this[ 0 ], attrs = elem && elem.attributes; // Gets all values if ( key === undefined ) { if ( this.length ) { data = dataUser.get( elem ); if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { i = attrs.length; while ( i-- ) { // Support: IE 11 only // The attrs elements can be null (#14894) if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.slice( 5 ) ); dataAttr( elem, name, data[ name ] ); } } } dataPriv.set( elem, "hasDataAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each( function() { dataUser.set( this, key ); } ); } return access( this, function( value ) { var data; // The calling jQuery object (element matches) is not empty // (and therefore has an element appears at this[ 0 ]) and the // `value` parameter was not undefined. An empty jQuery object // will result in `undefined` for elem = this[ 0 ] which will // throw an exception if an attempt to read a data cache is made. if ( elem && value === undefined ) { // Attempt to get data from the cache // The key will always be camelCased in Data data = dataUser.get( elem, key ); if ( data !== undefined ) { return data; } // Attempt to "discover" the data in // HTML5 custom data-* attrs data = dataAttr( elem, key ); if ( data !== undefined ) { return data; } // We tried really hard, but the data doesn't exist. return; } // Set the data... this.each( function() { // We always store the camelCased key dataUser.set( this, key, value ); } ); }, null, value, arguments.length > 1, null, true ); }, removeData: function( key ) { return this.each( function() { dataUser.remove( this, key ); } ); } } ); jQuery.extend( { queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = dataPriv.get( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || Array.isArray( data ) ) { queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // Clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // Not public - generate a queueHooks object, or return the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { empty: jQuery.Callbacks( "once memory" ).add( function() { dataPriv.remove( elem, [ type + "queue", key ] ); } ) } ); } } ); jQuery.fn.extend( { queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[ 0 ], type ); } return data === undefined ? this : this.each( function() { var queue = jQuery.queue( this, type, data ); // Ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { jQuery.dequeue( this, type ); } } ); }, dequeue: function( type ) { return this.each( function() { jQuery.dequeue( this, type ); } ); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } } ); var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; var isHiddenWithinTree = function( elem, el ) { // isHiddenWithinTree might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; // Inline style trumps all return elem.style.display === "none" || elem.style.display === "" && // Otherwise, check computed style // Support: Firefox <=43 - 45 // Disconnected elements can have computed display: none, so first confirm that elem is // in the document. jQuery.contains( elem.ownerDocument, elem ) && jQuery.css( elem, "display" ) === "none"; }; var swap = function( elem, options, callback, args ) { var ret, name, old = {}; // Remember the old values, and insert the new ones for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.apply( elem, args || [] ); // Revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; }; function adjustCSS( elem, prop, valueParts, tween ) { var adjusted, scale = 1, maxIterations = 20, currentValue = tween ? function() { return tween.cur(); } : function() { return jQuery.css( elem, prop, "" ); }, initial = currentValue(), unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), // Starting value computation is required for potential unit mismatches initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && rcssNum.exec( jQuery.css( elem, prop ) ); if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { // Trust units reported by jQuery.css unit = unit || initialInUnit[ 3 ]; // Make sure we update the tween properties later on valueParts = valueParts || []; // Iteratively approximate from a nonzero starting point initialInUnit = +initial || 1; do { // If previous iteration zeroed out, double until we get *something*. // Use string for doubling so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply initialInUnit = initialInUnit / scale; jQuery.style( elem, prop, initialInUnit + unit ); // Update scale, tolerating zero or NaN from tween.cur() // Break the loop if scale is unchanged or perfect, or if we've just had enough. } while ( scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations ); } if ( valueParts ) { initialInUnit = +initialInUnit || +initial || 0; // Apply relative offset (+=/-=) if specified adjusted = valueParts[ 1 ] ? initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : +valueParts[ 2 ]; if ( tween ) { tween.unit = unit; tween.start = initialInUnit; tween.end = adjusted; } } return adjusted; } var defaultDisplayMap = {}; function getDefaultDisplay( elem ) { var temp, doc = elem.ownerDocument, nodeName = elem.nodeName, display = defaultDisplayMap[ nodeName ]; if ( display ) { return display; } temp = doc.body.appendChild( doc.createElement( nodeName ) ); display = jQuery.css( temp, "display" ); temp.parentNode.removeChild( temp ); if ( display === "none" ) { display = "block"; } defaultDisplayMap[ nodeName ] = display; return display; } function showHide( elements, show ) { var display, elem, values = [], index = 0, length = elements.length; // Determine new display value for elements that need to change for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } display = elem.style.display; if ( show ) { // Since we force visibility upon cascade-hidden elements, an immediate (and slow) // check is required in this first loop unless we have a nonempty display value (either // inline or about-to-be-restored) if ( display === "none" ) { values[ index ] = dataPriv.get( elem, "display" ) || null; if ( !values[ index ] ) { elem.style.display = ""; } } if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { values[ index ] = getDefaultDisplay( elem ); } } else { if ( display !== "none" ) { values[ index ] = "none"; // Remember what we're overwriting dataPriv.set( elem, "display", display ); } } } // Set the display of the elements in a second loop to avoid constant reflow for ( index = 0; index < length; index++ ) { if ( values[ index ] != null ) { elements[ index ].style.display = values[ index ]; } } return elements; } jQuery.fn.extend( { show: function() { return showHide( this, true ); }, hide: function() { return showHide( this ); }, toggle: function( state ) { if ( typeof state === "boolean" ) { return state ? this.show() : this.hide(); } return this.each( function() { if ( isHiddenWithinTree( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); } } ); } } ); var rcheckableType = ( /^(?:checkbox|radio)$/i ); var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); var rscriptType = ( /^$|\/(?:java|ecma)script/i ); // We have to close these tags to support XHTML (#13200) var wrapMap = { // Support: IE <=9 only option: [ 1, "<select multiple='multiple'>", "</select>" ], // XHTML parsers do not magically insert elements in the // same way that tag soup parsers do. So we cannot shorten // this by omitting <tbody> or other required elements. thead: [ 1, "<table>", "</table>" ], col: [ 2, "<table><colgroup>", "</colgroup></table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], _default: [ 0, "", "" ] }; // Support: IE <=9 only wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; function getAll( context, tag ) { // Support: IE <=9 - 11 only // Use typeof to avoid zero-argument method invocation on host objects (#15151) var ret; if ( typeof context.getElementsByTagName !== "undefined" ) { ret = context.getElementsByTagName( tag || "*" ); } else if ( typeof context.querySelectorAll !== "undefined" ) { ret = context.querySelectorAll( tag || "*" ); } else { ret = []; } if ( tag === undefined || tag && nodeName( context, tag ) ) { return jQuery.merge( [ context ], ret ); } return ret; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var i = 0, l = elems.length; for ( ; i < l; i++ ) { dataPriv.set( elems[ i ], "globalEval", !refElements || dataPriv.get( refElements[ i ], "globalEval" ) ); } } var rhtml = /<|&#?\w+;/; function buildFragment( elems, context, scripts, selection, ignored ) { var elem, tmp, tag, wrap, contains, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); // Convert non-html into a text node } else if ( !rhtml.test( elem ) ) { nodes.push( context.createTextNode( elem ) ); // Convert html into DOM nodes } else { tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); // Deserialize a standard representation tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; // Descend through wrappers to the right content j = wrap[ 0 ]; while ( j-- ) { tmp = tmp.lastChild; } // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, tmp.childNodes ); // Remember the top-level container tmp = fragment.firstChild; // Ensure the created nodes are orphaned (#12392) tmp.textContent = ""; } } } // Remove wrapper from fragment fragment.textContent = ""; i = 0; while ( ( elem = nodes[ i++ ] ) ) { // Skip elements already in the context collection (trac-4087) if ( selection && jQuery.inArray( elem, selection ) > -1 ) { if ( ignored ) { ignored.push( elem ); } continue; } contains = jQuery.contains( elem.ownerDocument, elem ); // Append to fragment tmp = getAll( fragment.appendChild( elem ), "script" ); // Preserve script evaluation history if ( contains ) { setGlobalEval( tmp ); } // Capture executables if ( scripts ) { j = 0; while ( ( elem = tmp[ j++ ] ) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } return fragment; } ( function() { var fragment = document.createDocumentFragment(), div = fragment.appendChild( document.createElement( "div" ) ), input = document.createElement( "input" ); // Support: Android 4.0 - 4.3 only // Check state lost if the name is set (#11217) // Support: Windows Web Apps (WWA) // `name` and `type` must use .setAttribute for WWA (#14901) input.setAttribute( "type", "radio" ); input.setAttribute( "checked", "checked" ); input.setAttribute( "name", "t" ); div.appendChild( input ); // Support: Android <=4.1 only // Older WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE <=11 only // Make sure textarea (and checkbox) defaultValue is properly cloned div.innerHTML = "<textarea>x</textarea>"; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; } )(); var documentElement = document.documentElement; var rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rtypenamespace = /^([^.]*)(?:\.(.+)|)/; function returnTrue() { return true; } function returnFalse() { return false; } // Support: IE <=9 only // See #13393 for more info function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } function on( elem, types, selector, data, fn, one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { on( elem, type, selector, data, types[ type ], one ); } return elem; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return elem; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return elem.each( function() { jQuery.event.add( this, types, fn, data, selector ); } ); } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get( elem ); // Don't attach events to noData or text/comment nodes (but allow plain objects) if ( !elemData ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Ensure that invalid selectors throw exceptions at attach time // Evaluate against documentElement in case elem is a non-element node (e.g., document) if ( selector ) { jQuery.find.matchesSelector( documentElement, selector ); } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first if ( !( events = elemData.events ) ) { events = elemData.events = {}; } if ( !( eventHandle = elemData.handle ) ) { eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply( elem, arguments ) : undefined; }; } // Handle multiple events separated by a space types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; type = origType = tmp[ 1 ]; namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); // There *must* be a type, no attaching namespace-only handlers if ( !type ) { continue; } // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend( { type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join( "." ) }, handleObjIn ); // Init the event handler queue if we're the first if ( !( handlers = events[ type ] ) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } }, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); if ( !elemData || !( events = elemData.events ) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; type = origType = tmp[ 1 ]; namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[ 2 ] && new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); // Remove matching events origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove data and the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { dataPriv.remove( elem, "handle events" ); } }, dispatch: function( nativeEvent ) { // Make a writable jQuery.Event from the native event object var event = jQuery.event.fix( nativeEvent ); var i, j, ret, matched, handleObj, handlerQueue, args = new Array( arguments.length ), handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[ 0 ] = event; for ( i = 1; i < arguments.length; i++ ) { args[ i ] = arguments[ i ]; } event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers handlerQueue = jQuery.event.handlers.call( this, event, handlers ); // Run delegates first; they may want to stop propagation beneath us i = 0; while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( ( handleObj = matched.handlers[ j++ ] ) && !event.isImmediatePropagationStopped() ) { // Triggered event must either 1) have no namespace, or 2) have namespace(s) // a subset or equal to those in the bound event (both can have no namespace). if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || handleObj.handler ).apply( matched.elem, args ); if ( ret !== undefined ) { if ( ( event.result = ret ) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var i, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Find delegate handlers if ( delegateCount && // Support: IE <=9 // Black-hole SVG <use> instance trees (trac-13180) cur.nodeType && // Support: Firefox <=42 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click // Support: IE 11 only // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) !( event.type === "click" && event.button >= 1 ) ) { for ( ; cur !== this; cur = cur.parentNode || this ) { // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { matchedHandlers = []; matchedSelectors = {}; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matchedSelectors[ sel ] === undefined ) { matchedSelectors[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) > -1 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matchedSelectors[ sel ] ) { matchedHandlers.push( handleObj ); } } if ( matchedHandlers.length ) { handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); } } } } // Add the remaining (directly-bound) handlers cur = this; if ( delegateCount < handlers.length ) { handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); } return handlerQueue; }, addProp: function( name, hook ) { Object.defineProperty( jQuery.Event.prototype, name, { enumerable: true, configurable: true, get: jQuery.isFunction( hook ) ? function() { if ( this.originalEvent ) { return hook( this.originalEvent ); } } : function() { if ( this.originalEvent ) { return this.originalEvent[ name ]; } }, set: function( value ) { Object.defineProperty( this, name, { enumerable: true, configurable: true, writable: true, value: value } ); } } ); }, fix: function( originalEvent ) { return originalEvent[ jQuery.expando ] ? originalEvent : new jQuery.Event( originalEvent ); }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { // Fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== safeActiveElement() && this.focus ) { this.focus(); return false; } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === safeActiveElement() && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, click: { // For checkbox, fire native event so checked state will be right trigger: function() { if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { this.click(); return false; } }, // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { return nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( event ) { // Support: Firefox 20+ // Firefox doesn't alert if the returnValue field is not set. if ( event.result !== undefined && event.originalEvent ) { event.originalEvent.returnValue = event.result; } } } } }; jQuery.removeEvent = function( elem, type, handle ) { // This "if" is needed for plain objects if ( elem.removeEventListener ) { elem.removeEventListener( type, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !( this instanceof jQuery.Event ) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && // Support: Android <=2.3 only src.returnValue === false ? returnTrue : returnFalse; // Create target properties // Support: Safari <=6 - 7 only // Target should not be a text node (#504, #13143) this.target = ( src.target && src.target.nodeType === 3 ) ? src.target.parentNode : src.target; this.currentTarget = src.currentTarget; this.relatedTarget = src.relatedTarget; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { constructor: jQuery.Event, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, isSimulated: false, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( e && !this.isSimulated ) { e.preventDefault(); } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( e && !this.isSimulated ) { e.stopPropagation(); } }, stopImmediatePropagation: function() { var e = this.originalEvent; this.isImmediatePropagationStopped = returnTrue; if ( e && !this.isSimulated ) { e.stopImmediatePropagation(); } this.stopPropagation(); } }; // Includes all common event props including KeyEvent and MouseEvent specific props jQuery.each( { altKey: true, bubbles: true, cancelable: true, changedTouches: true, ctrlKey: true, detail: true, eventPhase: true, metaKey: true, pageX: true, pageY: true, shiftKey: true, view: true, "char": true, charCode: true, key: true, keyCode: true, button: true, buttons: true, clientX: true, clientY: true, offsetX: true, offsetY: true, pointerId: true, pointerType: true, screenX: true, screenY: true, targetTouches: true, toElement: true, touches: true, which: function( event ) { var button = event.button; // Add which for key events if ( event.which == null && rkeyEvent.test( event.type ) ) { return event.charCode != null ? event.charCode : event.keyCode; } // Add which for click: 1 === left; 2 === middle; 3 === right if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { if ( button & 1 ) { return 1; } if ( button & 2 ) { return 3; } if ( button & 4 ) { return 2; } return 0; } return event.which; } }, jQuery.event.addProp ); // Create mouseenter/leave events using mouseover/out and event-time checks // so that event delegation works in jQuery. // Do the same for pointerenter/pointerleave and pointerover/pointerout // // Support: Safari 7 only // Safari sends mouseenter too often; see: // https://bugs.chromium.org/p/chromium/issues/detail?id=470258 // for the description of the bug (it existed in older Chrome versions as well). jQuery.each( { mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mouseenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; } ); jQuery.fn.extend( { on: function( types, selector, data, fn ) { return on( this, types, selector, data, fn ); }, one: function( types, selector, data, fn ) { return on( this, types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each( function() { jQuery.event.remove( this, types, fn, selector ); } ); } } ); var /* eslint-disable max-len */ // See https://github.com/eslint/eslint/issues/3229 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, /* eslint-enable */ // Support: IE <=10 - 11, Edge 12 - 13 // In IE/Edge using regex groups here causes severe slowdowns. // See https://connect.microsoft.com/IE/feedback/details/1736512/ rnoInnerhtml = /<script|<style|<link/i, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; // Prefer a tbody over its parent table for containing new rows function manipulationTarget( elem, content ) { if ( nodeName( elem, "table" ) && nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { return jQuery( ">tbody", elem )[ 0 ] || elem; } return elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[ 1 ]; } else { elem.removeAttribute( "type" ); } return elem; } function cloneCopyEvent( src, dest ) { var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; if ( dest.nodeType !== 1 ) { return; } // 1. Copy private data: events, handlers, etc. if ( dataPriv.hasData( src ) ) { pdataOld = dataPriv.access( src ); pdataCur = dataPriv.set( dest, pdataOld ); events = pdataOld.events; if ( events ) { delete pdataCur.handle; pdataCur.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } } // 2. Copy user data if ( dataUser.hasData( src ) ) { udataOld = dataUser.access( src ); udataCur = jQuery.extend( {}, udataOld ); dataUser.set( dest, udataCur ); } } // Fix IE bugs, see support tests function fixInput( src, dest ) { var nodeName = dest.nodeName.toLowerCase(); // Fails to persist the checked state of a cloned checkbox or radio button. if ( nodeName === "input" && rcheckableType.test( src.type ) ) { dest.checked = src.checked; // Fails to return the selected option to the default selected state when cloning options } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } function domManip( collection, args, callback, ignored ) { // Flatten any nested arrays args = concat.apply( [], args ); var fragment, first, scripts, hasScripts, node, doc, i = 0, l = collection.length, iNoClone = l - 1, value = args[ 0 ], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return collection.each( function( index ) { var self = collection.eq( index ); if ( isFunction ) { args[ 0 ] = value.call( this, index, self.html() ); } domManip( self, args, callback, ignored ); } ); } if ( l ) { fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } // Require either new content or an interest in ignored elements to invoke the callback if ( first || ignored ) { scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; // Use the original fragment for the last item // instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); // Keep references to cloned scripts for later restoration if ( hasScripts ) { // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( collection[ i ], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; // Reenable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !dataPriv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); } } } } } } return collection; } function remove( elem, selector, keepData ) { var node, nodes = selector ? jQuery.filter( selector, elem ) : elem, i = 0; for ( ; ( node = nodes[ i ] ) != null; i++ ) { if ( !keepData && node.nodeType === 1 ) { jQuery.cleanData( getAll( node ) ); } if ( node.parentNode ) { if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { setGlobalEval( getAll( node, "script" ) ); } node.parentNode.removeChild( node ); } } return elem; } jQuery.extend( { htmlPrefilter: function( html ) { return html.replace( rxhtmlTag, "<$1></$2>" ); }, clone: function( elem, dataAndEvents, deepDataAndEvents ) { var i, l, srcElements, destElements, clone = elem.cloneNode( true ), inPage = jQuery.contains( elem.ownerDocument, elem ); // Fix IE cloning issues if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); for ( i = 0, l = srcElements.length; i < l; i++ ) { fixInput( srcElements[ i ], destElements[ i ] ); } } // Copy the events from the original to the clone if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0, l = srcElements.length; i < l; i++ ) { cloneCopyEvent( srcElements[ i ], destElements[ i ] ); } } else { cloneCopyEvent( elem, clone ); } } // Preserve script evaluation history destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } // Return the cloned set return clone; }, cleanData: function( elems ) { var data, elem, type, special = jQuery.event.special, i = 0; for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { if ( acceptData( elem ) ) { if ( ( data = elem[ dataPriv.expando ] ) ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Support: Chrome <=35 - 45+ // Assign undefined instead of using delete, see Data#remove elem[ dataPriv.expando ] = undefined; } if ( elem[ dataUser.expando ] ) { // Support: Chrome <=35 - 45+ // Assign undefined instead of using delete, see Data#remove elem[ dataUser.expando ] = undefined; } } } } } ); jQuery.fn.extend( { detach: function( selector ) { return remove( this, selector, true ); }, remove: function( selector ) { return remove( this, selector ); }, text: function( value ) { return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().each( function() { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { this.textContent = value; } } ); }, null, value, arguments.length ); }, append: function() { return domManip( this, arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } } ); }, prepend: function() { return domManip( this, arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } } ); }, before: function() { return domManip( this, arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } } ); }, after: function() { return domManip( this, arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } } ); }, empty: function() { var elem, i = 0; for ( ; ( elem = this[ i ] ) != null; i++ ) { if ( elem.nodeType === 1 ) { // Prevent memory leaks jQuery.cleanData( getAll( elem, false ) ); // Remove any remaining nodes elem.textContent = ""; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); } ); }, html: function( value ) { return access( this, function( value ) { var elem = this[ 0 ] || {}, i = 0, l = this.length; if ( value === undefined && elem.nodeType === 1 ) { return elem.innerHTML; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { value = jQuery.htmlPrefilter( value ); try { for ( ; i < l; i++ ) { elem = this[ i ] || {}; // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch ( e ) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function() { var ignored = []; // Make the changes, replacing each non-ignored context element with the new content return domManip( this, arguments, function( elem ) { var parent = this.parentNode; if ( jQuery.inArray( this, ignored ) < 0 ) { jQuery.cleanData( getAll( this ) ); if ( parent ) { parent.replaceChild( elem, this ); } } // Force callback invocation }, ignored ); } } ); jQuery.each( { appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, ret = [], insert = jQuery( selector ), last = insert.length - 1, i = 0; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone( true ); jQuery( insert[ i ] )[ original ]( elems ); // Support: Android <=4.0 only, PhantomJS 1 only // .get() because push.apply(_, arraylike) throws on ancient WebKit push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; } ); var rmargin = ( /^margin/ ); var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); var getStyles = function( elem ) { // Support: IE <=11 only, Firefox <=30 (#15098, #14150) // IE throws on elements created in popups // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" var view = elem.ownerDocument.defaultView; if ( !view || !view.opener ) { view = window; } return view.getComputedStyle( elem ); }; ( function() { // Executing both pixelPosition & boxSizingReliable tests require only one layout // so they're executed at the same time to save the second computation. function computeStyleTests() { // This is a singleton, we need to execute it only once if ( !div ) { return; } div.style.cssText = "box-sizing:border-box;" + "position:relative;display:block;" + "margin:auto;border:1px;padding:1px;" + "top:1%;width:50%"; div.innerHTML = ""; documentElement.appendChild( container ); var divStyle = window.getComputedStyle( div ); pixelPositionVal = divStyle.top !== "1%"; // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 reliableMarginLeftVal = divStyle.marginLeft === "2px"; boxSizingReliableVal = divStyle.width === "4px"; // Support: Android 4.0 - 4.3 only // Some styles come back with percentage values, even though they shouldn't div.style.marginRight = "50%"; pixelMarginRightVal = divStyle.marginRight === "4px"; documentElement.removeChild( container ); // Nullify the div so it wouldn't be stored in the memory and // it will also be a sign that checks already performed div = null; } var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, container = document.createElement( "div" ), div = document.createElement( "div" ); // Finish early in limited (non-browser) environments if ( !div.style ) { return; } // Support: IE <=9 - 11 only // Style of cloned element affects source element cloned (#8908) div.style.backgroundClip = "content-box"; div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + "padding:0;margin-top:1px;position:absolute"; container.appendChild( div ); jQuery.extend( support, { pixelPosition: function() { computeStyleTests(); return pixelPositionVal; }, boxSizingReliable: function() { computeStyleTests(); return boxSizingReliableVal; }, pixelMarginRight: function() { computeStyleTests(); return pixelMarginRightVal; }, reliableMarginLeft: function() { computeStyleTests(); return reliableMarginLeftVal; } } ); } )(); function curCSS( elem, name, computed ) { var width, minWidth, maxWidth, ret, // Support: Firefox 51+ // Retrieving style before computed somehow // fixes an issue with getting wrong values // on detached elements style = elem.style; computed = computed || getStyles( elem ); // getPropertyValue is needed for: // .css('filter') (IE 9 only, #12537) // .css('--customProperty) (#3144) if ( computed ) { ret = computed.getPropertyValue( name ) || computed[ name ]; if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); } // A tribute to the "awesome hack by Dean Edwards" // Android Browser returns percentage for some values, // but width seems to be reliably pixels. // This is against the CSSOM draft spec: // https://drafts.csswg.org/cssom/#resolved-values if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { // Remember the original values width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; // Put in the new values to get a computed value out style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; // Revert the changed values style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } return ret !== undefined ? // Support: IE <=9 - 11 only // IE returns zIndex value as an integer. ret + "" : ret; } function addGetHookIf( conditionFn, hookFn ) { // Define the hook, we'll check on the first run if it's really needed. return { get: function() { if ( conditionFn() ) { // Hook not needed (or it's not possible to use it due // to missing dependency), remove it. delete this.get; return; } // Hook needed; redefine it so that the support test is not executed again. return ( this.get = hookFn ).apply( this, arguments ); } }; } var // Swappable if display is none or starts with table // except "table", "table-cell", or "table-caption" // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, rcustomProp = /^--/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: "0", fontWeight: "400" }, cssPrefixes = [ "Webkit", "Moz", "ms" ], emptyStyle = document.createElement( "div" ).style; // Return a css property mapped to a potentially vendor prefixed property function vendorPropName( name ) { // Shortcut for names that are not vendor prefixed if ( name in emptyStyle ) { return name; } // Check for vendor prefixed names var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in emptyStyle ) { return name; } } } // Return a property mapped along what jQuery.cssProps suggests or to // a vendor prefixed property. function finalPropName( name ) { var ret = jQuery.cssProps[ name ]; if ( !ret ) { ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; } return ret; } function setPositiveNumber( elem, value, subtract ) { // Any relative (+/-) values have already been // normalized at this point var matches = rcssNum.exec( value ); return matches ? // Guard against undefined "subtract", e.g., when used as in cssHooks Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { var i, val = 0; // If we already have the right measurement, avoid augmentation if ( extra === ( isBorderBox ? "border" : "content" ) ) { i = 4; // Otherwise initialize for horizontal or vertical properties } else { i = name === "width" ? 1 : 0; } for ( ; i < 4; i += 2 ) { // Both box models exclude margin, so add it if we want it if ( extra === "margin" ) { val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); } if ( isBorderBox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); } // At this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } else { // At this point, extra isn't content, so add padding val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); // At this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } } return val; } function getWidthOrHeight( elem, name, extra ) { // Start with computed style var valueIsBorderBox, styles = getStyles( elem ), val = curCSS( elem, name, styles ), isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; // Computed unit is not pixels. Stop here and return. if ( rnumnonpx.test( val ) ) { return val; } // Check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] ); // Fall back to offsetWidth/Height when value is "auto" // This happens for inline elements with no explicit setting (gh-3571) if ( val === "auto" ) { val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ]; } // Normalize "", auto, and prepare for extra val = parseFloat( val ) || 0; // Use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox, styles ) ) + "px"; } jQuery.extend( { // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // We should always get a number back from opacity var ret = curCSS( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, // Don't automatically add "px" to these possibly-unitless properties cssNumber: { "animationIterationCount": true, "columnCount": true, "fillOpacity": true, "flexGrow": true, "flexShrink": true, "fontWeight": true, "lineHeight": true, "opacity": true, "order": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { "float": "cssFloat" }, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } // Make sure that we're working with the right name var ret, type, hooks, origName = jQuery.camelCase( name ), isCustomProp = rcustomProp.test( name ), style = elem.style; // Make sure that we're working with the right name. We don't // want to query the value if it is a CSS custom property // since they are user-defined. if ( !isCustomProp ) { name = finalPropName( origName ); } // Gets hook for the prefixed version, then unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // Check if we're setting a value if ( value !== undefined ) { type = typeof value; // Convert "+=" or "-=" to relative numbers (#7345) if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { value = adjustCSS( elem, name, ret ); // Fixes bug #9237 type = "number"; } // Make sure that null and NaN values aren't set (#7116) if ( value == null || value !== value ) { return; } // If a number was passed in, add the unit (except for certain CSS properties) if ( type === "number" ) { value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); } // background-* props affect original clone's values if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { style[ name ] = "inherit"; } // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !( "set" in hooks ) || ( value = hooks.set( elem, value, extra ) ) !== undefined ) { if ( isCustomProp ) { style.setProperty( name, value ); } else { style[ name ] = value; } } } else { // If a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { return ret; } // Otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, extra, styles ) { var val, num, hooks, origName = jQuery.camelCase( name ), isCustomProp = rcustomProp.test( name ); // Make sure that we're working with the right name. We don't // want to modify the value if it is a CSS custom property // since they are user-defined. if ( !isCustomProp ) { name = finalPropName( origName ); } // Try prefixed name followed by the unprefixed name hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // If a hook was provided get the computed value from there if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } // Otherwise, if a way to get the computed value exists, use that if ( val === undefined ) { val = curCSS( elem, name, styles ); } // Convert "normal" to computed value if ( val === "normal" && name in cssNormalTransform ) { val = cssNormalTransform[ name ]; } // Make numeric if forced or a qualifier was provided and val looks numeric if ( extra === "" || extra ) { num = parseFloat( val ); return extra === true || isFinite( num ) ? num || 0 : val; } return val; } } ); jQuery.each( [ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { if ( computed ) { // Certain elements can have dimension info if we invisibly show them // but it must have a current display style that would benefit return rdisplayswap.test( jQuery.css( elem, "display" ) ) && // Support: Safari 8+ // Table columns in Safari have non-zero offsetWidth & zero // getBoundingClientRect().width unless display is changed. // Support: IE <=11 only // Running getBoundingClientRect on a disconnected node // in IE throws an error. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? swap( elem, cssShow, function() { return getWidthOrHeight( elem, name, extra ); } ) : getWidthOrHeight( elem, name, extra ); } }, set: function( elem, value, extra ) { var matches, styles = extra && getStyles( elem ), subtract = extra && augmentWidthOrHeight( elem, name, extra, jQuery.css( elem, "boxSizing", false, styles ) === "border-box", styles ); // Convert to pixels if value adjustment is needed if ( subtract && ( matches = rcssNum.exec( value ) ) && ( matches[ 3 ] || "px" ) !== "px" ) { elem.style[ name ] = value; value = jQuery.css( elem, name ); } return setPositiveNumber( elem, value, subtract ); } }; } ); jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, function( elem, computed ) { if ( computed ) { return ( parseFloat( curCSS( elem, "marginLeft" ) ) || elem.getBoundingClientRect().left - swap( elem, { marginLeft: 0 }, function() { return elem.getBoundingClientRect().left; } ) ) + "px"; } } ); // These hooks are used by animate to expand properties jQuery.each( { margin: "", padding: "", border: "Width" }, function( prefix, suffix ) { jQuery.cssHooks[ prefix + suffix ] = { expand: function( value ) { var i = 0, expanded = {}, // Assumes a single number if not a string parts = typeof value === "string" ? value.split( " " ) : [ value ]; for ( ; i < 4; i++ ) { expanded[ prefix + cssExpand[ i ] + suffix ] = parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; } return expanded; } }; if ( !rmargin.test( prefix ) ) { jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; } } ); jQuery.fn.extend( { css: function( name, value ) { return access( this, function( elem, name, value ) { var styles, len, map = {}, i = 0; if ( Array.isArray( name ) ) { styles = getStyles( elem ); len = name.length; for ( ; i < len; i++ ) { map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); } return map; } return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }, name, value, arguments.length > 1 ); } } ); function Tween( elem, options, prop, end, easing ) { return new Tween.prototype.init( elem, options, prop, end, easing ); } jQuery.Tween = Tween; Tween.prototype = { constructor: Tween, init: function( elem, options, prop, end, easing, unit ) { this.elem = elem; this.prop = prop; this.easing = easing || jQuery.easing._default; this.options = options; this.start = this.now = this.cur(); this.end = end; this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); }, cur: function() { var hooks = Tween.propHooks[ this.prop ]; return hooks && hooks.get ? hooks.get( this ) : Tween.propHooks._default.get( this ); }, run: function( percent ) { var eased, hooks = Tween.propHooks[ this.prop ]; if ( this.options.duration ) { this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration ); } else { this.pos = eased = percent; } this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); } if ( hooks && hooks.set ) { hooks.set( this ); } else { Tween.propHooks._default.set( this ); } return this; } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { _default: { get: function( tween ) { var result; // Use a property on the element directly when it is not a DOM element, // or when there is no matching style property that exists. if ( tween.elem.nodeType !== 1 || tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { return tween.elem[ tween.prop ]; } // Passing an empty string as a 3rd parameter to .css will automatically // attempt a parseFloat and fallback to a string if the parse fails. // Simple values such as "10px" are parsed to Float; // complex values such as "rotate(1rad)" are returned as-is. result = jQuery.css( tween.elem, tween.prop, "" ); // Empty strings, null, undefined and "auto" are converted to 0. return !result || result === "auto" ? 0 : result; }, set: function( tween ) { // Use step hook for back compat. // Use cssHook if its there. // Use .style if available and use plain properties where available. if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.nodeType === 1 && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { tween.elem[ tween.prop ] = tween.now; } } } }; // Support: IE <=9 only // Panic based approach to setting things on disconnected nodes Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { set: function( tween ) { if ( tween.elem.nodeType && tween.elem.parentNode ) { tween.elem[ tween.prop ] = tween.now; } } }; jQuery.easing = { linear: function( p ) { return p; }, swing: function( p ) { return 0.5 - Math.cos( p * Math.PI ) / 2; }, _default: "swing" }; jQuery.fx = Tween.prototype.init; // Back compat <1.8 extension point jQuery.fx.step = {}; var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/; function schedule() { if ( inProgress ) { if ( document.hidden === false && window.requestAnimationFrame ) { window.requestAnimationFrame( schedule ); } else { window.setTimeout( schedule, jQuery.fx.interval ); } jQuery.fx.tick(); } } // Animations created synchronously will run synchronously function createFxNow() { window.setTimeout( function() { fxNow = undefined; } ); return ( fxNow = jQuery.now() ); } // Generate parameters to create a standard animation function genFx( type, includeWidth ) { var which, i = 0, attrs = { height: type }; // If we include width, step value is 1 to do all cssExpand values, // otherwise step value is 2 to skip over Left and Right includeWidth = includeWidth ? 1 : 0; for ( ; i < 4; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; } function createTween( value, prop, animation ) { var tween, collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), index = 0, length = collection.length; for ( ; index < length; index++ ) { if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { // We're done with this property return tween; } } } function defaultPrefilter( elem, props, opts ) { var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, isBox = "width" in props || "height" in props, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree( elem ), dataShow = dataPriv.get( elem, "fxshow" ); // Queue-skipping animations hijack the fx hooks if ( !opts.queue ) { hooks = jQuery._queueHooks( elem, "fx" ); if ( hooks.unqueued == null ) { hooks.unqueued = 0; oldfire = hooks.empty.fire; hooks.empty.fire = function() { if ( !hooks.unqueued ) { oldfire(); } }; } hooks.unqueued++; anim.always( function() { // Ensure the complete handler is called before this completes anim.always( function() { hooks.unqueued--; if ( !jQuery.queue( elem, "fx" ).length ) { hooks.empty.fire(); } } ); } ); } // Detect show/hide animations for ( prop in props ) { value = props[ prop ]; if ( rfxtypes.test( value ) ) { delete props[ prop ]; toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { // Pretend to be hidden if this is a "show" and // there is still data from a stopped show/hide if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { hidden = true; // Ignore all other no-op show/hide data } else { continue; } } orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); } } // Bail out if this is a no-op like .hide().hide() propTween = !jQuery.isEmptyObject( props ); if ( !propTween && jQuery.isEmptyObject( orig ) ) { return; } // Restrict "overflow" and "display" styles during box animations if ( isBox && elem.nodeType === 1 ) { // Support: IE <=9 - 11, Edge 12 - 13 // Record all 3 overflow attributes because IE does not infer the shorthand // from identically-valued overflowX and overflowY opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; // Identify a display type, preferring old show/hide data over the CSS cascade restoreDisplay = dataShow && dataShow.display; if ( restoreDisplay == null ) { restoreDisplay = dataPriv.get( elem, "display" ); } display = jQuery.css( elem, "display" ); if ( display === "none" ) { if ( restoreDisplay ) { display = restoreDisplay; } else { // Get nonempty value(s) by temporarily forcing visibility showHide( [ elem ], true ); restoreDisplay = elem.style.display || restoreDisplay; display = jQuery.css( elem, "display" ); showHide( [ elem ] ); } } // Animate inline elements as inline-block if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { if ( jQuery.css( elem, "float" ) === "none" ) { // Restore the original display value at the end of pure show/hide animations if ( !propTween ) { anim.done( function() { style.display = restoreDisplay; } ); if ( restoreDisplay == null ) { display = style.display; restoreDisplay = display === "none" ? "" : display; } } style.display = "inline-block"; } } } if ( opts.overflow ) { style.overflow = "hidden"; anim.always( function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; } ); } // Implement show/hide animations propTween = false; for ( prop in orig ) { // General show/hide setup for this element animation if ( !propTween ) { if ( dataShow ) { if ( "hidden" in dataShow ) { hidden = dataShow.hidden; } } else { dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); } // Store hidden/visible for toggle so `.stop().toggle()` "reverses" if ( toggle ) { dataShow.hidden = !hidden; } // Show elements before animating them if ( hidden ) { showHide( [ elem ], true ); } /* eslint-disable no-loop-func */ anim.done( function() { /* eslint-enable no-loop-func */ // The final step of a "hide" animation is actually hiding the element if ( !hidden ) { showHide( [ elem ] ); } dataPriv.remove( elem, "fxshow" ); for ( prop in orig ) { jQuery.style( elem, prop, orig[ prop ] ); } } ); } // Per-property setup propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = propTween.start; if ( hidden ) { propTween.end = propTween.start; propTween.start = 0; } } } } function propFilter( props, specialEasing ) { var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass for ( index in props ) { name = jQuery.camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( Array.isArray( value ) ) { easing = value[ 1 ]; value = props[ index ] = value[ 0 ]; } if ( index !== name ) { props[ name ] = value; delete props[ index ]; } hooks = jQuery.cssHooks[ name ]; if ( hooks && "expand" in hooks ) { value = hooks.expand( value ); delete props[ name ]; // Not quite $.extend, this won't overwrite existing keys. // Reusing 'index' because we have the correct "name" for ( index in value ) { if ( !( index in props ) ) { props[ index ] = value[ index ]; specialEasing[ index ] = easing; } } } else { specialEasing[ name ] = easing; } } } function Animation( elem, properties, options ) { var result, stopped, index = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always( function() { // Don't match elem in the :animated selector delete tick.elem; } ), tick = function() { if ( stopped ) { return false; } var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), // Support: Android 2.3 only // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; for ( ; index < length; index++ ) { animation.tweens[ index ].run( percent ); } deferred.notifyWith( elem, [ animation, percent, remaining ] ); // If there's more to do, yield if ( percent < 1 && length ) { return remaining; } // If this was an empty animation, synthesize a final progress notification if ( !length ) { deferred.notifyWith( elem, [ animation, 1, 0 ] ); } // Resolve the animation and report its conclusion deferred.resolveWith( elem, [ animation ] ); return false; }, animation = deferred.promise( { elem: elem, props: jQuery.extend( {}, properties ), opts: jQuery.extend( true, { specialEasing: {}, easing: jQuery.easing._default }, options ), originalProperties: properties, originalOptions: options, startTime: fxNow || createFxNow(), duration: options.duration, tweens: [], createTween: function( prop, end ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, stop: function( gotoEnd ) { var index = 0, // If we are going to the end, we want to run all the tweens // otherwise we skip this part length = gotoEnd ? animation.tweens.length : 0; if ( stopped ) { return this; } stopped = true; for ( ; index < length; index++ ) { animation.tweens[ index ].run( 1 ); } // Resolve when we played the last frame; otherwise, reject if ( gotoEnd ) { deferred.notifyWith( elem, [ animation, 1, 0 ] ); deferred.resolveWith( elem, [ animation, gotoEnd ] ); } else { deferred.rejectWith( elem, [ animation, gotoEnd ] ); } return this; } } ), props = animation.props; propFilter( props, animation.opts.specialEasing ); for ( ; index < length; index++ ) { result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); if ( result ) { if ( jQuery.isFunction( result.stop ) ) { jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = jQuery.proxy( result.stop, result ); } return result; } } jQuery.map( props, createTween, animation ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } // Attach callbacks from options animation .progress( animation.opts.progress ) .done( animation.opts.done, animation.opts.complete ) .fail( animation.opts.fail ) .always( animation.opts.always ); jQuery.fx.timer( jQuery.extend( tick, { elem: elem, anim: animation, queue: animation.opts.queue } ) ); return animation; } jQuery.Animation = jQuery.extend( Animation, { tweeners: { "*": [ function( prop, value ) { var tween = this.createTween( prop, value ); adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); return tween; } ] }, tweener: function( props, callback ) { if ( jQuery.isFunction( props ) ) { callback = props; props = [ "*" ]; } else { props = props.match( rnothtmlwhite ); } var prop, index = 0, length = props.length; for ( ; index < length; index++ ) { prop = props[ index ]; Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; Animation.tweeners[ prop ].unshift( callback ); } }, prefilters: [ defaultPrefilter ], prefilter: function( callback, prepend ) { if ( prepend ) { Animation.prefilters.unshift( callback ); } else { Animation.prefilters.push( callback ); } } } ); jQuery.speed = function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing }; // Go to the end state if fx are off if ( jQuery.fx.off ) { opt.duration = 0; } else { if ( typeof opt.duration !== "number" ) { if ( opt.duration in jQuery.fx.speeds ) { opt.duration = jQuery.fx.speeds[ opt.duration ]; } else { opt.duration = jQuery.fx.speeds._default; } } } // Normalize opt.queue - true/undefined/null -> "fx" if ( opt.queue == null || opt.queue === true ) { opt.queue = "fx"; } // Queueing opt.old = opt.complete; opt.complete = function() { if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } if ( opt.queue ) { jQuery.dequeue( this, opt.queue ); } }; return opt; }; jQuery.fn.extend( { fadeTo: function( speed, to, easing, callback ) { // Show any hidden elements after setting opacity to 0 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() // Animate to the value specified .end().animate( { opacity: to }, speed, easing, callback ); }, animate: function( prop, speed, easing, callback ) { var empty = jQuery.isEmptyObject( prop ), optall = jQuery.speed( speed, easing, callback ), doAnimation = function() { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation( this, jQuery.extend( {}, prop ), optall ); // Empty animations, or finishing resolves immediately if ( empty || dataPriv.get( this, "finish" ) ) { anim.stop( true ); } }; doAnimation.finish = doAnimation; return empty || optall.queue === false ? this.each( doAnimation ) : this.queue( optall.queue, doAnimation ); }, stop: function( type, clearQueue, gotoEnd ) { var stopQueue = function( hooks ) { var stop = hooks.stop; delete hooks.stop; stop( gotoEnd ); }; if ( typeof type !== "string" ) { gotoEnd = clearQueue; clearQueue = type; type = undefined; } if ( clearQueue && type !== false ) { this.queue( type || "fx", [] ); } return this.each( function() { var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = dataPriv.get( this ); if ( index ) { if ( data[ index ] && data[ index ].stop ) { stopQueue( data[ index ] ); } } else { for ( index in data ) { if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { stopQueue( data[ index ] ); } } } for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && ( type == null || timers[ index ].queue === type ) ) { timers[ index ].anim.stop( gotoEnd ); dequeue = false; timers.splice( index, 1 ); } } // Start the next in the queue if the last step wasn't forced. // Timers currently will call their complete callbacks, which // will dequeue but only if they were gotoEnd. if ( dequeue || !gotoEnd ) { jQuery.dequeue( this, type ); } } ); }, finish: function( type ) { if ( type !== false ) { type = type || "fx"; } return this.each( function() { var index, data = dataPriv.get( this ), queue = data[ type + "queue" ], hooks = data[ type + "queueHooks" ], timers = jQuery.timers, length = queue ? queue.length : 0; // Enable finishing flag on private data data.finish = true; // Empty the queue first jQuery.queue( this, type, [] ); if ( hooks && hooks.stop ) { hooks.stop.call( this, true ); } // Look for any active animations, and finish them for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && timers[ index ].queue === type ) { timers[ index ].anim.stop( true ); timers.splice( index, 1 ); } } // Look for any animations in the old queue and finish them for ( index = 0; index < length; index++ ) { if ( queue[ index ] && queue[ index ].finish ) { queue[ index ].finish.call( this ); } } // Turn off finishing flag delete data.finish; } ); } } ); jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { return speed == null || typeof speed === "boolean" ? cssFn.apply( this, arguments ) : this.animate( genFx( name, true ), speed, easing, callback ); }; } ); // Generate shortcuts for custom animations jQuery.each( { slideDown: genFx( "show" ), slideUp: genFx( "hide" ), slideToggle: genFx( "toggle" ), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; } ); jQuery.timers = []; jQuery.fx.tick = function() { var timer, i = 0, timers = jQuery.timers; fxNow = jQuery.now(); for ( ; i < timers.length; i++ ) { timer = timers[ i ]; // Run the timer and safely remove it when done (allowing for external removal) if ( !timer() && timers[ i ] === timer ) { timers.splice( i--, 1 ); } } if ( !timers.length ) { jQuery.fx.stop(); } fxNow = undefined; }; jQuery.fx.timer = function( timer ) { jQuery.timers.push( timer ); jQuery.fx.start(); }; jQuery.fx.interval = 13; jQuery.fx.start = function() { if ( inProgress ) { return; } inProgress = true; schedule(); }; jQuery.fx.stop = function() { inProgress = null; }; jQuery.fx.speeds = { slow: 600, fast: 200, // Default speed _default: 400 }; // Based off of the plugin by Clint Helfers, with permission. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ jQuery.fn.delay = function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = window.setTimeout( next, time ); hooks.stop = function() { window.clearTimeout( timeout ); }; } ); }; ( function() { var input = document.createElement( "input" ), select = document.createElement( "select" ), opt = select.appendChild( document.createElement( "option" ) ); input.type = "checkbox"; // Support: Android <=4.3 only // Default value for a checkbox should be "on" support.checkOn = input.value !== ""; // Support: IE <=11 only // Must access selectedIndex to make default options select support.optSelected = opt.selected; // Support: IE <=11 only // An input loses its value after becoming a radio input = document.createElement( "input" ); input.value = "t"; input.type = "radio"; support.radioValue = input.value === "t"; } )(); var boolHook, attrHandle = jQuery.expr.attrHandle; jQuery.fn.extend( { attr: function( name, value ) { return access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each( function() { jQuery.removeAttr( this, name ); } ); } } ); jQuery.extend( { attr: function( elem, name, value ) { var ret, hooks, nType = elem.nodeType; // Don't get/set attributes on text, comment and attribute nodes if ( nType === 3 || nType === 8 || nType === 2 ) { return; } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === "undefined" ) { return jQuery.prop( elem, name, value ); } // Attribute hooks are determined by the lowercase version // Grab necessary hook if one is defined if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { hooks = jQuery.attrHooks[ name.toLowerCase() ] || ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); return; } if ( hooks && "set" in hooks && ( ret = hooks.set( elem, value, name ) ) !== undefined ) { return ret; } elem.setAttribute( name, value + "" ); return value; } if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { return ret; } ret = jQuery.find.attr( elem, name ); // Non-existent attributes return null, we normalize to undefined return ret == null ? undefined : ret; }, attrHooks: { type: { set: function( elem, value ) { if ( !support.radioValue && value === "radio" && nodeName( elem, "input" ) ) { var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } } }, removeAttr: function( elem, value ) { var name, i = 0, // Attribute names can contain non-HTML whitespace characters // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 attrNames = value && value.match( rnothtmlwhite ); if ( attrNames && elem.nodeType === 1 ) { while ( ( name = attrNames[ i++ ] ) ) { elem.removeAttribute( name ); } } } } ); // Hooks for boolean attributes boolHook = { set: function( elem, value, name ) { if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else { elem.setAttribute( name, name ); } return name; } }; jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { var getter = attrHandle[ name ] || jQuery.find.attr; attrHandle[ name ] = function( elem, name, isXML ) { var ret, handle, lowercaseName = name.toLowerCase(); if ( !isXML ) { // Avoid an infinite loop by temporarily removing this function from the getter handle = attrHandle[ lowercaseName ]; attrHandle[ lowercaseName ] = ret; ret = getter( elem, name, isXML ) != null ? lowercaseName : null; attrHandle[ lowercaseName ] = handle; } return ret; }; } ); var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i; jQuery.fn.extend( { prop: function( name, value ) { return access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { return this.each( function() { delete this[ jQuery.propFix[ name ] || name ]; } ); } } ); jQuery.extend( { prop: function( elem, name, value ) { var ret, hooks, nType = elem.nodeType; // Don't get/set properties on text, comment and attribute nodes if ( nType === 3 || nType === 8 || nType === 2 ) { return; } if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && ( ret = hooks.set( elem, value, name ) ) !== undefined ) { return ret; } return ( elem[ name ] = value ); } if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { return ret; } return elem[ name ]; }, propHooks: { tabIndex: { get: function( elem ) { // Support: IE <=9 - 11 only // elem.tabIndex doesn't always return the // correct value when it hasn't been explicitly set // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ // Use proper attribute retrieval(#12072) var tabindex = jQuery.find.attr( elem, "tabindex" ); if ( tabindex ) { return parseInt( tabindex, 10 ); } if ( rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ) { return 0; } return -1; } } }, propFix: { "for": "htmlFor", "class": "className" } } ); // Support: IE <=11 only // Accessing the selectedIndex property // forces the browser to respect setting selected // on the option // The getter ensures a default option is selected // when in an optgroup // eslint rule "no-unused-expressions" is disabled for this code // since it considers such accessions noop if ( !support.optSelected ) { jQuery.propHooks.selected = { get: function( elem ) { /* eslint no-unused-expressions: "off" */ var parent = elem.parentNode; if ( parent && parent.parentNode ) { parent.parentNode.selectedIndex; } return null; }, set: function( elem ) { /* eslint no-unused-expressions: "off" */ var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } } }; } jQuery.each( [ "tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable" ], function() { jQuery.propFix[ this.toLowerCase() ] = this; } ); // Strip and collapse whitespace according to HTML spec // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace function stripAndCollapse( value ) { var tokens = value.match( rnothtmlwhite ) || []; return tokens.join( " " ); } function getClass( elem ) { return elem.getAttribute && elem.getAttribute( "class" ) || ""; } jQuery.fn.extend( { addClass: function( value ) { var classes, elem, cur, curValue, clazz, j, finalValue, i = 0; if ( jQuery.isFunction( value ) ) { return this.each( function( j ) { jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); } ); } if ( typeof value === "string" && value ) { classes = value.match( rnothtmlwhite ) || []; while ( ( elem = this[ i++ ] ) ) { curValue = getClass( elem ); cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); if ( cur ) { j = 0; while ( ( clazz = classes[ j++ ] ) ) { if ( cur.indexOf( " " + clazz + " " ) < 0 ) { cur += clazz + " "; } } // Only assign if different to avoid unneeded rendering. finalValue = stripAndCollapse( cur ); if ( curValue !== finalValue ) { elem.setAttribute( "class", finalValue ); } } } } return this; }, removeClass: function( value ) { var classes, elem, cur, curValue, clazz, j, finalValue, i = 0; if ( jQuery.isFunction( value ) ) { return this.each( function( j ) { jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); } ); } if ( !arguments.length ) { return this.attr( "class", "" ); } if ( typeof value === "string" && value ) { classes = value.match( rnothtmlwhite ) || []; while ( ( elem = this[ i++ ] ) ) { curValue = getClass( elem ); // This expression is here for better compressibility (see addClass) cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); if ( cur ) { j = 0; while ( ( clazz = classes[ j++ ] ) ) { // Remove *all* instances while ( cur.indexOf( " " + clazz + " " ) > -1 ) { cur = cur.replace( " " + clazz + " ", " " ); } } // Only assign if different to avoid unneeded rendering. finalValue = stripAndCollapse( cur ); if ( curValue !== finalValue ) { elem.setAttribute( "class", finalValue ); } } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value; if ( typeof stateVal === "boolean" && type === "string" ) { return stateVal ? this.addClass( value ) : this.removeClass( value ); } if ( jQuery.isFunction( value ) ) { return this.each( function( i ) { jQuery( this ).toggleClass( value.call( this, i, getClass( this ), stateVal ), stateVal ); } ); } return this.each( function() { var className, i, self, classNames; if ( type === "string" ) { // Toggle individual class names i = 0; self = jQuery( this ); classNames = value.match( rnothtmlwhite ) || []; while ( ( className = classNames[ i++ ] ) ) { // Check each className given, space separated list if ( self.hasClass( className ) ) { self.removeClass( className ); } else { self.addClass( className ); } } // Toggle whole class name } else if ( value === undefined || type === "boolean" ) { className = getClass( this ); if ( className ) { // Store className if set dataPriv.set( this, "__className__", className ); } // If the element has a class name or if we're passed `false`, // then remove the whole classname (if there was one, the above saved it). // Otherwise bring back whatever was previously saved (if anything), // falling back to the empty string if nothing was stored. if ( this.setAttribute ) { this.setAttribute( "class", className || value === false ? "" : dataPriv.get( this, "__className__" ) || "" ); } } } ); }, hasClass: function( selector ) { var className, elem, i = 0; className = " " + selector + " "; while ( ( elem = this[ i++ ] ) ) { if ( elem.nodeType === 1 && ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { return true; } } return false; } } ); var rreturn = /\r/g; jQuery.fn.extend( { val: function( value ) { var hooks, ret, isFunction, elem = this[ 0 ]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && ( ret = hooks.get( elem, "value" ) ) !== undefined ) { return ret; } ret = elem.value; // Handle most common string cases if ( typeof ret === "string" ) { return ret.replace( rreturn, "" ); } // Handle cases where value is null/undef or number return ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each( function( i ) { var val; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, jQuery( this ).val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( Array.isArray( val ) ) { val = jQuery.map( val, function( value ) { return value == null ? "" : value + ""; } ); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; // If set returns undefined, fall back to normal setting if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } } ); } } ); jQuery.extend( { valHooks: { option: { get: function( elem ) { var val = jQuery.find.attr( elem, "value" ); return val != null ? val : // Support: IE <=10 - 11 only // option.text throws exceptions (#14686, #14858) // Strip and collapse whitespace // https://html.spec.whatwg.org/#strip-and-collapse-whitespace stripAndCollapse( jQuery.text( elem ) ); } }, select: { get: function( elem ) { var value, option, i, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one", values = one ? null : [], max = one ? index + 1 : options.length; if ( index < 0 ) { i = max; } else { i = one ? index : 0; } // Loop through all the selected options for ( ; i < max; i++ ) { option = options[ i ]; // Support: IE <=9 only // IE8-9 doesn't update selected after form reset (#2551) if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup !option.disabled && ( !option.parentNode.disabled || !nodeName( option.parentNode, "optgroup" ) ) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; }, set: function( elem, value ) { var optionSet, option, options = elem.options, values = jQuery.makeArray( value ), i = options.length; while ( i-- ) { option = options[ i ]; /* eslint-disable no-cond-assign */ if ( option.selected = jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) { optionSet = true; } /* eslint-enable no-cond-assign */ } // Force browsers to behave consistently when non-matching value is set if ( !optionSet ) { elem.selectedIndex = -1; } return values; } } } } ); // Radios and checkboxes getter/setter jQuery.each( [ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { set: function( elem, value ) { if ( Array.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); } } }; if ( !support.checkOn ) { jQuery.valHooks[ this ].get = function( elem ) { return elem.getAttribute( "value" ) === null ? "on" : elem.value; }; } } ); // Return jQuery for attributes-only inclusion var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; jQuery.extend( jQuery.event, { trigger: function( event, data, elem, onlyHandlers ) { var i, cur, tmp, bubbleType, ontype, handle, special, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; cur = tmp = elem = elem || document; // Don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf( "." ) > -1 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split( "." ); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexOf( ":" ) < 0 && "on" + type; // Caller can pass in a jQuery.Event object, Object, or just an event type string event = event[ jQuery.expando ] ? event : new jQuery.Event( type, typeof event === "object" && event ); // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) event.isTrigger = onlyHandlers ? 2 : 3; event.namespace = namespaces.join( "." ); event.rnamespace = event.namespace ? new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : null; // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data == null ? [ event ] : jQuery.makeArray( data, [ event ] ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { cur = cur.parentNode; } for ( ; cur; cur = cur.parentNode ) { eventPath.push( cur ); tmp = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( tmp === ( elem.ownerDocument || document ) ) { eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } // Fire handlers on the event path i = 0; while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && dataPriv.get( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Native handler handle = ontype && cur[ ontype ]; if ( handle && handle.apply && acceptData( cur ) ) { event.result = handle.apply( cur, data ); if ( event.result === false ) { event.preventDefault(); } } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( ( !special._default || special._default.apply( eventPath.pop(), data ) === false ) && acceptData( elem ) ) { // Call a native DOM method on the target with the same name as the event. // Don't do default actions on window, that's where global variables be (#6170) if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[ type ](); jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, // Piggyback on a donor event to simulate a different one // Used only for `focus(in | out)` events simulate: function( type, elem, event ) { var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true } ); jQuery.event.trigger( e, null, elem ); } } ); jQuery.fn.extend( { trigger: function( type, data ) { return this.each( function() { jQuery.event.trigger( type, data, this ); } ); }, triggerHandler: function( type, data ) { var elem = this[ 0 ]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } } ); jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu" ).split( " " ), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; } ); jQuery.fn.extend( { hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } } ); support.focusin = "onfocusin" in window; // Support: Firefox <=44 // Firefox doesn't have focus(in | out) events // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 // // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 // focus(in | out) events fire after focus & blur events, // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 if ( !support.focusin ) { jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler on the document while someone wants focusin/focusout var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); }; jQuery.event.special[ fix ] = { setup: function() { var doc = this.ownerDocument || this, attaches = dataPriv.access( doc, fix ); if ( !attaches ) { doc.addEventListener( orig, handler, true ); } dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { var doc = this.ownerDocument || this, attaches = dataPriv.access( doc, fix ) - 1; if ( !attaches ) { doc.removeEventListener( orig, handler, true ); dataPriv.remove( doc, fix ); } else { dataPriv.access( doc, fix, attaches ); } } }; } ); } var location = window.location; var nonce = jQuery.now(); var rquery = ( /\?/ ); // Cross-browser xml parsing jQuery.parseXML = function( data ) { var xml; if ( !data || typeof data !== "string" ) { return null; } // Support: IE 9 - 11 only // IE throws on parseFromString with invalid input. try { xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); } catch ( e ) { xml = undefined; } if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }; var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; function buildParams( prefix, obj, traditional, add ) { var name; if ( Array.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // Item is non-scalar (array or object), encode its numeric index. buildParams( prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", v, traditional, add ); } } ); } else if ( !traditional && jQuery.type( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { // Serialize scalar item. add( prefix, obj ); } } // Serialize an array of form elements or a set of // key/values into a query string jQuery.param = function( a, traditional ) { var prefix, s = [], add = function( key, valueOrFunction ) { // If value is a function, invoke it and use its return value var value = jQuery.isFunction( valueOrFunction ) ? valueOrFunction() : valueOrFunction; s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value == null ? "" : value ); }; // If an array was passed in, assume that it is an array of form elements. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); } ); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization return s.join( "&" ); }; jQuery.fn.extend( { serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map( function() { // Can add propHook for "elements" to filter or add form elements var elements = jQuery.prop( this, "elements" ); return elements ? jQuery.makeArray( elements ) : this; } ) .filter( function() { var type = this.type; // Use .is( ":disabled" ) so that fieldset[disabled] works return this.name && !jQuery( this ).is( ":disabled" ) && rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && ( this.checked || !rcheckableType.test( type ) ); } ) .map( function( i, elem ) { var val = jQuery( this ).val(); if ( val == null ) { return null; } if ( Array.isArray( val ) ) { return jQuery.map( val, function( val ) { return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; } ); } return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; } ).get(); } } ); var r20 = /%20/g, rhash = /#.*$/, rantiCache = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, // #7653, #8125, #8152: local protocol detection rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression allTypes = "*/".concat( "*" ), // Anchor tag for parsing the document origin originAnchor = document.createElement( "a" ); originAnchor.href = location.href; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression while ( ( dataType = dataTypes[ i++ ] ) ) { // Prepend if requested if ( dataType[ 0 ] === "+" ) { dataType = dataType.slice( 1 ) || "*"; ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); // Otherwise append } else { ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); } } } }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { var inspected = {}, seekingTransport = ( structure === transports ); function inspect( dataType ) { var selected; inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; } else if ( seekingTransport ) { return !( selected = dataTypeOrTransport ); } } ); return selected; } return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } return target; } /* Handles responses to an ajax request: * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jqXHR, responses ) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes; // Remove auto dataType and get content-type in the process while ( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } /* Chain conversions given the request and the original response * Also sets the responseXXX fields on the jqXHR instance */ function ajaxConvert( s, response, jqXHR, isSuccess ) { var conv2, current, conv, tmp, prev, converters = {}, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(); // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } current = dataTypes.shift(); // Convert to each sequential dataType while ( current ) { if ( s.responseFields[ current ] ) { jqXHR[ s.responseFields[ current ] ] = response; } // Apply the dataFilter if provided if ( !prev && isSuccess && s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } prev = current; current = dataTypes.shift(); if ( current ) { // There's only work to do if current dataType is non-auto if ( current === "*" ) { current = prev; // Convert response if prev dataType is non-auto and differs from current } else if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split( " " ); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.unshift( tmp[ 1 ] ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s.throws ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } } } return { state: "success", data: response }; } jQuery.extend( { // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {}, ajaxSettings: { url: location.href, type: "GET", isLocal: rlocalProtocol.test( location.protocol ), global: true, processData: true, async: true, contentType: "application/x-www-form-urlencoded; charset=UTF-8", /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { "*": allTypes, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" }, contents: { xml: /\bxml\b/, html: /\bhtml/, json: /\bjson\b/ }, responseFields: { xml: "responseXML", text: "responseText", json: "responseJSON" }, // Data converters // Keys separate source (or catchall "*") and destination types with a single space converters: { // Convert anything to text "* text": String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": JSON.parse, // Parse text as xml "text xml": jQuery.parseXML }, // For options that shouldn't be deep extended: // you can add your own custom options here if // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { url: true, context: true } }, // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. ajaxSetup: function( target, settings ) { return settings ? // Building a settings object ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : // Extending ajaxSettings ajaxExtend( jQuery.ajaxSettings, target ); }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), // Main method ajax: function( url, options ) { // If url is an object, simulate pre-1.5 signature if ( typeof url === "object" ) { options = url; url = undefined; } // Force options to be an object options = options || {}; var transport, // URL without anti-cache param cacheURL, // Response headers responseHeadersString, responseHeaders, // timeout handle timeoutTimer, // Url cleanup var urlAnchor, // Request state (becomes false upon send and true upon completion) completed, // To know if global events are to be dispatched fireGlobals, // Loop variable i, // uncached part of the url uncached, // Create the final options object s = jQuery.ajaxSetup( {}, options ), // Callbacks context callbackContext = s.context || s, // Context for global events is callbackContext if it is a DOM node or jQuery collection globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks( "once memory" ), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, requestHeadersNames = {}, // Default abort message strAbort = "canceled", // Fake xhr jqXHR = { readyState: 0, // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( completed ) { if ( !responseHeaders ) { responseHeaders = {}; while ( ( match = rheaders.exec( responseHeadersString ) ) ) { responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match == null ? null : match; }, // Raw string getAllResponseHeaders: function() { return completed ? responseHeadersString : null; }, // Caches the header setRequestHeader: function( name, value ) { if ( completed == null ) { name = requestHeadersNames[ name.toLowerCase() ] = requestHeadersNames[ name.toLowerCase() ] || name; requestHeaders[ name ] = value; } return this; }, // Overrides response content-type header overrideMimeType: function( type ) { if ( completed == null ) { s.mimeType = type; } return this; }, // Status-dependent callbacks statusCode: function( map ) { var code; if ( map ) { if ( completed ) { // Execute the appropriate callbacks jqXHR.always( map[ jqXHR.status ] ); } else { // Lazy-add the new callbacks in a way that preserves old ones for ( code in map ) { statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; } } } return this; }, // Cancel the request abort: function( statusText ) { var finalText = statusText || strAbort; if ( transport ) { transport.abort( finalText ); } done( 0, finalText ); return this; } }; // Attach deferreds deferred.promise( jqXHR ); // Add protocol if not provided (prefilters might expect it) // Handle falsy url in the settings object (#10093: consistency with old signature) // We also use the url parameter if available s.url = ( ( url || s.url || location.href ) + "" ) .replace( rprotocol, location.protocol + "//" ); // Alias method option to type as per ticket #12004 s.type = options.method || options.type || s.method || s.type; // Extract dataTypes list s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; // A cross-domain request is in order when the origin doesn't match the current origin. if ( s.crossDomain == null ) { urlAnchor = document.createElement( "a" ); // Support: IE <=8 - 11, Edge 12 - 13 // IE throws exception on accessing the href property if url is malformed, // e.g. http://example.com:80x/ try { urlAnchor.href = s.url; // Support: IE <=8 - 11 only // Anchor's host property isn't correctly set when s.url is relative urlAnchor.href = urlAnchor.href; s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host; } catch ( e ) { // If there is an error parsing the URL, assume it is crossDomain, // it can be rejected by the transport if it is invalid s.crossDomain = true; } } // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } // Apply prefilters inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); // If request was aborted inside a prefilter, stop there if ( completed ) { return jqXHR; } // We can fire global events as of now if asked to // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) fireGlobals = jQuery.event && s.global; // Watch for a new set of requests if ( fireGlobals && jQuery.active++ === 0 ) { jQuery.event.trigger( "ajaxStart" ); } // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); // Save the URL in case we're toying with the If-Modified-Since // and/or If-None-Match header later on // Remove hash to simplify url manipulation cacheURL = s.url.replace( rhash, "" ); // More options handling for requests with no content if ( !s.hasContent ) { // Remember the hash so we can put it back uncached = s.url.slice( cacheURL.length ); // If data is available, append data to url if ( s.data ) { cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; // #9682: remove data so that it's not used in an eventual retry delete s.data; } // Add or update anti-cache param if needed if ( s.cache === false ) { cacheURL = cacheURL.replace( rantiCache, "$1" ); uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; } // Put hash and anti-cache on the URL that will be requested (gh-1732) s.url = cacheURL + uncached; // Change '%20' to '+' if this is encoded form body content (gh-2658) } else if ( s.data && s.processData && ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { s.data = s.data.replace( r20, "+" ); } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { if ( jQuery.lastModified[ cacheURL ] ) { jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); } if ( jQuery.etag[ cacheURL ] ) { jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { jqXHR.setRequestHeader( "Content-Type", s.contentType ); } // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? s.accepts[ s.dataTypes[ 0 ] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); // Check for headers option for ( i in s.headers ) { jqXHR.setRequestHeader( i, s.headers[ i ] ); } // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { // Abort if not done already and return return jqXHR.abort(); } // Aborting is no longer a cancellation strAbort = "abort"; // Install callbacks on deferreds completeDeferred.add( s.complete ); jqXHR.done( s.success ); jqXHR.fail( s.error ); // Get transport transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); // If no transport, we auto-abort if ( !transport ) { done( -1, "No Transport" ); } else { jqXHR.readyState = 1; // Send global event if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } // If request was aborted inside ajaxSend, stop there if ( completed ) { return jqXHR; } // Timeout if ( s.async && s.timeout > 0 ) { timeoutTimer = window.setTimeout( function() { jqXHR.abort( "timeout" ); }, s.timeout ); } try { completed = false; transport.send( requestHeaders, done ); } catch ( e ) { // Rethrow post-completion exceptions if ( completed ) { throw e; } // Propagate others as results done( -1, e ); } } // Callback for when everything is done function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Ignore repeat invocations if ( completed ) { return; } completed = true; // Clear timeout if it exists if ( timeoutTimer ) { window.clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Determine if successful isSuccess = status >= 200 && status < 300 || status === 304; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // Convert no matter what (that way responseXXX fields are always set) response = ajaxConvert( s, response, jqXHR, isSuccess ); // If successful, handle type chaining if ( isSuccess ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader( "Last-Modified" ); if ( modified ) { jQuery.lastModified[ cacheURL ] = modified; } modified = jqXHR.getResponseHeader( "etag" ); if ( modified ) { jQuery.etag[ cacheURL ] = modified; } } // if no content if ( status === 204 || s.type === "HEAD" ) { statusText = "nocontent"; // if not modified } else if ( status === 304 ) { statusText = "notmodified"; // If we have data, let's convert it } else { statusText = response.state; success = response.data; error = response.error; isSuccess = !error; } } else { // Extract error from statusText and normalize for non-aborts error = statusText; if ( status || !statusText ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); } } } return jqXHR; }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); } } ); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // Shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = undefined; } // The url can be an options object (which then must have .url) return jQuery.ajax( jQuery.extend( { url: url, type: method, dataType: type, data: data, success: callback }, jQuery.isPlainObject( url ) && url ) ); }; } ); jQuery._evalUrl = function( url ) { return jQuery.ajax( { url: url, // Make this explicit, since user can override this through ajaxSetup (#11264) type: "GET", dataType: "script", cache: true, async: false, global: false, "throws": true } ); }; jQuery.fn.extend( { wrapAll: function( html ) { var wrap; if ( this[ 0 ] ) { if ( jQuery.isFunction( html ) ) { html = html.call( this[ 0 ] ); } // The elements to wrap the target around wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); if ( this[ 0 ].parentNode ) { wrap.insertBefore( this[ 0 ] ); } wrap.map( function() { var elem = this; while ( elem.firstElementChild ) { elem = elem.firstElementChild; } return elem; } ).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each( function( i ) { jQuery( this ).wrapInner( html.call( this, i ) ); } ); } return this.each( function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } } ); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each( function( i ) { jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); } ); }, unwrap: function( selector ) { this.parent( selector ).not( "body" ).each( function() { jQuery( this ).replaceWith( this.childNodes ); } ); return this; } } ); jQuery.expr.pseudos.hidden = function( elem ) { return !jQuery.expr.pseudos.visible( elem ); }; jQuery.expr.pseudos.visible = function( elem ) { return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); }; jQuery.ajaxSettings.xhr = function() { try { return new window.XMLHttpRequest(); } catch ( e ) {} }; var xhrSuccessStatus = { // File protocol always yields status code 0, assume 200 0: 200, // Support: IE <=9 only // #1450: sometimes IE returns 1223 when it should be 204 1223: 204 }, xhrSupported = jQuery.ajaxSettings.xhr(); support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); support.ajax = xhrSupported = !!xhrSupported; jQuery.ajaxTransport( function( options ) { var callback, errorCallback; // Cross domain only allowed if supported through XMLHttpRequest if ( support.cors || xhrSupported && !options.crossDomain ) { return { send: function( headers, complete ) { var i, xhr = options.xhr(); xhr.open( options.type, options.url, options.async, options.username, options.password ); // Apply custom fields if provided if ( options.xhrFields ) { for ( i in options.xhrFields ) { xhr[ i ] = options.xhrFields[ i ]; } } // Override mime type if needed if ( options.mimeType && xhr.overrideMimeType ) { xhr.overrideMimeType( options.mimeType ); } // X-Requested-With header // For cross-domain requests, seeing as conditions for a preflight are // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { headers[ "X-Requested-With" ] = "XMLHttpRequest"; } // Set headers for ( i in headers ) { xhr.setRequestHeader( i, headers[ i ] ); } // Callback callback = function( type ) { return function() { if ( callback ) { callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; if ( type === "abort" ) { xhr.abort(); } else if ( type === "error" ) { // Support: IE <=9 only // On a manual native abort, IE9 throws // errors on any property access that is not readyState if ( typeof xhr.status !== "number" ) { complete( 0, "error" ); } else { complete( // File: protocol always yields status 0; see #8605, #14207 xhr.status, xhr.statusText ); } } else { complete( xhrSuccessStatus[ xhr.status ] || xhr.status, xhr.statusText, // Support: IE <=9 only // IE9 has no XHR2 but throws on binary (trac-11426) // For XHR2 non-text, let the caller handle it (gh-2498) ( xhr.responseType || "text" ) !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders() ); } } }; }; // Listen to events xhr.onload = callback(); errorCallback = xhr.onerror = callback( "error" ); // Support: IE 9 only // Use onreadystatechange to replace onabort // to handle uncaught aborts if ( xhr.onabort !== undefined ) { xhr.onabort = errorCallback; } else { xhr.onreadystatechange = function() { // Check readyState before timeout as it changes if ( xhr.readyState === 4 ) { // Allow onerror to be called first, // but that will not handle a native abort // Also, save errorCallback to a variable // as xhr.onerror cannot be accessed window.setTimeout( function() { if ( callback ) { errorCallback(); } } ); } }; } // Create the abort callback callback = callback( "abort" ); try { // Do send the request (this may raise an exception) xhr.send( options.hasContent && options.data || null ); } catch ( e ) { // #14683: Only rethrow if this hasn't been notified as an error yet if ( callback ) { throw e; } } }, abort: function() { if ( callback ) { callback(); } } }; } } ); // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) jQuery.ajaxPrefilter( function( s ) { if ( s.crossDomain ) { s.contents.script = false; } } ); // Install script dataType jQuery.ajaxSetup( { accepts: { script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript" }, contents: { script: /\b(?:java|ecma)script\b/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } } ); // Handle cache's special case and crossDomain jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; } } ); // Bind script tag hack transport jQuery.ajaxTransport( "script", function( s ) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, callback; return { send: function( _, complete ) { script = jQuery( "<script>" ).prop( { charset: s.scriptCharset, src: s.url } ).on( "load error", callback = function( evt ) { script.remove(); callback = null; if ( evt ) { complete( evt.type === "error" ? 404 : 200, evt.type ); } } ); // Use native DOM manipulation to avoid our domManip AJAX trickery document.head.appendChild( script[ 0 ] ); }, abort: function() { if ( callback ) { callback(); } } }; } } ); var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/; // Default jsonp settings jQuery.ajaxSetup( { jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } } ); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? "url" : typeof s.data === "string" && ( s.contentType || "" ) .indexOf( "application/x-www-form-urlencoded" ) === 0 && rjsonp.test( s.data ) && "data" ); // Handle iff the expected data type is "jsonp" or we have a parameter to set if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { // Get callback name, remembering preexisting value associated with it callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback; // Insert callback into url or form data if ( jsonProp ) { s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); } else if ( s.jsonp !== false ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } // Use data converter to retrieve json after script execution s.converters[ "script json" ] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); } return responseContainer[ 0 ]; }; // Force json dataType s.dataTypes[ 0 ] = "json"; // Install callback overwritten = window[ callbackName ]; window[ callbackName ] = function() { responseContainer = arguments; }; // Clean-up function (fires after converters) jqXHR.always( function() { // If previous value didn't exist - remove it if ( overwritten === undefined ) { jQuery( window ).removeProp( callbackName ); // Otherwise restore preexisting value } else { window[ callbackName ] = overwritten; } // Save back as free if ( s[ callbackName ] ) { // Make sure that re-using the options doesn't screw things around s.jsonpCallback = originalSettings.jsonpCallback; // Save the callback name for future use oldCallbacks.push( callbackName ); } // Call if it was a function and we have a response if ( responseContainer && jQuery.isFunction( overwritten ) ) { overwritten( responseContainer[ 0 ] ); } responseContainer = overwritten = undefined; } ); // Delegate to script return "script"; } } ); // Support: Safari 8 only // In Safari 8 documents created via document.implementation.createHTMLDocument // collapse sibling forms: the second one becomes a child of the first one. // Because of that, this security measure has to be disabled in Safari 8. // https://bugs.webkit.org/show_bug.cgi?id=137337 support.createHTMLDocument = ( function() { var body = document.implementation.createHTMLDocument( "" ).body; body.innerHTML = "<form></form><form></form>"; return body.childNodes.length === 2; } )(); // Argument "data" should be string of html // context (optional): If specified, the fragment will be created in this context, // defaults to document // keepScripts (optional): If true, will include scripts passed in the html string jQuery.parseHTML = function( data, context, keepScripts ) { if ( typeof data !== "string" ) { return []; } if ( typeof context === "boolean" ) { keepScripts = context; context = false; } var base, parsed, scripts; if ( !context ) { // Stop scripts or inline event handlers from being executed immediately // by using document.implementation if ( support.createHTMLDocument ) { context = document.implementation.createHTMLDocument( "" ); // Set the base href for the created document // so any parsed elements with URLs // are based on the document's URL (gh-2965) base = context.createElement( "base" ); base.href = document.location.href; context.head.appendChild( base ); } else { context = document; } } parsed = rsingleTag.exec( data ); scripts = !keepScripts && []; // Single tag if ( parsed ) { return [ context.createElement( parsed[ 1 ] ) ]; } parsed = buildFragment( [ data ], context, scripts ); if ( scripts && scripts.length ) { jQuery( scripts ).remove(); } return jQuery.merge( [], parsed.childNodes ); }; /** * Load a url into a page */ jQuery.fn.load = function( url, params, callback ) { var selector, type, response, self = this, off = url.indexOf( " " ); if ( off > -1 ) { selector = stripAndCollapse( url.slice( off ) ); url = url.slice( 0, off ); } // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = undefined; // Otherwise, build a param string } else if ( params && typeof params === "object" ) { type = "POST"; } // If we have elements to modify, make the request if ( self.length > 0 ) { jQuery.ajax( { url: url, // If "type" variable is undefined, then "GET" method will be used. // Make value of this field explicit since // user can override it through ajaxSetup method type: type || "GET", dataType: "html", data: params } ).done( function( responseText ) { // Save response for use in complete callback response = arguments; self.html( selector ? // If a selector was specified, locate the right elements in a dummy div // Exclude scripts to avoid IE 'Permission Denied' errors jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : // Otherwise use the full result responseText ); // If the request succeeds, this function gets "data", "status", "jqXHR" // but they are ignored because response was set above. // If it fails, this function gets "jqXHR", "status", "error" } ).always( callback && function( jqXHR, status ) { self.each( function() { callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); } ); } ); } return this; }; // Attach a bunch of functions for handling common AJAX events jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { jQuery.fn[ type ] = function( fn ) { return this.on( type, fn ); }; } ); jQuery.expr.pseudos.animated = function( elem ) { return jQuery.grep( jQuery.timers, function( fn ) { return elem === fn.elem; } ).length; }; jQuery.offset = { setOffset: function( elem, options, i ) { var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css( elem, "position" ), curElem = jQuery( elem ), props = {}; // Set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } curOffset = curElem.offset(); curCSSTop = jQuery.css( elem, "top" ); curCSSLeft = jQuery.css( elem, "left" ); calculatePosition = ( position === "absolute" || position === "fixed" ) && ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; // Need to be able to calculate position if either // top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat( curCSSTop ) || 0; curLeft = parseFloat( curCSSLeft ) || 0; } if ( jQuery.isFunction( options ) ) { // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); } if ( options.top != null ) { props.top = ( options.top - curOffset.top ) + curTop; } if ( options.left != null ) { props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend( { offset: function( options ) { // Preserve chaining for setter if ( arguments.length ) { return options === undefined ? this : this.each( function( i ) { jQuery.offset.setOffset( this, options, i ); } ); } var doc, docElem, rect, win, elem = this[ 0 ]; if ( !elem ) { return; } // Return zeros for disconnected and hidden (display: none) elements (gh-2310) // Support: IE <=11 only // Running getBoundingClientRect on a // disconnected node in IE throws an error if ( !elem.getClientRects().length ) { return { top: 0, left: 0 }; } rect = elem.getBoundingClientRect(); doc = elem.ownerDocument; docElem = doc.documentElement; win = doc.defaultView; return { top: rect.top + win.pageYOffset - docElem.clientTop, left: rect.left + win.pageXOffset - docElem.clientLeft }; }, position: function() { if ( !this[ 0 ] ) { return; } var offsetParent, offset, elem = this[ 0 ], parentOffset = { top: 0, left: 0 }; // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, // because it is its only offset parent if ( jQuery.css( elem, "position" ) === "fixed" ) { // Assume getBoundingClientRect is there when computed position is fixed offset = elem.getBoundingClientRect(); } else { // Get *real* offsetParent offsetParent = this.offsetParent(); // Get correct offsets offset = this.offset(); if ( !nodeName( offsetParent[ 0 ], "html" ) ) { parentOffset = offsetParent.offset(); } // Add offsetParent borders parentOffset = { top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ), left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ) }; } // Subtract parent offsets and element margins return { top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) }; }, // This method will return documentElement in the following cases: // 1) For the element inside the iframe without offsetParent, this method will return // documentElement of the parent window // 2) For the hidden or detached element // 3) For body or html element, i.e. in case of the html node - it will return itself // // but those exceptions were never presented as a real life use-cases // and might be considered as more preferable results. // // This logic, however, is not guaranteed and can change at any point in the future offsetParent: function() { return this.map( function() { var offsetParent = this.offsetParent; while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { offsetParent = offsetParent.offsetParent; } return offsetParent || documentElement; } ); } } ); // Create scrollLeft and scrollTop methods jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { var top = "pageYOffset" === prop; jQuery.fn[ method ] = function( val ) { return access( this, function( elem, method, val ) { // Coalesce documents and windows var win; if ( jQuery.isWindow( elem ) ) { win = elem; } else if ( elem.nodeType === 9 ) { win = elem.defaultView; } if ( val === undefined ) { return win ? win[ prop ] : elem[ method ]; } if ( win ) { win.scrollTo( !top ? val : win.pageXOffset, top ? val : win.pageYOffset ); } else { elem[ method ] = val; } }, method, val, arguments.length ); }; } ); // Support: Safari <=7 - 9.1, Chrome <=37 - 49 // Add the top/left cssHooks using jQuery.fn.position // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 // getComputedStyle returns percent when specified for top/left/bottom/right; // rather than make the css module depend on the offset module, just check for it here jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, function( elem, computed ) { if ( computed ) { computed = curCSS( elem, prop ); // If curCSS returns percentage, fallback to offset return rnumnonpx.test( computed ) ? jQuery( elem ).position()[ prop ] + "px" : computed; } } ); } ); // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { // Margin is only for outerHeight, outerWidth jQuery.fn[ funcName ] = function( margin, value ) { var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); return access( this, function( elem, type, value ) { var doc; if ( jQuery.isWindow( elem ) ) { // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) return funcName.indexOf( "outer" ) === 0 ? elem[ "inner" + name ] : elem.document.documentElement[ "client" + name ]; } // Get document width or height if ( elem.nodeType === 9 ) { doc = elem.documentElement; // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], // whichever is greatest return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); } return value === undefined ? // Get width or height on the element, requesting but not forcing parseFloat jQuery.css( elem, type, extra ) : // Set width or height on the element jQuery.style( elem, type, value, extra ); }, type, chainable ? margin : undefined, chainable ); }; } ); } ); jQuery.fn.extend( { bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); } } ); jQuery.holdReady = function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }; jQuery.isArray = Array.isArray; jQuery.parseJSON = JSON.parse; jQuery.nodeName = nodeName; // Register as a named AMD module, since jQuery can be concatenated with other // files that may use define, but not via a proper concatenation script that // understands anonymous AMD modules. A named AMD is safest and most robust // way to register. Lowercase jquery is used because AMD module names are // derived from file names, and jQuery is normally delivered in a lowercase // file name. Do this after creating the global so that if an AMD module wants // to call noConflict to hide this version of jQuery, it will work. // Note that for maximum portability, libraries that are not jQuery should // declare themselves as anonymous modules, and avoid setting a global if an // AMD loader is present. jQuery is a special case. For more information, see // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon if ( true ) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { return jQuery; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } var // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$; jQuery.noConflict = function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }; // Expose jQuery and $ identifiers, even in AMD // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) // and CommonJS for browser emulators (#13566) if ( !noGlobal ) { window.jQuery = window.$ = jQuery; } return jQuery; } ); /***/ }), /* 1 */ /***/ (function(module, exports) { var cats = ['dave', 'henry', 'martha']; module.exports = cats; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { var cats = __webpack_require__(1); var $ = __webpack_require__(0); console.log('$(cats).length', $(cats).length); $('#app').text("cats"); console.log(cats); /***/ }) /******/ ]);
hugonasciutti/Exercises
webpack/4/bin/app.bundle.js
JavaScript
mit
271,260
var webpack = require("webpack"), HtmlWebpackPlugin = require("html-webpack-plugin"), ExtractTextPlugin = require("extract-text-webpack-plugin"), CopyWebpackPlugin = require("copy-webpack-plugin"), helpers = require("./helpers"); const exercisePath = process.env.exercise; var plugins = [ new webpack.optimize.CommonsChunkPlugin({ name: ["app", "vendor", "polyfills"] }), new ExtractTextPlugin("[name].css"), new HtmlWebpackPlugin({ template: "index.html" }) ]; if (exercisePath === 'localization') { plugins.push( new CopyWebpackPlugin([{ from: "i18n", to: "i18n" }]) ) } module.exports = { context: helpers.root() + '/' + exercisePath + "/src", entry: { app: "./main.ts", vendor: helpers.root() + "/common/vendor.ts", polyfills: helpers.root() + "/common/polyfills.ts" }, resolve: { extensions: [".webpack.js", ".web.js", ".ts", ".js"] }, module: { exprContextCritical: false, loaders: [ { test: /\.ts$/, loaders: ["ts-loader", "angular2-router-loader?debug=true"] }, { test: /\.html$/, loader: "html-loader" }, { test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, loader: "file?name=assets/[name].[hash].[ext]" }, { test: /\.css$/, exclude: helpers.root("src", "app"), loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }) }, { test: /\.css$/, include: helpers.root("src", "app"), loader: "raw-loader" }, { test: /\.s(a|c)ss$/, loaders: ["raw-loader", "sass-loader"] } ] }, plugins: plugins, devtool: "source-map", output: { path: helpers.root("dist"), publicPath: "http://localhost:8080/", filename: "[name].js", chunkFilename: "[id].chunk.js" }, devServer: { historyApiFallback: { index: "http://localhost:8080/index.html" } } }
DEV6hub/Angular4-Course-Files
exercise/config/webpack.exercise.js
JavaScript
mit
1,853
import React, { Component, PropTypes } from 'react'; import DatePicker from 'material-ui/lib/date-picker/date-picker'; import * as layouts from '../../store/db_layouts.js'; function fmtDate( dt ) { return dt.toLocaleDateString(); } const CompFormDate = (props) => { const f = props.field; const curr_date = new Date( props.value ); // Drop the first argument, and send date in a god format for us let handleChange = ( this_is_null, new_date ) => { props.onChange( f, layouts.asYYYYMMDD( new_date )); }; return ( <DatePicker hintText={f.field} className="form_input" floatingLabelText={f.field} autoOk textFieldStyle={f.textstyle} style={f.style} formatDate={fmtDate} value={curr_date} mode="landscape" onChange={handleChange} />); }; CompFormDate.propTypes = { field: PropTypes.object.isRequired, value: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired }; export default CompFormDate;
yabadabu/react-playground
src/components/form/CompFormDate.js
JavaScript
mit
1,011
/* RequireJS 2.2.0 Copyright jQuery Foundation and other contributors. Released under MIT license, http://github.com/requirejs/requirejs/LICENSE */ var requirejs, require, define; (function(ga) { function ka(b, c, d, g) { return g || "" } function K(b) { return "[object Function]" === Q.call(b) } function L(b) { return "[object Array]" === Q.call(b) } function y(b, c) { if (b) { var d; for (d = 0; d < b.length && (!b[d] || !c(b[d], d, b)); d += 1) ; } } function X(b, c) { if (b) { var d; for (d = b.length - 1; -1 < d && (!b[d] || !c(b[d], d, b)); --d) ; } } function x(b, c) { return la.call(b, c) } function e(b, c) { return x(b, c) && b[c] } function D(b, c) { for (var d in b) if (x(b, d) && c(b[d], d)) break } function Y(b, c, d, g) { c && D(c, function(c, e) { if (d || !x(b, e)) !g || "object" !== typeof c || !c || L(c) || K(c) || c instanceof RegExp ? b[e] = c : (b[e] || (b[e] = {}), Y(b[e], c, d, g)) }); return b } function z(b, c) { return function() { return c.apply(b, arguments) } } function ha(b) { throw b; } function ia(b) { if (!b) return b; var c = ga; y(b.split("."), function(b) { c = c[b] }); return c } function F(b, c, d, g) { c = Error(c + "\nhttp://requirejs.org/docs/errors.html#" + b); c.requireType = b; c.requireModules = g; d && (c.originalError = d); return c } function ma(b) { function c(a, n, b) { var h, k, f, c, d, l, g, r; n = n && n.split("/"); var q = p.map , m = q && q["*"]; if (a) { a = a.split("/"); k = a.length - 1; p.nodeIdCompat && U.test(a[k]) && (a[k] = a[k].replace(U, "")); "." === a[0].charAt(0) && n && (k = n.slice(0, n.length - 1), a = k.concat(a)); k = a; for (f = 0; f < k.length; f++) c = k[f], "." === c ? (k.splice(f, 1), --f) : ".." === c && 0 !== f && (1 !== f || ".." !== k[2]) && ".." !== k[f - 1] && 0 < f && (k.splice(f - 1, 2), f -= 2); a = a.join("/") } if (b && q && (n || m)) { k = a.split("/"); f = k.length; a: for (; 0 < f; --f) { d = k.slice(0, f).join("/"); if (n) for (c = n.length; 0 < c; --c) if (b = e(q, n.slice(0, c).join("/"))) if (b = e(b, d)) { h = b; l = f; break a } !g && m && e(m, d) && (g = e(m, d), r = f) } !h && g && (h = g, l = r); h && (k.splice(0, l, h), a = k.join("/")) } return (h = e(p.pkgs, a)) ? h : a } function d(a) { E && y(document.getElementsByTagName("script"), function(n) { if (n.getAttribute("data-requiremodule") === a && n.getAttribute("data-requirecontext") === l.contextName) return n.parentNode.removeChild(n), !0 }) } function m(a) { var n = e(p.paths, a); if (n && L(n) && 1 < n.length) return n.shift(), l.require.undef(a), l.makeRequire(null, { skipMap: !0 })([a]), !0 } function r(a) { var n, b = a ? a.indexOf("!") : -1; -1 < b && (n = a.substring(0, b), a = a.substring(b + 1, a.length)); return [n, a] } function q(a, n, b, h) { var k, f, d = null, g = n ? n.name : null, p = a, q = !0, m = ""; a || (q = !1, a = "_@r" + (Q += 1)); a = r(a); d = a[0]; a = a[1]; d && (d = c(d, g, h), f = e(v, d)); a && (d ? m = f && f.normalize ? f.normalize(a, function(a) { return c(a, g, h) }) : -1 === a.indexOf("!") ? c(a, g, h) : a : (m = c(a, g, h), a = r(m), d = a[0], m = a[1], b = !0, k = l.nameToUrl(m))); b = !d || f || b ? "" : "_unnormalized" + (T += 1); return { prefix: d, name: m, parentMap: n, unnormalized: !!b, url: k, originalName: p, isDefine: q, id: (d ? d + "!" + m : m) + b } } function u(a) { var b = a.id , c = e(t, b); c || (c = t[b] = new l.Module(a)); return c } function w(a, b, c) { var h = a.id , k = e(t, h); if (!x(v, h) || k && !k.defineEmitComplete) if (k = u(a), k.error && "error" === b) c(k.error); else k.on(b, c); else "defined" === b && c(v[h]) } function A(a, b) { var c = a.requireModules , h = !1; if (b) b(a); else if (y(c, function(b) { if (b = e(t, b)) b.error = a, b.events.error && (h = !0, b.emit("error", a)) }), !h) g.onError(a) } function B() { V.length && (y(V, function(a) { var b = a[0]; "string" === typeof b && (l.defQueueMap[b] = !0); G.push(a) }), V = []) } function C(a) { delete t[a]; delete Z[a] } function J(a, b, c) { var h = a.map.id; a.error ? a.emit("error", a.error) : (b[h] = !0, y(a.depMaps, function(h, f) { var d = h.id , g = e(t, d); !g || a.depMatched[f] || c[d] || (e(b, d) ? (a.defineDep(f, v[d]), a.check()) : J(g, b, c)) }), c[h] = !0) } function H() { var a, b, c = (a = 1E3 * p.waitSeconds) && l.startTime + a < (new Date).getTime(), h = [], k = [], f = !1, g = !0; if (!aa) { aa = !0; D(Z, function(a) { var l = a.map , e = l.id; if (a.enabled && (l.isDefine || k.push(a), !a.error)) if (!a.inited && c) m(e) ? f = b = !0 : (h.push(e), d(e)); else if (!a.inited && a.fetched && l.isDefine && (f = !0, !l.prefix)) return g = !1 }); if (c && h.length) return a = F("timeout", "Load timeout for modules: " + h, null, h), a.contextName = l.contextName, A(a); g && y(k, function(a) { J(a, {}, {}) }); c && !b || !f || !E && !ja || ba || (ba = setTimeout(function() { ba = 0; H() }, 50)); aa = !1 } } function I(a) { x(v, a[0]) || u(q(a[0], null, !0)).init(a[1], a[2]) } function O(a) { a = a.currentTarget || a.srcElement; var b = l.onScriptLoad; a.detachEvent && !ca ? a.detachEvent("onreadystatechange", b) : a.removeEventListener("load", b, !1); b = l.onScriptError; a.detachEvent && !ca || a.removeEventListener("error", b, !1); return { node: a, id: a && a.getAttribute("data-requiremodule") } } function P() { var a; for (B(); G.length; ) { a = G.shift(); if (null === a[0]) return A(F("mismatch", "Mismatched anonymous define() module: " + a[a.length - 1])); I(a) } l.defQueueMap = {} } var aa, da, l, R, ba, p = { waitSeconds: 7, baseUrl: "./", paths: {}, bundles: {}, pkgs: {}, shim: {}, config: {} }, t = {}, Z = {}, ea = {}, G = [], v = {}, W = {}, fa = {}, Q = 1, T = 1; R = { require: function(a) { return a.require ? a.require : a.require = l.makeRequire(a.map) }, exports: function(a) { a.usingExports = !0; if (a.map.isDefine) return a.exports ? v[a.map.id] = a.exports : a.exports = v[a.map.id] = {} }, module: function(a) { return a.module ? a.module : a.module = { id: a.map.id, uri: a.map.url, config: function() { return e(p.config, a.map.id) || {} }, exports: a.exports || (a.exports = {}) } } }; da = function(a) { this.events = e(ea, a.id) || {}; this.map = a; this.shim = e(p.shim, a.id); this.depExports = []; this.depMaps = []; this.depMatched = []; this.pluginMaps = {}; this.depCount = 0 } ; da.prototype = { init: function(a, b, c, h) { h = h || {}; if (!this.inited) { this.factory = b; if (c) this.on("error", c); else this.events.error && (c = z(this, function(a) { this.emit("error", a) })); this.depMaps = a && a.slice(0); this.errback = c; this.inited = !0; this.ignore = h.ignore; h.enabled || this.enabled ? this.enable() : this.check() } }, defineDep: function(a, b) { this.depMatched[a] || (this.depMatched[a] = !0, --this.depCount, this.depExports[a] = b) }, fetch: function() { if (!this.fetched) { this.fetched = !0; l.startTime = (new Date).getTime(); var a = this.map; if (this.shim) l.makeRequire(this.map, { enableBuildCallback: !0 })(this.shim.deps || [], z(this, function() { return a.prefix ? this.callPlugin() : this.load() })); else return a.prefix ? this.callPlugin() : this.load() } }, load: function() { var a = this.map.url; W[a] || (W[a] = !0, l.load(this.map.id, a)) }, check: function() { if (this.enabled && !this.enabling) { var a, b, c = this.map.id; b = this.depExports; var h = this.exports , k = this.factory; if (!this.inited) x(l.defQueueMap, c) || this.fetch(); else if (this.error) this.emit("error", this.error); else if (!this.defining) { this.defining = !0; if (1 > this.depCount && !this.defined) { if (K(k)) { if (this.events.error && this.map.isDefine || g.onError !== ha) try { h = l.execCb(c, k, b, h) } catch (d) { a = d } else h = l.execCb(c, k, b, h); this.map.isDefine && void 0 === h && ((b = this.module) ? h = b.exports : this.usingExports && (h = this.exports)); if (a) return a.requireMap = this.map, a.requireModules = this.map.isDefine ? [this.map.id] : null, a.requireType = this.map.isDefine ? "define" : "require", A(this.error = a) } else h = k; this.exports = h; if (this.map.isDefine && !this.ignore && (v[c] = h, g.onResourceLoad)) { var f = []; y(this.depMaps, function(a) { f.push(a.normalizedMap || a) }); g.onResourceLoad(l, this.map, f) } C(c); this.defined = !0 } this.defining = !1; this.defined && !this.defineEmitted && (this.defineEmitted = !0, this.emit("defined", this.exports), this.defineEmitComplete = !0) } } }, callPlugin: function() { var a = this.map , b = a.id , d = q(a.prefix); this.depMaps.push(d); w(d, "defined", z(this, function(h) { var k, f, d = e(fa, this.map.id), M = this.map.name, r = this.map.parentMap ? this.map.parentMap.name : null, m = l.makeRequire(a.parentMap, { enableBuildCallback: !0 }); if (this.map.unnormalized) { if (h.normalize && (M = h.normalize(M, function(a) { return c(a, r, !0) }) || ""), f = q(a.prefix + "!" + M, this.map.parentMap), w(f, "defined", z(this, function(a) { this.map.normalizedMap = f; this.init([], function() { return a }, null, { enabled: !0, ignore: !0 }) })), h = e(t, f.id)) { this.depMaps.push(f); if (this.events.error) h.on("error", z(this, function(a) { this.emit("error", a) })); h.enable() } } else d ? (this.map.url = l.nameToUrl(d), this.load()) : (k = z(this, function(a) { this.init([], function() { return a }, null, { enabled: !0 }) }), k.error = z(this, function(a) { this.inited = !0; this.error = a; a.requireModules = [b]; D(t, function(a) { 0 === a.map.id.indexOf(b + "_unnormalized") && C(a.map.id) }); A(a) }), k.fromText = z(this, function(h, c) { var d = a.name , f = q(d) , M = S; c && (h = c); M && (S = !1); u(f); x(p.config, b) && (p.config[d] = p.config[b]); try { g.exec(h) } catch (e) { return A(F("fromtexteval", "fromText eval for " + b + " failed: " + e, e, [b])) } M && (S = !0); this.depMaps.push(f); l.completeLoad(d); m([d], k) }), h.load(a.name, m, k, p)) })); l.enable(d, this); this.pluginMaps[d.id] = d }, enable: function() { Z[this.map.id] = this; this.enabling = this.enabled = !0; y(this.depMaps, z(this, function(a, b) { var c, h; if ("string" === typeof a) { a = q(a, this.map.isDefine ? this.map : this.map.parentMap, !1, !this.skipMap); this.depMaps[b] = a; if (c = e(R, a.id)) { this.depExports[b] = c(this); return } this.depCount += 1; w(a, "defined", z(this, function(a) { this.undefed || (this.defineDep(b, a), this.check()) })); this.errback ? w(a, "error", z(this, this.errback)) : this.events.error && w(a, "error", z(this, function(a) { this.emit("error", a) })) } c = a.id; h = t[c]; x(R, c) || !h || h.enabled || l.enable(a, this) })); D(this.pluginMaps, z(this, function(a) { var b = e(t, a.id); b && !b.enabled && l.enable(a, this) })); this.enabling = !1; this.check() }, on: function(a, b) { var c = this.events[a]; c || (c = this.events[a] = []); c.push(b) }, emit: function(a, b) { y(this.events[a], function(a) { a(b) }); "error" === a && delete this.events[a] } }; l = { config: p, contextName: b, registry: t, defined: v, urlFetched: W, defQueue: G, defQueueMap: {}, Module: da, makeModuleMap: q, nextTick: g.nextTick, onError: A, configure: function(a) { a.baseUrl && "/" !== a.baseUrl.charAt(a.baseUrl.length - 1) && (a.baseUrl += "/"); if ("string" === typeof a.urlArgs) { var b = a.urlArgs; a.urlArgs = function(a, c) { return (-1 === c.indexOf("?") ? "?" : "&") + b } } var c = p.shim , h = { paths: !0, bundles: !0, config: !0, map: !0 }; D(a, function(a, b) { h[b] ? (p[b] || (p[b] = {}), Y(p[b], a, !0, !0)) : p[b] = a }); a.bundles && D(a.bundles, function(a, b) { y(a, function(a) { a !== b && (fa[a] = b) }) }); a.shim && (D(a.shim, function(a, b) { L(a) && (a = { deps: a }); !a.exports && !a.init || a.exportsFn || (a.exportsFn = l.makeShimExports(a)); c[b] = a }), p.shim = c); a.packages && y(a.packages, function(a) { var b; a = "string" === typeof a ? { name: a } : a; b = a.name; a.location && (p.paths[b] = a.location); p.pkgs[b] = a.name + "/" + (a.main || "main").replace(na, "").replace(U, "") }); D(t, function(a, b) { a.inited || a.map.unnormalized || (a.map = q(b, null, !0)) }); (a.deps || a.callback) && l.require(a.deps || [], a.callback) }, makeShimExports: function(a) { return function() { var b; a.init && (b = a.init.apply(ga, arguments)); return b || a.exports && ia(a.exports) } }, makeRequire: function(a, n) { function m(c, d, f) { var e, r; n.enableBuildCallback && d && K(d) && (d.__requireJsBuild = !0); if ("string" === typeof c) { if (K(d)) return A(F("requireargs", "Invalid require call"), f); if (a && x(R, c)) return R[c](t[a.id]); if (g.get) return g.get(l, c, a, m); e = q(c, a, !1, !0); e = e.id; return x(v, e) ? v[e] : A(F("notloaded", 'Module name "' + e + '" has not been loaded yet for context: ' + b + (a ? "" : ". Use require([])"))) } P(); l.nextTick(function() { P(); r = u(q(null, a)); r.skipMap = n.skipMap; r.init(c, d, f, { enabled: !0 }); H() }); return m } n = n || {}; Y(m, { isBrowser: E, toUrl: function(b) { var d, f = b.lastIndexOf("."), g = b.split("/")[0]; -1 !== f && ("." !== g && ".." !== g || 1 < f) && (d = b.substring(f, b.length), b = b.substring(0, f)); return l.nameToUrl(c(b, a && a.id, !0), d, !0) }, defined: function(b) { return x(v, q(b, a, !1, !0).id) }, specified: function(b) { b = q(b, a, !1, !0).id; return x(v, b) || x(t, b) } }); a || (m.undef = function(b) { B(); var c = q(b, a, !0) , f = e(t, b); f.undefed = !0; d(b); delete v[b]; delete W[c.url]; delete ea[b]; X(G, function(a, c) { a[0] === b && G.splice(c, 1) }); delete l.defQueueMap[b]; f && (f.events.defined && (ea[b] = f.events), C(b)) } ); return m }, enable: function(a) { e(t, a.id) && u(a).enable() }, completeLoad: function(a) { var b, c, d = e(p.shim, a) || {}, g = d.exports; for (B(); G.length; ) { c = G.shift(); if (null === c[0]) { c[0] = a; if (b) break; b = !0 } else c[0] === a && (b = !0); I(c) } l.defQueueMap = {}; c = e(t, a); if (!b && !x(v, a) && c && !c.inited) if (!p.enforceDefine || g && ia(g)) I([a, d.deps || [], d.exportsFn]); else return m(a) ? void 0 : A(F("nodefine", "No define call for " + a, null, [a])); H() }, nameToUrl: function(a, b, c) { var d, k, f, m; (d = e(p.pkgs, a)) && (a = d); if (d = e(fa, a)) return l.nameToUrl(d, b, c); if (g.jsExtRegExp.test(a)) d = a + (b || ""); else { d = p.paths; k = a.split("/"); for (f = k.length; 0 < f; --f) if (m = k.slice(0, f).join("/"), m = e(d, m)) { L(m) && (m = m[0]); k.splice(0, f, m); break } d = k.join("/"); d += b || (/^data\:|^blob\:|\?/.test(d) || c ? "" : ".js"); d = ("/" === d.charAt(0) || d.match(/^[\w\+\.\-]+:/) ? "" : p.baseUrl) + d } return p.urlArgs && !/^blob\:/.test(d) ? d + p.urlArgs(a, d) : d }, load: function(a, b) { g.load(l, a, b) }, execCb: function(a, b, c, d) { return b.apply(d, c) }, onScriptLoad: function(a) { if ("load" === a.type || oa.test((a.currentTarget || a.srcElement).readyState)) N = null, a = O(a), l.completeLoad(a.id) }, onScriptError: function(a) { var b = O(a); if (!m(b.id)) { var c = []; D(t, function(a, d) { 0 !== d.indexOf("_@r") && y(a.depMaps, function(a) { if (a.id === b.id) return c.push(d), !0 }) }); return A(F("scripterror", 'Script error for "' + b.id + (c.length ? '", needed by: ' + c.join(", ") : '"'), a, [b.id])) } } }; l.require = l.makeRequire(); return l } function pa() { if (N && "interactive" === N.readyState) return N; X(document.getElementsByTagName("script"), function(b) { if ("interactive" === b.readyState) return N = b }); return N } var g, B, C, H, O, I, N, P, u, T, qa = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, ra = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, U = /\.js$/, na = /^\.\//; B = Object.prototype; var Q = B.toString , la = B.hasOwnProperty , E = !("undefined" === typeof window || "undefined" === typeof navigator || !window.document) , ja = !E && "undefined" !== typeof importScripts , oa = E && "PLAYSTATION 3" === navigator.platform ? /^complete$/ : /^(complete|loaded)$/ , ca = "undefined" !== typeof opera && "[object Opera]" === opera.toString() , J = {} , w = {} , V = [] , S = !1; if ("undefined" === typeof define) { if ("undefined" !== typeof requirejs) { if (K(requirejs)) return; w = requirejs; requirejs = void 0 } "undefined" === typeof require || K(require) || (w = require, require = void 0); g = requirejs = function(b, c, d, m) { var r, q = "_"; L(b) || "string" === typeof b || (r = b, L(c) ? (b = c, c = d, d = m) : b = []); r && r.context && (q = r.context); (m = e(J, q)) || (m = J[q] = g.s.newContext(q)); r && m.configure(r); return m.require(b, c, d) } ; g.config = function(b) { return g(b) } ; g.nextTick = "undefined" !== typeof setTimeout ? function(b) { setTimeout(b, 4) } : function(b) { b() } ; require || (require = g); g.version = "2.2.0"; g.jsExtRegExp = /^\/|:|\?|\.js$/; g.isBrowser = E; B = g.s = { contexts: J, newContext: ma }; g({}); y(["toUrl", "undef", "defined", "specified"], function(b) { g[b] = function() { var c = J._; return c.require[b].apply(c, arguments) } }); E && (C = B.head = document.getElementsByTagName("head")[0], H = document.getElementsByTagName("base")[0]) && (C = B.head = H.parentNode); g.onError = ha; g.createNode = function(b, c, d) { c = b.xhtml ? document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") : document.createElement("script"); c.type = b.scriptType || "text/javascript"; c.charset = "utf-8"; c.async = !0; return c } ; g.load = function(b, c, d) { var m = b && b.config || {}, e; if (E) { e = g.createNode(m, c, d); e.setAttribute("data-requirecontext", b.contextName); e.setAttribute("data-requiremodule", c); !e.attachEvent || e.attachEvent.toString && 0 > e.attachEvent.toString().indexOf("[native code") || ca ? (e.addEventListener("load", b.onScriptLoad, !1), e.addEventListener("error", b.onScriptError, !1)) : (S = !0, e.attachEvent("onreadystatechange", b.onScriptLoad)); e.src = d; if (m.onNodeCreated) m.onNodeCreated(e, m, c, d); P = e; H ? C.insertBefore(e, H) : C.appendChild(e); P = null; return e } if (ja) try { setTimeout(function() {}, 0), importScripts(d), b.completeLoad(c) } catch (q) { b.onError(F("importscripts", "importScripts failed for " + c + " at " + d, q, [c])) } } ; E && !w.skipDataMain && X(document.getElementsByTagName("script"), function(b) { C || (C = b.parentNode); if (O = b.getAttribute("data-main")) return u = O, w.baseUrl || -1 !== u.indexOf("!") || (I = u.split("/"), u = I.pop(), T = I.length ? I.join("/") + "/" : "./", w.baseUrl = T), u = u.replace(U, ""), g.jsExtRegExp.test(u) && (u = O), w.deps = w.deps ? w.deps.concat(u) : [u], !0 }); define = function(b, c, d) { var e, g; "string" !== typeof b && (d = c, c = b, b = null); L(c) || (d = c, c = null); !c && K(d) && (c = [], d.length && (d.toString().replace(qa, ka).replace(ra, function(b, d) { c.push(d) }), c = (1 === d.length ? ["require"] : ["require", "exports", "module"]).concat(c))); S && (e = P || pa()) && (b || (b = e.getAttribute("data-requiremodule")), g = J[e.getAttribute("data-requirecontext")]); g ? (g.defQueue.push([b, c, d]), g.defQueueMap[b] = !0) : V.push([b, c, d]) } ; define.amd = { jQuery: !0 }; g.exec = function(b) { return eval(b) } ; g(w) } } )(this);
rlaj/tmc
source/mas/js/libs/require-min.js
JavaScript
mit
33,384
import * as React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path d="M12 3.7c-.66 0-1.2.54-1.2 1.2v1.51l2.39 2.39.01-3.9c0-.66-.54-1.2-1.2-1.2z" opacity=".3" /><path d="M19 11h-1.7c0 .58-.1 1.13-.27 1.64l1.27 1.27c.44-.88.7-1.87.7-2.91zM4.41 2.86L3 4.27l6 6V11c0 1.66 1.34 3 3 3 .23 0 .44-.03.65-.08l1.66 1.66c-.71.33-1.5.52-2.31.52-2.76 0-5.3-2.1-5.3-5.1H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c.91-.13 1.77-.45 2.55-.9l4.2 4.2 1.41-1.41L4.41 2.86zM10.8 4.9c0-.66.54-1.2 1.2-1.2s1.2.54 1.2 1.2l-.01 3.91L15 10.6V5c0-1.66-1.34-3-3-3-1.54 0-2.79 1.16-2.96 2.65l1.76 1.76V4.9z" /></React.Fragment> , 'MicOffTwoTone');
lgollut/material-ui
packages/material-ui-icons/src/MicOffTwoTone.js
JavaScript
mit
685
/*global console: false, creatis_carpenterStorage_replaceContentFromStorage: false */ $(function () { function initDesktop() { $("#accordion").accordion({ collapsible: true, active: localStorage.selectedCarpenter ? false : true, }); // Kontaktseite Suche $("#search-site-submit").click(function () { var searchQuery = $("#search-query-site").val(); if (isValidPostal(searchQuery)) { document.location = "/tischler?query=" + searchQuery; } return false; }); $("#search-query-site").on('input', function () { var isValid = isValidPostal($("#search-query-site").val()); $("#search-query-site").css('border-color', !isValid ? 'red' : '#d5d5d5'); }); $("#search-query").on('input', function () { var isValid = isValidPostal($("#search-query").val()); $("#search-query").css('border-color', !isValid ? 'red' : '#d5d5d5'); }); //Prevent default on enter $('#search-query').keypress(function (event) { if (event.keyCode == 10 || event.keyCode == 13) event.preventDefault(); }); $("#accordion").removeClass('c-hidden'); $("#search-flyout-submit").click(function () { var searchQuery = $("#search-query").val(); if (searchQuery !== null && searchQuery !== "" && isValidPostal(searchQuery)) { document.location = "/tischler?query=" + searchQuery; } return false; }); if (typeof (creatis_carpenterStorage_replaceContentFromStorage) !== "undefined") { creatis_carpenterStorage_replaceContentFromStorage(); } } function initMobile() { //code taken from https://github.com/codrops/ButtonComponentMorph/blob/master/index.html var docElem = window.document.documentElement, didScroll, scrollPosition; // trick to prevent scrolling when opening/closing button function noScrollFn() { window.scrollTo(scrollPosition ? scrollPosition.x : 0, scrollPosition ? scrollPosition.y : 0); } function noScroll() { window.removeEventListener('scroll', scrollHandler); window.addEventListener('scroll', noScrollFn); } function scrollFn() { window.addEventListener('scroll', scrollHandler); } function canScroll() { window.removeEventListener('scroll', noScrollFn); scrollFn(); } function scrollHandler() { if (!didScroll) { didScroll = true; setTimeout(function () { scrollPage(); }, 60); } }; function scrollPage() { scrollPosition = { x: window.pageXOffset || docElem.scrollLeft, y: window.pageYOffset || docElem.scrollTop }; didScroll = false; }; scrollFn(); // Mobile carpenter search button var mobileSearchButton = document.querySelector('#search-mobile .morph-button'); $('#search-mobile .morph-button').click(function (ev) { if (ev.originalEvent) { ev.originalEvent.preventDefault(); } }); var mobileSearchMorphingButton = new UIMorphingButton(mobileSearchButton, { closeEl: '.icon-close', onBeforeOpen: function () { // don't allow to scroll noScroll(); }, onAfterOpen: function () { // can scroll again canScroll(); $('.dialog-page').hide(); $('.mobile-search-page-overview').show(); }, onBeforeClose: function () { // don't allow to scroll noScroll(); }, onAfterClose: function () { // can scroll again if (window.buyWithoutCarpenter && localStorage.selectedCarpenter !== null) { $('#purchase-request-starter')[0].click(); } else { window.buyWithoutCarpenter = false; } canScroll(); } }); } (function startup() { if (isMobile()) { initMobile(); } else { if ($("#accordion").length > 0) { initDesktop(); } } //initDesktop(); //initMobile(); displaySelectedCarpenter(); })(); }); function isMobile() { return $("#search-mobile").css("visibility") === "visible"; } function displaySelectedCarpenter() { if (localStorage.selectedCarpenter) { $('#div_text').css('display', 'none'); var data = JSON.parse(localStorage.getItem('selectedCarpenter')); var cId = data.id; setTimeout(function () { $('#' + cId + ' .btn-select').first().trigger('click'); }, 50); } }
BROCKHAUS-AG/contentmonkee
MAIN/Default.WebUI/App_Themes/default/js/jquery-ui.searchflyout.js
JavaScript
mit
5,088
import { create, visitable } from 'ember-cli-page-object'; import accountSetup from 'code-corps-ember/tests/pages/components/payments/account-setup'; export default create({ visit: visitable(':organization/:project/settings/donations/payments'), accountSetup });
code-corps/code-corps-ember
tests/pages/project/settings/donations/payments.js
JavaScript
mit
268
'use strict'; /* main App */ var app = angular.module('submitConformationcontroller', []); app.controller('confirmationCtrl', ['$scope', function($scope){ $scope.volunteerList = ["Joop Bakker", "Dirk Dijkstra", "Sterre Hendriks", "Hendrik Jacobs", "Hans Heuvel", "Jaap Beek", "Jan-Jaap Dijk", "Marleen Jansen", "Geert Hoek", "Beer Heuvel"]; $scope.jobTitle = ''; $scope.jobType = ''; $scope.describeWork = ''; function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } $scope.jobTitle = getParameterByName('jobTitle'); $scope.jobType = getParameterByName('jobType'); $scope.describeWork = getParameterByName('describeWork'); }]);
iamlalit/olympia-volunteer
app/organization/confirmation/confirmationController.js
JavaScript
mit
886
// Copyright (c) 2012, Event Store LLP // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // Neither the name of the Event Store LLP nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // "use strict"; // these $ globals are defined by external environment // they are redefined here to make R# like tools understand them var _log = $log; var _load_module = $load_module; function log(message) { _log("PROJECTIONS (JS): " + message); } function initializeModules() { // load module load new instance of the given module every time // this is a responsibility of prelude to manage instances of modules var modules = _load_module('Modules'); // TODO: replace with createRequire($load_module) modules.$load_module = _load_module; return modules; } function initializeProjections() { var projections = _load_module('Projections'); return projections; } var modules = initializeModules(); var projections = initializeProjections(); var eventProcessor; function scope($on, $notify) { eventProcessor = projections.createEventProcessor(log, $notify); eventProcessor.register_command_handlers($on); function queryLog(message) { if (typeof message === "string") _log(message); else _log(JSON.stringify(message)); } function translateOn(handlers) { for (var name in handlers) { if (name == 0 || name === "$init") { eventProcessor.on_init_state(handlers[name]); } else if (name === "$initShared") { eventProcessor.on_init_shared_state(handlers[name]); } else if (name === "$any") { eventProcessor.on_any(handlers[name]); } else if (name === "$deleted") { eventProcessor.on_deleted_notification(handlers[name]); } else if (name === "$created") { eventProcessor.on_created_notification(handlers[name]); } else { eventProcessor.on_event(name, handlers[name]); } } } function $defines_state_transform() { eventProcessor.$defines_state_transform(); } function transformBy(by) { eventProcessor.chainTransformBy(by); return { transformBy: transformBy, filterBy: filterBy, outputState: outputState, outputTo: outputTo, }; } function filterBy(by) { eventProcessor.chainTransformBy(function (s) { var result = by(s); return result ? s : null; }); return { transformBy: transformBy, filterBy: filterBy, outputState: outputState, outputTo: outputTo, }; } function outputTo(resultStream, partitionResultStreamPattern) { eventProcessor.$defines_state_transform(); eventProcessor.options({ resultStreamName: resultStream, partitionResultStreamNamePattern: partitionResultStreamPattern, }); } function outputState() { eventProcessor.$outputState(); return { transformBy: transformBy, filterBy: filterBy, outputTo: outputTo, }; } function when(handlers) { translateOn(handlers); return { $defines_state_transform: $defines_state_transform, transformBy: transformBy, filterBy: filterBy, outputTo: outputTo, outputState: outputState, }; } function foreachStream() { eventProcessor.byStream(); return { when: when, }; } function partitionBy(byHandler) { eventProcessor.partitionBy(byHandler); return { when: when, }; } function fromCategory(category) { eventProcessor.fromCategory(category); return { partitionBy: partitionBy, foreachStream: foreachStream, when: when, outputState: outputState, }; } function fromAll() { eventProcessor.fromAll(); return { partitionBy: partitionBy, when: when, foreachStream: foreachStream, outputState: outputState, }; } function fromStream(stream) { eventProcessor.fromStream(stream); return { partitionBy: partitionBy, when: when, outputState: outputState, }; } function fromStreamCatalog(streamCatalog, transformer) { eventProcessor.fromStreamCatalog(streamCatalog, transformer ? transformer : null); return { foreachStream: foreachStream, }; } function fromStreamsMatching(filter) { eventProcessor.fromStreamsMatching(filter); return { when: when, }; } function fromStreams(streams) { var arr = Array.isArray(streams) ? streams : arguments; for (var i = 0; i < arr.length; i++) eventProcessor.fromStream(arr[i]); return { partitionBy: partitionBy, when: when, outputState: outputState, }; } function emit(streamId, eventName, eventBody, metadata) { var message = { streamId: streamId, eventName: eventName , body: JSON.stringify(eventBody), metadata: metadata, isJson: true }; eventProcessor.emit(message); } function linkTo(streamId, event, metadata) { var message = { streamId: streamId, eventName: "$>", body: event.sequenceNumber + "@" + event.streamId, metadata: metadata, isJson: false }; eventProcessor.emit(message); } function copyTo(streamId, event, metadata) { var m = {}; var em = event.metadata; if (em) for (var p1 in em) if (p1.indexOf("$") !== 0 || p1 === "$correlationId") m[p1] = em[p1]; if (metadata) for (var p2 in metadata) if (p2.indexOf("$") !== 0) m[p2] = metadata[p2]; var message = { streamId: streamId, eventName: event.eventType, body: event.bodyRaw, metadata: m }; eventProcessor.emit(message); } function linkStreamTo(streamId, linkedStreamId, metadata) { var message = { streamId: streamId, eventName: "$@", body: linkedStreamId, metadata: metadata, isJson: false }; eventProcessor.emit(message); } function options(options_object) { eventProcessor.options(options_object); } return { log: queryLog, on_any: eventProcessor.on_any, on_raw: eventProcessor.on_raw, fromAll: fromAll, fromCategory: fromCategory, fromStream: fromStream, fromStreams: fromStreams, fromStreamCatalog: fromStreamCatalog, fromStreamsMatching: fromStreamsMatching, options: options, emit: emit, linkTo: linkTo, copyTo: copyTo, linkStreamTo: linkStreamTo, require: modules.require, }; }; scope;
Narvalex/Eventing
src/Sample/Inventory.Server/EventStore/Prelude/1Prelude.js
JavaScript
mit
8,499
'use strict'; var R6MStatsOpData = (function(R6MLangTerms, undefined) { var WARNING_THRESHOLD = 20, opStats = { attackers: [], defenders: [], sortInfo: { field: null, rank: null, isDescending: null } }; var getAveragesTotals = function getAveragesTotals(opRoleStats) { var count = 0, averagesTotals = {}; for (var opKey in opRoleStats) { for (var sarKey in opRoleStats[opKey].statsAllRanks) { averagesTotals[sarKey] = averagesTotals[sarKey] || {}; averagesTotals[sarKey].all = averagesTotals[sarKey].all || { total: 0, avg: 0 }; averagesTotals[sarKey].all.total += opRoleStats[opKey].statsAllRanks[sarKey]; } for (var sbrKey in opRoleStats[opKey].statsByRank) { for (var key in opRoleStats[opKey].statsByRank[sbrKey]) { averagesTotals[key] = averagesTotals[key] || {}; averagesTotals[key][sbrKey] = averagesTotals[key][sbrKey] || { total: 0, avg: 0 }; averagesTotals[key][sbrKey].total += opRoleStats[opKey].statsByRank[sbrKey][key]; } } count++; } for (var statKey in averagesTotals) { for (var operator in averagesTotals[statKey]) { averagesTotals[statKey][operator].avg = averagesTotals[statKey][operator].total / count; } } return averagesTotals; }; var getEmptyStatsObject = function getEmptyStatsObject() { return { totalKills: 0, totalDeaths: 0, totalPlays: 0, totalWins: 0, killsPerRound: 0, killsPerDeath: 0, pickRate: 0, winRate: 0, survivalRate: 0, warning: false }; }; var getCurrentStats = function getCurrentStats() { return opStats; }; var getOpRoleStats = function getOpRoleStats(apiOpData, totalRounds, opMetaData) { var opRoleStats = [], totalPlaysByRank = {}, totalPlaysAllRanks = 0; for (var opKey in apiOpData) { var newOpStats = { key: opKey, name: opMetaData[opKey].name, cssClass: opMetaData[opKey].cssClass, statsByRank: {}, statsAllRanks: getEmptyStatsObject() }; for (var rankKey in apiOpData[opKey]) { var opRankStats = getEmptyStatsObject(), apiOpRankData = apiOpData[opKey][rankKey]; ['totalWins', 'totalKills', 'totalDeaths', 'totalPlays'].forEach(function(statKey) { opRankStats[statKey] = +apiOpRankData[statKey]; newOpStats.statsAllRanks[statKey] += opRankStats[statKey]; }); totalPlaysByRank[rankKey] = totalPlaysByRank[rankKey] ? totalPlaysByRank[rankKey] + opRankStats.totalPlays : opRankStats.totalPlays; totalPlaysAllRanks += opRankStats.totalPlays; newOpStats.statsByRank[rankKey] = opRankStats; } opRoleStats.push(newOpStats); } setTallies(opRoleStats, totalRounds, totalPlaysByRank, totalPlaysAllRanks); setWarnings(opRoleStats); return { operators: opRoleStats, averagesTotals: getAveragesTotals(opRoleStats) }; }; var set = function set(apiData, totalRounds, opMetaData) { opStats.attackers = getOpRoleStats(apiData.role.Attacker, totalRounds, opMetaData); opStats.defenders = getOpRoleStats(apiData.role.Defender, totalRounds, opMetaData); }; var setTallies = function setTallies(opRoleStats, totalRounds, totalPlaysByRank, totalPlaysAllRanks) { opRoleStats.forEach(function(operator) { setTalliesForRank(operator.statsAllRanks); operator.statsAllRanks.pickRate = (!totalRounds) ? 0 : operator.statsAllRanks.totalPlays / totalRounds; for (var rankKey in operator.statsByRank) { var stats = operator.statsByRank[rankKey]; setTalliesForRank(stats); stats.pickRate = (!totalPlaysByRank[rankKey] || !operator.statsAllRanks.totalPlays || !totalPlaysAllRanks) ? 0 : (stats.totalPlays / totalPlaysByRank[rankKey]) / (operator.statsAllRanks.totalPlays / totalPlaysAllRanks) * operator.statsAllRanks.pickRate; stats.pickRate = Math.min(0.99, Math.max(0.001, stats.pickRate)); } }); }; var setTalliesForRank = function setTalliesForRank(stats) { stats.killsPerDeath = (!stats.totalDeaths) ? 0 : stats.totalKills / stats.totalDeaths; stats.killsPerRound = (!stats.totalPlays) ? 0 : stats.totalKills / stats.totalPlays; stats.survivalRate = (!stats.totalPlays) ? 0 : (stats.totalPlays - stats.totalDeaths) / stats.totalPlays; stats.winRate = (!stats.totalPlays) ? 0 : stats.totalWins / stats.totalPlays; }; var setWarnings = function setWarnings(opRoleStats) { for (var opKey in opRoleStats) { if (opRoleStats[opKey].statsAllRanks.totalPlays < WARNING_THRESHOLD) { opRoleStats[opKey].statsAllRanks.warning = true; } for (var rankKey in opRoleStats[opKey].statsByRank) { if (opRoleStats[opKey].statsByRank[rankKey].totalPlays < WARNING_THRESHOLD) { opRoleStats[opKey].statsByRank[rankKey].warning = true; } } } }; var trySort = function trySort(sortField, isDescending, optionalRank) { opStats.sortInfo.field = sortField || 'name'; opStats.sortInfo.rank = optionalRank; opStats.sortInfo.isDescending = isDescending; trySortRole(opStats.attackers.operators, sortField, isDescending, optionalRank); trySortRole(opStats.defenders.operators, sortField, isDescending, optionalRank); }; var trySortRole = function trySortRole(newOpStats, sortField, isDescending, optionalRank) { newOpStats.sort(function(a, b) { var aValue = a.name, bValue = b.name, nameCompare = true; if (sortField != 'name') { nameCompare = false; if (!optionalRank) { aValue = a.statsAllRanks[sortField]; bValue = b.statsAllRanks[sortField]; } else { aValue = (a.statsByRank[optionalRank]) ? a.statsByRank[optionalRank][sortField] : -1; bValue = (b.statsByRank[optionalRank]) ? b.statsByRank[optionalRank][sortField] : -1; } if (aValue == bValue) { aValue = a.name; bValue = b.name; nameCompare = true; } } if (nameCompare) { if (aValue > bValue) { return 1; } if (aValue < bValue) { return -1; } } else { if (aValue < bValue) { return 1; } if (aValue > bValue) { return -1; } } return 0; }); if (isDescending) { newOpStats.reverse(); } }; return { get: getCurrentStats, set: set, trySort: trySort }; })(R6MLangTerms);
capajon/r6maps
dev/js/stats/stats.operators.data.js
JavaScript
mit
6,671
var React = require('react'); var Router = require('react-router'); var whenKeys = require('when/keys'); var EventEmitter = require('events').EventEmitter; var { Route, DefaultRoute, RouteHandler, Link } = Router; var API = 'http://addressbook-api.herokuapp.com'; var loadingEvents = new EventEmitter(); function getJSON(url) { if (getJSON._cache[url]) return Promise.resolve(getJSON._cache[url]); return new Promise((resolve, reject) => { var req = new XMLHttpRequest(); req.onload = function () { if (req.status === 404) { reject(new Error('not found')); } else { // fake a slow response every now and then setTimeout(function () { var data = JSON.parse(req.response); resolve(data); getJSON._cache[url] = data; }, Math.random() > 0.5 ? 0 : 1000); } }; req.open('GET', url); req.send(); }); } getJSON._cache = {}; var App = React.createClass({ statics: { fetchData (params) { return getJSON(`${API}/contacts`).then((res) => res.contacts); } }, getInitialState () { return { loading: false }; }, componentDidMount () { var timer; loadingEvents.on('loadStart', () => { clearTimeout(timer); // for slow responses, indicate the app is thinking // otherwise its fast enough to just wait for the // data to load timer = setTimeout(() => { this.setState({ loading: true }); }, 300); }); loadingEvents.on('loadEnd', () => { clearTimeout(timer); this.setState({ loading: false }); }); }, renderContacts () { return this.props.data.contacts.map((contact) => { return ( <li> <Link to="contact" params={contact}>{contact.first} {contact.last}</Link> </li> ); }); }, render () { return ( <div className={this.state.loading ? 'loading' : ''}> <ul> {this.renderContacts()} </ul> <RouteHandler {...this.props}/> </div> ); } }); var Contact = React.createClass({ statics: { fetchData (params) { return getJSON(`${API}/contacts/${params.id}`).then((res) => res.contact); } }, render () { var { contact } = this.props.data; return ( <div> <p><Link to="contacts">Back</Link></p> <h1>{contact.first} {contact.last}</h1> <img key={contact.avatar} src={contact.avatar}/> </div> ); } }); var Index = React.createClass({ render () { return ( <div> <h1>Welcome!</h1> </div> ); } }); var routes = ( <Route name="contacts" path="/" handler={App}> <DefaultRoute name="index" handler={Index}/> <Route name="contact" path="contact/:id" handler={Contact}/> </Route> ); function fetchData(routes, params) { return whenKeys.all(routes.filter((route) => { return route.handler.fetchData; }).reduce((data, route) => { data[route.name] = route.handler.fetchData(params); return data; }, {})); } Router.run(routes, function (Handler, state) { loadingEvents.emit('loadStart'); fetchData(state.routes, state.params).then((data) => { loadingEvents.emit('loadEnd'); React.render(<Handler data={data}/>, document.getElementById('example')); }); });
winkler1/react-router
examples/async-data/app.js
JavaScript
mit
3,295
//= require ./core/monocle //= require ./compat/env //= require ./compat/css //= require ./compat/stubs //= require ./compat/browser //= require ./compat/gala //= require ./core/bookdata //= require ./core/factory //= require ./core/events //= require ./core/styles //= require ./core/formatting //= require ./core/reader //= require ./core/book //= require ./core/place //= require ./core/component //= require ./core/selection //= require ./core/billboard //= require ./controls/panel //= require ./panels/twopane //= require ./panels/imode //= require ./panels/eink //= require ./panels/marginal //= require ./panels/magic //= require ./dimensions/columns //= require ./flippers/slider //= require ./flippers/scroller //= require ./flippers/instant
joseph/Monocle
src/monocore.js
JavaScript
mit
752
/** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; const fs = jest.genMockFromModule('fs'); const mockFiles = new Map(); function __setMockFiles(newMockFiles) { mockFiles.clear(); Object.keys(newMockFiles).forEach(fileName => { mockFiles.set(fileName, newMockFiles[fileName]); }); } fs.__setMockFiles = __setMockFiles; fs.readFileSync = jest.fn(file => mockFiles.get(file)); module.exports = fs;
bookman25/jest
packages/jest-config/src/__mocks__/fs.js
JavaScript
mit
584
'use strict'; module.exports = { up: function(queryInterface, Sequelize) { return queryInterface.createTable('Profiles', { id: { allowNull: false, autoIncrement: true, primaryKey: true, type: Sequelize.INTEGER }, first_name: { type: Sequelize.STRING }, last_name: { type: Sequelize.STRING }, gender: { type: Sequelize.STRING }, age: { type: Sequelize.INTEGER }, country_origin: { type: Sequelize.STRING }, catch_phrase: { type: Sequelize.STRING }, createdAt: { allowNull: false, type: Sequelize.DATE }, updatedAt: { allowNull: false, type: Sequelize.DATE } }); }, down: function(queryInterface, Sequelize) { return queryInterface.dropTable('Profiles'); } };
bigkangtheory/wanderly
back/migrations/20170131224205-create-profile.js
JavaScript
mit
897
'use strict'; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactMixin = require('react-mixin'); var _reactMixin2 = _interopRequireDefault(_reactMixin); var _mixins = require('./mixins'); var _utilsHexToRgb = require('../../utils/hexToRgb'); var _utilsHexToRgb2 = _interopRequireDefault(_utilsHexToRgb); var styles = { base: { paddingTop: 3, paddingBottom: 3, paddingRight: 0, marginLeft: 14 }, label: { display: 'inline-block', marginRight: 5 } }; var JSONStringNode = (function (_React$Component) { _inherits(JSONStringNode, _React$Component); function JSONStringNode() { _classCallCheck(this, _JSONStringNode); _React$Component.apply(this, arguments); } JSONStringNode.prototype.render = function render() { var backgroundColor = 'transparent'; if (this.props.previousValue !== this.props.value) { var bgColor = _utilsHexToRgb2['default'](this.props.theme.base06); backgroundColor = 'rgba(' + bgColor.r + ', ' + bgColor.g + ', ' + bgColor.b + ', 0.1)'; } return _react2['default'].createElement( 'li', { style: _extends({}, styles.base, { backgroundColor: backgroundColor }), onClick: this.handleClick.bind(this) }, _react2['default'].createElement( 'label', { style: _extends({}, styles.label, { color: this.props.theme.base0D }) }, this.props.keyName, ':' ), _react2['default'].createElement( 'span', { style: { color: this.props.theme.base0B } }, '"', this.props.value, '"' ) ); }; var _JSONStringNode = JSONStringNode; JSONStringNode = _reactMixin2['default'].decorate(_mixins.SquashClickEventMixin)(JSONStringNode) || JSONStringNode; return JSONStringNode; })(_react2['default'].Component); exports['default'] = JSONStringNode; module.exports = exports['default'];
toke182/react-redux-experiment
node_modules/redux-devtools/lib/react/JSONTree/JSONStringNode.js
JavaScript
mit
2,907
import falcor from 'falcor'; import _ from 'lodash'; import * as db from 'lib/db'; import { has } from 'lib/utilities'; const $ref = falcor.Model.ref; export default [ { // get featured article route: "issues['byNumber'][{integers:issueNumbers}]['featured']", get: pathSet => new Promise(resolve => { db.featuredArticleQuery(pathSet.issueNumbers).then(data => { const results = []; data.forEach(row => { results.push({ path: ['issues', 'byNumber', row.issue_number, 'featured'], value: $ref(['articles', 'bySlug', row.slug]), }); }); resolve(results); }); }), }, { // get editor's picks route: "issues['byNumber'][{integers:issueNumbers}]['picks'][{integers:indices}]", get: pathSet => new Promise(resolve => { db.editorPickQuery(pathSet.issueNumbers).then(data => { const results = []; _.forEach(data, (postSlugArray, issueNumber) => { pathSet.indices.forEach(index => { if (index < postSlugArray.length) { results.push({ path: ['issues', 'byNumber', issueNumber, 'picks', index], value: $ref(['articles', 'bySlug', postSlugArray[index]]), }); } }); }); resolve(results); }); }), }, { // Get articles category information from articles. /* This is a special case as it actually makes us store a bit of information twice But we can't just give a ref here since because the articles of a category is different depending on whether it is fetched directly from categories which is ordered chronologically and all articles from that category are fetched or from an issue where it is ordered by editor tools */ route: "issues['byNumber'][{integers:issueNumbers}]['categories'][{integers:indices}]['id', 'name', 'slug']", // eslint-disable-line max-len get: pathSet => new Promise(resolve => { const requestedFields = pathSet[5]; db.issueCategoryQuery(pathSet.issueNumbers, requestedFields).then( data => { // data is an object with keys of issue numbers and values // arrays of category objects in correct order as given in editor tools const results = []; _.forEach(data, (categorySlugArray, issueNumber) => { pathSet.indices.forEach(index => { if (index < categorySlugArray.length) { requestedFields.forEach(field => { results.push({ path: [ 'issues', 'byNumber', issueNumber, 'categories', index, field, ], value: categorySlugArray[index][field], }); }); } }); }); resolve(results); }, ); }), }, { // Get articles within issue categories route: "issues['byNumber'][{integers:issueNumbers}]['categories'][{integers:categoryIndices}]['articles'][{integers:articleIndices}]", // eslint-disable-line max-len get: pathSet => // This will currently fetch every single article from the issue // every time, and then just only return the ones asked for // which shouldn't at all be a problem at current capacity of // 10-20 articles an issue. new Promise(resolve => { db.issueCategoryArticleQuery(pathSet.issueNumbers).then(data => { // data is an object with keys equal to issueNumbers and values // being an array of arrays, the upper array being the categories // in their given order, and the lower level array within each category // is article slugs also in their given order. const results = []; _.forEach(data, (categoryArray, issueNumber) => { pathSet.categoryIndices.forEach(categoryIndex => { if (categoryIndex < categoryArray.length) { pathSet.articleIndices.forEach(articleIndex => { if (articleIndex < categoryArray[categoryIndex].length) { results.push({ path: [ 'issues', 'byNumber', issueNumber, 'categories', categoryIndex, 'articles', articleIndex, ], value: $ref([ 'articles', 'bySlug', categoryArray[categoryIndex][articleIndex], ]), }); } }); } }); }); resolve(results); }); }), }, { // Get issue data // eslint-disable-next-line max-len route: "issues['byNumber'][{integers:issueNumbers}]['id', 'published_at', 'name', 'issueNumber']", get: pathSet => { const mapFields = field => { switch (field) { case 'issueNumber': return 'issue_number'; default: return field; } }; return new Promise(resolve => { const requestedFields = pathSet[3]; const dbColumns = requestedFields.map(mapFields); db.issueQuery(pathSet.issueNumbers, dbColumns).then(data => { const results = []; data.forEach(issue => { // Convert Date object to time integer const processedIssue = { ...issue }; if ( has.call(processedIssue, 'published_at') && processedIssue.published_at instanceof Date ) { processedIssue.published_at = processedIssue.published_at.getTime(); } requestedFields.forEach(field => { results.push({ path: [ 'issues', 'byNumber', processedIssue.issue_number, field, ], value: processedIssue[mapFields(field)], }); }); }); resolve(results); }); }); }, set: jsonGraphArg => new Promise(resolve => { const issueNumber = Object.keys(jsonGraphArg.issues.byNumber)[0]; const issueObject = jsonGraphArg.issues.byNumber[issueNumber]; const results = []; db.updateIssueData(jsonGraphArg).then(flag => { if (flag !== true) { throw new Error('Error while updating issue data'); } _.forEach(issueObject, (value, field) => { results.push({ path: ['issues', 'byNumber', parseInt(issueNumber, 10), field], value, }); }); results.push({ path: ['issues', 'latest'], invalidated: true, }); resolve(results); }); }), }, { route: "issues['byNumber']['updateIssueArticles']", call: (callPath, args) => new Promise(resolve => { const issueNumber = args[0]; const featuredArticles = args[1]; const picks = args[2]; const mainArticles = args[3]; db.updateIssueArticles( issueNumber, featuredArticles, picks, mainArticles, ).then(data => { let results = []; const toAdd = data.data; const toInvalidate = data.invalidated; // Build the return array from the structure we know it returns // from db.js if (toInvalidate) { results = results.concat(toInvalidate); } if (has.call(toAdd, 'featured')) { results.push(toAdd.featured); } if (has.call(toAdd, 'picks')) { results = results.concat(toAdd.picks); } if (has.call(toAdd, 'categories')) { _.forEach(toAdd.categories, (category, key) => { results.push({ path: [ 'issues', 'byNumber', issueNumber, 'categories', key, 'name', ], value: category.name, }); results.push({ path: [ 'issues', 'byNumber', issueNumber, 'categories', key, 'slug', ], value: category.slug, }); results = results.concat(category.articles); }); } if (has.call(toAdd, 'published')) { results = results.concat(toAdd.published); } resolve(results); }); }), }, { route: "issues['byNumber'][{integers:issueNumbers}]['updateIssueCategories']", call: (callPath, args) => new Promise(resolve => { const issueNumber = callPath.issueNumbers[0]; const idArray = args[0]; db.updateIssueCategories(issueNumber, idArray).then(flag => { if (flag !== true) { throw new Error('updateIssueCategories returned non-true flag'); } const results = [ { path: ['placeholder'], value: 'placeholder', }, { path: ['issues', 'byNumber', issueNumber, 'categories'], invalidated: true, }, ]; resolve(results); }); }), }, { route: "issues['byNumber'][{integers:issueNumbers}]['publishIssue']", call: (callPath, args) => new Promise(resolve => { const issueId = args[0]; const issueNumber = callPath.issueNumbers[0]; db.publishIssue(issueId).then(data => { const results = []; const publishTime = data.date.getTime(); results.push({ path: ['issues', 'byNumber', issueNumber, 'published_at'], value: publishTime, }); data.publishedArticles.forEach(slug => { results.push({ path: ['articles', 'bySlug', slug, 'published_at'], value: publishTime, }); }); resolve(results); }); }), }, { route: "issues['byNumber']['addIssue']", call: (callPath, args) => new Promise((resolve, reject) => { const issue = args[0]; verifyIssue(issue); const fields = Object.keys(issue); db.addIssue(issue) .then(flag => { if (flag !== true) { throw new Error( 'For some reason addIssue db function returned a non-true flag', ); } const results = []; fields.forEach(field => { results.push({ path: ['issues', 'byNumber', issue.issue_number, field], value: issue[field], }); }); results.push({ path: ['issues', 'latest'], invalidated: true, }); resolve(results); }) .catch(reject); }), }, ]; function verifyIssue(issue) { const requiredFields = ['name', 'issue_number']; const optionalFields = ['published_at']; requiredFields.every(field => { if (!has.call(issue, field)) { throw new Error(`Required field ${field} was not present`); } return true; }); const allFields = requiredFields.concat(optionalFields); Object.keys(issue).every(issueField => { if (!allFields.includes(issueField)) { throw new Error(`Unknown field ${issueField} was found on issue`); } return true; }); }
thegazelle-ad/gazelle-server
src/lib/falcor/routes/issues/by-number.js
JavaScript
mit
12,136
import React, {PropTypes} from 'react' import styles from './Form.css' export default React.createClass({ propTypes: { username: PropTypes.string.isRequired, onLogout: PropTypes.func }, render() { return ( <div className={styles.forms}> <section> <label>当前用户:</label> <input type="text" value={this.props.username} readOnly /> </section> <section> <button onClick={this.props.onLogout} className={`${styles.btn} ${styles.btnBorderOpen} ${styles.btnPurple}`} > 注销 </button> </section> </div> ) } })
simongfxu/sync-editor
app/components/LoginStatus.js
JavaScript
mit
667
(function() { 'use strict'; angular .module('echarliApp') .factory('Activate', Activate); Activate.$inject = ['$resource']; function Activate ($resource) { var service = $resource('api/activate', {}, { 'get': { method: 'GET', params: {}, isArray: false} }); return service; } })();
dilosung/ad-manage
ad_manage/static/js/app/services/auth/activate.service.js
JavaScript
mit
358
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M22 11h-5V6h-3v5h-4V3H7v8H1.84v2H7v8h3v-8h4v5h3v-5h5z" }), 'AlignVerticalCenterOutlined'); exports.default = _default;
oliviertassinari/material-ui
packages/mui-icons-material/lib/AlignVerticalCenterOutlined.js
JavaScript
mit
536
// conf.js exports.config = { seleniumServerJar: "./node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar", specs: ["test/e2e/*.scenarios.coffee"], baseUrl: "http://localhost:3000", capabilities: { "browserName": "chrome" }, framework: "mocha" }
doug-wade/generator-koa-angular
app/templates/protractor.conf.js
JavaScript
mit
279
/* Magic Mirror * Log * * This logger is very simple, but needs to be extended. * This system can eventually be used to push the log messages to an external target. * * By Michael Teeuw https://michaelteeuw.nl * MIT Licensed. */ (function (root, factory) { if (typeof exports === "object") { if (process.env.JEST_WORKER_ID === undefined) { // add timestamps in front of log messages require("console-stamp")(console, { pattern: "yyyy-mm-dd HH:MM:ss.l", include: ["debug", "log", "info", "warn", "error"] }); } // Node, CommonJS-like module.exports = factory(root.config); } else { // Browser globals (root is window) root.Log = factory(root.config); } })(this, function (config) { let logLevel; let enableLog; if (typeof exports === "object") { // in nodejs and not running with jest enableLog = process.env.JEST_WORKER_ID === undefined; } else { // in browser and not running with jsdom enableLog = typeof window === "object" && window.name !== "jsdom"; } if (enableLog) { logLevel = { debug: Function.prototype.bind.call(console.debug, console), log: Function.prototype.bind.call(console.log, console), info: Function.prototype.bind.call(console.info, console), warn: Function.prototype.bind.call(console.warn, console), error: Function.prototype.bind.call(console.error, console), group: Function.prototype.bind.call(console.group, console), groupCollapsed: Function.prototype.bind.call(console.groupCollapsed, console), groupEnd: Function.prototype.bind.call(console.groupEnd, console), time: Function.prototype.bind.call(console.time, console), timeEnd: Function.prototype.bind.call(console.timeEnd, console), timeStamp: Function.prototype.bind.call(console.timeStamp, console) }; logLevel.setLogLevel = function (newLevel) { if (newLevel) { Object.keys(logLevel).forEach(function (key, index) { if (!newLevel.includes(key.toLocaleUpperCase())) { logLevel[key] = function () {}; } }); } }; } else { logLevel = { debug: function () {}, log: function () {}, info: function () {}, warn: function () {}, error: function () {}, group: function () {}, groupCollapsed: function () {}, groupEnd: function () {}, time: function () {}, timeEnd: function () {}, timeStamp: function () {} }; logLevel.setLogLevel = function () {}; } return logLevel; });
Tyvonne/MagicMirror
js/logger.js
JavaScript
mit
2,418
/** * Dummy file for grunt-nodemon to run node-inspector task */
rorymadden/angular-neo4j
node-inspector.js
JavaScript
mit
67
'use strict'; var a = 0; var b = 1; var x = a; var y = b; console.log( x + y );
Victorystick/rollup
test/form/skips-dead-branches-g/_expected/cjs.js
JavaScript
mit
81
module.exports={A:{A:{"2":"H D G E A B EB"},B:{"2":"C p x J L N I"},C:{"2":"0 1 2 3 4 5 6 8 9 YB BB F K H D G E A B C p x J L N I O P Q R S T U V W X Y Z b c d e f g h i j k l m n o M q r s t u v w y WB QB"},D:{"1":"0 1 2 3 4 5 6 8 9 J L N I O P Q R S T U V W X Y Z b c d e f g h i j k l m n o M q r s t u v w y KB aB FB a GB HB IB","16":"F K H D G E A B C p x"},E:{"1":"H D G E A B C LB MB NB OB PB z RB","16":"F K JB CB"},F:{"1":"0 J L N I O P Q R S T U V W X Y Z b c d e f g h i j k l m n o M q r s t u v w","2":"7 E B C SB TB UB VB z AB XB"},G:{"1":"G bB cB dB eB fB gB hB iB jB kB","16":"CB ZB DB"},H:{"2":"lB"},I:{"1":"BB F a oB pB DB qB rB","16":"mB nB"},J:{"1":"D A"},K:{"1":"M","2":"7 A B C z AB"},L:{"1":"a"},M:{"2":"y"},N:{"2":"A B"},O:{"1":"sB"},P:{"1":"F K tB"},Q:{"1":"uB"},R:{"1":"vB"}},B:7,C:"Element.scrollIntoViewIfNeeded()"};
friendsofagape/mt2414ui
node_modules/caniuse-lite/data/features/scrollintoviewifneeded.js
JavaScript
mit
845